You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/02/15 01:01:12 UTC
svn commit: r507747 - in
/incubator/tuscany/java/sca/runtime/standalone/launcher/src/main:
java/org/apache/tuscany/launcher/Main.java
resources/org/apache/tuscany/launcher/Main.properties
Author: meerajk
Date: Wed Feb 14 16:01:11 2007
New Revision: 507747
URL: http://svn.apache.org/viewvc?view=rev&rev=507747
Log:
Intermediate checkin for the deployment hack for launcher.
Modified:
incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
Modified: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java?view=diff&rev=507747&r1=507746&r2=507747
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java (original)
+++ incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/java/org/apache/tuscany/launcher/Main.java Wed Feb 14 16:01:11 2007
@@ -18,7 +18,11 @@
*/
package org.apache.tuscany.launcher;
+import java.io.File;
+import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ResourceBundle;
import java.util.concurrent.Callable;
import java.text.MessageFormat;
@@ -29,34 +33,42 @@
import org.apache.tuscany.host.runtime.TuscanyRuntime;
import org.apache.tuscany.runtime.standalone.DirectoryHelper;
import org.apache.tuscany.runtime.standalone.StandaloneRuntimeInfo;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.CompositeImplementation;
/**
- * Main class for launcher runtime environment.
- * <code>
+ * Main class for launcher runtime environment. <code>
* usage: java [jvm-options] -jar launcher.jar <componentURI>
* </code>
- * where the componentURI identifies a component in the assembly that should be called.
- *
+ * where the componentURI identifies a component in the assembly that should be
+ * called.
+ *
* @version $Rev$ $Date$
*/
public class Main {
/**
* Main method.
- *
+ *
* @param args the command line args
- * @throws Throwable if there are problems launching the runtime or application
+ * @throws Throwable if there are problems launching the runtime or
+ * application
*/
public static void main(String[] args) throws Throwable {
- if (args.length == 0) {
+ if (args.length != 2) {
usage();
throw new AssertionError();
}
+ URI applicationURI = new URI(args[0]);
+
StandaloneRuntimeInfo runtimeInfo = DirectoryHelper.createRuntimeInfo("launcher", Main.class);
TuscanyRuntime runtime = DirectoryHelper.createRuntime(runtimeInfo);
runtime.initialize();
+
+ deployApplication(args, applicationURI, runtime);
+
try {
- URI applicationURI = new URI(args[0]);
+
String serviceName = applicationURI.getFragment();
ComponentContext context = runtime.getComponentContext(applicationURI);
if (context == null) {
@@ -75,6 +87,20 @@
runtime.destroy();
}
+ }
+
+ private static void deployApplication(String[] args, URI applicationURI, TuscanyRuntime runtime) throws MalformedURLException {
+ URL applicationJar = new File(args[1]).toURL();
+ ClassLoader applicationClassLoader =
+ new URLClassLoader(new URL[] {applicationJar}, runtime.getHostClassLoader());
+ URL appScdl = applicationClassLoader.getResource("META-INF/sca/default.scdl");
+ CompositeImplementation impl = new CompositeImplementation();
+ impl.setScdlLocation(appScdl);
+ impl.setClassLoader(applicationClassLoader);
+
+ ComponentDefinition<CompositeImplementation> definition =
+ new ComponentDefinition<CompositeImplementation>(applicationURI, impl);
+ // TODO Deploy the SCDL
}
private static void usage() {
Modified: incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties?view=diff&rev=507747&r1=507746&r2=507747
==============================================================================
--- incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties (original)
+++ incubator/tuscany/java/sca/runtime/standalone/launcher/src/main/resources/org/apache/tuscany/launcher/Main.properties Wed Feb 14 16:01:11 2007
@@ -17,5 +17,5 @@
#
# $Rev$ $Date$
#
-org.apache.tuscany.launcher.Usage=usage: java [jvm-options] -jar launcher.jar <componentURI>
+org.apache.tuscany.launcher.Usage=usage: java [jvm-options] -jar launcher.jar <componentURI> <componentJar>
org.apache.tuscany.launcher.NoComponent=No component found with id "{0}"
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org