]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Integrate detached with standard SLC
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 2 Oct 2008 07:46:39 +0000 (07:46 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 2 Oct 2008 07:46:39 +0000 (07:46 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1677 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.detached.launcher/.classpath
org.argeo.slc.detached.launcher/pom.xml
org.argeo.slc.detached.launcher/src/assembly/dist.xml [new file with mode: 0644]
org.argeo.slc.detached.launcher/src/main/java/org/argeo/slc/detached/launcher/Main.java
org.argeo.slc.detached.launcher/src/main/resources/log4j.properties [new file with mode: 0644]
org.argeo.slc.detached.launcher/src/main/resources/org/argeo/slc/detached/launcher/felix.properties

index 1aa73cdbf084050c2f4611c2f74041009d5307dc..4972669eda6e786357f31fc5611c9c984689d836 100644 (file)
@@ -4,5 +4,5 @@
        <classpathentry kind="src" path="src/main/resources"/>
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-       <classpathentry kind="output" path="bin"/>
+       <classpathentry kind="output" path="target/classes"/>
 </classpath>
index 1e6637d4f619743131986fa75e466c904880f716..50930710eb450768125b8c859c58fd574c38f64b 100644 (file)
@@ -1,52 +1,82 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.slc</groupId>
-               <artifactId>argeo-slc</artifactId>
-               <version>0.11.1-SNAPSHOT</version>
-               <relativePath>../org.argeo.slc</relativePath>
-       </parent>
-       <artifactId>org.argeo.slc.detached.launcher</artifactId>
-       <name>Argeo SLC Detached Launcher</name>
-       <packaging>jar</packaging>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <configuration>
-                                       <source>1.3</source>
-                                       <target>1.3</target>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-source-plugin</artifactId>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.slc</groupId>
-                       <artifactId>org.argeo.slc.detached</artifactId>
-                       <version>${project.version}</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.felix</groupId>
-                       <artifactId>org.apache.felix.main</artifactId>
-               </dependency>
-               <!-- Spring -->
-               <dependency>
-                       <groupId>org.springframework</groupId>
-                       <artifactId>spring-context</artifactId>
-                       <version>2.0.8</version>
-               </dependency>
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.argeo.slc</groupId>
+        <artifactId>argeo-slc</artifactId>
+        <version>0.11.1-SNAPSHOT</version>
+        <relativePath>../org.argeo.slc</relativePath>
+    </parent>
+    <artifactId>org.argeo.slc.detached.launcher</artifactId>
+    <name>Argeo SLC Detached Launcher</name>
+    <packaging>jar</packaging>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.3</source>
+                    <target>1.3</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>
+                                org.argeo.slc.detached.launcher.Main
+                            </mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptors>
+                        <descriptor>src/assembly/dist.xml</descriptor>
+                    </descriptors>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>attach-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.main</artifactId>
+        </dependency>
+        <!-- Spring -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>2.0.8</version>
+        </dependency>
 
-               <dependency>
-                       <groupId>xerces</groupId>
-                       <artifactId>xercesImpl</artifactId>
-               </dependency>
-       </dependencies>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+    </dependencies>
 </project>
\ No newline at end of file
diff --git a/org.argeo.slc.detached.launcher/src/assembly/dist.xml b/org.argeo.slc.detached.launcher/src/assembly/dist.xml
new file mode 100644 (file)
index 0000000..c3df209
--- /dev/null
@@ -0,0 +1,30 @@
+<assembly xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+    <id>dist</id>
+    <formats>
+        <format>tar.gz</format>
+    </formats>
+    <dependencySets>
+        <dependencySet>
+            <unpack>false</unpack>
+            <outputDirectory>lib</outputDirectory>
+            <includes>
+                <include>*:jar</include>
+            </includes>
+        </dependencySet>
+        <!-- 
+        <dependencySet>
+            <unpack>true</unpack>
+            <outputDirectory></outputDirectory>
+            <outputFileNameMapping></outputFileNameMapping>
+            <includes>
+                <include>
+                    org.argeo.slc:argeo-slc-agent:tar.gz:base
+                </include>
+            </includes>
+            <fileMode>0755</fileMode>
+        </dependencySet>
+         -->
+    </dependencySets>
+</assembly>
\ No newline at end of file
index 5eff46c2606a65f2fb44e339245e91c54323cc36..17c4ff4b0530b31be6f2a024d91803bc69cb3de2 100644 (file)
@@ -1,6 +1,7 @@
 package org.argeo.slc.detached.launcher;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.Method;
@@ -20,12 +21,21 @@ public class Main {
        private final static Log log = LogFactory.getLog(Main.class);
 
        public static void main(String[] args) {
+               log.info("Argeo SLC Detached launcher starting...");
                try {
                        // Load properties
-                       Properties config = prepareConfig();
+                       String propertyPath = "slc-detached.properties";
+                       Properties config = prepareConfig(propertyPath);
+
+                       // Create cache dir
+                       if (!config.containsKey(BundleCache.CACHE_PROFILE_DIR_PROP)) {
+                               final File cachedir = createTemporaryCacheDir();
+                               config.put(BundleCache.CACHE_PROFILE_DIR_PROP, cachedir
+                                               .getAbsolutePath());
+                       }
 
-                       // Start UI (in main class loader)
-                       startUi(config);
+                       // Start app (in main class loader)
+                       startApp(config);
                        // Thread.sleep(10000);
 
                        // Start OSGi system
@@ -40,9 +50,8 @@ public class Main {
                }
        }
 
-       protected static Properties prepareConfig() throws Exception {
-               final File cachedir = createTemporaryCacheDir();
-
+       protected static Properties prepareConfig(String propertyFilePath)
+                       throws Exception {
                // Load config
                Properties config = new Properties();
                InputStream in = null;
@@ -56,19 +65,26 @@ public class Main {
                                in.close();
                }
 
+               try {
+                       in = new FileInputStream(propertyFilePath);
+                       config.load(in);
+               } finally {
+                       if (in != null)
+                               in.close();
+               }
+
+               // System properties have priority.
+               config.putAll(System.getProperties());
+
                // Perform variable substitution for system properties.
                for (Enumeration e = config.propertyNames(); e.hasMoreElements();) {
                        String name = (String) e.nextElement();
                        config.setProperty(name, org.apache.felix.main.Main.substVars(
                                        config.getProperty(name), name, null, config));
+                       if (log.isTraceEnabled())
+                               log.trace(name + "=" + config.getProperty(name));
                }
 
-               config.put(BundleCache.CACHE_PROFILE_DIR_PROP, cachedir
-                               .getAbsolutePath());
-
-               // System properties have priority.
-               config.putAll(System.getProperties());
-
                return config;
        }
 
@@ -100,10 +116,10 @@ public class Main {
                return felix;
        }
 
-       public static void startUi(Properties config) throws Exception {
-               String className = config.getProperty("argeo.scl.autoui.uiclass");
+       public static void startApp(Properties config) throws Exception {
+               String className = config.getProperty("argeo.scl.detached.appclass");
                String[] uiArgs = readArgumentsFromLine(config.getProperty(
-                               "argeo.slc.autoui.uiargs", ""));
+                               "argeo.slc.detached.appargs", ""));
 
                // Launch main method using reflection
                Class clss = Class.forName(className);
diff --git a/org.argeo.slc.detached.launcher/src/main/resources/log4j.properties b/org.argeo.slc.detached.launcher/src/main/resources/log4j.properties
new file mode 100644 (file)
index 0000000..48539ac
--- /dev/null
@@ -0,0 +1,15 @@
+# Set root logger level to DEBUG and its only appender to A1.\r
+log4j.rootLogger=WARN, console\r
+\r
+## Levels\r
+# Slc\r
+log4j.logger.org.argeo.slc=DEBUG\r
+\r
+## Appenders\r
+# A1 is set to be a ConsoleAppender.\r
+log4j.appender.console=org.apache.log4j.ConsoleAppender\r
+\r
+# A1 uses PatternLayout.\r
+log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c %n\r
+\r
index 7ac5502b9990dfb76bb21fee7cdec2e163bbc121..268cd25bd9fb0886383e8fb19892247d8e5fbbe7 100644 (file)
@@ -1,9 +1,9 @@
  
 # Argeo Specific Context Properties
-argeo.slc.mavenBase=file:${user.home}/.m2/repository/
+argeo.slc.mavenBase=file:${user.home}/.m2/repository
 
-argeo.scl.autoui.uiclass=org.argeo.slc.testui.SwingTestUi
-argeo.slc.autoui.uiargs=noExitOnClose
+argeo.scl.detached.appclass=org.argeo.slc.testui.SwingTestUi
+argeo.slc.detached.appargs=noExitOnClose
 
 #
 # Framework config properties.
@@ -29,12 +29,12 @@ org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \
 # file:bundle/org.apache.felix.shell.tui-1.0.2.jar \
 # file:bundle/org.apache.felix.bundlerepository-1.2.0.jar
 
-felix.auto.start.1= \
- reference:file:${user.dir}/../sandbox/argeo.slc.jemmytest/bin/ \
- reference:file:${user.dir}/../org.argeo.slc.detached/bin/ \
- ${argeo.slc.mavenBase}org/apache/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar \
- ${argeo.slc.mavenBase}org/apache/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar \
- ${argeo.slc.mavenBase}org/argeo/dep/jemmy/org.argeo.dep.jemmy.nb61/0.2.2/org.argeo.dep.jemmy.nb61-0.2.2.jar
+#felix.auto.start.1= \
+# reference:file:${user.dir}/../sandbox/argeo.slc.jemmytest/bin/ \
+# reference:file:${user.dir}/../org.argeo.slc.detached/bin/ \
+# ${argeo.slc.mavenBase}/org/apache/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar \
+# ${argeo.slc.mavenBase}/org/apache/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar \
+# ${argeo.slc.mavenBase}/org/argeo/dep/jemmy/org.argeo.dep.jemmy.nb61/0.2.2/org.argeo.dep.jemmy.nb61-0.2.2.jar
 # ${argeo.slc.mavenBase}org/argeo/slc/sandbox/org.argeo.slc.sandbox.jemmytest/0.1.2-SNAPSHOT/org.argeo.slc.sandbox.jemmytest-0.1.2-SNAPSHOT.jar"