[jboss-cvs] JBossAS SVN: r94043 - in projects/bootstrap/trunk: api-embedded and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 25 23:04:28 EDT 2009
Author: ALRubinger
Date: 2009-09-25 23:04:26 -0400 (Fri, 25 Sep 2009)
New Revision: 94043
Added:
projects/bootstrap/trunk/api-embedded/
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServer.java
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServerFactory.java
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/SecurityActions.java
projects/bootstrap/trunk/impl-embedded/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/IgnoreXbUnorderedSequenceLifecycleEventHandler.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/InitLoggingManagerLifecycleEventHandler.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SecurityActions.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetRmiHostnameLifecycleEventHandler.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetSysPropIfNotSpecifiedLifecycleEventHandler.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/JBossASEmbeddedServerImpl.java
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/SecurityActions.java
Removed:
projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/embedded/
projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/embedded/
Modified:
projects/bootstrap/trunk/api-embedded/pom.xml
projects/bootstrap/trunk/build/pom.xml
projects/bootstrap/trunk/impl-embedded/pom.xml
projects/bootstrap/trunk/pom.xml
Log:
[JBBOOT-109] Port embedded-core and embedded-api to org.jboss.bootstrap
Copied: projects/bootstrap/trunk/api-embedded (from rev 94036, projects/embedded/trunk/api)
Modified: projects/bootstrap/trunk/api-embedded/pom.xml
===================================================================
--- projects/embedded/trunk/api/pom.xml 2009-09-25 20:13:31 UTC (rev 94036)
+++ projects/bootstrap/trunk/api-embedded/pom.xml 2009-09-26 03:04:26 UTC (rev 94043)
@@ -7,9 +7,9 @@
<!-- Parent -->
<parent>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-build</artifactId>
- <version>0.1.0-SNAPSHOT</version>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-build</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
<relativePath>../build/pom.xml</relativePath>
</parent>
@@ -17,10 +17,10 @@
<modelVersion>4.0.0</modelVersion>
<!-- Artifact Configuration -->
- <artifactId>jboss-embedded-api</artifactId>
+ <artifactId>jboss-bootstrap-api-embedded</artifactId>
<version>0.1.0-SNAPSHOT</version>
- <name>JBossAS Embedded API</name>
- <description>JBoss Application Server Embedded API</description>
+ <name>JBoss Bootstrap API for AS Embedded</name>
+ <description>JBoss Application Server Bootstrap Embedded API</description>
<!-- Properties -->
Added: projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServer.java
===================================================================
--- projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServer.java (rev 0)
+++ projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServer.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.api.embedded.server;
+
+import org.jboss.bootstrap.api.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.api.as.server.JBossASBasedServer;
+import org.jboss.tmpdpl.api.container.Container;
+
+
+/**
+ * JBossASEmbeddedServer
+ *
+ * Contract of the JBoss Application Server as seen by clients
+ * wishing to embed into an existing runtime
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossASEmbeddedServer
+ extends
+ JBossASBasedServer<JBossASEmbeddedServer, JBossASServerConfig>,
+ Container
+{
+
+}
Added: projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServerFactory.java
===================================================================
--- projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServerFactory.java (rev 0)
+++ projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/JBossASEmbeddedServerFactory.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.bootstrap.api.embedded.server;
+
+import org.jboss.bootstrap.api.as.server.JBossASServerFactory;
+
+/**
+ * JBossASEmbeddedServerFactory
+ *
+ * Stateless factory used in constructing new {@link JBossASEmbeddedServer}
+ * instances. Does not leak internals and allows the client compilation and
+ * runtime classpath (application ClassLoader) to be free of the
+ * implementation classes.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JBossASEmbeddedServerFactory
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * The FQN of the default server implementation class to create
+ */
+ public static final String DEFAULT_SERVER_IMPL_CLASS_NAME = "org.jboss.embedded.core.server.JBossASEmbeddedServerImpl";
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Constructor, should not be used
+ *
+ * @throws UnsupportedOperationException If invoked
+ */
+ private JBossASEmbeddedServerFactory()
+ {
+ // No access
+ throw new UnsupportedOperationException("No instances permitted");
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Factory Methods --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Creates a JBossASEmbeddedServer from the default implementation class name
+ * {@link JBossASEmbeddedServerFactory#DEFAULT_SERVER_IMPL_CLASS_NAME}, using the
+ * Thread Context ClassLoader. The returned server will additionally be created using
+ * the TCCL.
+ *
+ * @return The newly-created Server
+ */
+ public static JBossASEmbeddedServer createServer()
+ {
+ return createServer(SecurityActions.getTccl());
+ }
+
+ /**
+ * Creates a JBossASEmbeddedServer from the default implementation class name
+ * {@link JBossASEmbeddedServerFactory#DEFAULT_SERVER_IMPL_CLASS_NAME}, using the
+ * specified ClassLoader. The returned server will additionally be created using
+ * the ClassLoader denoted.
+ *
+ * @param cl The ClassLoader used to create the new server instance
+ * @throws IllegalArgumentException If the ClassLoader is null
+ * @return The newly-created Server
+ */
+ public static JBossASEmbeddedServer createServer(final ClassLoader cl) throws IllegalArgumentException
+ {
+ try
+ {
+ return JBossASServerFactory.createServer(DEFAULT_SERVER_IMPL_CLASS_NAME, cl, JBossASEmbeddedServer.class);
+ }
+ catch (final InstantiationException ie)
+ {
+ // Should really only be encountered if the impl class name above is wrong, so don't expose
+ // this as a checked exception to the user, wrap in a runtime exception
+ throw new RuntimeException("Server instance could not be created", ie);
+ }
+ }
+
+}
Added: projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/SecurityActions.java (rev 0)
+++ projects/bootstrap/trunk/api-embedded/src/main/java/org/jboss/bootstrap/api/embedded/server/SecurityActions.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.bootstrap.api.embedded.server;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * Utility class for security actions, so as to provide
+ * some centralization without leaking privileged actions
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * In place to prevent instantiation
+ */
+ private SecurityActions()
+ {
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the Thread Context ClassLoader
+ *
+ * @return
+ */
+ static ClassLoader getTccl()
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+
+ public ClassLoader run()
+ {
+ // Return the TCCL
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ });
+ }
+}
Modified: projects/bootstrap/trunk/build/pom.xml
===================================================================
--- projects/bootstrap/trunk/build/pom.xml 2009-09-25 22:33:53 UTC (rev 94042)
+++ projects/bootstrap/trunk/build/pom.xml 2009-09-26 03:04:26 UTC (rev 94043)
@@ -30,7 +30,8 @@
<version.org.jboss.logging_jboss.logging.spi>2.0.5.GA</version.org.jboss.logging_jboss.logging.spi>
<version.org.jboss.microcontainer_jboss.kernel>2.0.4.GA</version.org.jboss.microcontainer_jboss.kernel>
<version.org.jboss_jbossxb>2.0.0.GA</version.org.jboss_jbossxb>
- <version.junit_junit>4.5</version.junit_junit>
+ <version.org.jboss.tmpdpl_tmpdpl.impl.vdf>0.1.0-SNAPSHOT</version.org.jboss.tmpdpl_tmpdpl.impl.vdf>
+ <version.junit_junit>4.6</version.junit_junit>
</properties>
@@ -68,12 +69,12 @@
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
<showDeprecation>false</showDeprecation>
<showWarnings>true</showWarnings>
<optimize>true</optimize>
- <compilerVersion>1.5</compilerVersion>
+ <compilerVersion>1.6</compilerVersion>
<fork>true</fork>
<argLine>-Xmx512M</argLine>
<executable>${JAVA_HOME}/bin/javac</executable>
@@ -103,6 +104,30 @@
<tagBase>https://svn.jboss.org/repos/jbossas/projects/bootstrap/tags</tagBase>
</configuration>
</plugin>
+
+ <!-- Enforce Maven Environment -->
+ <plugin>
+ <artifactId>maven-enforcer-plugin
+ </artifactId>
+ <executions>
+ <execution>
+ <id>enforce-maven-environment</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>[2.0.9,2.1)</version> <!-- Must be Maven 2.0.9 >= x > 2.1 -->
+ </requireMavenVersion>
+ <requireJavaVersion>
+ <version>1.6.0</version> <!-- Must be JDK6 -->
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </plugin>
</plugins>
@@ -143,6 +168,13 @@
<version>${version.org.jboss.microcontainer_jboss.kernel}</version>
</dependency>
+ <!-- Deployable Containers (groupId and artifactId will change) -->
+ <dependency>
+ <groupId>org.jboss.tmpdpl</groupId>
+ <artifactId>tmpdpl-impl-vdf</artifactId>
+ <version>${version.org.jboss.tmpdpl_tmpdpl.impl.vdf}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
Copied: projects/bootstrap/trunk/impl-embedded (from rev 94036, projects/embedded/trunk/core)
Modified: projects/bootstrap/trunk/impl-embedded/pom.xml
===================================================================
--- projects/embedded/trunk/core/pom.xml 2009-09-25 20:13:31 UTC (rev 94036)
+++ projects/bootstrap/trunk/impl-embedded/pom.xml 2009-09-26 03:04:26 UTC (rev 94043)
@@ -7,9 +7,9 @@
<!-- Parent -->
<parent>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-build</artifactId>
- <version>0.1.0-SNAPSHOT</version>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-build</artifactId>
+ <version>2.0.0-alpha-1</version>
<relativePath>../build/pom.xml</relativePath>
</parent>
@@ -17,31 +17,29 @@
<modelVersion>4.0.0</modelVersion>
<!-- Artifact Configuration -->
- <artifactId>jboss-embedded-core</artifactId>
+ <artifactId>jboss-bootstrap-impl-embedded</artifactId>
<version>0.1.0-SNAPSHOT</version>
- <name>JBossAS Embedded Core</name>
- <description>JBoss Application Server Embedded Core Libraries</description>
+ <name>JBoss Bootstrap Implementation for AS Embedded</name>
+ <description>JBossAS Bootstrap for Embedded Implementation Libraries</description>
<!-- Properties -->
<properties>
<!-- Versioning -->
- <version.org.jboss.embedded_jboss.embedded.api>0.1.0-SNAPSHOT
- </version.org.jboss.embedded_jboss.embedded.api>
- <version.org.jboss.bootstrap_jboss.bootstrap.impl.as>2.0.0-alpha-4
- </version.org.jboss.bootstrap_jboss.bootstrap.impl.as>
+ <version.org.jboss.bootstrap_jboss.bootstrap.api.embedded>0.1.0-SNAPSHOT</version.org.jboss.bootstrap_jboss.bootstrap.api.embedded>
+ <version.org.jboss.bootstrap_jboss.bootstrap.impl.as>2.0.0-alpha-4</version.org.jboss.bootstrap_jboss.bootstrap.impl.as>
</properties>
<!-- Dependencies -->
<dependencies>
- <!-- org.jboss.embedded:jboss.embedded.api -->
+ <!-- org.jboss.bootstrap:jboss-bootstrap-api-embedded -->
<dependency>
- <groupId>org.jboss.embedded</groupId>
- <artifactId>jboss-embedded-api</artifactId>
- <version>${version.org.jboss.embedded_jboss.embedded.api}</version>
+ <groupId>org.jboss.bootstrap</groupId>
+ <artifactId>jboss-bootstrap-api-embedded</artifactId>
+ <version>${version.org.jboss.bootstrap_jboss.bootstrap.api.embedded}</version>
</dependency>
<!-- org.jboss.bootstrap:jboss-bootstrap-impl-as -->
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/IgnoreXbUnorderedSequenceLifecycleEventHandler.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/IgnoreXbUnorderedSequenceLifecycleEventHandler.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/IgnoreXbUnorderedSequenceLifecycleEventHandler.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.impl.embedded.lifecycle;
+
+/**
+ * IgnoreXbUnorderedSequenceLifecycleEventHandler
+ *
+ * Lifecycle event handler which, unless otherwise specified,
+ * sets the system property denoting that JBossXB should
+ * ignore the order of elements when doing schema validation
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated Should be removed when this is no longer required by AS
+ * for proper boot.
+ * @see https://jira.jboss.org/jira/browse/JBAS-6924 Dependency
+ * @see http://lists.jboss.org/pipermail/jboss-development/2009-May/014394.html
+ */
+ at Deprecated
+public class IgnoreXbUnorderedSequenceLifecycleEventHandler extends SetSysPropIfNotSpecifiedLifecycleEventHandler
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * System property telling XB whether it may ignore the order of elements, regardless of what's in the schema
+ */
+ private static final String SYS_PROP_XB_IGNORE_UNORDERED = "xb.builder.useUnorderedSequence";
+
+ /**
+ * Value for the ignore property
+ */
+ private static final String XB_IGNORE_VALUE = Boolean.TRUE.toString();
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropName()
+ */
+ @Override
+ String getSysPropName()
+ {
+ return SYS_PROP_XB_IGNORE_UNORDERED;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropValue()
+ */
+ @Override
+ String getSysPropValue()
+ {
+ return XB_IGNORE_VALUE;
+ }
+
+}
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/InitLoggingManagerLifecycleEventHandler.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/InitLoggingManagerLifecycleEventHandler.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/InitLoggingManagerLifecycleEventHandler.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.impl.embedded.lifecycle;
+
+/**
+ * InitLoggingManagerLifecycleEventHandler
+ *
+ * Lifecycle event handler which, unless otherwise specified,
+ * sets the system property to initialize the JDK Logging Manager
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated Should be done in a jboss-beans.xml? Handled some other way? Moved to
+ * Bootstrap impl-as as part of JBossASServerImpl?
+ */
+ at Deprecated
+public class InitLoggingManagerLifecycleEventHandler extends SetSysPropIfNotSpecifiedLifecycleEventHandler
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * System property for the logging manager
+ */
+ private static final String SYS_PROP_LOGGING_MANAGER = "java.util.logging.manager";
+
+ /**
+ * Value for the logging manager
+ */
+ private static final String VALUE = "org.jboss.logmanager.LogManager";
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropName()
+ */
+ @Override
+ String getSysPropName()
+ {
+ return SYS_PROP_LOGGING_MANAGER;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropValue()
+ */
+ @Override
+ String getSysPropValue()
+ {
+ return VALUE;
+ }
+
+}
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SecurityActions.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SecurityActions.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,73 @@
+package org.jboss.bootstrap.impl.embedded.lifecycle;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * A set of privileged actions that are not to leak out
+ * of this package
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * No external instanciation
+ */
+ private SecurityActions()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Sets the specified property with key and value
+ */
+ static void setSystemProperty(final String key, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ System.setProperty(key, value);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Obtains the system property with the specified key
+ *
+ * @param key
+ * @return
+ * @throws IllegalArgumentException If the key is null
+ */
+ static String getSystemProperty(final String key) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key was null");
+ }
+
+ // Get sysprop
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(key);
+ }
+ });
+ }
+}
Property changes on: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SecurityActions.java
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetRmiHostnameLifecycleEventHandler.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetRmiHostnameLifecycleEventHandler.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetRmiHostnameLifecycleEventHandler.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.impl.embedded.lifecycle;
+
+/**
+ * SetRmiHostnameLifecycleEventHandler
+ *
+ * Lifecycle event handler which, unless otherwise specified,
+ * sets the system property denoting the bind hostname for the RMI Server
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated Why is this required to start the server? See where this is provided to
+ * AS standalone (run scripts?) and standardize somewhere.
+ */
+ at Deprecated
+public class SetRmiHostnameLifecycleEventHandler extends SetSysPropIfNotSpecifiedLifecycleEventHandler
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * System property for the RMI server hostname
+ */
+ private static final String SYS_PROP_RMI_SERVER_HOSTNAME = "java.rmi.server.hostname";
+
+ /**
+ * Value for the hostname
+ */
+ private static final String HOSTNAME_VALUE = "localhost";
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropName()
+ */
+ @Override
+ String getSysPropName()
+ {
+ return SYS_PROP_RMI_SERVER_HOSTNAME;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.embedded.core.lifecycle.SetSysPropIfNotSpecifiedLifecycleEventHandler#getSysPropValue()
+ */
+ @Override
+ String getSysPropValue()
+ {
+ return HOSTNAME_VALUE;
+ }
+
+}
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetSysPropIfNotSpecifiedLifecycleEventHandler.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetSysPropIfNotSpecifiedLifecycleEventHandler.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/lifecycle/SetSysPropIfNotSpecifiedLifecycleEventHandler.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.impl.embedded.lifecycle;
+
+import org.jboss.bootstrap.api.lifecycle.LifecycleEventException;
+import org.jboss.bootstrap.api.lifecycle.LifecycleEventHandler;
+import org.jboss.bootstrap.api.lifecycle.LifecycleState;
+import org.jboss.logging.Logger;
+
+/**
+ * SetSysPropIfNotSpecifiedLifecycleEventHandler
+ *
+ * Lifecycle event handler which sets a system property
+ * unless it's been explicitly specified already
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @deprecated Remove when all children are expunged
+ */
+ at Deprecated
+abstract class SetSysPropIfNotSpecifiedLifecycleEventHandler implements LifecycleEventHandler
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(SetSysPropIfNotSpecifiedLifecycleEventHandler.class);
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.spi.lifecycle.LifecycleEventHandler#handleEvent(org.jboss.bootstrap.spi.lifecycle.LifecycleState)
+ */
+ public void handleEvent(final LifecycleState state) throws LifecycleEventException
+ {
+ // Get the system property
+ final String sysPropName = this.getSysPropName();
+
+ // Determine if we should set the property (only if not already specified)
+ boolean setProp = true;
+ final String propertyExplicitlySpecified = SecurityActions.getSystemProperty(sysPropName);
+ if (propertyExplicitlySpecified != null)
+ {
+ setProp = false;
+ }
+
+ // Return if we're not setting
+ if (!setProp)
+ {
+ log.debug("Skipping setting property \"" + sysPropName + "\"; already specified: "
+ + propertyExplicitlySpecified);
+ return;
+ }
+
+ // Set
+ final String sysPropValue = this.getSysPropValue();
+ log.debug("Setting system property \"" + sysPropName + "\": " + sysPropValue);
+ SecurityActions.setSystemProperty(sysPropName, sysPropValue);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns the name of the system property in question
+ * @return
+ */
+ abstract String getSysPropName();
+
+ /**
+ * Returns the value to set upon the system property
+ * if it's not already set
+ * @return
+ */
+ abstract String getSysPropValue();
+
+}
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/JBossASEmbeddedServerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/JBossASEmbeddedServerImpl.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/JBossASEmbeddedServerImpl.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,518 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bootstrap.impl.embedded.server;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.bootstrap.api.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.api.embedded.server.JBossASEmbeddedServer;
+import org.jboss.bootstrap.api.lifecycle.LifecycleEventHandler;
+import org.jboss.bootstrap.api.lifecycle.LifecycleState;
+import org.jboss.bootstrap.impl.as.config.BasicJBossASServerConfig;
+import org.jboss.bootstrap.impl.as.server.AbstractJBossASServerBase;
+import org.jboss.bootstrap.impl.embedded.lifecycle.IgnoreXbUnorderedSequenceLifecycleEventHandler;
+import org.jboss.bootstrap.impl.embedded.lifecycle.InitLoggingManagerLifecycleEventHandler;
+import org.jboss.bootstrap.impl.embedded.lifecycle.SetRmiHostnameLifecycleEventHandler;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.tmpdpl.api.container.DeploymentException;
+import org.jboss.tmpdpl.api.deployable.Deployable;
+import org.jboss.tmpdpl.impl.vdf.VfsVdfDeployableImpl;
+import org.jboss.tmpdpl.spi.vdf.VdfDeployable;
+
+/**
+ * JBossASEmbeddedServer
+ *
+ * Extension of the JBossAS Server implementation
+ * for use in Embedded environments
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JBossASEmbeddedServerImpl extends AbstractJBossASServerBase<JBossASEmbeddedServer, JBossASServerConfig>
+ implements
+ JBossASEmbeddedServer
+{
+
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(JBossASEmbeddedServerImpl.class);
+
+ /**
+ * Environment Variable name for JBOSS_HOME
+ */
+ public static final String ENV_VAR_JBOSS_HOME = "JBOSS_HOME";
+
+ /**
+ * System property name for JBOSS_HOME
+ */
+ public static final String SYS_PROP_JBOSS_HOME = "jboss.home";
+
+ /**
+ * Name under which the MainDeployer is registered with MC
+ */
+ private static final String MC_NAME_MAIN_DEPLOYER = "MainDeployer";
+
+ //-------------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * A mapping of deployable types to their resultant deployments (so we can undeploy)
+ */
+ private final Map<Deployable, Deployment> deployableToDeploymentMap = new ConcurrentHashMap<Deployable, Deployment>();
+
+ //-------------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * Creates a new instance, finding JBOSS_HOME from either:
+ *
+ * 1) Environment variable "JBOSS_HOME"
+ * 2) System property "jboss.home"
+ *
+ * ...with preference to the system property
+ *
+ * @throws IllegalStateException
+ */
+ public JBossASEmbeddedServerImpl() throws IllegalStateException
+ {
+ // Call Super
+ super(JBossASEmbeddedServer.class);
+
+ // Get JBOSS_HOME
+ String jbossHome = SecurityActions.getSystemProperty(SYS_PROP_JBOSS_HOME);
+ if (jbossHome == null)
+ {
+ jbossHome = SecurityActions.getEnvironmentVariable(ENV_VAR_JBOSS_HOME);
+ log.info("Using " + ENV_VAR_JBOSS_HOME + " Environment Variable: " + jbossHome);
+ }
+ else
+ {
+ log.info("Using " + SYS_PROP_JBOSS_HOME + " System Property: " + jbossHome);
+ }
+ if (jbossHome == null)
+ {
+ throw new IllegalStateException("JBOSS_HOME must be specified, either via environment variable \""
+ + ENV_VAR_JBOSS_HOME + "\" or system property \"" + SYS_PROP_JBOSS_HOME + "\".");
+ }
+
+ // Init
+ this.initialize(jbossHome);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param Absolute location of JBOSS_HOME on the filesystem
+ * @throws IllegalArgumentException If jbossHome is not specified
+ */
+ public JBossASEmbeddedServerImpl(final String jbossHome) throws IllegalArgumentException
+ {
+ // Call super
+ super(JBossASEmbeddedServer.class);
+
+ // Init
+ this.initialize(jbossHome);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * @see org.jboss.tmpdpl.api.container.Container#deploy(org.jboss.tmpdpl.api.deployable.Deployable[])
+ */
+ @Override
+ public void deploy(final Deployable... deployables) throws DeploymentException, IllegalArgumentException
+ {
+ // Precondition checks and obtain as VDF impls
+ final Collection<VdfDeployable> vdfDeployables = this.asVdfDeployables(deployables);
+
+ // Get the MainDeployer
+ //TODO Use ProfileService - EMB-39
+ final MainDeployer mainDeployer = this.getMainDeployer();
+
+ // Add each deployable
+ for (final VdfDeployable vdfDeployable : vdfDeployables)
+ {
+
+ /*
+ * Get the Deployers SPI Deployment
+ */
+
+ // Declare
+ final Deployment deployment = vdfDeployable.getDeployment();
+
+ // Add to the MainDeployer
+ log.debug("Adding to " + mainDeployer + ": " + deployment);
+ try
+ {
+ // Add the deployment to the MainDeployer
+ mainDeployer.addDeployment(deployment);
+ }
+ catch (org.jboss.deployers.spi.DeploymentException de)
+ {
+ // Wrap in our own API's DeploymentException
+ throw new DeploymentException(de);
+ }
+
+ // Add to the map (so we can undeploy the deployable later)
+ this.deployableToDeploymentMap.put(vdfDeployable, deployment);
+ }
+
+ // Process and check
+ this.processAndCheckMainDeployer(mainDeployer);
+
+ }
+
+ /**
+ * @see org.jboss.tmpdpl.api.container.Container#undeploy(org.jboss.tmpdpl.api.deployable.Deployable[])
+ */
+ @Override
+ public void undeploy(final Deployable... deployables) throws DeploymentException, IllegalArgumentException
+ {
+ /*
+ * Precondition checks
+ */
+
+ // Ensure deployables are specified
+ if (deployables == null || deployables.length == 0)
+ {
+ throw new IllegalArgumentException("At least one deployable must be specified");
+ }
+
+ // Get the MainDeployer
+ //TODO Use ProfileService - EMB-39
+ final MainDeployer mainDeployer = this.getMainDeployer();
+
+ // Get the deployments for each deployable
+ for (final Deployable deployable : deployables)
+ {
+ final Deployment deployment = this.getDeployablesToDeploymentsMap().get(deployable);
+ if (deployment == null)
+ {
+ log.warn("Specified deployable " + deployable + " cannot be undeployed because it is not deployed.");
+ }
+ else
+ {
+ // Remove from MainDeployer
+ try
+ {
+ mainDeployer.removeDeployment(deployment);
+ }
+ catch (org.jboss.deployers.spi.DeploymentException de)
+ {
+ // Wrap in our own API's DeploymentException
+ throw new DeploymentException(de);
+ }
+
+ // Remove from Map
+ this.deployableToDeploymentMap.remove(deployable);
+ }
+ }
+
+ // Process and check
+ this.processAndCheckMainDeployer(mainDeployer);
+
+ }
+
+ /**
+ * @see org.jboss.bootstrap.impl.base.server.AbstractServer#getDefaultServerConfigClass()
+ */
+ @Override
+ protected Class<? extends JBossASServerConfig> getDefaultServerConfigClass()
+ {
+ return BasicJBossASServerConfig.class;
+ }
+
+ /**
+ * @see org.jboss.tmpdpl.api.container.Container#deploy(org.jboss.shrinkwrap.api.Archive[])
+ */
+ @Override
+ public void deploy(final Archive<?>... archives) throws DeploymentException, IllegalArgumentException
+ {
+ // Precondition checks and obtain as array of Deployables
+ final Deployable[] deployables = this.asDeployableArray(archives);
+
+ // Deploy
+ this.deploy(deployables);
+ }
+
+ /**
+ * @see org.jboss.tmpdpl.api.container.Container#undeploy(org.jboss.shrinkwrap.api.Archive[])
+ */
+ @Override
+ public void undeploy(final Archive<?>... archives) throws DeploymentException, IllegalArgumentException
+ {
+ // Precondition checks and obtain as array of Deployables
+ final Deployable[] deployables = this.asDeployableArray(archives);
+
+ // Undeploy
+ this.undeploy(deployables);
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Centralizes initialization for the constructors
+ *
+ * @param jbossHome
+ * @throws IllegalArgumentException If JBOSS_HOME is not specified
+ */
+ private void initialize(final String jbossHome) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (jbossHome == null || jbossHome.length() == 0)
+ {
+ throw new IllegalArgumentException("JBOSS_HOME is required but was not specified");
+ }
+
+ // Set JBOSS_HOME
+ this.getConfiguration().jbossHome(jbossHome);
+
+ // Set some lifecycle handlers
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler ignoreXbOrder = new IgnoreXbUnorderedSequenceLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, ignoreXbOrder);
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler setRmiHostname = new SetRmiHostnameLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, setRmiHostname);
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler initLoggingManager = new InitLoggingManagerLifecycleEventHandler();
+ this.registerEventHandler(LifecycleState.INITIALIZED, initLoggingManager);
+
+ //TODO
+ /*
+ * Do we need some handler for boot.log? Something like:
+ */
+ log.warn(this + " has not installed any handler for a boot.log in $JBOSS_HOME/server/[name]/log");
+ // /*
+ // * Set boot log directory
+ // */
+ // final String sysPropBootLogDir = "jboss.boot.server.log.dir";
+ // final String sysPropLogDir = JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR;
+ // String serverName = System.getProperty(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
+ // if (serverName == null || serverName.length() == 0)
+ // {
+ // serverName = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
+ // }
+ // final String manualBootLogDir = System.getProperty(sysPropBootLogDir);
+ // final String manualLogDir = System.getProperty(sysPropLogDir);
+ // // If nothing's been explicitly specified
+ // if (manualBootLogDir == null && manualLogDir == null)
+ // {
+ // // We default it
+ // final File jbossHomeFile = new File(jbossHome);
+ // final URL jbossHomeUrl = jbossHomeFile.toURI().toURL();
+ // final URL serverLog = new URL(jbossHomeUrl, "server/" + serverName + "/log/");
+ // final File serverLogFile = new File(serverLog.toURI());
+ // final String serverLogString = serverLogFile.getAbsolutePath();
+ // System.setProperty(sysPropBootLogDir, serverLogString);
+ // }
+ // // If we've got a manual log dir, use it
+ // else if (manualLogDir != null)
+ // {
+ // System.setProperty(sysPropBootLogDir, manualLogDir);
+ // }
+ }
+
+ /**
+ * Obtains the specified archives as an array of
+ * Deployables
+ *
+ * @param archives
+ * @throws IllegalArgumentException If the specified archives are not specified or not of acceptable
+ * (VFS) backing type
+ */
+ private Deployable[] asDeployableArray(final Archive<?>... archives) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (archives == null || archives.length == 0)
+ {
+ throw new IllegalArgumentException("At least one archive must be specified");
+ }
+
+ // Make a deployable from each archive
+ final Collection<Deployable> deployables = new ArrayList<Deployable>();
+ for (final Archive<?> archive : archives)
+ {
+ final Deployable deployable = VfsVdfDeployableImpl.create(archive);
+ deployables.add(deployable);
+ }
+
+ // Return
+ return deployables.toArray(new Deployable[]
+ {});
+ }
+
+ /**
+ * Obtains the MainDeployer via MC
+ * @return
+ * @deprecated EMB-39
+ */
+ @Deprecated
+ protected final MainDeployer getMainDeployer()
+ {
+ // Get the MainDeployer
+ final Kernel kernel = this.getKernel();
+ final KernelController controller = kernel.getController();
+ final ControllerContext context = controller.getContext(MC_NAME_MAIN_DEPLOYER, ControllerState.INSTALLED);
+ if (context == null)
+ {
+ throw new IllegalStateException("Main deployer could not be found");
+ }
+ final Object target = context.getTarget();
+ final MainDeployer mainDeployer = MainDeployer.class.cast(target);
+
+ // Return
+ return mainDeployer;
+ }
+
+ /**
+ * Returns a view of the specified Deployables as {@link VdfDeployable}s.
+ *
+ * @param deployables
+ * @return
+ * @throws IllegalArgumentException If the deployables are either null, empty, or
+ * contain any non-VDF types
+ */
+ private Collection<VdfDeployable> asVdfDeployables(final Deployable... deployables) throws IllegalArgumentException
+ {
+ return this.asExpectedTypeCollection(VdfDeployable.class, deployables);
+ }
+
+ /**
+ * Obtains the specified array of objects as a Collection of the specified
+ * type. Each object in the array must be assignable to the target type.
+ *
+ * @param <T>
+ * @param expectedType
+ * @param objects
+ * @return
+ * @throws IllegalArgumentException If the objects array is null or empty, or one of the objects
+ * in the array is not assignable to the specified type
+ */
+ private <T> Collection<T> asExpectedTypeCollection(final Class<T> expectedType, final Object[] objects)
+ throws IllegalArgumentException
+ {
+ /*
+ * Precondition checks
+ */
+
+ // Ensure objects are specified
+ assert objects != null && objects.length > 0 : "At least one object must be specified";
+
+ // Ensure all objects are of expected type
+ final Collection<T> typedCollection = new ArrayList<T>();
+
+ // For each object
+ for (final Object object : objects)
+ {
+ // Is of expected type?
+ final T typedObject;
+ if (expectedType.isAssignableFrom(object.getClass()))
+ {
+ typedObject = expectedType.cast(object);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unsupported" + "; must be of type \"" + expectedType.getName()
+ + "\" but was " + object.getClass().getName());
+ }
+
+ // Add
+ typedCollection.add(typedObject);
+
+ }
+
+ // Return
+ return typedCollection;
+ }
+
+ /**
+ * Processes and checks the specified MainDeployer
+ * @param mainDeployer
+ * @throws DeploymentException
+ * @throws IllegalArgumentException If the mainDeployer is not specified
+ * @deprecated EMB-39
+ */
+ @Deprecated
+ private void processAndCheckMainDeployer(final MainDeployer mainDeployer) throws DeploymentException,
+ IllegalArgumentException
+ {
+ // Precondition check
+ if (mainDeployer == null)
+ {
+ throw new IllegalArgumentException("mainDeployer must be specified");
+ }
+
+ // Process All
+ log.debug("Processing: " + mainDeployer);
+ mainDeployer.process();
+
+ // Check all completed OK
+ try
+ {
+ log.debug("Checking: " + mainDeployer);
+ mainDeployer.checkComplete();
+ }
+ catch (org.jboss.deployers.spi.DeploymentException de)
+ {
+ // Wrap in our own API's DeploymentException
+ throw new DeploymentException(de);
+ }
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Accessors / Mutators ---------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Returns an immutable view of the deployables/deployments map
+ * @return the Deployments
+ */
+ protected final Map<Deployable, Deployment> getDeployablesToDeploymentsMap()
+ {
+ return Collections.unmodifiableMap(deployableToDeploymentMap);
+ }
+}
Added: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/SecurityActions.java (rev 0)
+++ projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/SecurityActions.java 2009-09-26 03:04:26 UTC (rev 94043)
@@ -0,0 +1,83 @@
+package org.jboss.bootstrap.impl.embedded.server;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * SecurityActions
+ *
+ * A set of privileged actions that are not to leak out
+ * of this package
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class SecurityActions
+{
+
+ //-------------------------------------------------------------------------------||
+ // Constructor ------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * No external instanciation
+ */
+ private SecurityActions()
+ {
+
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Utility Methods --------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the system property with the specified key
+ *
+ * @param key
+ * @return
+ * @throws IllegalArgumentException If the key is null
+ */
+ static String getSystemProperty(final String key) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key was null");
+ }
+
+ // Get sysprop
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(key);
+ }
+ });
+ }
+
+ /**
+ * Obtains the environment variable with the specified key
+ *
+ * @param key
+ * @return
+ * @throws IllegalArgumentException If the key is null
+ */
+ static String getEnvironmentVariable(final String key) throws IllegalArgumentException
+ {
+ // Precondition check
+ if (key == null)
+ {
+ throw new IllegalArgumentException("key was null");
+ }
+
+ // Get envvar
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getenv(key);
+ }
+ });
+ }
+}
Property changes on: projects/bootstrap/trunk/impl-embedded/src/main/java/org/jboss/bootstrap/impl/embedded/server/SecurityActions.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: projects/bootstrap/trunk/pom.xml
===================================================================
--- projects/bootstrap/trunk/pom.xml 2009-09-25 22:33:53 UTC (rev 94042)
+++ projects/bootstrap/trunk/pom.xml 2009-09-26 03:04:26 UTC (rev 94043)
@@ -34,9 +34,11 @@
<module>build</module>
<module>api</module>
<module>api-as</module>
+ <module>api-embedded</module>
<module>api-mc</module>
<module>impl-as</module>
<module>impl-base</module>
+ <module>impl-embedded</module>
<module>impl-mc</module>
<module>spi</module>
<module>spi-as</module>
More information about the jboss-cvs-commits
mailing list