From de9dfb078d4ce69d203868063dc493d0fd95874a Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 2 May 2014 14:04:54 +0200 Subject: [PATCH] remove outdated samples --- pom.xml | 1 - scm-samples/pom.xml | 45 --- scm-samples/scm-sample-auth/pom.xml | 36 --- .../auth/SampleAuthenticationHandler.java | 259 ------------------ .../sonia/scm/sample/auth/SampleConfig.java | 81 ------ .../scm/sample/auth/SampleConfigResource.java | 119 -------- .../main/resources/META-INF/scm/plugin.xml | 51 ---- .../scm/sample/auth/sonia.sample-auth.js | 79 ------ scm-samples/scm-sample-hello/pom.xml | 36 --- .../main/java/sample/hello/HelloResource.java | 97 ------- .../main/resources/META-INF/scm/plugin.xml | 63 ----- .../resources/sample/hello/sample.hello.js | 66 ----- 12 files changed, 933 deletions(-) delete mode 100644 scm-samples/pom.xml delete mode 100644 scm-samples/scm-sample-auth/pom.xml delete mode 100644 scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleAuthenticationHandler.java delete mode 100644 scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfig.java delete mode 100644 scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfigResource.java delete mode 100644 scm-samples/scm-sample-auth/src/main/resources/META-INF/scm/plugin.xml delete mode 100644 scm-samples/scm-sample-auth/src/main/resources/sonia/scm/sample/auth/sonia.sample-auth.js delete mode 100644 scm-samples/scm-sample-hello/pom.xml delete mode 100644 scm-samples/scm-sample-hello/src/main/java/sample/hello/HelloResource.java delete mode 100644 scm-samples/scm-sample-hello/src/main/resources/META-INF/scm/plugin.xml delete mode 100644 scm-samples/scm-sample-hello/src/main/resources/sample/hello/sample.hello.js diff --git a/pom.xml b/pom.xml index 2ec3111371..639af910e0 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,6 @@ scm-core scm-test scm-plugins - scm-samples scm-dao-xml scm-webapp scm-server diff --git a/scm-samples/pom.xml b/scm-samples/pom.xml deleted file mode 100644 index 13c1bd030a..0000000000 --- a/scm-samples/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - - sonia.scm - scm - 2.0.0-SNAPSHOT - - - sonia.scm.samples - scm-samples - pom - 2.0.0-SNAPSHOT - scm-samples - - - scm-sample-hello - scm-sample-auth - - - - - - - src/main/resources - true - - META-INF/scm/plugin.xml - - - - - src/main/resources - false - - META-INF/scm/plugin.xml - - - - - - - \ No newline at end of file diff --git a/scm-samples/scm-sample-auth/pom.xml b/scm-samples/scm-sample-auth/pom.xml deleted file mode 100644 index 429c5c1383..0000000000 --- a/scm-samples/scm-sample-auth/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - - scm-samples - sonia.scm.samples - 2.0.0-SNAPSHOT - - - sonia.scm.sample - scm-sample-auth - 2.0.0-SNAPSHOT - scm-sample-auth - Sample Authentication Plugin - https://bitbucket.org/sdorra/scm-manager - - - - - javax.servlet - servlet-api - ${servlet.version} - provided - - - - sonia.scm - scm-core - 2.0.0-SNAPSHOT - - - - - diff --git a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleAuthenticationHandler.java b/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleAuthenticationHandler.java deleted file mode 100644 index e87118417f..0000000000 --- a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleAuthenticationHandler.java +++ /dev/null @@ -1,259 +0,0 @@ -/** - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ - - - -package sonia.scm.sample.auth; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import sonia.scm.SCMContextProvider; -import sonia.scm.plugin.Extension; -import sonia.scm.store.Store; -import sonia.scm.store.StoreFactory; -import sonia.scm.user.User; -import sonia.scm.util.AssertUtil; -import sonia.scm.web.security.AuthenticationHandler; -import sonia.scm.web.security.AuthenticationResult; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.IOException; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -@Extension -public class SampleAuthenticationHandler implements AuthenticationHandler -{ - - /** Field description */ - public static final String STORE_NAME = "sample-auth"; - - /** Field description */ - public static final String TYPE = "sample"; - - /** the logger for SampleAuthenticationHandler */ - private static final Logger logger = - LoggerFactory.getLogger(SampleAuthenticationHandler.class); - - //~--- constructors --------------------------------------------------------- - - /** - * Constructs ... - * - * - * @param storeFactory - */ - @Inject - public SampleAuthenticationHandler(StoreFactory storeFactory) - { - store = storeFactory.getStore(SampleConfig.class, STORE_NAME); - } - - //~--- methods -------------------------------------------------------------- - - /** - * Method description - * - * - * @param request - * @param response - * @param username - * @param password - * - * @return - */ - @Override - public AuthenticationResult authenticate(HttpServletRequest request, - HttpServletResponse response, String username, String password) - { - AssertUtil.assertIsNotEmpty(username); - AssertUtil.assertIsNotEmpty(password); - - return authenticate(username, password); - } - - /** - * Method description - * - * - * @throws IOException - */ - @Override - public void close() throws IOException - { - - // nothing todo - } - - /** - * Method description - * - * - * @param context - */ - @Override - public void init(SCMContextProvider context) - { - config = store.get(); - - if (config == null) - { - config = new SampleConfig(); - } - - addUser(new User("dent", "Arthur Dent", "arthur.dent@hitchhiker.com")); - addUser(new User("perfect", "Ford Prefect", "ford.perfect@hitchhiker.com")); - addUser(new User("slarti", "Slartibartfaß", - "slartibartfass@hitchhiker.com")); - addUser(new User("marvin", "Marvin", "paranoid.android@hitchhiker.com")); - } - - /** - * Method description - * - */ - public void storeConfig() - { - store.set(config); - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - public SampleConfig getConfig() - { - return config; - } - - /** - * Method description - * - * - * @return - */ - @Override - public String getType() - { - return TYPE; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param config - */ - public void setConfig(SampleConfig config) - { - this.config = config; - } - - //~--- methods -------------------------------------------------------------- - - /** - * Method description - * - * - * @param user - */ - private void addUser(User user) - { - user.setType(TYPE); - userDB.put(user.getName(), user); - } - - /** - * Method description - * - * - * @param username - * @param password - * - * @return - */ - private AuthenticationResult authenticate(String username, String password) - { - AuthenticationResult result = null; - User dbUser = userDB.get(username); - - if (dbUser != null) - { - if (password.equals(username.concat(config.getPasswordSuffix()))) - { - result = new AuthenticationResult(dbUser); - } - else - { - result = AuthenticationResult.FAILED; - } - } - else - { - result = AuthenticationResult.NOT_FOUND; - } - - return result; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SampleConfig config; - - /** Field description */ - private Store store; - - /** Field description */ - private Map userDB = new ConcurrentHashMap(); -} diff --git a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfig.java b/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfig.java deleted file mode 100644 index 495f65c797..0000000000 --- a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ - - - -package sonia.scm.sample.auth; - -//~--- JDK imports ------------------------------------------------------------ - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * - * @author Sebastian Sdorra - */ -@XmlRootElement(name = "sample-config") -@XmlAccessorType(XmlAccessType.FIELD) -public class SampleConfig -{ - - /** - * Method description - * - * - * @return - */ - public String getPasswordSuffix() - { - return passwordSuffix; - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param passwordSuffix - */ - public void setPasswordSuffix(String passwordSuffix) - { - this.passwordSuffix = passwordSuffix; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - @XmlElement(name = "password-suffix") - private String passwordSuffix = "123"; -} diff --git a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfigResource.java b/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfigResource.java deleted file mode 100644 index 7f40b34105..0000000000 --- a/scm-samples/scm-sample-auth/src/main/java/sonia/scm/sample/auth/SampleConfigResource.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ - - - -package sonia.scm.sample.auth; - -//~--- non-JDK imports -------------------------------------------------------- - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.IOException; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -/** - * - * @author Sebastian Sdorra - */ -@Singleton -@Path("config/auth/sample") -public class SampleConfigResource -{ - - /** - * Constructs ... - * - * - * @param authenticationHandler - */ - @Inject - public SampleConfigResource(SampleAuthenticationHandler authenticationHandler) - { - this.authenticationHandler = authenticationHandler; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @GET - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public SampleConfig getConfig() - { - return authenticationHandler.getConfig(); - } - - //~--- set methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @param uriInfo - * @param config - * - * @return - * - * @throws IOException - */ - @POST - @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response setConfig(@Context UriInfo uriInfo, SampleConfig config) - throws IOException - { - authenticationHandler.setConfig(config); - authenticationHandler.storeConfig(); - - return Response.created(uriInfo.getRequestUri()).build(); - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private SampleAuthenticationHandler authenticationHandler; -} diff --git a/scm-samples/scm-sample-auth/src/main/resources/META-INF/scm/plugin.xml b/scm-samples/scm-sample-auth/src/main/resources/META-INF/scm/plugin.xml deleted file mode 100644 index 8776d2aec3..0000000000 --- a/scm-samples/scm-sample-auth/src/main/resources/META-INF/scm/plugin.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - ${project.name} - ${project.description} - Sebastian Sdorra - ${project.url} - - - - - - - diff --git a/scm-samples/scm-sample-auth/src/main/resources/sonia/scm/sample/auth/sonia.sample-auth.js b/scm-samples/scm-sample-auth/src/main/resources/sonia/scm/sample/auth/sonia.sample-auth.js deleted file mode 100644 index 6563201cac..0000000000 --- a/scm-samples/scm-sample-auth/src/main/resources/sonia/scm/sample/auth/sonia.sample-auth.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ - -registerGeneralConfigPanel({ - xtype : 'configForm', - title : 'Sample Authentication', - items : [{ - xtype : 'textfield', - fieldLabel : 'Password-Suffix', - name : 'password-suffix', - allowBlank : false - }], - - onSubmit: function(values){ - this.el.mask('Submit ...'); - Ext.Ajax.request({ - url: restUrl + 'config/auth/sample.json', - method: 'POST', - jsonData: values, - scope: this, - disableCaching: true, - success: function(response){ - this.el.unmask(); - }, - failure: function(){ - this.el.unmask(); - } - }); - }, - - onLoad: function(el){ - var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); - Ext.Ajax.request({ - url: restUrl + 'config/auth/sample.json', - method: 'GET', - scope: this, - disableCaching: true, - success: function(response){ - var obj = Ext.decode(response.responseText); - this.load(obj); - clearTimeout(tid); - el.unmask(); - }, - failure: function(){ - el.unmask(); - clearTimeout(tid); - alert('failure'); - } - }); - } -}); \ No newline at end of file diff --git a/scm-samples/scm-sample-hello/pom.xml b/scm-samples/scm-sample-hello/pom.xml deleted file mode 100644 index 9b1f7bbdb2..0000000000 --- a/scm-samples/scm-sample-hello/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 4.0.0 - - - scm-samples - sonia.scm.samples - 2.0.0-SNAPSHOT - - - sonia.scm.sample - scm-sample-hello - 2.0.0-SNAPSHOT - scm-sample-hello - A simple hello world plugin - https://bitbucket.org/sdorra/scm-manager - - - - - javax.servlet - servlet-api - ${servlet.version} - provided - - - - sonia.scm - scm-core - 2.0.0-SNAPSHOT - - - - - diff --git a/scm-samples/scm-sample-hello/src/main/java/sample/hello/HelloResource.java b/scm-samples/scm-sample-hello/src/main/java/sample/hello/HelloResource.java deleted file mode 100644 index 586c03ced3..0000000000 --- a/scm-samples/scm-sample-hello/src/main/java/sample/hello/HelloResource.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ - - - -package sample.hello; - -//~--- non-JDK imports -------------------------------------------------------- - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.subject.Subject; - -import sonia.scm.user.User; - -//~--- JDK imports ------------------------------------------------------------ - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -/** - * - * @author Sebastian Sdorra - */ -@Path("sample/hello") -public class HelloResource -{ - - /** - * Constructs ... - * - * - * @param securityContextProvider - */ - public HelloResource() - { - Subject subject = SecurityUtils.getSubject(); - String displayName = "Unknown"; - - if (subject.isAuthenticated() || subject.isRemembered()) - { - displayName = - subject.getPrincipals().oneByType(User.class).getDisplayName(); - } - - message = "Hello " + displayName; - } - - //~--- get methods ---------------------------------------------------------- - - /** - * Method description - * - * - * @return - */ - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getHelloMessage() - { - return message; - } - - //~--- fields --------------------------------------------------------------- - - /** Field description */ - private String message; -} diff --git a/scm-samples/scm-sample-hello/src/main/resources/META-INF/scm/plugin.xml b/scm-samples/scm-sample-hello/src/main/resources/META-INF/scm/plugin.xml deleted file mode 100644 index ccbf405403..0000000000 --- a/scm-samples/scm-sample-hello/src/main/resources/META-INF/scm/plugin.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - ${project.name} - ${project.description} - Sebastian Sdorra - ${project.url} - - - - sample.hello - - - - - - - diff --git a/scm-samples/scm-sample-hello/src/main/resources/sample/hello/sample.hello.js b/scm-samples/scm-sample-hello/src/main/resources/sample/hello/sample.hello.js deleted file mode 100644 index 02636998c8..0000000000 --- a/scm-samples/scm-sample-hello/src/main/resources/sample/hello/sample.hello.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2010, Sebastian Sdorra - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of SCM-Manager; nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * http://bitbucket.org/sdorra/scm-manager - * - */ -function sayHello(){ - Ext.Ajax.request({ - url: restUrl + 'sample/hello', - method: 'GET', - disableCaching: true, - success: function(response){ - var msg = response.responseText; - Ext.MessageBox.show({ - title: 'Hello Message', - msg: msg, - buttons: Ext.MessageBox.OK, - icon: Ext.MessageBox.INFO - }); - }, - failure: function(){ - Ext.MessageBox.show({ - title: 'Error', - msg: 'Could not display the hello message', - buttons: Ext.MessageBox.OK, - icon: Ext.MessageBox.ERROR - }); - } - }); -} - -loginCallbacks.push(function(){ - var navPanel = Ext.getCmp('navigationPanel'); - var count = navPanel.count() - 1; - navPanel.insertSection(count, { - title: 'Hello World', - links: [{ - label: 'Say Hello', - fn: sayHello - }] - }); -}); \ No newline at end of file