Author: peteroyle
Date: 2009-04-09 18:29:36 -0400 (Thu, 09 Apr 2009)
New Revision: 2375
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
Log:
Added ability to access command line parameters before web beans manager is deployed (ie:
during initialisation).
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-04-09
22:27:45 UTC (rev 2374)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/ShutdownManager.java 2009-04-09
22:29:36 UTC (rev 2375)
@@ -35,7 +35,7 @@
{
hasShutdownBeenCalled = true;
bootstrap.shutdown();
- DependentContext.INSTANCE.setActive(false);
+ DependentContext.instance().setActive(false);
}
else
{
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-04-09
22:27:45 UTC (rev 2374)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/StartMain.java 2009-04-09
22:29:36 UTC (rev 2375)
@@ -24,7 +24,6 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.environment.se.beans.ParametersFactory;
import org.jboss.webbeans.environment.se.discovery.SEWebBeanDiscovery;
import org.jboss.webbeans.environment.se.resources.NoNamingContext;
import org.jboss.webbeans.environment.se.util.Reflections;
@@ -47,14 +46,14 @@
private final Bootstrap bootstrap;
private final BeanStore applicationBeanStore;
- public static String[] ARGS;
+ public static String[] PARAMETERS;
private WebBeansManager manager;
public StartMain(String[] commandLineArgs)
{
- ARGS = commandLineArgs;
+ PARAMETERS = commandLineArgs;
try
{
bootstrap = Reflections.newInstance(BOOTSTRAP_IMPL_CLASS_NAME,
Bootstrap.class);
@@ -75,13 +74,12 @@
bootstrap.initialize();
this.manager = bootstrap.getManager();
bootstrap.boot();
- DependentContext.INSTANCE.setActive(true);
+ DependentContext.instance().setActive(true);
bootstrap.getManager().getInstanceByType(ShutdownManager.class).setBootstrap(bootstrap);
}
/**
- * The main method called from the command line. This little puppy will get
- * the ball rolling.
+ * The main method called from the command line.
*
* @param args
* the command line arguments
@@ -96,5 +94,10 @@
go();
return manager;
}
-
+
+ public static String[] getParameters() {
+ // TODO(PR): make immutable
+ return PARAMETERS;
+ }
+
}
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java
===================================================================
---
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-04-09
22:27:45 UTC (rev 2374)
+++
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/beans/ParametersFactory.java 2009-04-09
22:29:36 UTC (rev 2375)
@@ -87,6 +87,6 @@
* @param manager The Manager which has been initialized.
*/
public void initArgs(@Observes @Initialized Manager manager) {
- this.setArgs( StartMain.ARGS );
+ this.setArgs( StartMain.PARAMETERS );
}
}
Show replies by date