org.springframework.osgi.web.extender,
org.springframework.osgi.samples.simplewebapp,
org.argeo.slc.server.activemq,
- org.argeo.slc.server.mysql,
+ org.argeo.slc.server.hsqldb,
org.argeo.slc.server.hibernate,
org.argeo.slc.server.services,
org.argeo.slc.server.jms,
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
+ <artifactId>com.springsource.net.sourceforge.jtds</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
-<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">
+<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>
+ <groupId>org.argeo.slc.runtime</groupId>
+ <artifactId>argeo-slc-runtime</artifactId>
<version>0.11.3-SNAPSHOT</version>
- <relativePath>../org.argeo.slc</relativePath>
+ <relativePath>..</relativePath>
</parent>
<artifactId>org.argeo.slc.detached.launcher</artifactId>
<name>Argeo SLC Detached Launcher</name>
</instructions>
</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>
+ <!--
+ <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>
- -->
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
-<!--
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>org.springframework.osgi.extender</artifactId>
- </dependency>
- -->
-
- <!--
- Old <dependency> <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId> <version>2.0.8</version>
- </dependency> <dependency> <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId> </dependency> <dependency>
- <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency>
- <dependency> <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId> </dependency>
- -->
<!--
- <dependency> <groupId>org.argeo.slc</groupId>
- <artifactId>org.argeo.slc.detached.ext.log4j</artifactId>
- <version>0.11.2</version> </dependency>
- -->
- <!-- Spring
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>org.springframework.context</artifactId>
- </dependency>
- -->
- <!--
- <dependency> <groupId>org.apache.xerces</groupId>
- <artifactId>com.springsource.org.apache.xerces</artifactId>
- </dependency> <dependency> <groupId>org.apache.xalan</groupId>
- <artifactId>com.springsource.org.apache.xalan</artifactId>
- </dependency> <dependency>
- <groupId>edu.emory.mathcs.backport</groupId> <artifactId>
- com.springsource.edu.emory.mathcs.backport </artifactId>
- </dependency>
- -->
- <!--
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>
- com.springsource.org.apache.commons.io
- </artifactId>
- </dependency>
- <dependency>
- <groupId>org.junit</groupId>
- <artifactId>com.springsource.junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.log4j</groupId>
- <artifactId>com.springsource.org.apache.log4j</artifactId>
- </dependency> -->
- <!--
- <dependency> <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
- </dependency> <dependency> <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.jcl</artifactId> </dependency>
+ <dependency> <groupId>org.springframework.osgi</groupId>
+ <artifactId>org.springframework.osgi.extender</artifactId>
+ </dependency> <dependency> <groupId>org.argeo.slc.runtime</groupId>
+ <artifactId>org.argeo.slc.detached</artifactId> </dependency>
-->
</dependencies>
</project>
\ No newline at end of file
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.TreeMap;
import java.util.Vector;
import org.eclipse.core.runtime.adaptor.EclipseStarter;
public class Main {
public final static String PROP_SLC_HOME = "slc.home";
+ public final static String PROP_SLC_DETACHED_PROEPRTIES = "slc.detached.properties";
public final static String PROP_SLC_OSGI_START = "slc.osgi.start";
public final static String PROP_SLC_OSGI_SCAN_CLASSPATH = "slc.osgi.scanClasspath";
public final static String PROP_SLC_OSGI_EQUINOX_ARGS = "slc.osgi.equinox.args";
info("Argeo SLC Detached launcher starting...");
try {
// Load properties
- String propertyPath = "slc-detached.properties";
+ String propertyPath = System.getProperty("slc.detached.properties",
+ "slc-detached.properties");
Properties config = prepareConfig(propertyPath);
// Start app (in main class loader)
try {
startEquinox(config);
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
info("Argeo SLC Detached launcher started.");
} catch (Exception e) {
e.printStackTrace();
- System.exit(-1);
+ System.exit(1);
}
}
protected static Properties prepareConfig(String propertyFilePath)
throws Exception {
- // Format slc.home
- String slcHome = System.getProperty(PROP_SLC_HOME);
- if (slcHome != null) {
- slcHome = new File(slcHome).getCanonicalPath();
- System.setProperty(PROP_SLC_HOME, slcHome);
- }
-
// Load config
Properties config = new Properties();
InputStream in = null;
in.close();
}
+ // Format slc.home
+ String slcHome = System.getProperty(Main.PROP_SLC_HOME);
+ if (slcHome == null) {
+ slcHome = config.getProperty(Main.PROP_SLC_HOME);
+ }
+ if (slcHome != null) {
+ slcHome = new File(slcHome).getCanonicalPath();
+ System.setProperty(Main.PROP_SLC_HOME, slcHome);
+ }
+
// System properties have priority.
config.putAll(System.getProperties());
+
+ // SET ALL PROPERTIES AS SYSTEM PROPERTIES
+ TreeMap ordered = new TreeMap(config);
+ for (Iterator it = ordered.keySet().iterator(); it.hasNext();) {
+ String key = it.next().toString();
+ String value = ordered.get(key).toString();
+ System.out.println(key + "=" + value);
+ System.setProperty(key, value);
+ }
+
return config;
}
private static void startBundle(BundleContext bundleContext,
String symbolicName) throws BundleException {
- //info("Starting bundle " + symbolicName + "...");
+ // info("Starting bundle " + symbolicName + "...");
Bundle bundle = findBundleBySymbolicName(bundleContext, symbolicName);
if (bundle != null)
bundle.start();
private static void bundleInstallWarn(Object obj) {
System.err.println("[WARN] " + obj);
- //Thread.dumpStack();
+ // Thread.dumpStack();
}
}
this.agentUnregister = agentUnregister;
}
- /*
- * public void onMessage(Message message) { // FIXME: we filter the messages
- * on the client side, // because of a weird problem with selector since
- * moving to OSGi try { if (message.getStringProperty("slc-agentId").equals(
- * agentDescriptor.getUuid())) { runSlcExecution((SlcExecution)
- * messageConverter .fromMessage(message)); } else { if
- * (log.isDebugEnabled()) log.debug("Filtered out message " + message); } }
- * catch (JMSException e) { throw new SlcException("Cannot convert message "
- * + message, e); }
- *
- * }
- */
-
public String getMessageSelector() {
String messageSelector = "slc_agentId='" + agentDescriptor.getUuid()
+ "'";
SlcExecution slcExecution = (SlcExecution) jmsTemplate
.getMessageConverter().fromMessage(message);
runSlcExecution(slcExecution);
+ return;
} else {
// try {
// // FIXME: generalize
+ value.getClass().getName());
}
values.put(key, refValue);
+ } else if (attribute instanceof ResourceSpecAttribute) {
+ PrimitiveValue primitiveValue = new PrimitiveValue();
+ primitiveValue
+ .setType(((ResourceSpecAttribute) attribute)
+ .getType());
+ primitiveValue.setValue(value);
+ values.put(key, primitiveValue);
} else {
throw new SlcException("Unkown spec attribute type "
+ attribute.getClass());
this.type = type;
}
+ public String getType() {
+ return type;
+ }
+
}
};
stdOutThread.start();
StreamReaderThread stdErrThread = new StreamReaderThread(process
- .getInputStream()) {
+ .getErrorStream()) {
protected void callback(String line) {
stdErrCallback(line);
}
// Wait for the end of the process
if (synchronous) {
Integer exitCode = process.waitFor();
- if (exitCode != 0)
+ if (exitCode != 0) {
+ Thread.sleep(5000);// leave the process a chance to log
log.warn("Process return exit code " + exitCode);
+ }
} else {
// asynchronous: return
}
else
return dir.getPath();
}
-
+
protected void stdOutCallback(String line) {
log(stdOutLogLevel, line);
}
-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
- <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
-jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://localhost/sparta_prod
+jdbc.url=jdbc:mysql://localhost/slc
jdbc.username=root
jdbc.password=
<dependency>
<groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
+ <artifactId>com.springsource.net.sourceforge.jtds</artifactId>
</dependency>
<dependency>
<groupId>com.mysql.jdbc</groupId>