tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: wiring TomEEEmbeddedArg in TomEEEmbeddedApplicationRunner
Date Sat, 01 Oct 2016 09:19:08 GMT
Repository: tomee
Updated Branches:
  refs/heads/master dafe6d287 -> 63792008e


wiring TomEEEmbeddedArg in TomEEEmbeddedApplicationRunner


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/63792008
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/63792008
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/63792008

Branch: refs/heads/master
Commit: 63792008eb783003970777fe43ca87a264d9d4ec
Parents: dafe6d2
Author: rmannibucau <rmannibucau@apache.org>
Authored: Sat Oct 1 11:18:58 2016 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Sat Oct 1 11:18:58 2016 +0200

----------------------------------------------------------------------
 .../TomEEEmbeddedApplicationRunner.java         | 27 +++++++++++---------
 .../embedded/component/TomEEEmbeddedArgs.java   |  6 +++++
 2 files changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/63792008/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
index c16b970..12033d2 100644
--- a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
+++ b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
@@ -17,6 +17,7 @@
 package org.apache.tomee.embedded;
 
 import org.apache.openejb.config.DeploymentsResolver;
+import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.testing.Application;
 import org.apache.openejb.testing.ApplicationComposers;
 import org.apache.openejb.testing.Classes;
@@ -24,6 +25,7 @@ import org.apache.openejb.testing.ContainerProperties;
 import org.apache.openejb.testing.Jars;
 import org.apache.openejb.testing.RandomPort;
 import org.apache.openejb.testing.WebResource;
+import org.apache.tomee.embedded.component.TomEEEmbeddedArgs;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.inject.OWBInjector;
 import org.apache.xbean.finder.AnnotationFinder;
@@ -87,7 +89,7 @@ public class TomEEEmbeddedApplicationRunner implements AutoCloseable {
             }
         }
         try {
-            start(app.getClass(), overrides);
+            start(app.getClass(), overrides, args);
             return this;
         } catch (final Exception e) {
             throw new IllegalStateException(e);
@@ -102,7 +104,7 @@ public class TomEEEmbeddedApplicationRunner implements AutoCloseable {
         return app;
     }
 
-    public synchronized void start(final Class<?> marker, final Properties config)
throws Exception {
+    public synchronized void start(final Class<?> marker, final Properties config,
final String... args) throws Exception {
         if (started) {
             return;
         }
@@ -195,7 +197,7 @@ public class TomEEEmbeddedApplicationRunner implements AutoCloseable {
         }
 
         final Jars jars = appClass.getAnnotation(Jars.class);
-        List<URL> urls = null;
+        final List<URL> urls;
         if (jars != null) {
             final Collection<File> files = ApplicationComposers.findFiles(jars);
             urls = new ArrayList<>(files.size());
@@ -225,15 +227,16 @@ public class TomEEEmbeddedApplicationRunner implements AutoCloseable
{
             configuration.loadFromProperties(config);
         }
 
-        final Container container = new Container(configuration)
-                .deploy(new Container.DeploymentRequest(
-                        context,
-                        // call ClasspathSearcher that lazily since container needs to be
started to not preload logging
-                        urls == null ? new DeploymentsResolver.ClasspathSearcher().loadUrls(Thread.currentThread().getContextClassLoader()).getUrls()
: urls,
-                        webResource != null ? new File(webResource) : null,
-                        true,
-                        null,
-                        archive));
+        final Container container = new Container(configuration);
+        SystemInstance.get().setComponent(TomEEEmbeddedArgs.class, new TomEEEmbeddedArgs(args,
null));
+        container.deploy(new Container.DeploymentRequest(
+                context,
+                // call ClasspathSearcher that lazily since container needs to be started
to not preload logging
+                urls == null ? new DeploymentsResolver.ClasspathSearcher().loadUrls(Thread.currentThread().getContextClassLoader()).getUrls()
: urls,
+                webResource != null ? new File(webResource) : null,
+                true,
+                null,
+                archive));
 
         for (final Map.Entry<String, Field> f : ports.entrySet()) {
             switch (f.getKey()) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/63792008/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/component/TomEEEmbeddedArgs.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/component/TomEEEmbeddedArgs.java
b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/component/TomEEEmbeddedArgs.java
index 51bd8c5..6750364 100644
--- a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/component/TomEEEmbeddedArgs.java
+++ b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/component/TomEEEmbeddedArgs.java
@@ -27,10 +27,16 @@ public class TomEEEmbeddedArgs {
         this.commandLine = commandLine;
     }
 
+    /**
+     * @return the args passed to the launcher.
+     */
     public String[] getArgs() {
         return args;
     }
 
+    /**
+     * @return the command like if used from tomee Main/FatApp, null otherwise.
+     */
     public CommandLine getCommandLine() {
         return commandLine;
     }


Mime
View raw message