[jboss-cvs] JBossAS SVN: r91241 - in projects/bootstrap/trunk: impl-as/src/main/java/org/jboss/bootstrap/impl/as/server and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 14 16:12:16 EDT 2009
Author: ALRubinger
Date: 2009-07-14 16:12:15 -0400 (Tue, 14 Jul 2009)
New Revision: 91241
Added:
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/AbstractJBossASServerBase.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedConfigurationInitializer.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedServerConfig.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASBasedServer.java
Removed:
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java
Modified:
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationPropertyOverrideTestCase.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/PropertyValueResolutionTestCase.java
projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/JBossASBootstrap.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfig.java
projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASServer.java
Log:
[JBBOOT-99] Allow AS SPIs to be extended for Server, ServerConfig and Bootstrap; extend the generics chain
Copied: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java (from rev 91184, projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java)
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java (rev 0)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,199 @@
+/*
+ * 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.as.config;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationValidator;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.config.ConfigurationValidator;
+import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
+import org.jboss.logging.Logger;
+
+/**
+ * JBossASBasedConfigurationValidator
+ *
+ * Base validator for JBossAS Configurations
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class JBossASBasedConfigurationValidator<T extends JBossASBasedServerConfig<T>>
+ extends
+ AbstractBasicConfigurationValidator<T> implements ConfigurationValidator<T>
+{
+
+ //-------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ private static final Logger log = Logger.getLogger(JBossASBasedConfigurationValidator.class);
+
+ //-------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.spi.config.AbstractBasicConfigurationValidator#validate(org.jboss.bootstrap.spi.config.ServerConfig)
+ */
+ @Override
+ public void validate(T config) throws InvalidConfigurationException
+ {
+ // Log
+ if (log.isTraceEnabled())
+ {
+ log.trace("Validating Configuration: " + config + " ...");
+ }
+
+ // Validate the super configuration
+ super.validate(config);
+
+ /*
+ * The following properties must be specified
+ */
+
+ // jboss.home
+ this.require(config.getJBossHome(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_HOME);
+ // jboss.bind.address
+ this.require(config.getBindAddress(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS);
+ // jboss.server.name
+ this.require(config.getServerName(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
+ // jboss.lib.url
+ this.require(config.getBootLibraryLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL);
+ // jboss.server.base.url
+ this.require(config.getServerBaseLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL);
+ // jboss.server.home.url
+ this.require(config.getServerHomeLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_HOME_URL);
+ // jboss.common.base.url
+ this.require(config.getCommonBaseLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_COMMON_BASE_URL);
+ // jboss.common.lib.url
+ this.require(config.getCommonLibLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL);
+ // jboss.server.log.dir
+ this.require(config.getServerLogLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR, false);
+ // jboss.server.conf.url
+ this.require(config.getServerConfLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_CONF_URL);
+ // jboss.server.lib.url
+ this.require(config.getServerLibLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL);
+ // jboss.server.data.dir
+ this.require(config.getServerDataLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR, false);
+ // jboss.server.tmp.dir
+ this.require(config.getServerTempLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR, false);
+ // jboss.partition.name
+ this.require(config.getPartitionName(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME);
+ // jboss.native.load
+ this.require(config.isLoadNative(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_NATIVE_LOAD);
+ // jboss.native.lib
+ this.require(config.getNativeLibraryLocation(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_NATIVE_DIR, false);
+ // jboss.platform.mbeanserver
+ this.require(config.isUsePlatformMBeanServer(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER);
+
+ // Log
+ log.debug("Configuration is valid: " + config);
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Internal Helper Methods ------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Requires that the specified argument is both non-null and
+ * non-empty.
+ *
+ * @throws InvalidConfigurationException If the specified argument is
+ * either null or empty
+ */
+ protected void require(final String arg, final String propertyName) throws InvalidConfigurationException
+ {
+ // If not specified
+ if (arg == null || arg.length() == 0)
+ {
+ // Tell 'em about it
+ throw new InvalidConfigurationException(propertyName + " must be specified");
+ }
+ }
+
+ /**
+ * Requires that the specified argument is both non-null and
+ * non-empty.
+ *
+ * @throws InvalidConfigurationException If the specified argument is
+ * either null or empty
+ */
+ protected void require(final Boolean arg, final String propertyName) throws InvalidConfigurationException
+ {
+ // If not specified
+ if (arg == null)
+ {
+ // Tell 'em about it
+ throw new InvalidConfigurationException(propertyName + " must be specified");
+ }
+ }
+
+ /**
+ * Requires that the specified argument is both non-null and
+ * pointing to an existent location
+ *
+ * @throws InvalidConfigurationException If the specified argument is
+ * either null or nonexistent
+ */
+ protected void require(final URL arg, final String propertyName) throws InvalidConfigurationException
+ {
+ this.require(arg, propertyName, true);
+ }
+
+ /**
+ * Requires that the specified argument is both non-null and, optionally,
+ * pointing to an existent location
+ *
+ * @throws InvalidConfigurationException If the specified argument is
+ * either null or nonexistent
+ */
+ protected void require(final URL arg, final String propertyName, final boolean exists)
+ throws InvalidConfigurationException
+ {
+ // If not specified
+ if (arg == null)
+ {
+ // Throw
+ throw new InvalidConfigurationException(propertyName + " must be specified");
+ }
+
+ // Try to open a connection, to see if exists
+ if (exists)
+ {
+ try
+ {
+ final URLConnection connection = arg.openConnection();
+ connection.connect();
+ }
+ catch (IOException ioe)
+ {
+ throw new InvalidConfigurationException("Could not get a connection to the " + propertyName + ": "
+ + arg.toExternalForm(), ioe);
+ }
+ }
+ }
+
+}
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -27,7 +27,8 @@
import java.util.Map;
import org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationInitializer;
-import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
import org.jboss.logging.Logger;
@@ -40,9 +41,9 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public class JBossASConfigurationInitializerImpl extends AbstractBasicConfigurationInitializer<JBossASServerConfig>
- implements
- JBossASConfigurationInitializer
+public class JBossASConfigurationInitializerImpl<T extends JBossASBasedServerConfig<T>>
+ extends
+ AbstractBasicConfigurationInitializer<T> implements JBossASBasedConfigurationInitializer<T>
{
//-------------------------------------------------------------------------------||
@@ -70,7 +71,7 @@
* @see org.jboss.bootstrap.spi.config.AbstractBasicConfigurationInitializer#initialize(org.jboss.bootstrap.spi.config.ServerConfig)
*/
@Override
- public void initialize(JBossASServerConfig config) throws InvalidConfigurationException, IllegalArgumentException,
+ public void initialize(T config) throws InvalidConfigurationException, IllegalArgumentException,
IllegalStateException
{
// Log
@@ -89,17 +90,17 @@
// ${jboss.bind.address}
final String bindAddress = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS, config
- .getBindAddress(), JBossASConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT, configProps);
+ .getBindAddress(), JBossASBasedConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT, configProps);
config.bindAddress(bindAddress);
// ${jboss.server.name}
final String serverName = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME, config
- .getServerName(), JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT, configProps);
+ .getServerName(), JBossASBasedConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT, configProps);
config.serverName(serverName);
// ${jboss.lib.url}
final URL bootLibLocation = config.getBootLibraryLocation();
- final String bootLibDefault = jbossHome + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ final String bootLibDefault = jbossHome + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
final String currentBootLibLocation = bootLibLocation != null ? bootLibLocation.toExternalForm() : null;
String resolvedBootLibLocation = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL,
currentBootLibLocation, bootLibDefault, configProps);
@@ -108,7 +109,8 @@
// ${jboss.server.base.url} / ${jboss.server.base.dir}
final URL serverBaseLocation = config.getServerBaseLocation();
- final String serverBaseDefault = jbossHome + JBossASConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
+ final String serverBaseDefault = jbossHome
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
final String currentServerBaseLocation = serverBaseLocation != null ? serverBaseLocation.toExternalForm() : null;
String resolvedServerBaseLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL, currentServerBaseLocation, serverBaseDefault,
@@ -128,7 +130,8 @@
// ${jboss.common.base.url}
final URL commonBaseLocation = config.getCommonBaseLocation();
- final String commonBaseDefault = jbossHome + JBossASConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
+ final String commonBaseDefault = jbossHome
+ + JBossASBasedConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
final String currentCommonBaseLocation = commonBaseLocation != null ? commonBaseLocation.toExternalForm() : null;
String resolvedCommonBaseLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_COMMON_BASE_URL, currentCommonBaseLocation, commonBaseDefault,
@@ -139,7 +142,7 @@
// ${jboss.common.lib.url}
final URL commonLibLocation = config.getCommonLibLocation();
final String commonLibDefault = resolvedCommonBaseLocation
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
final String currentCommonLibLocation = commonLibLocation != null ? commonLibLocation.toExternalForm() : null;
String resolvedCommonLibLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL, currentCommonLibLocation, commonLibDefault,
@@ -150,7 +153,7 @@
// ${jboss.server.log.dir}
final URL serverLogLocation = config.getServerLogLocation();
final String serverLogDefault = resolvedServerHomeLocation
- + JBossASConfigurationInitializer.VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT;
final String currentServerLogLocation = serverLogLocation != null ? serverLogLocation.toExternalForm() : null;
String resolvedServerLogLocation = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR,
currentServerLogLocation, serverLogDefault, configProps);
@@ -160,7 +163,7 @@
// ${jboss.server.conf.url}
final URL serverConfLocation = config.getServerConfLocation();
final String serverConfDefault = resolvedServerHomeLocation
- + JBossASConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
final String currentServerConfLocation = serverConfLocation != null ? serverConfLocation.toExternalForm() : null;
String resolvedServerConfLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_CONF_URL, currentServerConfLocation, serverConfDefault,
@@ -175,7 +178,7 @@
// ${jboss.server.lib.url}
final URL serverLibLocation = config.getServerLibLocation();
final String serverLibDefault = resolvedServerHomeLocation
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
final String currentServerLibLocation = serverLibLocation != null ? serverLibLocation.toExternalForm() : null;
String resolvedServerLibLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL, currentServerLibLocation, serverLibDefault,
@@ -186,7 +189,7 @@
// ${jboss.server.data.dir}
final URL serverDataLocation = config.getServerDataLocation();
final String serverDataDefault = resolvedServerHomeLocation
- + JBossASConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
final String currentServerDataLocation = serverDataLocation != null ? serverDataLocation.toExternalForm() : null;
String resolvedServerDataLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR, currentServerDataLocation, serverDataDefault,
@@ -197,7 +200,7 @@
// ${jboss.server.tmp.dir}
final URL serverTempLocation = config.getServerTempLocation();
final String serverTempDefault = resolvedServerHomeLocation
- + JBossASConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
final String currentServerTempLocation = serverTempLocation != null ? serverTempLocation.toExternalForm() : null;
String resolvedServerTempLocation = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR, currentServerTempLocation, serverTempDefault,
@@ -217,7 +220,7 @@
// ${jboss.partition.name}
final String partitionName = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME,
- config.getPartitionName(), JBossASConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT, configProps);
+ config.getPartitionName(), JBossASBasedConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT, configProps);
config.partitionName(partitionName);
// ${jboss.partition.udpGroup}
@@ -247,7 +250,7 @@
final Boolean loadNative = config.isLoadNative();
final String loadNativeString = loadNative != null ? loadNative.toString() : null;
final String loadNativeResolved = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_LOAD,
- loadNativeString, JBossASConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT.toString(), configProps);
+ loadNativeString, JBossASBasedConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT.toString(), configProps);
if (loadNativeResolved != null)
{
final boolean loadNativeOverride = Boolean.parseBoolean(loadNativeResolved);
@@ -257,7 +260,7 @@
// ${jboss.native.dir}
final URL nativeLibLocation = config.getNativeLibraryLocation();
final String nativeLibDefault = resolvedServerTempLocation
- + JBossASConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
final String currentNativeLibLocation = nativeLibLocation != null ? nativeLibLocation.toExternalForm() : null;
String resolvedNativeLibLocation = this.resolvePropertyValue(JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_DIR,
currentNativeLibLocation, nativeLibDefault, configProps);
@@ -269,7 +272,7 @@
final String platformMBeanServerString = platformMBeanServer != null ? platformMBeanServer.toString() : null;
final String platformMBeanServerResolved = this.resolvePropertyValue(
JBossASServerConfig.PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER, platformMBeanServerString,
- JBossASConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT.toString(), configProps);
+ JBossASBasedConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT.toString(), configProps);
if (platformMBeanServerResolved != null)
{
final boolean platformMbeanServerOverride = Boolean.parseBoolean(platformMBeanServerResolved);
@@ -286,7 +289,7 @@
* @see org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationInitializer#getDefaultBootstrapHome()
*/
@Override
- protected URL getDefaultBootstrapHome(JBossASServerConfig config)
+ protected URL getDefaultBootstrapHome(T config)
{
// For AS, the bootstrap home is the server conf location
return config.getServerConfLocation();
Deleted: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidator.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -1,199 +0,0 @@
-/*
- * 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.as.config;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationValidator;
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.config.ConfigurationValidator;
-import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
-import org.jboss.logging.Logger;
-
-/**
- * JBossASConfigurationValidator
- *
- * Validator for JBossAS Configurations
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class JBossASConfigurationValidator extends AbstractBasicConfigurationValidator<JBossASServerConfig>
- implements
- ConfigurationValidator<JBossASServerConfig>
-{
-
- //-------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- private static final Logger log = Logger.getLogger(JBossASConfigurationValidator.class);
-
- //-------------------------------------------------------------------------------||
- // Overridden Implementations ---------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.spi.config.AbstractBasicConfigurationValidator#validate(org.jboss.bootstrap.spi.config.ServerConfig)
- */
- @Override
- public void validate(JBossASServerConfig config) throws InvalidConfigurationException
- {
- // Log
- if (log.isTraceEnabled())
- {
- log.trace("Validating Configuration: " + config + " ...");
- }
-
- // Validate the super configuration
- super.validate(config);
-
- /*
- * The following properties must be specified
- */
-
- // jboss.home
- this.require(config.getJBossHome(), JBossASServerConfig.PROP_KEY_JBOSSAS_HOME);
- // jboss.bind.address
- this.require(config.getBindAddress(), JBossASServerConfig.PROP_KEY_JBOSSAS_BIND_ADDRESS);
- // jboss.server.name
- this.require(config.getServerName(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_NAME);
- // jboss.lib.url
- this.require(config.getBootLibraryLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL);
- // jboss.server.base.url
- this.require(config.getServerBaseLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_BASE_URL);
- // jboss.server.home.url
- this.require(config.getServerHomeLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_HOME_URL);
- // jboss.common.base.url
- this.require(config.getCommonBaseLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_COMMON_BASE_URL);
- // jboss.common.lib.url
- this.require(config.getCommonLibLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL);
- // jboss.server.log.dir
- this.require(config.getServerLogLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LOG_DIR, false);
- // jboss.server.conf.url
- this.require(config.getServerConfLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_CONF_URL);
- // jboss.server.lib.url
- this.require(config.getServerLibLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL);
- // jboss.server.data.dir
- this.require(config.getServerDataLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_DATA_DIR, false);
- // jboss.server.tmp.dir
- this.require(config.getServerTempLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_SERVER_TEMP_DIR, false);
- // jboss.partition.name
- this.require(config.getPartitionName(), JBossASServerConfig.PROP_KEY_JBOSSAS_PARTITION_NAME);
- // jboss.native.load
- this.require(config.isLoadNative(), JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_LOAD);
- // jboss.native.lib
- this.require(config.getNativeLibraryLocation(), JBossASServerConfig.PROP_KEY_JBOSSAS_NATIVE_DIR, false);
- // jboss.platform.mbeanserver
- this.require(config.isUsePlatformMBeanServer(), JBossASServerConfig.PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER);
-
- // Log
- log.debug("Configuration is valid: " + config);
- }
-
- //-------------------------------------------------------------------------------||
- // Internal Helper Methods ------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Requires that the specified argument is both non-null and
- * non-empty.
- *
- * @throws InvalidConfigurationException If the specified argument is
- * either null or empty
- */
- protected void require(final String arg, final String propertyName) throws InvalidConfigurationException
- {
- // If not specified
- if (arg == null || arg.length() == 0)
- {
- // Tell 'em about it
- throw new InvalidConfigurationException(propertyName + " must be specified");
- }
- }
-
- /**
- * Requires that the specified argument is both non-null and
- * non-empty.
- *
- * @throws InvalidConfigurationException If the specified argument is
- * either null or empty
- */
- protected void require(final Boolean arg, final String propertyName) throws InvalidConfigurationException
- {
- // If not specified
- if (arg == null)
- {
- // Tell 'em about it
- throw new InvalidConfigurationException(propertyName + " must be specified");
- }
- }
-
- /**
- * Requires that the specified argument is both non-null and
- * pointing to an existent location
- *
- * @throws InvalidConfigurationException If the specified argument is
- * either null or nonexistent
- */
- protected void require(final URL arg, final String propertyName) throws InvalidConfigurationException
- {
- this.require(arg, propertyName, true);
- }
-
- /**
- * Requires that the specified argument is both non-null and, optionally,
- * pointing to an existent location
- *
- * @throws InvalidConfigurationException If the specified argument is
- * either null or nonexistent
- */
- protected void require(final URL arg, final String propertyName, final boolean exists)
- throws InvalidConfigurationException
- {
- // If not specified
- if (arg == null)
- {
- // Throw
- throw new InvalidConfigurationException(propertyName + " must be specified");
- }
-
- // Try to open a connection, to see if exists
- if (exists)
- {
- try
- {
- final URLConnection connection = arg.openConnection();
- connection.connect();
- }
- catch (IOException ioe)
- {
- throw new InvalidConfigurationException("Could not get a connection to the " + propertyName + ": "
- + arg.toExternalForm(), ioe);
- }
- }
- }
-
-}
Copied: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/AbstractJBossASServerBase.java (from rev 91184, projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java)
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/AbstractJBossASServerBase.java (rev 0)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/AbstractJBossASServerBase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,397 @@
+/*
+ * 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.as.server;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.bootstrap.impl.as.config.JBossASBasedConfigurationValidator;
+import org.jboss.bootstrap.impl.as.config.JBossASConfigurationInitializerImpl;
+import org.jboss.bootstrap.impl.as.lifecycle.KernelStartEventLifecycleEventHandler;
+import org.jboss.bootstrap.impl.as.lifecycle.KernelStopEventLifecycleEventHandler;
+import org.jboss.bootstrap.impl.as.lifecycle.VfsInitializingLifecycleEventHandler;
+import org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
+import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleEventException;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleEventHandler;
+import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * AbstractJBossASServerBase
+ *
+ * Base implementation of a JBossAS Server
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at ManagementObject(name = "jboss.system:type=MCServer", isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "the MCServer bootstrap view", componentType = @ManagementComponent(type = "MCBean", subtype = "*"))
+public abstract class AbstractJBossASServerBase<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+ extends
+ AbstractMCServerBase<K, T> implements JBossASBasedServer<K, T>
+{
+ //-------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Logger
+ */
+ private static final Logger log = Logger.getLogger(AbstractJBossASServerBase.class);
+
+ /**
+ * Character denoting that we're referencing an environment variable or some property
+ */
+ private static final char CHAR_ENV_VAR = '$';
+
+ /**
+ * Newline character
+ */
+ private static final char CHAR_NEWLINE = '\n';
+
+ /**
+ * Tab character
+ */
+ private static final char CHAR_TAB = '\t';
+
+ //-------------------------------------------------------------------------------||
+ // Instance Members -------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Container for version information.
+ */
+ private final Version version = Version.getInstance();
+
+ /**
+ * The date in which the server was started.
+ * Must not be exported (as it's mutable). Synchronized
+ * on "this" (as implicit from start() lifecycle) and volatile
+ * so that we don't need to block in {@link AbstractJBossASServerBase#getStartDate()}
+ */
+ private volatile Date startDate;
+
+ /**
+ * The optional configuration metadata for the server. No sync required as the backing
+ * instance is final. Requires Thread-safe impl (as it's exported).
+ */
+ private final Map<String, Object> metadata = new ConcurrentHashMap<String, Object>();
+
+ //-------------------------------------------------------------------------------||
+ // Constructors -----------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Constructor
+ *
+ * Constructs a new JBossAS Server using a new default configuration,
+ * which will be automatically created and set
+ *
+ * @param actualClass Type of the actual class (used in casting for covarient return)
+ */
+ public AbstractJBossASServerBase(final Class<K> actualClass) throws IllegalArgumentException
+ {
+ // Use other ctor
+ this(actualClass, null);
+
+ }
+
+ /**
+ * Constructor
+ *
+ * Constructs a new JBossAS Server with the specified underlying configuration
+ *
+ * @param actualClass Type of the actual class (used in casting for covarient return)
+ * @param config
+ */
+ public AbstractJBossASServerBase(final Class<K> actualClass, final T config) throws IllegalArgumentException
+ {
+ // Invoke super
+ super(actualClass, config);
+
+ // Set properties
+ this.setValidator(new JBossASBasedConfigurationValidator<T>());
+ this.setServerInitializer(new JBossASServerInitializer<K, T>());
+ this.setConfigInitializer(new JBossASConfigurationInitializerImpl<T>());
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildDate()
+ */
+ @ManagementProperty(description = "The server build date", readOnly = true)
+ public String getBuildDate()
+ {
+ return version.getBuildDate();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildID()
+ */
+ @ManagementProperty(description = "The server build ID", readOnly = true)
+ public String getBuildID()
+ {
+ return version.getBuildID();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildJVM()
+ */
+ @ManagementProperty(description = "The server build JVM", readOnly = true)
+ public String getBuildJVM()
+ {
+ return version.getBuildJVM();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildNumber()
+ */
+ @ManagementProperty(description = "The server build number", readOnly = true)
+ public String getBuildNumber()
+ {
+ return version.getBuildNumber();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildOS()
+ */
+ @ManagementProperty(description = "The server build OS", readOnly = true)
+ public String getBuildOS()
+ {
+ return version.getBuildOS();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getStartDate()
+ */
+ @ManagementProperty(description = "The server start time", readOnly = true)
+ public Date getStartDate()
+ {
+ // We copy so we don't export the mutable state, JBBOOT-73
+ final Date copyDate = (Date) startDate.clone();
+ return copyDate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersion()
+ */
+ @ManagementProperty(description = "The server version string", readOnly = true)
+ public String getVersion()
+ {
+ return version.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersionName()
+ */
+ @ManagementProperty(description = "The server version name", readOnly = true)
+ public String getVersionName()
+ {
+ return version.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersionNumber()
+ */
+ @ManagementProperty(description = "The server version number string", readOnly = true)
+ public String getVersionNumber()
+ {
+ return version.getVersionNumber();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.spi.server.Server#getMetaData()
+ */
+ public Map<String, Object> getMetaData()
+ {
+ return this.metadata;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.spi.as.server.JBossASServer#isStarted()
+ */
+ /*
+ * JBBOOT-80 Remove this when jboss-bootstrap is for AS6 only (no
+ * more AS5.x support)
+ */
+ @Deprecated
+ public boolean isStarted()
+ {
+ final LifecycleState state = this.getState();
+ return state.equals(LifecycleState.STARTED);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.base.server.AbstractServer#initialize()
+ */
+ @Override
+ protected void doInitialize() throws IllegalStateException, InvalidConfigurationException, LifecycleEventException
+ {
+ // Call Super
+ super.doInitialize();
+
+ // JBBOOT-68
+ //TODO Remove once VFS is init'd from something else
+ // Register an event handler to init VFS alongside server start
+ @SuppressWarnings("deprecation")
+ final LifecycleEventHandler initVfsHandler = new VfsInitializingLifecycleEventHandler();
+ this.registerEventHandler(initVfsHandler, LifecycleState.INITIALIZED);
+
+ // Create and Register handlers
+ final BasicBootstrap bootstrap = this.getBootstrap();
+ final LifecycleEventHandler startHandler = new KernelStartEventLifecycleEventHandler(bootstrap);
+ final LifecycleEventHandler stopHandler = new KernelStopEventLifecycleEventHandler(bootstrap);
+ this.registerEventHandler(startHandler, LifecycleState.STARTED);
+ this.registerEventHandler(stopHandler, LifecycleState.STOPPED);
+
+ // Log the server info
+ this.logServerInfo();
+ }
+
+ /**
+ * Logs out information from the underlying server configuration
+ */
+ protected void logServerInfo()
+ {
+ // Initialize
+ final StringBuilder sb = new StringBuilder();
+ final char newline = CHAR_NEWLINE;
+ final char tab = CHAR_TAB;
+
+ // Get the config
+ final T config = this.getConfiguration();
+
+ if (config.getJBossHome() != null)
+ {
+ final String jbossHome = config.getJBossHome().toExternalForm();
+ sb.append("Server Configuration:");
+ sb.append(newline).append(newline).append(tab);
+ sb.append("JBOSS_HOME URL: " + jbossHome);
+ sb.append(newline).append(tab);
+ sb.append("Bootstrap: " + getRelativePath(jbossHome, config.getBootstrapUrl()));
+ sb.append(newline).append(tab);
+ sb.append("Common Base: " + getRelativePath(jbossHome, config.getCommonBaseLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Common Library: " + getRelativePath(jbossHome, config.getCommonLibLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Name: " + config.getServerName());
+ sb.append(newline).append(tab);
+ sb.append("Server Base: " + getRelativePath(jbossHome, config.getServerBaseLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Library: " + getRelativePath(jbossHome, config.getServerLibLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Config: " + getRelativePath(jbossHome, config.getServerConfLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Home: " + getRelativePath(jbossHome, config.getServerHomeLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Data: " + getRelativePath(jbossHome, config.getServerDataLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Log: " + getRelativePath(jbossHome, config.getServerLogLocation()));
+ sb.append(newline).append(tab);
+ sb.append("Server Temp: " + getRelativePath(jbossHome, config.getServerTempLocation()));
+ sb.append(newline);
+
+ // Log
+ log.info(sb.toString());
+ }
+
+ }
+
+ /**
+ * Helper method to remove make configuration URLs relative in the logs [JBBOOT-86]
+ */
+ private static String getRelativePath(final String jbossHome, final URL url)
+ {
+
+ if (url == null)
+ {
+ return "Not defined";
+ }
+
+ String urlString = url.toExternalForm();
+ if (urlString.startsWith(jbossHome))
+ {
+ urlString = CHAR_ENV_VAR + JBossASServerConfig.ENV_VAR_JBOSSAS_HOME + File.separatorChar
+ + urlString.substring(jbossHome.length());
+ return urlString;
+ }
+
+ return url.toExternalForm();
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Overridden Implementations ---------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase#doStart()
+ */
+ @Override
+ protected void doStart() throws Exception
+ {
+ // Call super
+ super.doStart();
+
+ // Mark the start date
+ this.setStartDate(new Date());
+ }
+
+ //-------------------------------------------------------------------------------||
+ // Accessors / Mutators ---------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * @param startDate the startDate to set
+ */
+ protected void setStartDate(final Date startDate)
+ {
+ // Clone so we don't give callers access to internal state
+ this.startDate = (Date) startDate.clone();
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("JBoss Server[");
+ sb.append(this.version.toString());
+ sb.append("]");
+ return sb.toString();
+ }
+
+}
Deleted: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerImpl.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -1,431 +0,0 @@
-/*
- * 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.as.server;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.jboss.bootstrap.impl.as.config.BasicJBossASServerConfig;
-import org.jboss.bootstrap.impl.as.config.JBossASConfigurationInitializerImpl;
-import org.jboss.bootstrap.impl.as.config.JBossASConfigurationValidator;
-import org.jboss.bootstrap.impl.as.lifecycle.KernelStartEventLifecycleEventHandler;
-import org.jboss.bootstrap.impl.as.lifecycle.KernelStopEventLifecycleEventHandler;
-import org.jboss.bootstrap.impl.as.lifecycle.VfsInitializingLifecycleEventHandler;
-import org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase;
-import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
-import org.jboss.bootstrap.spi.config.ConfigurationValidator;
-import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
-import org.jboss.bootstrap.spi.lifecycle.LifecycleEventException;
-import org.jboss.bootstrap.spi.lifecycle.LifecycleEventHandler;
-import org.jboss.bootstrap.spi.lifecycle.LifecycleState;
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * JBossASServerImpl
- *
- * Implementation of a JBossAS Server
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
- at ManagementObject(name = "jboss.system:type=MCServer", isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "the MCServer bootstrap view", componentType = @ManagementComponent(type = "MCBean", subtype = "*"))
-public class JBossASServerImpl extends AbstractMCServerBase<JBossASServer, JBossASServerConfig>
- implements
- JBossASServer
-{
- //-------------------------------------------------------------------------------||
- // Class Members ----------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Logger
- */
- private static final Logger log = Logger.getLogger(JBossASServerImpl.class);
-
- /**
- * The validator instance
- */
- private static final ConfigurationValidator<JBossASServerConfig> VALIDATOR;
-
- /**
- * The server initializer instance
- */
- private static final JBossASServerInitializer SERVER_INITIALIZER;
-
- /**
- * The config validator instance
- */
- private static final JBossASConfigurationInitializer CONFIG_INITIALIZER;
-
- /**
- * Character denoting that we're referencing an environment variable or some property
- */
- private static final char CHAR_ENV_VAR = '$';
-
- /**
- * Newline character
- */
- private static final char CHAR_NEWLINE = '\n';
-
- /**
- * Tab character
- */
- private static final char CHAR_TAB = '\t';
-
- /*
- * Initialize constants
- */
- static
- {
- VALIDATOR = new JBossASConfigurationValidator();
- SERVER_INITIALIZER = new JBossASServerInitializer();
- CONFIG_INITIALIZER = new JBossASConfigurationInitializerImpl();
- }
-
- //-------------------------------------------------------------------------------||
- // Instance Members -------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Container for version information.
- */
- private final Version version = Version.getInstance();
-
- /**
- * The date in which the server was started.
- * Must not be exported (as it's mutable). Synchronized
- * on "this" (as implicit from start() lifecycle) and volatile
- * so that we don't need to block in {@link JBossASServerImpl#getStartDate()}
- */
- private volatile Date startDate;
-
- /**
- * The optional configuration metadata for the server. No sync required as the backing
- * instance is final. Requires Thread-safe impl (as it's exported).
- */
- private final Map<String, Object> metadata = new ConcurrentHashMap<String, Object>();
-
- //-------------------------------------------------------------------------------||
- // Constructors -----------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Constructor
- *
- * Constructs a new JBossAS Server using a new default configuration,
- * which will be automatically created and set
- *
- *
- */
- public JBossASServerImpl() throws IllegalArgumentException
- {
- // Use other ctor
- this(null);
- }
-
- /**
- * Constructor
- *
- * Constructs a new JBossAS Server with the specified underlying configuration
- *
- * @param config
- */
- public JBossASServerImpl(final JBossASServerConfig config) throws IllegalArgumentException
- {
- // Invoke super
- super(JBossASServer.class, config);
-
- // Set properties
- this.setServerInitializer(SERVER_INITIALIZER);
- this.setConfigInitializer(CONFIG_INITIALIZER);
- this.setValidator(VALIDATOR);
- }
-
- //-------------------------------------------------------------------------------||
- // Required Implementations -----------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.base.server.AbstractServer#getDefaultServerConfigClass()
- */
- @Override
- protected Class<? extends JBossASServerConfig> getDefaultServerConfigClass()
- {
- return BasicJBossASServerConfig.class;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildDate()
- */
- @ManagementProperty(description = "The server build date", readOnly = true)
- public String getBuildDate()
- {
- return version.getBuildDate();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildID()
- */
- @ManagementProperty(description = "The server build ID", readOnly = true)
- public String getBuildID()
- {
- return version.getBuildID();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildJVM()
- */
- @ManagementProperty(description = "The server build JVM", readOnly = true)
- public String getBuildJVM()
- {
- return version.getBuildJVM();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildNumber()
- */
- @ManagementProperty(description = "The server build number", readOnly = true)
- public String getBuildNumber()
- {
- return version.getBuildNumber();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getBuildOS()
- */
- @ManagementProperty(description = "The server build OS", readOnly = true)
- public String getBuildOS()
- {
- return version.getBuildOS();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getStartDate()
- */
- @ManagementProperty(description = "The server start time", readOnly = true)
- public Date getStartDate()
- {
- // We copy so we don't export the mutable state, JBBOOT-73
- final Date copyDate = (Date) startDate.clone();
- return copyDate;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersion()
- */
- @ManagementProperty(description = "The server version string", readOnly = true)
- public String getVersion()
- {
- return version.toString();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersionName()
- */
- @ManagementProperty(description = "The server version name", readOnly = true)
- public String getVersionName()
- {
- return version.getName();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.as.server.JBossASServer#getVersionNumber()
- */
- @ManagementProperty(description = "The server version number string", readOnly = true)
- public String getVersionNumber()
- {
- return version.getVersionNumber();
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.spi.server.Server#getMetaData()
- */
- public Map<String, Object> getMetaData()
- {
- return this.metadata;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.spi.as.server.JBossASServer#isStarted()
- */
- /*
- * JBBOOT-80 Remove this when jboss-bootstrap is for AS6 only (no
- * more AS5.x support)
- */
- @Deprecated
- public boolean isStarted()
- {
- final LifecycleState state = this.getState();
- return state.equals(LifecycleState.STARTED);
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.bootstrap.impl.base.server.AbstractServer#initialize()
- */
- @Override
- protected void doInitialize() throws IllegalStateException, InvalidConfigurationException, LifecycleEventException
- {
- // Call Super
- super.doInitialize();
-
- // JBBOOT-68
- //TODO Remove once VFS is init'd from something else
- // Register an event handler to init VFS alongside server start
- @SuppressWarnings("deprecation")
- final LifecycleEventHandler initVfsHandler = new VfsInitializingLifecycleEventHandler();
- this.registerEventHandler(initVfsHandler, LifecycleState.INITIALIZED);
-
- // Create and Register handlers
- final BasicBootstrap bootstrap = this.getBootstrap();
- final LifecycleEventHandler startHandler = new KernelStartEventLifecycleEventHandler(bootstrap);
- final LifecycleEventHandler stopHandler = new KernelStopEventLifecycleEventHandler(bootstrap);
- this.registerEventHandler(startHandler, LifecycleState.STARTED);
- this.registerEventHandler(stopHandler, LifecycleState.STOPPED);
-
- // Log the server info
- this.logServerInfo();
- }
-
- /**
- * Logs out information from the underlying server configuration
- */
- protected void logServerInfo()
- {
- // Initialize
- final StringBuilder sb = new StringBuilder();
- final char newline = CHAR_NEWLINE;
- final char tab = CHAR_TAB;
-
- // Get the config
- final JBossASServerConfig config = this.getConfiguration();
-
- if (config.getJBossHome() != null)
- {
- final String jbossHome = config.getJBossHome().toExternalForm();
- sb.append("Server Configuration:");
- sb.append(newline).append(newline).append(tab);
- sb.append("JBOSS_HOME URL: " + jbossHome);
- sb.append(newline).append(tab);
- sb.append("Bootstrap: " + getRelativePath(jbossHome, config.getBootstrapUrl()));
- sb.append(newline).append(tab);
- sb.append("Common Base: " + getRelativePath(jbossHome, config.getCommonBaseLocation()));
- sb.append(newline).append(tab);
- sb.append("Common Library: " + getRelativePath(jbossHome, config.getCommonLibLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Name: " + config.getServerName());
- sb.append(newline).append(tab);
- sb.append("Server Base: " + getRelativePath(jbossHome, config.getServerBaseLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Library: " + getRelativePath(jbossHome, config.getServerLibLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Config: " + getRelativePath(jbossHome, config.getServerConfLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Home: " + getRelativePath(jbossHome, config.getServerHomeLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Data: " + getRelativePath(jbossHome, config.getServerDataLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Log: " + getRelativePath(jbossHome, config.getServerLogLocation()));
- sb.append(newline).append(tab);
- sb.append("Server Temp: " + getRelativePath(jbossHome, config.getServerTempLocation()));
- sb.append(newline);
-
- // Log
- log.info(sb.toString());
- }
-
- }
-
- /**
- * Helper method to remove make configuration URLs relative in the logs [JBBOOT-86]
- */
- private static String getRelativePath(final String jbossHome, final URL url)
- {
-
- if (url == null)
- {
- return "Not defined";
- }
-
- String urlString = url.toExternalForm();
- if (urlString.startsWith(jbossHome))
- {
- urlString = CHAR_ENV_VAR + JBossASServerConfig.ENV_VAR_JBOSSAS_HOME + File.separatorChar
- + urlString.substring(jbossHome.length());
- return urlString;
- }
-
- return url.toExternalForm();
- }
-
- //-------------------------------------------------------------------------------||
- // Overridden Implementations ---------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /* (non-Javadoc)
- * @see org.jboss.bootstrap.impl.mc.server.AbstractMCServerBase#doStart()
- */
- @Override
- protected void doStart() throws Exception
- {
- // Call super
- super.doStart();
-
- // Mark the start date
- this.setStartDate(new Date());
- }
-
- //-------------------------------------------------------------------------------||
- // Accessors / Mutators ---------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * @param startDate the startDate to set
- */
- protected void setStartDate(final Date startDate)
- {
- // Clone so we don't give callers access to internal state
- this.startDate = (Date) startDate.clone();
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("JBoss Server[");
- sb.append(this.version.toString());
- sb.append("]");
- return sb.toString();
- }
-
-}
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/server/JBossASServerInitializer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -28,8 +28,9 @@
import java.net.URL;
import org.jboss.bootstrap.impl.base.server.AbstractBasicServerInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
import org.jboss.bootstrap.spi.server.ServerInitializer;
import org.jboss.logging.Logger;
@@ -39,9 +40,9 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public class JBossASServerInitializer extends AbstractBasicServerInitializer<JBossASServer, JBossASServerConfig>
- implements
- ServerInitializer<JBossASServer, JBossASServerConfig>
+public class JBossASServerInitializer<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+ extends
+ AbstractBasicServerInitializer<K, T> implements ServerInitializer<K, T>
{
//-------------------------------------------------------------------------------||
@@ -58,7 +59,7 @@
* @see org.jboss.bootstrap.spi.server.AbstractBasicServerInitializer#initialize(org.jboss.bootstrap.spi.server.Server)
*/
@Override
- public void initialize(JBossASServer server) throws IllegalArgumentException, IllegalStateException
+ public void initialize(K server) throws IllegalArgumentException, IllegalStateException
{
// Log
if (log.isTraceEnabled())
@@ -74,7 +75,7 @@
* @see org.jboss.bootstrap.spi.server.AbstractBasicServerInitializer#setSystemProperties(org.jboss.bootstrap.spi.config.ServerConfig)
*/
@Override
- protected void setSystemProperties(JBossASServerConfig configuration)
+ protected void setSystemProperties(T configuration)
{
// Log
if (log.isTraceEnabled())
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializationTestCase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -28,7 +28,7 @@
import org.jboss.bootstrap.impl.as.common.TestUtils;
import org.jboss.bootstrap.impl.base.config.AbstractBasicConfigurationInitializer;
-import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
import org.jboss.logging.Logger;
import org.junit.After;
@@ -59,7 +59,7 @@
/**
* The initializer implementation to test
*/
- private static JBossASConfigurationInitializer initializer;
+ private static JBossASBasedConfigurationInitializer<JBossASServerConfig> initializer;
/**
* JBOSS_HOME for our tests
@@ -98,7 +98,7 @@
@BeforeClass
public static void init()
{
- initializer = new JBossASConfigurationInitializerImpl();
+ initializer = new JBossASConfigurationInitializerImpl<JBossASServerConfig>();
}
/**
@@ -141,7 +141,7 @@
final String bindAddress = config.getBindAddress();
// Get expected value
- final String expected = JBossASConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT;
+ final String expected = JBossASBasedConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT;
// Test
TestCase.assertEquals("Bind address was not defaulted as expected", expected, bindAddress);
@@ -162,7 +162,7 @@
final String serverName = config.getServerName();
// Get expected value
- final String expected = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
+ final String expected = JBossASBasedConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
// Test
TestCase.assertEquals("Server name was not defaulted as expected", expected, serverName);
@@ -184,7 +184,7 @@
// Get expected value
final String expected = JBOSS_HOME.toExternalForm()
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Boot library location was not defaulted as expected", expected, actual);
@@ -206,7 +206,7 @@
// Get expected value
final String expected = JBOSS_HOME.toExternalForm()
- + JBossASConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Server base location was not defaulted as expected", expected, actual);
@@ -249,7 +249,7 @@
// Get expected value
final String expected = JBOSS_HOME.toExternalForm()
- + JBossASConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Common base location was not defaulted as expected", expected, actual);
@@ -271,8 +271,8 @@
// Get expected value
final String expected = JBOSS_HOME.toExternalForm()
- + JBossASConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Common lib location was not defaulted as expected", expected, actual);
@@ -294,7 +294,7 @@
// Get expected value
final String expected = this.getServerHomeLocation()
- + JBossASConfigurationInitializer.VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT;
// Test, using the trailing slash because the URL location doesn't actually exist
TestCase.assertEquals("Server log location was not defaulted as expected", expected, actual + TRAILING_SLASH);
@@ -316,7 +316,7 @@
// Get expected value
final String expected = this.getServerHomeLocation()
- + JBossASConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Server config location was not defaulted as expected", expected, actual);
@@ -338,7 +338,7 @@
// Get expected value
final String expected = this.getServerHomeLocation()
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
// Test
TestCase.assertEquals("Server lib location was not defaulted as expected", expected, actual);
@@ -360,7 +360,7 @@
// Get expected value
final String expected = this.getServerHomeLocation()
- + JBossASConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
// Test, using the trailing slash because the URL location doesn't actually exist
TestCase.assertEquals("Server data location was not defaulted as expected", expected, actual + TRAILING_SLASH);
@@ -382,7 +382,7 @@
// Get expected value
final String expected = this.getServerHomeLocation()
- + JBossASConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
// Test, using the trailing slash because the URL location doesn't actually exist
TestCase.assertEquals("Server temp location was not defaulted as expected", expected, actual + TRAILING_SLASH);
@@ -451,7 +451,7 @@
final String actual = config.getPartitionName();
// Get expected value
- final String expected = JBossASConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
+ final String expected = JBossASBasedConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
// Test
TestCase.assertEquals("Partition name for AS was not defaulted as expected", expected, actual);
@@ -473,7 +473,7 @@
final Boolean actual = config.isLoadNative();
// Get expected value
- final Boolean expected = JBossASConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT;
+ final Boolean expected = JBossASBasedConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT;
// Test
TestCase.assertEquals("Load Native for AS was not defaulted as expected", expected, actual);
@@ -497,7 +497,7 @@
// Get expected value
final String expected = this.getServerTempLocation()
- + JBossASConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
+ + JBossASBasedConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
// Test, using the trailing slash because the URL location doesn't actually exist
TestCase.assertEquals("Native Lib URL for AS was not defaulted as expected", expected, actual + TRAILING_SLASH);
@@ -519,7 +519,7 @@
final Boolean actual = config.isUsePlatformMBeanServer();
// Get expected value
- final Boolean expected = JBossASConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT;
+ final Boolean expected = JBossASBasedConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT;
// Test
TestCase.assertEquals("Using Platform MBean Server for AS was not defaulted as expected", expected, actual);
@@ -535,8 +535,8 @@
*/
private String getServerHomeLocation()
{
- return JBOSS_HOME.toExternalForm() + JBossASConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT
- + JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT + TRAILING_SLASH;
+ return JBOSS_HOME.toExternalForm() + JBossASBasedConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT + TRAILING_SLASH;
}
/**
@@ -545,7 +545,7 @@
*/
private String getServerTempLocation()
{
- return this.getServerHomeLocation() + JBossASConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
+ return this.getServerHomeLocation() + JBossASBasedConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
}
/**
@@ -554,6 +554,6 @@
*/
private String getBootstrapHome()
{
- return this.getServerHomeLocation() + JBossASConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
+ return this.getServerHomeLocation() + JBossASBasedConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
}
}
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationPropertyOverrideTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationPropertyOverrideTestCase.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationPropertyOverrideTestCase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -27,7 +27,7 @@
import junit.framework.TestCase;
-import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
import org.jboss.logging.Logger;
import org.junit.After;
@@ -58,7 +58,7 @@
/**
* The initializer implementation to test
*/
- private static JBossASConfigurationInitializer initializer;
+ private static JBossASBasedConfigurationInitializer<JBossASServerConfig> initializer;
/**
* HTTP protocol portion of a URL
@@ -145,7 +145,7 @@
@BeforeClass
public static void init()
{
- initializer = new JBossASConfigurationInitializerImpl();
+ initializer = new JBossASConfigurationInitializerImpl<JBossASServerConfig>();
}
/**
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationValidationTestCase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -28,7 +28,7 @@
import junit.framework.TestCase;
-import org.jboss.bootstrap.spi.as.config.JBossASConfigurationInitializer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedConfigurationInitializer;
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
import org.jboss.bootstrap.spi.config.ConfigurationValidator;
import org.jboss.bootstrap.spi.config.InvalidConfigurationException;
@@ -91,7 +91,7 @@
@BeforeClass
public static void initValidator()
{
- validator = new JBossASConfigurationValidator();;
+ validator = new JBossASBasedConfigurationValidator<JBossASServerConfig>();;
}
/**
@@ -515,23 +515,25 @@
final String jbossHome = this.getJBossHome().getAbsolutePath() + "/";
final URL bootstrapHome = this.getBootstrapHome();
final String bootstrapName = BOOTSTRAP_NAME;
- final String bindAddress = JBossASConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT;
- final String serverName = JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
- final String bootLib = jbossHome + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
- final String serverBase = jbossHome + JBossASConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
+ final String bindAddress = JBossASBasedConfigurationInitializer.VALUE_BIND_ADDRESS_DEFAULT;
+ final String serverName = JBossASBasedConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT;
+ final String bootLib = jbossHome + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ final String serverBase = jbossHome + JBossASBasedConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT;
final String serverHome = serverBase + serverName + "/";
- final String commonBase = jbossHome + JBossASConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
- final String commonLib = jbossHome + JBossASConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT
- + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
- final String serverLog = serverHome + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
- final String serverConfig = serverHome + JBossASConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
- final String serverLib = serverHome + JBossASConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
- final String serverData = serverHome + JBossASConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
- final String serverTemp = serverHome + JBossASConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
- final String partitionName = JBossASConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
- final Boolean nativeLoad = JBossASConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT;
- final String nativeLibLocation = serverTemp + JBossASConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
- final Boolean usePlatformMBeanServer = JBossASConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT;
+ final String commonBase = jbossHome + JBossASBasedConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT;
+ final String commonLib = jbossHome + JBossASBasedConfigurationInitializer.VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT
+ + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ final String serverLog = serverHome + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ final String serverConfig = serverHome
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT;
+ final String serverLib = serverHome + JBossASBasedConfigurationInitializer.VALUE_LIBRARY_URL_SUFFIX_DEFAULT;
+ final String serverData = serverHome + JBossASBasedConfigurationInitializer.VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT;
+ final String serverTemp = serverHome + JBossASBasedConfigurationInitializer.VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT;
+ final String partitionName = JBossASBasedConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
+ final Boolean nativeLoad = JBossASBasedConfigurationInitializer.VALUE_NATIVE_LOAD_DEFAULT;
+ final String nativeLibLocation = serverTemp
+ + JBossASBasedConfigurationInitializer.VALUE_NATIVE_DIR_SUFFIX_DEFAULT;
+ final Boolean usePlatformMBeanServer = JBossASBasedConfigurationInitializer.VALUE_PLATFORM_MBEAN_SERVER_DEFAULT;
// Populate
config.jbossHome(jbossHome).bootstrapHome(bootstrapHome).bootstrapName(bootstrapName).bindAddress(bindAddress)
@@ -584,9 +586,9 @@
// Build Bootstrap Home relative to JBOSS_HOME
final File bootstrapHome = new File(jbossHome,
- JBossASConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT
- + JBossASConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT + SLASH
- + JBossASConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT + BOOTSTRAP_NAME);
+ JBossASBasedConfigurationInitializer.VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_NAME_DEFAULT + SLASH
+ + JBossASBasedConfigurationInitializer.VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT + BOOTSTRAP_NAME);
// Convert to URL
final URL bootstrapHomeUrl = bootstrapHome.toURI().toURL();
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/PropertyValueResolutionTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/PropertyValueResolutionTestCase.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/config/PropertyValueResolutionTestCase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -28,6 +28,7 @@
import junit.framework.TestCase;
+import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
import org.jboss.logging.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -90,7 +91,7 @@
/**
* The initializer implementation to test
*/
- private static JBossASConfigurationInitializerImpl initializer;
+ private static JBossASConfigurationInitializerImpl<JBossASServerConfig> initializer;
//-------------------------------------------------------------------------------||
// Lifecycle --------------------------------------------------------------------||
@@ -102,7 +103,7 @@
@BeforeClass
public static void init()
{
- initializer = new JBossASConfigurationInitializerImpl();
+ initializer = new JBossASConfigurationInitializerImpl<JBossASServerConfig>();
}
//-------------------------------------------------------------------------------||
Modified: projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/impl-as/src/test/java/org/jboss/bootstrap/impl/as/server/JBossASServerVersionInformationTestCase.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -250,7 +250,7 @@
}
/**
- * Test that the {@link JBossASServerImpl#toString()} contains the version
+ * Test that the {@link AbstractJBossASServerBase#toString()} contains the version
* information about the server
*/
@Test
Modified: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/JBossASBootstrap.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/JBossASBootstrap.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/JBossASBootstrap.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -23,8 +23,8 @@
package org.jboss.bootstrap.spi.as;
import org.jboss.bootstrap.spi.Bootstrap;
-import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.as.server.JBossASServer;
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.as.server.JBossASBasedServer;
/**
* JBossASBootstrap
@@ -34,7 +34,9 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public interface JBossASBootstrap extends Bootstrap<JBossASServer, JBossASServerConfig>
+public interface JBossASBootstrap<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+ extends
+ Bootstrap<K, T>
{
// Contracts in superinterface, here we define type safety
}
Copied: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedConfigurationInitializer.java (from rev 91184, projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java)
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedConfigurationInitializer.java (rev 0)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedConfigurationInitializer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,141 @@
+/*
+ * 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.spi.as.config;
+
+import org.jboss.bootstrap.spi.config.ConfigurationInitializer;
+import org.jboss.bootstrap.spi.server.ServerInitializer;
+
+/**
+ * JBossASBasedConfigurationInitializer
+ *
+ * Contract for a JBossAS-based Configuration Initializers
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ * @see {@link ServerInitializer}
+ */
+public interface JBossASBasedConfigurationInitializer<T extends JBossASBasedServerConfig<T>>
+ extends
+ ConfigurationInitializer<T>
+{
+ //-------------------------------------------------------------------------------||
+ // Constants --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /*
+ * The following denote default values in the case
+ * a property is not explicitly-specified
+ */
+
+ /**
+ * Default address which will be set
+ * if {@link JBossASBasedServerConfig#getBindAddress()} or
+ * system or configuration property
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_BIND_ADDRESS}
+ * is not defined
+ */
+ String VALUE_BIND_ADDRESS_DEFAULT = "127.0.0.1";
+
+ /**
+ * Value for address representing any/all interfaces
+ */
+ String VALUE_BIND_ADDRESS_ANY = "0.0.0.0";
+
+ /**
+ * Default server name which will be set if
+ * {@link JBossASBasedServerConfig#getBindAddress()} or
+ * system or configuration property
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_NAME}
+ * is not defined
+ */
+ String VALUE_SERVER_NAME_DEFAULT = "default";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL},
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL} and
+ * {@link #PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL}.
+ */
+ String VALUE_LIBRARY_URL_SUFFIX_DEFAULT = "lib/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_BASE_URL}.
+ */
+ String VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT = "server/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_COMMON_BASE_URL}
+ */
+ String VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT = "common/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_LOG_DIR}.
+ */
+ String VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT = "log/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_CONF_URL}.
+ */
+ String VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT = "conf/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_DATA_DIR}.
+ */
+ String VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT = "data/";
+
+ /**
+ * The suffix used when generating the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_SERVER_TEMP_DIR}.
+ */
+ String VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT = "tmp/";
+
+ /**
+ * The partition name used as the default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_PARTITION_NAME}
+ */
+ String VALUE_PARTITION_NAME_DEFAULT = "DefaultPartition";
+
+ /**
+ * The default value for
+ * {@link JBossASBasedServerConfig#PROP_KEY_JBOSSAS_NATIVE_LOAD}
+ */
+ Boolean VALUE_NATIVE_LOAD_DEFAULT = false;
+
+ /**
+ * The default suffix used to construct native libaray
+ * locations, relative to the Server Temp Home
+ * (eg. $JBOSS_HOME/server/[serverName]/tmp/native/)
+ */
+ String VALUE_NATIVE_DIR_SUFFIX_DEFAULT = "native/";
+
+ /**
+ * The default value used in determining whether or not
+ * to use the Platform MBean Server under JDK 1.5+
+ */
+ Boolean VALUE_PLATFORM_MBEAN_SERVER_DEFAULT = true;
+}
Property changes on: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedConfigurationInitializer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Added: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedServerConfig.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedServerConfig.java (rev 0)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASBasedServerConfig.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,628 @@
+/*
+ * 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.spi.as.config;
+
+import java.net.URL;
+
+import org.jboss.bootstrap.spi.mc.config.MCBasedServerConfig;
+
+/**
+ * JBossASBasedServerConfig
+ *
+ * Contract for the configuration of AS-based Servers,
+ * may be extended for a direct AS ServerConfig
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossASBasedServerConfig<T extends JBossASBasedServerConfig<T>> extends MCBasedServerConfig<T>
+{
+ //-------------------------------------------------------------------------------||
+ // Constants --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Constant that holds the name of the system or
+ * configuration property
+ */
+ String PROP_KEY_JBOSSAS_BIND_ADDRESS = "jboss.bind.address";
+
+ /**
+ * Constant that holds the name of the system or configuration
+ * property which specifies the name of the server which will be used to
+ * calculate the servers home directory and url.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_NAME = "jboss.server.name";
+
+ /**
+ * Constant that holds the name of the environment
+ * variable which specifies the root of the AS
+ * installation
+ */
+ String ENV_VAR_JBOSSAS_HOME = "JBOSS_HOME";
+
+ /**
+ * Constant that holds the name of the system or configuration
+ * property which specifies the root of the AS
+ * installation
+ */
+ String PROP_KEY_JBOSSAS_HOME = "jboss.home";
+
+ /**
+ * Constant that holds the name of the system property
+ * which specifies the home directory for JBossAS.
+ */
+ String PROP_KEY_JBOSSAS_HOME_DIR = "jboss.home.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * which specifies the home URL for JBossAS.
+ */
+ String PROP_KEY_JBOSSAS_HOME_URL = "jboss.home.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the URL where JBoss will read library files
+ * from.
+ */
+ String PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL = "jboss.lib.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the base directory for calculating server
+ * home directories.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_BASE_DIR = "jboss.server.base.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the base URL for calculating server
+ * home URLs.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_BASE_URL = "jboss.server.base.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the server home directory for JBoss.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_HOME_DIR = "jboss.server.home.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the server home URL for JBoss.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_HOME_URL = "jboss.server.home.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the base URL for files and directories
+ * common to different server configurations
+ */
+ String PROP_KEY_JBOSSAS_COMMON_BASE_URL = "jboss.common.base.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying a library directory URL that points to libraries
+ * shared by the various server configurations.
+ */
+ String PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL = "jboss.common.lib.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the server log directory for JBoss.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_LOG_DIR = "jboss.server.log.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the server configuration URL.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_CONF_URL = "jboss.server.config.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the URL where JBoss will read server specific
+ * library files from.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL = "jboss.server.lib.url";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the directory which JBoss will use for
+ * persistent data file storage.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_DATA_DIR = "jboss.server.data.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the directory which JBoss will use for
+ * temporary file storage.
+ */
+ String PROP_KEY_JBOSSAS_SERVER_TEMP_DIR = "jboss.server.temp.dir";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the partition name for this instance in clustering
+ */
+ String PROP_KEY_JBOSSAS_PARTITION_NAME = "jboss.partition.name";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the UDP Group for this instance in clustering
+ */
+ String PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP = "jboss.partition.udpGroup";
+
+ /**
+ * Constant that holds the name of the system property
+ * for specifying the UDP Port for this instance in clustering
+ */
+ String PROP_KEY_JBOSSAS_PARTITION_UDP_PORT = "jboss.jgroups.udp.mcast_port";
+
+ /**
+ * Constant that holds the name of the system property
+ * designating whether to load native libraries
+ */
+ String PROP_KEY_JBOSSAS_NATIVE_LOAD = "jboss.native.load";
+
+ /**
+ * Constant that holds the location of native libraries
+ */
+ String PROP_KEY_JBOSSAS_NATIVE_DIR = "jboss.native.dir";
+
+ /**
+ * Constant that holds the name of the system property for specifying
+ * whether or not to use as the main jboss server the MBeanServer returned
+ * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
+ *
+ * <p>If not set then jboss will instantiate its own MBeanServer
+ */
+ String PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
+
+ //-------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------||
+
+ /**
+ * Obtains the bind address to be used for the Server.
+ *
+ * @return
+ */
+ String getBindAddress();
+
+ /**
+ * Sets the bind address for the server
+ *
+ * @param bindAddress
+ * @return
+ */
+ T bindAddress(String bindAddress);
+
+ /**
+ * Obtains the name of the server configuration.
+ *
+ * @return
+ */
+ String getServerName();
+
+ /**
+ * Sets the name of the server configuration
+ *
+ * @param serverName
+ * @return
+ */
+ T serverName(String serverName);
+
+ /**
+ * Obtains the $JBOSS_HOME, the path to the
+ * root location of the JBossAS
+ * installation.
+ *
+ * @return
+ */
+ URL getJBossHome();
+
+ /**
+ * Sets $JBOSS_HOME, the path to the root location
+ * of the JBossAS installation.
+ *
+ * @param jbossHome The location to $JBOSS_HOME
+ * @return This configuration
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T jbossHome(String jbossHome) throws IllegalArgumentException;
+
+ /**
+ * Sets $JBOSS_HOME, the path to the root location
+ * of the JBossAS installation.
+ *
+ * @param jbossHome The location to $JBOSS_HOME
+ * @return This configuration
+ */
+ T jbossHome(URL jbossHome);
+
+ /**
+ * Obtains the location of the JBossAS
+ * Boot Libraries
+ *
+ * @return
+ */
+ URL getBootLibraryLocation();
+
+ /**
+ * Sets the location of the JBossAS
+ * Boot Libraries
+ *
+ * @param bootLibraryLocation
+ * @return
+ */
+ T bootLibraryLocation(URL bootLibraryLocation);
+
+ /**
+ * Sets the location of the JBossAS
+ * Boot Libraries
+ *
+ * @param bootLibraryLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T bootLibraryLocation(String bootLibraryLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location of the server base, from
+ * which server homes (by default) decend
+ *
+ * @return
+ */
+ URL getServerBaseLocation();
+
+ /**
+ * Sets the location of the server
+ * base, from which server homes (by default)
+ * decend
+ *
+ * @param serverBaseLocation
+ * @return
+ */
+ T serverBaseLocation(URL serverBaseLocation);
+
+ /**
+ * Sets the location of the server
+ * base, from which server homes (by default)
+ * decend
+ *
+ * @param serverBaseLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverBaseLocation(String serverBaseLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location of the server home
+ *
+ * @return
+ */
+ URL getServerHomeLocation();
+
+ /**
+ * Sets the location of the server home
+ *
+ * @param serverBaseLocation
+ * @return
+ */
+ T serverHomeLocation(URL serverHomeLocation);
+
+ /**
+ * Sets the location of the server home
+ *
+ * @param serverHomeLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverHomeLocation(String serverHomeLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location of the common base
+ *
+ * @return
+ */
+ URL getCommonBaseLocation();
+
+ /**
+ * Sets the location of the common base
+ *
+ * @param serverBaseLocation
+ * @return
+ */
+ T commonBaseLocation(URL commonBaseLocation);
+
+ /**
+ * Sets the location of the common base
+ *
+ * @param commonBaseLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T commonBaseLocation(String commonBaseLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location of the common lib
+ *
+ * @return
+ */
+ URL getCommonLibLocation();
+
+ /**
+ * Sets the location of the common lib
+ *
+ * @param commonLibLocation
+ * @return
+ */
+ T commonLibLocation(URL commonLibLocation);
+
+ /**
+ * Sets the location of the common lib
+ *
+ * @param commonLibLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T commonLibLocation(String commonLibLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location in which the server logs reside
+ *
+ * @return
+ */
+ URL getServerLogLocation();
+
+ /**
+ * Sets the location in which the server logs reside
+ *
+ * @param serverLogLocation
+ * @return
+ */
+ T serverLogLocation(URL serverLogLocation);
+
+ /**
+ * Sets the location in which the server logs reside
+ *
+ * @param serverLogLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverLogLocation(String serverLogLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location in which the server configuration resides
+ *
+ * @return
+ */
+ URL getServerConfLocation();
+
+ /**
+ * Sets the location in which the server configuration resides
+ *
+ * @param serverConfLocation
+ * @return
+ */
+ T serverConfLocation(URL serverConfLocation);
+
+ /**
+ * Sets the location in which the server configuration resides
+ *
+ * @param serverConfLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverConfLocation(String serverConfLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location in which the server libraries reside
+ *
+ * @return
+ */
+ URL getServerLibLocation();
+
+ /**
+ * Sets the location in which the server libraries reside
+ *
+ * @param serverLibLocation
+ * @return
+ */
+ T serverLibLocation(URL serverLibLocation);
+
+ /**
+ * Sets the location in which the server libraries reside
+ *
+ * @param serverLibLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverLibLocation(String serverLibLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location in which the server persistent data resides
+ *
+ * @return
+ */
+ URL getServerDataLocation();
+
+ /**
+ * Sets the location in which the server persistent data resides
+ *
+ * @param serverDataLocation
+ * @return
+ */
+ T serverDataLocation(URL serverDataLocation);
+
+ /**
+ * Sets the location in which the server persistent data resides
+ *
+ * @param serverDataLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverDataLocation(String serverDataLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the location in which the server temp data resides
+ *
+ * @return
+ */
+ URL getServerTempLocation();
+
+ /**
+ * Sets the location in which the server temp data resides
+ *
+ * @param serverTempLocation
+ * @return
+ */
+ T serverTempLocation(URL serverTempLocation);
+
+ /**
+ * Sets the location in which the server temp data resides
+ *
+ * @param serverTempLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T serverTempLocation(String serverTempLocation) throws IllegalArgumentException;
+
+ /**
+ * Obtains the partition name for this instance in clustering
+ *
+ * @return
+ */
+ String getPartitionName();
+
+ /**
+ * Sets the partition name for this instance in clustering
+ *
+ * @param partitionName
+ * @return
+ */
+ T partitionName(String partitionName);
+
+ /**
+ * Obtains the UDP Group for this instance in clustering
+ *
+ * @return
+ */
+ String getUdpGroup();
+
+ /**
+ * Sets the UDP Group for this instance in clustering
+ *
+ * @param udpGroup
+ * @return
+ */
+ T udpGroup(String udpGroup);
+
+ /**
+ * Obtains the JGroups UDP Multicast port for use
+ * in clustering
+ *
+ * @return
+ */
+ Integer getUdpPort();
+
+ /**
+ * Sets the JGroups UDP Multicast port for use
+ * in clustering
+ *
+ * @param udpPort The port, or null to use the default
+ * @return
+ */
+ T udpPort(Integer udpPort);
+
+ /**
+ * Determines whether or not to load the native libraries
+ *
+ * @return
+ */
+ Boolean isLoadNative();
+
+ /**
+ * Sets whether or not to load the native libraries
+ *
+ * @param loadNative true or false, or null to use the default
+ * @return
+ */
+ T loadNative(Boolean loadNative);
+
+ /**
+ * Obtains the location of the JBossAS
+ * Native Libraries
+ *
+ * @return
+ */
+ URL getNativeLibraryLocation();
+
+ /**
+ * Sets the location of the JBossAS
+ * Native Libraries
+ *
+ * @param nativeLibraryLocation
+ * @return
+ */
+ T nativeLibraryLocation(URL nativeLibraryLocation);
+
+ /**
+ * Sets the location of the JBossAS
+ * Native Libraries
+ *
+ * @param nativeLibraryLocation
+ * @return
+ * @throws IllegalArgumentException If the specified argument
+ * is non-null and cannot be constructed into a URL
+ */
+ T nativeLibraryLocation(String nativeLibraryLocation) throws IllegalArgumentException;
+
+ /**
+ * Determines whether or not to use as the main jboss server the MBeanServer returned
+ * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
+ *
+ * @return
+ */
+ Boolean isUsePlatformMBeanServer();
+
+ /**
+ * Sets whether or not to use as the main jboss server the MBeanServer returned
+ * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
+ *
+ * @param usePlatformMBeanServer
+ * @return
+ */
+ T usePlatformMBeanServer(Boolean usePlatformMBeanServer);
+
+}
Deleted: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -1,139 +0,0 @@
-/*
- * 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.spi.as.config;
-
-import org.jboss.bootstrap.spi.config.ConfigurationInitializer;
-import org.jboss.bootstrap.spi.server.ServerInitializer;
-
-/**
- * JBossASConfigurationInitializer
- *
- * Contract for a JBossAS Configuration Initializer
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- * @see {@link ServerInitializer}
- */
-public interface JBossASConfigurationInitializer extends ConfigurationInitializer<JBossASServerConfig>
-{
- //-------------------------------------------------------------------------------||
- // Constants --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /*
- * The following denote default values in the case
- * a property is not explicitly-specified
- */
-
- /**
- * Default address which will be set
- * if {@link JBossASServerConfig#getBindAddress()} or
- * system or configuration property
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_BIND_ADDRESS}
- * is not defined
- */
- String VALUE_BIND_ADDRESS_DEFAULT = "127.0.0.1";
-
- /**
- * Value for address representing any/all interfaces
- */
- String VALUE_BIND_ADDRESS_ANY = "0.0.0.0";
-
- /**
- * Default server name which will be set if
- * {@link JBossASServerConfig#getBindAddress()} or
- * system or configuration property
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_NAME}
- * is not defined
- */
- String VALUE_SERVER_NAME_DEFAULT = "default";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL},
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL} and
- * {@link #PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL}.
- */
- String VALUE_LIBRARY_URL_SUFFIX_DEFAULT = "lib/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_BASE_URL}.
- */
- String VALUE_SERVER_BASE_URL_SUFFIX_DEFAULT = "server/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_COMMON_BASE_URL}
- */
- String VALUE_COMMON_BASE_URL_SUFFIX_DEFAULT = "common/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_LOG_DIR}.
- */
- String VALUE_SERVER_LOG_DIR_SUFFIX_DEFAULT = "log/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_CONF_URL}.
- */
- String VALUE_SERVER_CONFIG_URL_SUFFIX_DEFAULT = "conf/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_DATA_DIR}.
- */
- String VALUE_SERVER_DATA_DIR_SUFFIX_DEFAULT = "data/";
-
- /**
- * The suffix used when generating the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_SERVER_TEMP_DIR}.
- */
- String VALUE_SERVER_TEMP_DIR_SUFFIX_DEFAULT = "tmp/";
-
- /**
- * The partition name used as the default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_PARTITION_NAME}
- */
- String VALUE_PARTITION_NAME_DEFAULT = "DefaultPartition";
-
- /**
- * The default value for
- * {@link JBossASServerConfig#PROP_KEY_JBOSSAS_NATIVE_LOAD}
- */
- Boolean VALUE_NATIVE_LOAD_DEFAULT = false;
-
- /**
- * The default suffix used to construct native libaray
- * locations, relative to the Server Temp Home
- * (eg. $JBOSS_HOME/server/[serverName]/tmp/native/)
- */
- String VALUE_NATIVE_DIR_SUFFIX_DEFAULT = "native/";
-
- /**
- * The default value used in determining whether or not
- * to use the Platform MBean Server under JDK 1.5+
- */
- Boolean VALUE_PLATFORM_MBEAN_SERVER_DEFAULT = true;
-}
Added: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java (rev 0)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASConfigurationInitializer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,35 @@
+/*
+ * 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.spi.as.config;
+
+/**
+ * JBossASSConfigurationInitializer
+ *
+ * Contract for a JBossAS Configuration Initializer
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossASConfigurationInitializer extends JBossASBasedConfigurationInitializer<JBossASServerConfig>
+{
+
+}
Modified: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfig.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfig.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/config/JBossASServerConfig.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -22,10 +22,6 @@
package org.jboss.bootstrap.spi.as.config;
-import java.net.URL;
-
-import org.jboss.bootstrap.spi.mc.config.MCBasedServerConfig;
-
/**
* JBossASServerConfig
*
@@ -34,595 +30,7 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public interface JBossASServerConfig extends MCBasedServerConfig<JBossASServerConfig>
+public interface JBossASServerConfig extends JBossASBasedServerConfig<JBossASServerConfig>
{
- //-------------------------------------------------------------------------------||
- // Constants --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
- /**
- * Constant that holds the name of the system or
- * configuration property
- */
- String PROP_KEY_JBOSSAS_BIND_ADDRESS = "jboss.bind.address";
-
- /**
- * Constant that holds the name of the system or configuration
- * property which specifies the name of the server which will be used to
- * calculate the servers home directory and url.
- */
- String PROP_KEY_JBOSSAS_SERVER_NAME = "jboss.server.name";
-
- /**
- * Constant that holds the name of the environment
- * variable which specifies the root of the AS
- * installation
- */
- String ENV_VAR_JBOSSAS_HOME = "JBOSS_HOME";
-
- /**
- * Constant that holds the name of the system or configuration
- * property which specifies the root of the AS
- * installation
- */
- String PROP_KEY_JBOSSAS_HOME = "jboss.home";
-
- /**
- * Constant that holds the name of the system property
- * which specifies the home directory for JBossAS.
- */
- String PROP_KEY_JBOSSAS_HOME_DIR = "jboss.home.dir";
-
- /**
- * Constant that holds the name of the system property
- * which specifies the home URL for JBossAS.
- */
- String PROP_KEY_JBOSSAS_HOME_URL = "jboss.home.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the URL where JBoss will read library files
- * from.
- */
- String PROP_KEY_JBOSSAS_BOOT_LIBRARY_URL = "jboss.lib.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the base directory for calculating server
- * home directories.
- */
- String PROP_KEY_JBOSSAS_SERVER_BASE_DIR = "jboss.server.base.dir";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the base URL for calculating server
- * home URLs.
- */
- String PROP_KEY_JBOSSAS_SERVER_BASE_URL = "jboss.server.base.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the server home directory for JBoss.
- */
- String PROP_KEY_JBOSSAS_SERVER_HOME_DIR = "jboss.server.home.dir";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the server home URL for JBoss.
- */
- String PROP_KEY_JBOSSAS_SERVER_HOME_URL = "jboss.server.home.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the base URL for files and directories
- * common to different server configurations
- */
- String PROP_KEY_JBOSSAS_COMMON_BASE_URL = "jboss.common.base.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying a library directory URL that points to libraries
- * shared by the various server configurations.
- */
- String PROP_KEY_JBOSSAS_COMMON_LIBRARY_URL = "jboss.common.lib.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the server log directory for JBoss.
- */
- String PROP_KEY_JBOSSAS_SERVER_LOG_DIR = "jboss.server.log.dir";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the server configuration URL.
- */
- String PROP_KEY_JBOSSAS_SERVER_CONF_URL = "jboss.server.config.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the URL where JBoss will read server specific
- * library files from.
- */
- String PROP_KEY_JBOSSAS_SERVER_LIBRARY_URL = "jboss.server.lib.url";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the directory which JBoss will use for
- * persistent data file storage.
- */
- String PROP_KEY_JBOSSAS_SERVER_DATA_DIR = "jboss.server.data.dir";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the directory which JBoss will use for
- * temporary file storage.
- */
- String PROP_KEY_JBOSSAS_SERVER_TEMP_DIR = "jboss.server.temp.dir";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the partition name for this instance in clustering
- */
- String PROP_KEY_JBOSSAS_PARTITION_NAME = "jboss.partition.name";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the UDP Group for this instance in clustering
- */
- String PROP_KEY_JBOSSAS_PARTITION_UDP_GROUP = "jboss.partition.udpGroup";
-
- /**
- * Constant that holds the name of the system property
- * for specifying the UDP Port for this instance in clustering
- */
- String PROP_KEY_JBOSSAS_PARTITION_UDP_PORT = "jboss.jgroups.udp.mcast_port";
-
- /**
- * Constant that holds the name of the system property
- * designating whether to load native libraries
- */
- String PROP_KEY_JBOSSAS_NATIVE_LOAD = "jboss.native.load";
-
- /**
- * Constant that holds the location of native libraries
- */
- String PROP_KEY_JBOSSAS_NATIVE_DIR = "jboss.native.dir";
-
- /**
- * Constant that holds the name of the system property for specifying
- * whether or not to use as the main jboss server the MBeanServer returned
- * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
- *
- * <p>If not set then jboss will instantiate its own MBeanServer
- */
- String PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER = "jboss.platform.mbeanserver";
-
- //-------------------------------------------------------------------------------||
- // Contracts --------------------------------------------------------------------||
- //-------------------------------------------------------------------------------||
-
- /**
- * Obtains the bind address to be used for the Server.
- *
- * @return
- */
- String getBindAddress();
-
- /**
- * Sets the bind address for the server
- *
- * @param bindAddress
- * @return
- */
- JBossASServerConfig bindAddress(String bindAddress);
-
- /**
- * Obtains the name of the server configuration.
- *
- * @return
- */
- String getServerName();
-
- /**
- * Sets the name of the server configuration
- *
- * @param serverName
- * @return
- */
- JBossASServerConfig serverName(String serverName);
-
- /**
- * Obtains the $JBOSS_HOME, the path to the
- * root location of the JBossAS
- * installation.
- *
- * @return
- */
- URL getJBossHome();
-
- /**
- * Sets $JBOSS_HOME, the path to the root location
- * of the JBossAS installation.
- *
- * @param jbossHome The location to $JBOSS_HOME
- * @return This configuration
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig jbossHome(String jbossHome) throws IllegalArgumentException;
-
- /**
- * Sets $JBOSS_HOME, the path to the root location
- * of the JBossAS installation.
- *
- * @param jbossHome The location to $JBOSS_HOME
- * @return This configuration
- */
- JBossASServerConfig jbossHome(URL jbossHome);
-
- /**
- * Obtains the location of the JBossAS
- * Boot Libraries
- *
- * @return
- */
- URL getBootLibraryLocation();
-
- /**
- * Sets the location of the JBossAS
- * Boot Libraries
- *
- * @param bootLibraryLocation
- * @return
- */
- JBossASServerConfig bootLibraryLocation(URL bootLibraryLocation);
-
- /**
- * Sets the location of the JBossAS
- * Boot Libraries
- *
- * @param bootLibraryLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig bootLibraryLocation(String bootLibraryLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location of the server base, from
- * which server homes (by default) decend
- *
- * @return
- */
- URL getServerBaseLocation();
-
- /**
- * Sets the location of the server
- * base, from which server homes (by default)
- * decend
- *
- * @param serverBaseLocation
- * @return
- */
- JBossASServerConfig serverBaseLocation(URL serverBaseLocation);
-
- /**
- * Sets the location of the server
- * base, from which server homes (by default)
- * decend
- *
- * @param serverBaseLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverBaseLocation(String serverBaseLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location of the server home
- *
- * @return
- */
- URL getServerHomeLocation();
-
- /**
- * Sets the location of the server home
- *
- * @param serverBaseLocation
- * @return
- */
- JBossASServerConfig serverHomeLocation(URL serverHomeLocation);
-
- /**
- * Sets the location of the server home
- *
- * @param serverHomeLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverHomeLocation(String serverHomeLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location of the common base
- *
- * @return
- */
- URL getCommonBaseLocation();
-
- /**
- * Sets the location of the common base
- *
- * @param serverBaseLocation
- * @return
- */
- JBossASServerConfig commonBaseLocation(URL commonBaseLocation);
-
- /**
- * Sets the location of the common base
- *
- * @param commonBaseLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig commonBaseLocation(String commonBaseLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location of the common lib
- *
- * @return
- */
- URL getCommonLibLocation();
-
- /**
- * Sets the location of the common lib
- *
- * @param commonLibLocation
- * @return
- */
- JBossASServerConfig commonLibLocation(URL commonLibLocation);
-
- /**
- * Sets the location of the common lib
- *
- * @param commonLibLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig commonLibLocation(String commonLibLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location in which the server logs reside
- *
- * @return
- */
- URL getServerLogLocation();
-
- /**
- * Sets the location in which the server logs reside
- *
- * @param serverLogLocation
- * @return
- */
- JBossASServerConfig serverLogLocation(URL serverLogLocation);
-
- /**
- * Sets the location in which the server logs reside
- *
- * @param serverLogLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverLogLocation(String serverLogLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location in which the server configuration resides
- *
- * @return
- */
- URL getServerConfLocation();
-
- /**
- * Sets the location in which the server configuration resides
- *
- * @param serverConfLocation
- * @return
- */
- JBossASServerConfig serverConfLocation(URL serverConfLocation);
-
- /**
- * Sets the location in which the server configuration resides
- *
- * @param serverConfLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverConfLocation(String serverConfLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location in which the server libraries reside
- *
- * @return
- */
- URL getServerLibLocation();
-
- /**
- * Sets the location in which the server libraries reside
- *
- * @param serverLibLocation
- * @return
- */
- JBossASServerConfig serverLibLocation(URL serverLibLocation);
-
- /**
- * Sets the location in which the server libraries reside
- *
- * @param serverLibLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverLibLocation(String serverLibLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location in which the server persistent data resides
- *
- * @return
- */
- URL getServerDataLocation();
-
- /**
- * Sets the location in which the server persistent data resides
- *
- * @param serverDataLocation
- * @return
- */
- JBossASServerConfig serverDataLocation(URL serverDataLocation);
-
- /**
- * Sets the location in which the server persistent data resides
- *
- * @param serverDataLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverDataLocation(String serverDataLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the location in which the server temp data resides
- *
- * @return
- */
- URL getServerTempLocation();
-
- /**
- * Sets the location in which the server temp data resides
- *
- * @param serverTempLocation
- * @return
- */
- JBossASServerConfig serverTempLocation(URL serverTempLocation);
-
- /**
- * Sets the location in which the server temp data resides
- *
- * @param serverTempLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig serverTempLocation(String serverTempLocation) throws IllegalArgumentException;
-
- /**
- * Obtains the partition name for this instance in clustering
- *
- * @return
- */
- String getPartitionName();
-
- /**
- * Sets the partition name for this instance in clustering
- *
- * @param partitionName
- * @return
- */
- JBossASServerConfig partitionName(String partitionName);
-
- /**
- * Obtains the UDP Group for this instance in clustering
- *
- * @return
- */
- String getUdpGroup();
-
- /**
- * Sets the UDP Group for this instance in clustering
- *
- * @param udpGroup
- * @return
- */
- JBossASServerConfig udpGroup(String udpGroup);
-
- /**
- * Obtains the JGroups UDP Multicast port for use
- * in clustering
- *
- * @return
- */
- Integer getUdpPort();
-
- /**
- * Sets the JGroups UDP Multicast port for use
- * in clustering
- *
- * @param udpPort The port, or null to use the default
- * @return
- */
- JBossASServerConfig udpPort(Integer udpPort);
-
- /**
- * Determines whether or not to load the native libraries
- *
- * @return
- */
- Boolean isLoadNative();
-
- /**
- * Sets whether or not to load the native libraries
- *
- * @param loadNative true or false, or null to use the default
- * @return
- */
- JBossASServerConfig loadNative(Boolean loadNative);
-
- /**
- * Obtains the location of the JBossAS
- * Native Libraries
- *
- * @return
- */
- URL getNativeLibraryLocation();
-
- /**
- * Sets the location of the JBossAS
- * Native Libraries
- *
- * @param nativeLibraryLocation
- * @return
- */
- JBossASServerConfig nativeLibraryLocation(URL nativeLibraryLocation);
-
- /**
- * Sets the location of the JBossAS
- * Native Libraries
- *
- * @param nativeLibraryLocation
- * @return
- * @throws IllegalArgumentException If the specified argument
- * is non-null and cannot be constructed into a URL
- */
- JBossASServerConfig nativeLibraryLocation(String nativeLibraryLocation) throws IllegalArgumentException;
-
- /**
- * Determines whether or not to use as the main jboss server the MBeanServer returned
- * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
- *
- * @return
- */
- Boolean isUsePlatformMBeanServer();
-
- /**
- * Sets whether or not to use as the main jboss server the MBeanServer returned
- * from ManagementFactory.getPlatformMBeanServer(), when running under jdk1.5+
- *
- * @param usePlatformMBeanServer
- * @return
- */
- JBossASServerConfig usePlatformMBeanServer(Boolean usePlatformMBeanServer);
-
}
Added: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASBasedServer.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASBasedServer.java (rev 0)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASBasedServer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -0,0 +1,93 @@
+/*
+ * 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.spi.as.server;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.jboss.bootstrap.spi.as.config.JBossASBasedServerConfig;
+import org.jboss.bootstrap.spi.mc.server.MCBasedServer;
+import org.jboss.bootstrap.spi.server.Server;
+
+/**
+ * JBossASBasedServer
+ *
+ * Contract for JBoss Application Servers and extensions
+ * thereof
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface JBossASBasedServer<K extends JBossASBasedServer<K, T>, T extends JBossASBasedServerConfig<T>>
+ extends
+ MCBasedServer<K, T>
+{
+ //-------------------------------------------------------------------------------------||
+ // Contracts --------------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /** @return The server start date */
+ Date getStartDate();
+
+ /** @return The server version, the underlying version expressed as a String */
+ String getVersion();
+
+ /** @return The server version code name */
+ String getVersionName();
+
+ /** @return The full server version number */
+ String getVersionNumber();
+
+ /** @return The date the server was build (compiled) */
+ String getBuildNumber();
+
+ /** @return The JVM used to build the server */
+ String getBuildJVM();
+
+ /** @return The Operating System used to build the server */
+ String getBuildOS();
+
+ /** @return The build id */
+ String getBuildID();
+
+ /** @return The date the server was build */
+ String getBuildDate();
+
+ /**
+ * Get the optional server configuration metadata
+ *
+ * @return A possibly empty map of configuration metadata
+ */
+ Map<String, Object> getMetaData();
+
+ /**
+ * Returns whether or not the server is started.
+ *
+ * JBBOOT-80
+ * @return
+ * @deprecated Should be removed when we won't be targeting
+ * jboss-bootstrap for AS 5.x anymore. AS6 will not support
+ * this invocation, instead we should use {@link Server#getState()}
+ */
+ @Deprecated
+ boolean isStarted();
+}
Modified: projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASServer.java
===================================================================
--- projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASServer.java 2009-07-14 19:55:29 UTC (rev 91240)
+++ projects/bootstrap/trunk/spi-as/src/main/java/org/jboss/bootstrap/spi/as/server/JBossASServer.java 2009-07-14 20:12:15 UTC (rev 91241)
@@ -22,12 +22,7 @@
package org.jboss.bootstrap.spi.as.server;
-import java.util.Date;
-import java.util.Map;
-
import org.jboss.bootstrap.spi.as.config.JBossASServerConfig;
-import org.jboss.bootstrap.spi.mc.server.MCBasedServer;
-import org.jboss.bootstrap.spi.server.Server;
/**
* JBossASServer
@@ -39,55 +34,7 @@
* @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
-public interface JBossASServer extends MCBasedServer<JBossASServer, JBossASServerConfig>
+public interface JBossASServer extends JBossASBasedServer<JBossASServer, JBossASServerConfig>
{
- //-------------------------------------------------------------------------------------||
- // Contracts --------------------------------------------------------------------------||
- //-------------------------------------------------------------------------------------||
- /** @return The server start date */
- Date getStartDate();
-
- /** @return The server version, the underlying version expressed as a String */
- String getVersion();
-
- /** @return The server version code name */
- String getVersionName();
-
- /** @return The full server version number */
- String getVersionNumber();
-
- /** @return The date the server was build (compiled) */
- String getBuildNumber();
-
- /** @return The JVM used to build the server */
- String getBuildJVM();
-
- /** @return The Operating System used to build the server */
- String getBuildOS();
-
- /** @return The build id */
- String getBuildID();
-
- /** @return The date the server was build */
- String getBuildDate();
-
- /**
- * Get the optional server configuration metadata
- *
- * @return A possibly empty map of configuration metadata
- */
- Map<String, Object> getMetaData();
-
- /**
- * Returns whether or not the server is started.
- *
- * JBBOOT-80
- * @return
- * @deprecated Should be removed when we won't be targeting
- * jboss-bootstrap for AS 5.x anymore. AS6 will not support
- * this invocation, instead we should use {@link Server#getState()}
- */
- @Deprecated
- boolean isStarted();
}
More information about the jboss-cvs-commits
mailing list