diff --git a/pom.xml b/pom.xml
index 796e144434..2bdb8ff60e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,8 +52,6 @@
scm-core
scm-test
maven
- scm-server-api
- scm-server-jetty
plugins
samples
scm-webapp
diff --git a/scm-server-api/pom.xml b/scm-server-api/pom.xml
deleted file mode 100644
index 175559888a..0000000000
--- a/scm-server-api/pom.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- 4.0.0
-
-
- scm
- sonia.scm
- 1.1-SNAPSHOT
-
-
- sonia.scm
- scm-server-api
- 1.1-SNAPSHOT
- scm-server-api
-
-
diff --git a/scm-server-api/src/main/java/sonia/scm/server/Server.java b/scm-server-api/src/main/java/sonia/scm/server/Server.java
deleted file mode 100644
index eae0a657b9..0000000000
--- a/scm-server-api/src/main/java/sonia/scm/server/Server.java
+++ /dev/null
@@ -1,93 +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.server;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public interface Server
-{
-
- /**
- * Method description
- *
- *
- * @param listener
- */
- public void addListener(ServerListener listener);
-
- /**
- * Method description
- *
- *
- * @param listener
- */
- public void removeListener(ServerListener listener);
-
- /**
- * Method description
- *
- *
- * @param webapp
- *
- * @throws IOException
- * @throws ServerException
- */
- public void start(File webapp) throws ServerException, IOException;
-
- /**
- * Method description
- *
- *
- * @throws IOException
- * @throws ServerException
- */
- public void stop() throws ServerException, IOException;
-
- //~--- get methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @return
- */
- public boolean isRunning();
-}
diff --git a/scm-server-api/src/main/java/sonia/scm/server/ServerAllreadyRunningException.java b/scm-server-api/src/main/java/sonia/scm/server/ServerAllreadyRunningException.java
deleted file mode 100644
index ba8f2015af..0000000000
--- a/scm-server-api/src/main/java/sonia/scm/server/ServerAllreadyRunningException.java
+++ /dev/null
@@ -1,43 +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.server;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public class ServerAllreadyRunningException extends ServerException
-{
-
- /** Field description */
- private static final long serialVersionUID = 3816513762034851638L;
-}
diff --git a/scm-server-api/src/main/java/sonia/scm/server/ServerApplication.java b/scm-server-api/src/main/java/sonia/scm/server/ServerApplication.java
deleted file mode 100644
index fac659b671..0000000000
--- a/scm-server-api/src/main/java/sonia/scm/server/ServerApplication.java
+++ /dev/null
@@ -1,174 +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.server;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.util.NoSuchElementException;
-import java.util.ServiceLoader;
-
-import javax.xml.bind.JAXB;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public class ServerApplication
-{
-
- /** Field description */
- public static final String APPINFO = "/app-info.xml";
-
- /** Field description */
- public static final String PROPERTY_BASEDIR = "basedir";
-
- /** Field description */
- public static final String PROPERTY_SCMBASEDIR = "scm.basedir";
-
- /** Field description */
- public static final int RETURNCODE_CLI_ERROR = 2;
-
- /** Field description */
- public static final int RETURNCODE_MISSING_APPINFO = 1;
-
- /** Field description */
- public static final int RETURNCODE_MISSING_SERVER_IMPLEMENTATION = 3;
-
- /** Field description */
- public static final String SERVERCONFIG = "/config.xml";
-
- //~--- methods --------------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @param args
- *
- * @throws IOException
- * @throws ServerException
- */
- public static void main(String[] args) throws ServerException, IOException
- {
- InputStream input = ServerApplication.class.getResourceAsStream(APPINFO);
-
- if (input == null)
- {
- System.err.println("could not find /app-info.xml in classpath");
- System.exit(RETURNCODE_MISSING_APPINFO);
- }
-
- ApplicationInformation appInfo = JAXB.unmarshal(input,
- ApplicationInformation.class);
- final Server server = getServer();
-
- if (server == null)
- {
- System.err.println("could not find an server implementation");
- System.exit(RETURNCODE_MISSING_SERVER_IMPLEMENTATION);
- }
-
- String basedir = System.getProperty(PROPERTY_BASEDIR);
-
- if (basedir != null)
- {
- if (!basedir.endsWith(File.separator))
- {
- basedir = basedir.concat(File.separator);
- }
-
- System.setProperty(PROPERTY_SCMBASEDIR, basedir);
- }
-
- File webapp = new File("webapp", appInfo.getAppName());
-
- server.start(webapp);
- Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- if (server.isRunning())
- {
- try
- {
- server.stop();
- }
- catch (ServerException ex)
- {
- ex.printStackTrace(System.err);
- }
- catch (IOException ex)
- {
- ex.printStackTrace(System.err);
- }
- }
- }
- }));
- }
-
- //~--- get methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @return
- */
- private static Server getServer()
- {
- Server server = null;
-
- try
- {
- ServiceLoader loader = ServiceLoader.load(Server.class);
-
- if (loader != null)
- {
- server = loader.iterator().next();
- }
- }
- catch (NoSuchElementException ex)
- {
-
- // no server available
- }
-
- return server;
- }
-}
diff --git a/scm-server-api/src/main/java/sonia/scm/server/ServerListener.java b/scm-server-api/src/main/java/sonia/scm/server/ServerListener.java
deleted file mode 100644
index b32a034270..0000000000
--- a/scm-server-api/src/main/java/sonia/scm/server/ServerListener.java
+++ /dev/null
@@ -1,60 +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.server;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public interface ServerListener
-{
-
- /**
- * Method description
- *
- *
- * @param throwable
- */
- public void failed(Throwable throwable);
-
- /**
- * Method description
- *
- */
- public void started();
-
- /**
- * Method description
- *
- */
- public void stopped();
-}
diff --git a/scm-server-jetty/pom.xml b/scm-server-jetty/pom.xml
deleted file mode 100644
index 15039d0ad5..0000000000
--- a/scm-server-jetty/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- 4.0.0
-
-
- scm
- sonia.scm
- 1.1-SNAPSHOT
-
-
- sonia.scm
- scm-server-jetty
- 1.1-SNAPSHOT
- scm-server-jetty
-
-
-
-
- sonia.scm
- scm-server-api
- 1.1-SNAPSHOT
-
-
-
- org.eclipse.jetty
- jetty-server
- ${jetty.version}
-
-
-
- org.eclipse.jetty
- jetty-webapp
- ${jetty.version}
-
-
-
- org.eclipse.jetty
- jetty-jmx
- ${jetty.version}
-
-
-
- org.eclipse.jetty
- jetty-ajp
- ${jetty.version}
-
-
-
-
-
- 7.3.0.v20110203
-
-
-
diff --git a/scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServer.java b/scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServer.java
deleted file mode 100644
index 0feca425d2..0000000000
--- a/scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServer.java
+++ /dev/null
@@ -1,182 +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.server.jetty;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import org.eclipse.jetty.xml.XmlConfiguration;
-
-import sonia.scm.server.Server;
-import sonia.scm.server.ServerAllreadyRunningException;
-import sonia.scm.server.ServerException;
-import sonia.scm.server.ServerListener;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.File;
-import java.io.IOException;
-
-import java.net.URL;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- *
- * @author Sebastian Sdorra
- */
-public class JettyServer implements Server
-{
-
- /** Field description */
- public static final String CONFIGURATION = "/server-config.xml";
-
- //~--- methods --------------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @param listener
- */
- @Override
- public void addListener(ServerListener listener)
- {
- listeners.add(listener);
- }
-
- /**
- * Method description
- *
- *
- * @param listener
- */
- @Override
- public void removeListener(ServerListener listener)
- {
- listeners.remove(listener);
- }
-
- /**
- * Method description
- *
- *
- * @param webapp
- *
- * @throws IOException
- * @throws ServerException
- */
- @Override
- public void start(File webapp) throws ServerException, IOException
- {
- if (isRunning())
- {
- throw new ServerAllreadyRunningException();
- }
-
- URL configURL = JettyServer.class.getResource(CONFIGURATION);
-
- if (configURL == null)
- {
- throw new ServerException("could not find server-config.xml");
- }
-
- try
- {
- server = new org.eclipse.jetty.server.Server();
-
- XmlConfiguration config = new XmlConfiguration(configURL);
-
- config.configure(server);
-
- for (ServerListener listener : listeners)
- {
- server.addLifeCycleListener(new JettyServerListenerAdapter(listener));
- }
-
- // server.setStopAtShutdown(true);
- server.start();
- server.join();
- }
- catch (Exception ex)
- {
- throw new ServerException(ex);
- }
- }
-
- /**
- * Method description
- *
- *
- * @throws IOException
- * @throws ServerException
- */
- @Override
- public void stop() throws ServerException, IOException
- {
- if (isRunning())
- {
- try
- {
- server.stop();
- }
- catch (Exception ex)
- {
- throw new ServerException(ex);
- }
- }
- }
-
- //~--- get methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @return
- */
- @Override
- public boolean isRunning()
- {
- return server != null;
- }
-
- //~--- fields ---------------------------------------------------------------
-
- /** Field description */
- private Set listeners = new HashSet();
-
- /** Field description */
- private org.eclipse.jetty.server.Server server;
-}
diff --git a/scm-server-jetty/src/main/resources/META-INF/services/sonia.scm.server.Server b/scm-server-jetty/src/main/resources/META-INF/services/sonia.scm.server.Server
deleted file mode 100644
index bfef293326..0000000000
--- a/scm-server-jetty/src/main/resources/META-INF/services/sonia.scm.server.Server
+++ /dev/null
@@ -1 +0,0 @@
-sonia.scm.server.jetty.JettyServer
\ No newline at end of file
diff --git a/scm-server/pom.xml b/scm-server/pom.xml
index 5106cd8ed3..3d8103cc24 100644
--- a/scm-server/pom.xml
+++ b/scm-server/pom.xml
@@ -14,24 +14,46 @@
scm-server
1.1-SNAPSHOT
scm-server
- pom
+ jar
- sonia.scm
- scm-server-api
- 1.1-SNAPSHOT
+ commons-daemon
+ commons-daemon
+ 1.0.5
- sonia.scm
- scm-server-jetty
- 1.1-SNAPSHOT
+ org.eclipse.jetty
+ jetty-server
+ ${jetty.version}
+
+
+
+ org.eclipse.jetty
+ jetty-webapp
+ ${jetty.version}
+
+
+
+ org.eclipse.jetty
+ jetty-jmx
+ ${jetty.version}
+
+
+
+ org.eclipse.jetty
+ jetty-ajp
+ ${jetty.version}
+
+ 7.3.0.v20110203
+
+
@@ -39,70 +61,42 @@
sonia.maven
appassembler-maven-plugin
- 1.1
+ 1.2-SNAPSHOT
- scm-jsw
-
${project.build.directory}/appassembler
- ${project.build.directory}/appassembler/jsw/scm-server
+ ${project.build.directory}/appassembler/commons-daemon/scm-server
lib
flat
true
-
- scm-server
- sonia.scm.server.ServerApplication
-
- jsw
-
- 3.5.7
-
- 256m
- 256m
-
+ scm-server
+ sonia.scm.server.ScmServerDaemon
+
+ commons-daemon
+
+
- jsw
-
- linux-x86-32
- linux-x86-64
- macosx-x86-universal-32
- macosx-x86-universal-64
- solaris-sparc-32
- solaris-sparc-64
- solaris-x86-32
- solaris-x86-64
- windows-x86-32
-
+
+ commons-daemon
- configuration.directory.in.classpath.first
+ configuration.directory
conf
-
- set.default.REPO_DIR
- lib
-
-
- app.base.libexec
- libexec
-
-
- wrapper.logfile
- logs/wrapper.log
-
+
@@ -111,32 +105,6 @@
-
- scm-app
- package
-
- assemble
-
-
- ${project.build.directory}/appassembler/app/scm-server
- lib
- flat
- true
-
- conf
- true
- src/main/conf
- true
-
-
- sonia.scm.server.ServerApplication
- scm-server
-
-
-
-
@@ -152,22 +120,12 @@
-
-
- ${project.groupId}
- scm-webapp
- ${project.version}
- war
- ${project.build.directory}/appassembler/app/scm-server/webapp
+ ${project.build.directory}/appassembler/commons-daemon/scm-server/var/webapp
scm-webapp.war
@@ -182,9 +140,6 @@
2.2
-
src/main/assembly/scm-server-app.xml
diff --git a/scm-server/src/main/assembly/scm-server-app.xml b/scm-server/src/main/assembly/scm-server-app.xml
index 13761f3710..8691c4a74b 100644
--- a/scm-server/src/main/assembly/scm-server-app.xml
+++ b/scm-server/src/main/assembly/scm-server-app.xml
@@ -48,35 +48,30 @@
- target/appassembler/app/scm-server/bin
+ target/appassembler/commons-daemon/scm-server/bin
false
bin
0755
- target/appassembler/app/scm-server/conf
- true
+ target/appassembler/commons-daemon/scm-server
+ false
+
+
+
+
+ src/main/conf
+ false
conf
-
- target/appassembler/app/scm-server/lib
- false
- lib
-
-
-
- target/appassembler/app/scm-server/webapp
- false
- webapp
-
-
src/main/docroot
false
- webapp/docroot
+ var/webapp/docroot
+
diff --git a/scm-server/src/main/assembly/scm-server-jsw.xml b/scm-server/src/main/assembly/scm-server-jsw.xml
deleted file mode 100644
index 101efd01ee..0000000000
--- a/scm-server/src/main/assembly/scm-server-jsw.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
- jsw
-
-
- zip
- tar.gz
-
-
- true
-
-
-
-
- target/appassembler/jsw/scm-server/bin
- false
- bin
- 0755
-
-
-
- target/appassembler/jsw/scm-server/conf
- true
- conf
-
-
-
- target/appassembler/jsw/scm-server/lib
- false
- lib
-
-
-
- target/appassembler/jsw/scm-server/libexec
- false
- libexec
-
-
-
- target/appassembler/jsw/scm-server/webapp
- false
- webapp
-
-
-
- src/main/docroot
- false
- webapp/docroot
-
-
-
- src/main/conf
- true
-
- *
-
- conf
-
-
-
- target
- false
-
- **/*
-
- logs
-
-
-
-
-
\ No newline at end of file
diff --git a/scm-server/src/main/conf/app-info.xml b/scm-server/src/main/conf/app-info.xml
deleted file mode 100644
index 2491b0ac0e..0000000000
--- a/scm-server/src/main/conf/app-info.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
- ${project.name}
- ${project.version}
- scm-webapp.war
-
-
diff --git a/scm-server/src/main/conf/server-config.xml b/scm-server/src/main/conf/server-config.xml
index 0391836773..d1f6e56f4c 100644
--- a/scm-server/src/main/conf/server-config.xml
+++ b/scm-server/src/main/conf/server-config.xml
@@ -29,7 +29,7 @@
/scm
- webapp/scm-webapp.war
+ var/webapp/scm-webapp.war
@@ -38,7 +38,7 @@
- - webapp/docroot
+ - var/webapp/docroot
diff --git a/scm-server-api/src/main/java/sonia/scm/server/ApplicationInformation.java b/scm-server/src/main/java/sonia/scm/server/ScmServer.java
similarity index 60%
rename from scm-server-api/src/main/java/sonia/scm/server/ApplicationInformation.java
rename to scm-server/src/main/java/sonia/scm/server/ScmServer.java
index 9e8468e097..6cb36415a6 100644
--- a/scm-server-api/src/main/java/sonia/scm/server/ApplicationInformation.java
+++ b/scm-server/src/main/java/sonia/scm/server/ScmServer.java
@@ -29,96 +29,96 @@
*
*/
+
+
package sonia.scm.server;
+//~--- non-JDK imports --------------------------------------------------------
+
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.xml.XmlConfiguration;
+
//~--- JDK imports ------------------------------------------------------------
-import javax.xml.bind.annotation.XmlRootElement;
+import java.net.URL;
/**
*
* @author Sebastian Sdorra
*/
-@XmlRootElement(name = "app-info")
-public class ApplicationInformation
+public class ScmServer extends Thread
{
+ /** Field description */
+ public static final String CONFIGURATION = "/server-config.xml";
+
+ //~--- constructors ---------------------------------------------------------
+
+ /**
+ * Constructs ...
+ *
+ */
+ public ScmServer()
+ {
+ URL configURL = ScmServer.class.getResource(CONFIGURATION);
+
+ if (configURL == null)
+ {
+ throw new ScmServerException("could not find server-config.xml");
+ }
+
+ server = new org.eclipse.jetty.server.Server();
+
+ try
+ {
+ XmlConfiguration config = new XmlConfiguration(configURL);
+
+ config.configure(server);
+ }
+ catch (Exception ex)
+ {
+ throw new ScmServerException("error during server configuration", ex);
+ }
+ }
+
+ //~--- methods --------------------------------------------------------------
+
/**
* Method description
*
- *
- * @return
*/
- public String getAppName()
+ @Override
+ public void run()
{
- return appName;
+ try
+ {
+ server.start();
+ server.join();
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
}
/**
* Method description
*
- *
- * @return
*/
- public String getName()
+ public void stopServer()
{
- return name;
- }
-
- /**
- * Method description
- *
- *
- * @return
- */
- public String getVersion()
- {
- return version;
- }
-
- //~--- set methods ----------------------------------------------------------
-
- /**
- * Method description
- *
- *
- * @param appName
- */
- public void setAppName(String appName)
- {
- this.appName = appName;
- }
-
- /**
- * Method description
- *
- *
- * @param name
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Method description
- *
- *
- * @param version
- */
- public void setVersion(String version)
- {
- this.version = version;
+ try
+ {
+ server.setStopAtShutdown(true);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace(System.err);
+ }
}
//~--- fields ---------------------------------------------------------------
/** Field description */
- private String appName;
-
- /** Field description */
- private String name;
-
- /** Field description */
- private String version;
+ private Server server = new Server();
}
diff --git a/scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServerListenerAdapter.java b/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java
similarity index 66%
rename from scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServerListenerAdapter.java
rename to scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java
index c85f0cce9c..93fd7d77bd 100644
--- a/scm-server-jetty/src/main/java/sonia/scm/server/jetty/JettyServerListenerAdapter.java
+++ b/scm-server/src/main/java/sonia/scm/server/ScmServerDaemon.java
@@ -29,31 +29,25 @@
*
*/
-package sonia.scm.server.jetty;
+
+
+package sonia.scm.server;
//~--- non-JDK imports --------------------------------------------------------
-import org.eclipse.jetty.util.component.LifeCycle;
-
-import sonia.scm.server.ServerListener;
+import org.apache.commons.daemon.Daemon;
+import org.apache.commons.daemon.DaemonContext;
+import org.apache.commons.daemon.DaemonInitException;
/**
*
* @author Sebastian Sdorra
*/
-public class JettyServerListenerAdapter implements LifeCycle.Listener
+public class ScmServerDaemon implements Daemon
{
- /**
- * Constructs ...
- *
- *
- * @param listener
- */
- public JettyServerListenerAdapter(ServerListener listener)
- {
- this.listener = listener;
- }
+ /** Field description */
+ private static volatile ScmServer webserver = new ScmServer();
//~--- methods --------------------------------------------------------------
@@ -61,35 +55,46 @@ public class JettyServerListenerAdapter implements LifeCycle.Listener
* Method description
*
*
- * @param lc
- * @param throwable
+ * @param args
*/
- @Override
- public void lifeCycleFailure(LifeCycle lc, Throwable throwable)
+ public static void main(String[] args)
{
- listener.failed(throwable);
+ webserver.run();
}
/**
* Method description
*
*
- * @param lc
+ * @param args
+ *
+ * @throws Exception
*/
- @Override
- public void lifeCycleStarted(LifeCycle lc)
+ public static void start(String[] args) throws Exception
{
- listener.started();
+ webserver.start();
}
/**
* Method description
*
*
- * @param lc
+ * @param args
+ *
+ * @throws Exception
+ */
+ public static void stop(String[] args) throws Exception
+ {
+ webserver.stopServer();
+ webserver.join(2000l);
+ }
+
+ /**
+ * Method description
+ *
*/
@Override
- public void lifeCycleStarting(LifeCycle lc)
+ public void destroy()
{
// do nothing
@@ -99,29 +104,43 @@ public class JettyServerListenerAdapter implements LifeCycle.Listener
* Method description
*
*
- * @param lc
+ * @param context
+ *
+ * @throws DaemonInitException
+ * @throws Exception
*/
@Override
- public void lifeCycleStopped(LifeCycle lc)
+ public void init(DaemonContext context) throws DaemonInitException, Exception
{
- listener.stopped();
+ daemonArgs = context.getArguments();
}
/**
* Method description
*
*
- * @param lc
+ * @throws Exception
*/
@Override
- public void lifeCycleStopping(LifeCycle lc)
+ public void start() throws Exception
{
+ start(daemonArgs);
+ }
- // do nothing
+ /**
+ * Method description
+ *
+ *
+ * @throws Exception
+ */
+ @Override
+ public void stop() throws Exception
+ {
+ stop(daemonArgs);
}
//~--- fields ---------------------------------------------------------------
/** Field description */
- private ServerListener listener;
+ private String[] daemonArgs;
}
diff --git a/scm-server-api/src/main/java/sonia/scm/server/ServerException.java b/scm-server/src/main/java/sonia/scm/server/ScmServerException.java
similarity index 83%
rename from scm-server-api/src/main/java/sonia/scm/server/ServerException.java
rename to scm-server/src/main/java/sonia/scm/server/ScmServerException.java
index 15119d3041..899acc98e0 100644
--- a/scm-server-api/src/main/java/sonia/scm/server/ServerException.java
+++ b/scm-server/src/main/java/sonia/scm/server/ScmServerException.java
@@ -29,17 +29,19 @@
*
*/
+
+
package sonia.scm.server;
/**
*
* @author Sebastian Sdorra
*/
-public class ServerException extends Exception
+public class ScmServerException extends RuntimeException
{
/** Field description */
- private static final long serialVersionUID = 2936673332739265774L;
+ private static final long serialVersionUID = -6496747280225411051L;
//~--- constructors ---------------------------------------------------------
@@ -47,7 +49,7 @@ public class ServerException extends Exception
* Constructs ...
*
*/
- public ServerException() {}
+ public ScmServerException() {}
/**
* Constructs ...
@@ -55,7 +57,7 @@ public class ServerException extends Exception
*
* @param message
*/
- public ServerException(String message)
+ public ScmServerException(String message)
{
super(message);
}
@@ -64,11 +66,11 @@ public class ServerException extends Exception
* Constructs ...
*
*
- * @param cause
+ * @param throwable
*/
- public ServerException(Throwable cause)
+ public ScmServerException(Throwable throwable)
{
- super(cause);
+ super(throwable);
}
/**
@@ -76,10 +78,10 @@ public class ServerException extends Exception
*
*
* @param message
- * @param cause
+ * @param throwable
*/
- public ServerException(String message, Throwable cause)
+ public ScmServerException(String message, Throwable throwable)
{
- super(message, cause);
+ super(message, throwable);
}
}