[jboss-cvs] JBossAS SVN: r83923 - in trunk: bootstrap/src/main/org/jboss/bootstrap/spi and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 5 23:17:10 EST 2009
Author: scott.stark at jboss.org
Date: 2009-02-05 23:17:10 -0500 (Thu, 05 Feb 2009)
New Revision: 83923
Modified:
trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java
trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Server.java
trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
Log:
Update the Server interface to accept a map of configuration metadata
Modified: trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java 2009-02-06 03:08:13 UTC (rev 83922)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/AbstractServerImpl.java 2009-02-06 04:17:10 UTC (rev 83923)
@@ -24,8 +24,10 @@
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.LogManager;
@@ -50,7 +52,7 @@
* @author Scott.Stark at jboss.org
* @author Dimitris.Andreadis at jboss.org
* @author adrian at jboss.org
- * @version $Revision:$
+ * @version $Revision$
*/
public abstract class AbstractServerImpl extends NotificationBroadcasterSupport
implements ServerProcess, NotificationEmitter
@@ -67,6 +69,9 @@
/** The basic configuration for the server. */
private BaseServerConfig config;
+ /** The optional configuration metadata for the server */
+ private Map<String, Object> metadata;
+
/** When the server was started. */
private Date startDate;
@@ -130,14 +135,24 @@
}
/**
+ * Initialize the server by calling init(props, null);
+ */
+ public void init(final Properties props)
+ throws IllegalStateException, Exception
+ {
+ init(props, null);
+ }
+ /**
* Initialize the Server instance.
*
* @param props - The configuration properties for the server.
+ * @param metadata configuration metadata for the server
*
* @throws IllegalStateException Already initialized.
* @throws Exception Failed to initialize.
*/
- public void init(final Properties props) throws IllegalStateException, Exception
+ public void init(final Properties props, final Map<String, Object> metadata)
+ throws IllegalStateException, Exception
{
if (props == null)
throw new IllegalArgumentException("props is null");
@@ -145,6 +160,11 @@
if (config != null)
throw new IllegalStateException("already initialized");
+ if (metadata == null)
+ this.metadata = Collections.emptyMap();
+ else
+ this.metadata = Collections.unmodifiableMap(metadata);
+
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
try
@@ -316,6 +336,26 @@
}
/**
+ * Get the optional server configuration metadata
+ * @return a possibly empty map of configuration metadata.
+ */
+ public Map<String, Object> getMetaData()
+ {
+ return metadata;
+ }
+ /**
+ * Set the server configuration metadata
+ * @param metadata
+ */
+ public void setMetaData(Map<String, Object> metadata)
+ {
+ if (metadata == null)
+ this.metadata = Collections.emptyMap();
+ else
+ this.metadata = Collections.unmodifiableMap(metadata);
+ }
+
+ /**
* Check if the server is started.
*
* @return True if the server is started, else false.
Modified: trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Server.java
===================================================================
--- trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Server.java 2009-02-06 03:08:13 UTC (rev 83922)
+++ trunk/bootstrap/src/main/org/jboss/bootstrap/spi/Server.java 2009-02-06 04:17:10 UTC (rev 83923)
@@ -22,6 +22,7 @@
package org.jboss.bootstrap.spi;
import java.util.Date;
+import java.util.Map;
import java.util.Properties;
/**
@@ -81,6 +82,7 @@
* @throws Exception Failed to initialize.
*/
void init(Properties props) throws IllegalStateException, Exception;
+ void init(Properties props, Map<String, Object> metadata) throws IllegalStateException, Exception;
/**
* Get the typed server configuration object which the
@@ -93,6 +95,12 @@
ServerConfig getConfig() throws IllegalStateException;
/**
+ * Get the optional server configuration metadata
+ * @return a possibly empty map of configuration metadata.
+ */
+ Map<String, Object> getMetaData();
+
+ /**
* Start the Server instance.
*
* @throws IllegalStateException Already started or not initialized.
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-02-06 03:08:13 UTC (rev 83922)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-02-06 04:17:10 UTC (rev 83923)
@@ -72,6 +72,7 @@
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.types.ControllerStateMetaType;
import org.jboss.system.server.profileservice.repository.AbstractBootstrapProfileFactory;
@@ -223,6 +224,9 @@
profileName = server.getConfig().getServerName();
this.profileKey = new ProfileKey(profileName);
+ Map<String, Object> metaData = server.getMetaData();
+ ProfileMetaData pmd = (ProfileMetaData) metaData.get(ProfileMetaData.class.getName());
+
// Register the profiles
Collection<Profile> bootstrapProfiles = profileFactory.createProfiles(profileKey, null);
for(Profile profile : bootstrapProfiles)
Modified: trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java
===================================================================
--- trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-02-06 03:08:13 UTC (rev 83922)
+++ trunk/system/src/tests/org/jboss/test/server/profileservice/support/MockServer.java 2009-02-06 04:17:10 UTC (rev 83923)
@@ -21,7 +21,9 @@
*/
package org.jboss.test.server.profileservice.support;
+import java.util.Collections;
import java.util.Date;
+import java.util.Map;
import java.util.Properties;
import org.jboss.bootstrap.spi.Server;
@@ -102,10 +104,17 @@
public void init(Properties props) throws IllegalStateException, Exception
{
+ init(props, null);
+ }
+ public void init(Properties props, Map<String, Object> metadata) throws IllegalStateException, Exception
+ {
// FIXME init
}
-
+ public Map<String, Object> getMetaData()
+ {
+ return Collections.emptyMap();
+ }
public boolean isInShutdown()
{
// FIXME isInShutdown
Modified: trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2009-02-06 03:08:13 UTC (rev 83922)
+++ trunk/system-jmx/src/main/org/jboss/system/server/jmx/JMXKernel.java 2009-02-06 04:17:10 UTC (rev 83923)
@@ -25,8 +25,10 @@
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import javax.management.ListenerNotFoundException;
@@ -260,6 +262,10 @@
{
serverImpl.init(props);
}
+ public void init(Properties props, Map<String, Object> metadata) throws Exception
+ {
+ serverImpl.init(props);
+ }
public void exit()
{
@@ -275,6 +281,14 @@
{
return serverConfig;
}
+ /**
+ * Get the optional server configuration metadata
+ * @return a possibly empty map of configuration metadata.
+ */
+ public Map<String, Object> getMetaData()
+ {
+ return Collections.emptyMap();
+ }
public String getBuildDate()
{
return serverImpl.getBuildDate();
More information about the jboss-cvs-commits
mailing list