You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2005/10/12 04:27:40 UTC
svn commit: r314753 [1/2] - in /geronimo/trunk:
applications/console-standard/src/java/org/apache/geronimo/console/configmanager/
applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/
applications/console-standard/src/java...
Author: djencks
Date: Tue Oct 11 19:27:12 2005
New Revision: 314753
URL: http://svn.apache.org/viewcvs?rev=314753&view=rev
Log:
GERONIMO-1060 step 1. Rearrange the use of the attribute store
Modified:
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
geronimo/trunk/modules/assembly/maven.xml
geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml
geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
geronimo/trunk/modules/assembly/src/plan/system-plan.xml
geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/Daemon.java
geronimo/trunk/modules/system/src/test/org/apache/geronimo/system/configuration/LocalConfigStoreTest.java
geronimo/trunk/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
geronimo/trunk/plugins/geronimo-deployment-plugin/src/java/org/apache/geronimo/deployment/mavenplugin/StartServer.java
geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenAttributeStore.java
geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/MavenConfigStore.java
geronimo/trunk/plugins/geronimo-packaging-plugin/src/java/org/apache/geronimo/plugin/packaging/PackageBuilder.java
Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java Tue Oct 11 19:27:12 2005
@@ -45,6 +45,7 @@
import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.management.State;
@@ -60,14 +61,14 @@
private static final String UNINSTALL_METHOD = "uninstall";
- private static final String[] CONTAINSCONFIG_SIG = { URI.class.getName() };
+ private static final String[] CONTAINSCONFIG_SIG = {URI.class.getName()};
- private static final String[] UNINSTALL_SIG = { URI.class.getName() };
+ private static final String[] UNINSTALL_SIG = {URI.class.getName()};
private static final String QUEUETOPIC_URI = "runtimedestination/";
private static final String CONFIG_INIT_PARAM = "config-type";
-
+
private static final ObjectName deployer = JMXUtil
.getObjectName(ObjectNameConstants.DEPLOYER_OBJECT_NAME);
@@ -92,7 +93,7 @@
}
public void processAction(ActionRequest actionRequest,
- ActionResponse actionResponse) throws PortletException, IOException {
+ ActionResponse actionResponse) throws PortletException, IOException {
String action = actionRequest.getParameter("action");
actionResponse.setRenderParameter("message", ""); // set to blank first
try {
@@ -100,15 +101,15 @@
.getConfigurationManager(kernel);
ObjectName configName = null;
String config = getConfigID(actionRequest);
- if (configurationManager.isLoaded(URI.create(config)))
- configName = JMXUtil
- .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
- + "\"" + getConfigID(actionRequest) + "\"");
- else
- configName = configurationManager.load(URI.create(config));
+ URI configID = URI.create(config);
+ if (configurationManager.isLoaded(configID)) {
+ configName = Configuration.getConfigurationObjectName(configID);
+ } else {
+ configName = configurationManager.load(configID);
+ }
if (START_ACTION.equals(action)) {
- kernel.startRecursiveGBean(configName);
+ configurationManager.start(configName);
//kernel.startConfiguration(getConfigID(actionRequest));
messageStatus = "Started application<br /><br />";
} else if (STOP_ACTION.equals(action)) {
@@ -136,7 +137,7 @@
throw new PortletException("Exception", e);
}
}
-
+
/**
* Uninstall an application configuration
*
@@ -155,36 +156,39 @@
ObjectName configStore = (ObjectName) configStores.get(i);
Boolean result = (Boolean) kernel.invoke(configStore,
CONTAINSCONFIG_METHOD,
- new Object[] { URI.create(configID) }, CONTAINSCONFIG_SIG);
+ new Object[]{URI.create(configID)}, CONTAINSCONFIG_SIG);
if (result.booleanValue() == true) {
// stop config if running
if (configManager.isLoaded(URI.create(configID))) {
//int state = kernel.getConfigurationState(configID);
int state = kernel
.getGBeanState(JMXUtil
- .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
- + "\"" + configID + "\""));
+ .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
+ + "\"" + configID + "\""));
if (state == State.RUNNING.toInt()) {
//kernel.stopConfiguration(configID);
kernel
.stopGBean(JMXUtil
- .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
- + "\"" + configID + "\""));
+ .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
+ + "\"" + configID + "\""));
}
}
- kernel.invoke(configStore, UNINSTALL_METHOD, new Object[] { URI
- .create(configID) }, UNINSTALL_SIG);
+ kernel.invoke(configStore, UNINSTALL_METHOD, new Object[]{URI
+ .create(configID)}, UNINSTALL_SIG);
}
}
}
+
/**
- * Check if a configuration should be listed here. This method depends on the "config-type" portlet parameter
+ * Check if a configuration should be listed here. This method depends on the "config-type" portlet parameter
* which is set in portle.xml.
*/
- private boolean shouldListConfig(ConfigurationInfo info){
- String configType = getInitParameter(CONFIG_INIT_PARAM);
- if(configType!=null && !info.getType().getName().equalsIgnoreCase(configType)) return false;
- else return true;
+ private boolean shouldListConfig(ConfigurationInfo info) {
+ String configType = getInitParameter(CONFIG_INIT_PARAM);
+ if (configType != null && !info.getType().getName().equalsIgnoreCase(configType))
+ return false;
+ else
+ return true;
}
/*
@@ -201,7 +205,7 @@
}
protected void doView(RenderRequest renderRequest,
- RenderResponse renderResponse) throws IOException, PortletException {
+ RenderResponse renderResponse) throws IOException, PortletException {
if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
return;
}
@@ -219,13 +223,11 @@
if (shouldListConfig(info)) {
// TODO: Check if this is the right solution
// Disregard JMS Queues and Topics &&
- if (!info.getConfigID().getPath().startsWith(
- QUEUETOPIC_URI)
+ if (!info.getConfigID().getPath().startsWith(QUEUETOPIC_URI)
&& !info
- .getConfigID()
- .getPath()
- .startsWith(
- SecurityConstants.SECURITY_CONFIG_PREFIX)) {
+ .getConfigID()
+ .getPath()
+ .startsWith(SecurityConstants.SECURITY_CONFIG_PREFIX)) {
configInfo.add(info);
}
}
@@ -249,19 +251,16 @@
}
protected void doHelp(RenderRequest renderRequest,
- RenderResponse renderResponse) throws PortletException, IOException {
+ RenderResponse renderResponse) throws PortletException, IOException {
helpView.include(renderRequest, renderResponse);
}
public void init(PortletConfig portletConfig) throws PortletException {
super.init(portletConfig);
kernel = KernelRegistry.getSingleKernel();
- normalView = portletConfig.getPortletContext().getRequestDispatcher(
- "/WEB-INF/view/configmanager/normal.jsp");
- maximizedView = portletConfig.getPortletContext().getRequestDispatcher(
- "/WEB-INF/view/configmanager/maximized.jsp");
- helpView = portletConfig.getPortletContext().getRequestDispatcher(
- "/WEB-INF/view/configmanager/help.jsp");
+ normalView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/normal.jsp");
+ maximizedView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/maximized.jsp");
+ helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/help.jsp");
}
public void destroy() {
Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/DeploymentPortlet.java Tue Oct 11 19:27:12 2005
@@ -43,6 +43,7 @@
import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.jmx.JMXUtil;
public class DeploymentPortlet extends BasePortlet {
@@ -54,8 +55,8 @@
private Kernel kernel;
- private static final String[] ARGS = { File.class.getName(),
- File.class.getName() };
+ private static final String[] ARGS = {File.class.getName(),
+ File.class.getName()};
private static final ObjectName deployer = JMXUtil
.getObjectName(ObjectNameConstants.DEPLOYER_OBJECT_NAME);
@@ -63,15 +64,14 @@
private boolean messageNotRendered = true;
public void processAction(ActionRequest actionRequest,
- ActionResponse actionResponse) throws PortletException, IOException {
+ ActionResponse actionResponse) throws PortletException, IOException {
messageNotRendered = true;
if (!PortletFileUpload.isMultipartContent(actionRequest)) {
throw new PortletException("Expected file upload");
}
File rootDir = new File(System.getProperty("java.io.tmpdir"));
- PortletFileUpload uploader = new PortletFileUpload(
- new DiskFileItemFactory(10240, rootDir));
+ PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory(10240, rootDir));
File moduleFile = null;
File planFile = null;
String startApp = null;
@@ -116,27 +116,23 @@
throw new PortletException(e);
}
try {
- List list = (List) kernel.invoke(deployer, "deploy", new Object[] {
- moduleFile, planFile }, ARGS);
+ List list = (List) kernel.invoke(deployer, "deploy", new Object[]{
+ moduleFile, planFile}, ARGS);
actionResponse.setRenderParameter("outcome",
"The application was successfully deployed.<br/>");
// start installed app/s
if ((startApp != null) && "YES".equalsIgnoreCase(startApp)) {
ConfigurationManager configurationManager = ConfigurationUtil
.getConfigurationManager(kernel);
- int size = list.size();
- // assumes installed app/s returned as a list
- for (int i = 0; i < size; i++) {
- URI config = URI.create((String) list.get(i));
- // This is a hack that seems to work. Please fix this when
- // you understand what is happening or where you can get the
- // ObjectName from the configId without calling
- // ConfigurationManager.load(URI).
- if (configurationManager.isLoaded(config))
- configurationManager.unload(config);
-
- ObjectName configName = configurationManager.load(config);
- kernel.startRecursiveGBean(configName);
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ URI config = URI.create((String)iterator.next());
+ ObjectName configName;
+ if (configurationManager.isLoaded(config)) {
+ configName = Configuration.getConfigurationObjectName(config);
+ } else {
+ configName = configurationManager.load(config);
+ }
+ configurationManager.start(configName);
}
}
} catch (DeploymentException e) {
@@ -168,7 +164,7 @@
}
protected void doView(RenderRequest renderRequest,
- RenderResponse renderResponse) throws PortletException, IOException {
+ RenderResponse renderResponse) throws PortletException, IOException {
if (messageNotRendered) {
renderRequest.setAttribute("outcome", renderRequest
.getParameter("outcome"));
@@ -179,17 +175,15 @@
}
protected void doHelp(RenderRequest renderRequest,
- RenderResponse renderResponse) throws PortletException, IOException {
+ RenderResponse renderResponse) throws PortletException, IOException {
helpView.include(renderRequest, renderResponse);
}
public void init(PortletConfig portletConfig) throws PortletException {
super.init(portletConfig);
kernel = KernelRegistry.getSingleKernel();
- deployView = portletConfig.getPortletContext().getRequestDispatcher(
- "/WEB-INF/view/configmanager/deploy.jsp");
- helpView = portletConfig.getPortletContext().getRequestDispatcher(
- "/WEB-INF/view/configmanager/deployHelp.jsp");
+ deployView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/deploy.jsp");
+ helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/configmanager/deployHelp.jsp");
}
public void destroy() {
Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/DatabaseManagerHelper.java Tue Oct 11 19:27:12 2005
@@ -40,6 +40,7 @@
import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.jmx.JMXUtil;
public class DatabaseManagerHelper {
@@ -180,20 +181,15 @@
ConfigurationManager configurationManager = ConfigurationUtil
.getConfigurationManager(kernel);
// start installed app/s
- int size = list.size();
- for (int i = 0; i < size; i++) {
- String config = (String) list.get(i);
- //URI configID = new URI(config);
- //kernel.startConfiguration(configID);
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ URI configId = URI.create((String)iterator.next());
ObjectName configName = null;
- if (configurationManager.isLoaded(URI.create(config))) {
- configName = JMXUtil
- .getObjectName(ObjectNameConstants.CONFIG_GBEAN_PREFIX
- + "\"" + config + "\"");
+ if (configurationManager.isLoaded(configId)) {
+ configName = Configuration.getConfigurationObjectName(configId);
} else {
- configName = configurationManager.load(URI.create(config));
+ configName = configurationManager.load(configId);
}
- kernel.startRecursiveGBean(configName);
+ configurationManager.start(configName);
}
} catch (DeploymentException e) {
StringBuffer buf = new StringBuffer(256);
Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java Tue Oct 11 19:27:12 2005
@@ -40,6 +40,7 @@
import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.jmx.JMXUtil;
public class ActiveMQConnectorHelper {
@@ -75,8 +76,6 @@
private static final String GETURL_METHOD = "getURL";
- private List dependencies;
-
static {
// Initialize static vars
REPO_FOLDER = getRepositoryFile();
@@ -187,19 +186,18 @@
Kernel kernel = KernelRegistry.getSingleKernel();
List list = (List) kernel.invoke(DEPLOYER_NAME, DEPLOY_METHOD,
new Object[] {moduleFile, planFile}, DEPLOYER_ARGS);
- System.out.println("Deployed: " + moduleFile + " : " + planFile);
- // start installed app/s
- int size = list.size();
- for (int i = 0; i < size; i++) {
- String config = (String) list.get(i);
- //URI configID = new URI(config);
- //kernel.startConfiguration(configID);
- ConfigurationManager configurationManager = ConfigurationUtil
- .getConfigurationManager(kernel);
- ObjectName configName = configurationManager.load(URI
- .create(config));
+ ConfigurationManager configurationManager = ConfigurationUtil
+ .getConfigurationManager(kernel);
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ URI configId = URI.create((String)iterator.next());
+ ObjectName configName = null;
+ if (configurationManager.isLoaded(configId)) {
+ configName = Configuration.getConfigurationObjectName(configId);
+ } else {
+ configName = configurationManager.load(configId);
+ }
- kernel.startRecursiveGBean(configName);
+ configurationManager.start(configName);
}
} catch (DeploymentException e) {
StringBuffer buf = new StringBuffer(256);
Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java Tue Oct 11 19:27:12 2005
@@ -156,7 +156,7 @@
ConfigurationData.class.getName(), File.class.getName() });
ObjectName configName = configurationManager.load(configId);
- kernel.startRecursiveGBean(configName);
+ configurationManager.start(configName);
} catch (Exception e) {
log.info("problem", e);
Modified: geronimo/trunk/modules/assembly/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/maven.xml?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/maven.xml (original)
+++ geronimo/trunk/modules/assembly/maven.xml Tue Oct 11 19:27:12 2005
@@ -360,6 +360,12 @@
<ant:mkdir dir="${geronimo.assembly.dir}/bin"/>
<ant:java fork="true" jar="${geronimo.assembly.dir}/bin/deployer.jar" failonerror="true">
<ant:jvmarg value="-ea"/>
+<!--
+ <ant:jvmarg value="-Xdebug"/>
+ <ant:jvmarg value="-Xnoagent"/>
+ <ant:jvmarg value="-Djava.compiler=NONE"/>
+ <ant:jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+-->
<ant:arg value="package"/>
<ant:arg value="--classPath"/>
<ant:arg value="${server.classpath}"/>
Modified: geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/client-system-plan.xml Tue Oct 11 19:27:12 2005
@@ -39,6 +39,7 @@
<!-- Configuration Manager service -->
<gbean name="ConfigurationManager" class="org.apache.geronimo.kernel.config.ConfigurationManagerImpl">
<reference name="Stores"><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></reference>
+ <reference name="AttributeStore"><name>AttributeManager</name></reference>
</gbean>
<!-- User-editable attribute service -->
Modified: geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/deployer-system-plan.xml Tue Oct 11 19:27:12 2005
@@ -35,6 +35,7 @@
<!-- Configuration Manager service -->
<gbean name="ConfigurationManager" class="org.apache.geronimo.kernel.config.ConfigurationManagerImpl">
<reference name="Stores"><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></reference>
+ <reference name="AttributeStore"><name>AttributeManager</name></reference>
</gbean>
<!-- User-editable attribute service -->
Modified: geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/j2ee-tomcat-plan.xml Tue Oct 11 19:27:12 2005
@@ -112,14 +112,14 @@
<gbean name="TomcatWebConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
<attribute name="name">HTTP</attribute>
- <attribute name="host">0.0.0.0</attribute>
- <attribute name="port">${PlanHTTPPort}</attribute>
+ <attribute name="host">${PlanServerHostname}</attribute>
+ <attribute name="port">${PlanHTTPPort2}</attribute>
<attribute name="maxHttpHeaderSizeBytes">8192</attribute>
<attribute name="maxThreads">150</attribute>
<attribute name="minSpareThreads">25</attribute>
<attribute name="maxSpareThreads">75</attribute>
<attribute name="hostLookupEnabled">false</attribute>
- <attribute name="redirectPort">${PlanHTTPSPort}</attribute>
+ <attribute name="redirectPort">${PlanHTTPSPort2}</attribute>
<attribute name="acceptQueueSize">100</attribute>
<attribute name="connectionTimeoutMillis">20000</attribute>
<attribute name="uploadTimeoutEnabled">false</attribute>
@@ -131,10 +131,10 @@
<gbean name="TomcatAJPConnector" class="org.apache.geronimo.tomcat.ConnectorGBean">
<attribute name="protocol">AJP</attribute>
<attribute name="name">AJP</attribute>
- <attribute name="host">0.0.0.0</attribute>
- <attribute name="port">${PlanAJPPort}</attribute>
+ <attribute name="host">${PlanServerHostname}</attribute>
+ <attribute name="port">${PlanAJPPort2}</attribute>
<attribute name="hostLookupEnabled">false</attribute>
- <attribute name="redirectPort">${PlanHTTPSPort}</attribute>
+ <attribute name="redirectPort">${PlanHTTPSPort2}</attribute>
<reference name="TomcatContainer">
<name>TomcatWebContainer</name>
</reference>
@@ -145,8 +145,8 @@
-->
<gbean name="TomcatWebSSLConnector" class="org.apache.geronimo.tomcat.HttpsConnectorGBean">
<attribute name="name">HTTPS</attribute>
- <attribute name="host">0.0.0.0</attribute>
- <attribute name="port">${PlanHTTPSPort}</attribute>
+ <attribute name="host">${PlanServerHostname}</attribute>
+ <attribute name="port">${PlanHTTPSPort2}</attribute>
<attribute name="maxHttpHeaderSizeBytes">8192</attribute>
<attribute name="maxThreads">150</attribute>
<attribute name="minSpareThreads">25</attribute>
Modified: geronimo/trunk/modules/assembly/src/plan/system-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/assembly/src/plan/system-plan.xml?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/assembly/src/plan/system-plan.xml (original)
+++ geronimo/trunk/modules/assembly/src/plan/system-plan.xml Tue Oct 11 19:27:12 2005
@@ -39,6 +39,7 @@
<!-- Configuration Manager service -->
<gbean name="ConfigurationManager" class="org.apache.geronimo.kernel.config.ConfigurationManagerImpl">
<reference name="Stores"><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></reference>
+ <reference name="AttributeStore"><name>AttributeManager</name></reference>
</gbean>
<!-- User-editable attribute service -->
Modified: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java Tue Oct 11 19:27:12 2005
@@ -69,6 +69,7 @@
import org.apache.geronimo.kernel.config.ConfigurationStore;
import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Repository;
@@ -377,8 +378,8 @@
Kernel kernel = null;
try {
GBeanData config = ExecutableConfigurationUtil.getConfigurationGBeanData(configurationData);
- ObjectName objectName = ObjectName.getInstance("test:configuration=test-ejb-jar");
- config.setName(objectName);
+ ObjectName configName = ObjectName.getInstance("test:configuration=test-ejb-jar");
+ config.setName(configName);
kernel = KernelFactory.newInstance().createKernel("bar");
kernel.boot();
@@ -413,9 +414,9 @@
// load the configuration
config.setAttribute("baseURL", unpackedDir.toURL());
kernel.loadGBean(config, cl);
-
- // start the configuration
- kernel.startRecursiveGBean(objectName);
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
Set gb = kernel.listGBeans(JMXUtil.getObjectName("test:*"));
for (Iterator iterator = gb.iterator(); iterator.hasNext();) {
ObjectName name = (ObjectName) iterator.next();
@@ -423,7 +424,7 @@
System.out.println("Not running: " + name);
}
}
- assertRunning(kernel, objectName);
+ assertRunning(kernel, configName);
ObjectName applicationObjectName = NameFactory.getApplicationName(null, null, null, j2eeContext);
if (!j2eeContext.getJ2eeApplicationName().equals("null")) {
@@ -523,7 +524,7 @@
}
- kernel.stopGBean(objectName);
+ kernel.stopGBean(configName);
} finally {
if (ds != null) {
Connection connection = null;
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Tue Oct 11 19:27:12 2005
@@ -110,7 +110,7 @@
List list = configurationManager.loadRecursive(configID);
for (int j = 0; j < list.size(); j++) {
ObjectName name = (ObjectName) list.get(j);
- kernel.startRecursiveGBean(name);
+ configurationManager.start(name);
updateStatus("Started "+clean(name.getKeyProperty("name")));
}
}
Modified: geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java (original)
+++ geronimo/trunk/modules/deploy-jsr88/src/java/org/apache/geronimo/deployment/plugin/local/StartCommand.java Tue Oct 11 19:27:12 2005
@@ -70,12 +70,12 @@
// That means that the configuration may have been distributed but has not yet been loaded.
// That's fine, we'll load it next.
}
-
+
// Load and start the module
List list = configurationManager.loadRecursive(moduleID);
for (int j = 0; j < list.size(); j++) {
ObjectName name = (ObjectName) list.get(j);
- kernel.startRecursiveGBean(name);
+ configurationManager.start(name);
String configName = ObjectName.unquote(name.getKeyProperty("name"));
List kids = loadChildren(kernel, configName);
TargetModuleIDImpl id = new TargetModuleIDImpl(modules[i].getTarget(), configName,
Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Tue Oct 11 19:27:12 2005
@@ -472,25 +472,29 @@
ClassLoader[] parentCL;
List parentId = configurationData.getParentId();
if (kernel != null && parentId != null && parentId.size() > 0) {
- loadAncestors(kernel, parentId, loadedAncestors);
- ParentSource parentSource = new ConfigurationParentSource(kernel);
- parentId = getExtremalSet(parentId, parentSource);
- configurationData.setParentId(parentId);
-
+ ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
try {
- for (Iterator iterator = parentId.iterator(); iterator.hasNext();) {
- URI uri = (URI) iterator.next();
- ObjectName ancestorName = Configuration.getConfigurationObjectName(uri);
- List started = new ArrayList();
- startAncestors(ancestorName, kernel, started);
- startedAncestors.addAll(started);
+ loadAncestors(kernel, parentId, loadedAncestors, configurationManager);
+ ParentSource parentSource = new ConfigurationParentSource(kernel);
+ parentId = getExtremalSet(parentId, parentSource);
+ configurationData.setParentId(parentId);
+
+ try {
+ for (Iterator iterator = parentId.iterator(); iterator.hasNext();) {
+ URI uri = (URI) iterator.next();
+ ObjectName ancestorName = Configuration.getConfigurationObjectName(uri);
+ List started = new ArrayList();
+ startAncestors(ancestorName, kernel, started, configurationManager);
+ startedAncestors.addAll(started);
+ }
+ } catch (DeploymentException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new DeploymentException(e);
}
- } catch (DeploymentException e) {
- throw e;
- } catch (Exception e) {
- throw new DeploymentException(e);
+ } finally {
+ ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
}
-
try {
parentCL = new ClassLoader[parentId.size()];
for (int i = 0; i < parentId.size(); i++) {
@@ -513,10 +517,8 @@
return parentCL;
}
- private void loadAncestors(Kernel kernel, List parentId, List loadedAncestors) throws DeploymentException {
+ private void loadAncestors(Kernel kernel, List parentId, List loadedAncestors, ConfigurationManager configurationManager) throws DeploymentException {
if (kernel != null && parentId != null) {
- ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
-
try {
for (Iterator iterator = parentId.iterator(); iterator.hasNext();) {
URI uri = (URI) iterator.next();
@@ -524,23 +526,21 @@
}
} catch (Exception e) {
throw new DeploymentException("Unable to load parents", e);
- } finally {
- ConfigurationUtil.releaseConfigurationManager(kernel, configurationManager);
}
}
}
- private void startAncestors(ObjectName name, Kernel kernel, List started) throws Exception {
+ private void startAncestors(ObjectName name, Kernel kernel, List started, ConfigurationManager configurationManager) throws Exception {
if (name != null && !isRunning(kernel, name)) {
URI[] patterns = (URI[]) kernel.getGBeanData(name).getAttribute("parentId");
if (patterns != null) {
for (int i = 0; i < patterns.length; i++) {
URI pattern = patterns[i];
ObjectName ancestorName = Configuration.getConfigurationObjectName(pattern);
- startAncestors(ancestorName, kernel, started);
+ startAncestors(ancestorName, kernel, started, configurationManager);
}
}
- kernel.startGBean(name);
+ configurationManager.loadGBeans(name);
started.add(name);
}
}
Modified: geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/trunk/modules/jetty-builder/src/test/org/apache/geronimo/jetty/deployment/JettyModuleBuilderTest.java Tue Oct 11 19:27:12 2005
@@ -68,6 +68,7 @@
import org.apache.geronimo.kernel.config.ConfigurationStore;
import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.security.SecurityServiceImpl;
@@ -117,11 +118,14 @@
builder.addGBeans(earContext, module, cl);
earContext.close();
module.close();
+
GBeanData configData = earContext.getConfigurationGBeanData();
+ ObjectName configName = configData.getName();
configData.setAttribute("baseURL", path.toURL());
kernel.loadGBean(configData, cl);
-
- kernel.startRecursiveGBean(configData.getName());
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
if (kernel.getGBeanState(configData.getName()) != State.RUNNING_INDEX) {
fail("gbean not started: " + configData.getName());
}
@@ -135,13 +139,17 @@
GBeanData filterMapping2Data = kernel.getGBeanData(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,Servlet=Servlet1,WebFilter=Filter2,WebModule=war4,j2eeType=WebFilterMapping"));
// assertEquals(Collections.singleton(ObjectName.getInstance("test:J2EEApplication=null,J2EEServer=bar,Servlet=Servlet1,WebFilter=Filter1,WebModule=war4,j2eeType=WebFilterMapping")), filterMapping2Data.getReferencePatterns("Previous"));
- kernel.stopGBean(configData.getName());
- kernel.unloadGBean(configData.getName());
+ kernel.stopGBean(configName);
+ kernel.unloadGBean(configName);
+
+ //what is this testing?
kernel.loadGBean(configData, cl);
- kernel.startRecursiveGBean(configData.getName());
- kernel.stopGBean(configData.getName());
- kernel.unloadGBean(configData.getName());
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
+ kernel.stopGBean(configName);
+ kernel.unloadGBean(configName);
}
private EARContext createEARContext(File outputPath, URI id) throws MalformedObjectNameException, DeploymentException {
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/basic/ProxyMethodInterceptor.java Tue Oct 11 19:27:12 2005
@@ -349,7 +349,7 @@
}
public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
- kernel.startRecursiveGBean(objectName);
+ kernel.startGBean(objectName);
return null;
}
}
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/Configuration.java Tue Oct 11 19:27:12 2005
@@ -128,11 +128,6 @@
*/
private final ConfigurationStore configurationStore;
- /**
- * Used to override stored attribute values with values set by the user.
- */
- private final ManageableAttributeStore manageableStore;
-
private final List dependencies;
private final List classPath;
private final String domain;
@@ -184,7 +179,6 @@
classPath = null;
baseURL = null;
repositories = null;
- manageableStore = null;
}
/**
@@ -210,8 +204,7 @@
byte[] gbeanState,
Collection repositories,
List dependencies,
- ConfigurationStore configurationStore,
- ManageableAttributeStore manageableStore) throws Exception {
+ ConfigurationStore configurationStore) throws Exception {
this.kernel = kernel;
this.objectNameString = objectName;
@@ -234,7 +227,6 @@
}
this.configurationStore = configurationStore;
- this.manageableStore = manageableStore;
this.domain = domain;
this.server = server;
@@ -267,6 +259,12 @@
configurationClassLoader = new MultiParentClassLoader(id, urls, getClassLoaders(parentId));
}
+// loadGBeans();
+
+ log.info("Started configuration " + id);
+ }
+
+ public void loadGBeans(ManageableAttributeStore attributeStore) throws InvalidConfigException, GBeanAlreadyExistsException {
// DSS: why exactally are we doing this? I bet there is a reason, but
// we should state why here.
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
@@ -274,7 +272,10 @@
Thread.currentThread().setContextClassLoader(configurationClassLoader);
// create and initialize GBeans
- Collection gbeans = loadGBeans(gbeanState, configurationClassLoader);
+ Collection gbeans = loadGBeans();
+ if (attributeStore != null) {
+ gbeans = attributeStore.setAttributes(id, gbeans);
+ }
// register all the GBeans
Set objectNames = new HashSet();
@@ -287,8 +288,15 @@
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
+ }
- log.info("Started configuration " + id);
+ public void startRecursiveGBeans() throws GBeanNotFoundException {
+ for (Iterator iterator = objectNames.iterator(); iterator.hasNext();) {
+ ObjectName gbeanName = (ObjectName) iterator.next();
+ if (kernel.isGBeanEnabled(gbeanName)) {
+ kernel.startRecursiveGBean(gbeanName);
+ }
+ }
}
private void addParentDependencies(Kernel kernel, URI id, URI[] parentId) throws MalformedObjectNameException {
@@ -488,11 +496,8 @@
}
private ObjectName loadGBean(GBeanData beanData, Set objectNames) throws GBeanAlreadyExistsException {
- // todo jnb: initializing attibutes here seems questionable - perhaps these should be injected
- // by the ConfigurationManager once the Configuration has been loaded
ObjectName name = beanData.getName();
setGBeanBaseUrl(beanData, baseURL);
- setManageableAttributes(beanData);
log.trace("Registering GBean " + name);
kernel.loadGBean(beanData, configurationClassLoader);
@@ -502,6 +507,7 @@
return name;
}
+/*
private void setManageableAttributes(GBeanData data) {
if(manageableStore == null) {
log.debug("Configuration cannot load manageable attributes; no manageable store present");
@@ -516,19 +522,18 @@
}
}
}
+*/
/**
* Load GBeans from the supplied byte array using the supplied ClassLoader
*
- * @param gbeanState the serialized form of the GBeans
- * @param cl the ClassLoader used to locate classes needed during deserialization
* @return a Map<ObjectName, GBeanMBean> of GBeans loaded from the persisted state
* @throws InvalidConfigException if there is a problem deserializing the state
*/
- private static Collection loadGBeans(byte[] gbeanState, ClassLoader cl) throws InvalidConfigException {
+ public Collection loadGBeans() throws InvalidConfigException {
Map gbeans = new HashMap();
try {
- ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), cl);
+ ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), configurationClassLoader);
try {
while (true) {
GBeanData gbeanData = new GBeanData();
@@ -630,11 +635,13 @@
infoFactory.addReference("Repositories", Repository.class, "GBean");
infoFactory.addReference("ConfigurationStore", ConfigurationStore.class);
- infoFactory.addReference("AttributeStore", ManageableAttributeStore.class);
+// infoFactory.addReference("AttributeStore", ManageableAttributeStore.class);
infoFactory.addOperation("addGBean", new Class[]{GBeanData.class, boolean.class});
infoFactory.addOperation("removeGBean", new Class[]{ObjectName.class});
infoFactory.addOperation("saveState");
+ infoFactory.addOperation("loadGBeans", new Class[] {ManageableAttributeStore.class});
+ infoFactory.addOperation("startRecursiveGBeans");
infoFactory.setConstructor(new String[]{
"kernel",
@@ -649,8 +656,8 @@
"gBeanState",
"Repositories",
"dependencies",
- "ConfigurationStore",
- "AttributeStore"});
+ "ConfigurationStore"
+ });
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Oct 11 19:27:12 2005
@@ -73,5 +73,8 @@
* @throws NoSuchConfigException if the configuration is now loaded into the kernel
*/
void unload(URI configID) throws NoSuchConfigException;
-
+
+ void start(ObjectName configName) throws InvalidConfigException;
+
+ void loadGBeans(ObjectName configName) throws InvalidConfigException;
}
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java Tue Oct 11 19:27:12 2005
@@ -45,6 +45,7 @@
private static final Log log = LogFactory.getLog(ConfigurationManagerImpl.class);
private final Kernel kernel;
private final Collection stores;
+ private final ManageableAttributeStore attributeStore;
private final ShutdownHook shutdownHook;
private static final ObjectName CONFIGURATION_NAME_QUERY;
@@ -56,11 +57,11 @@
}
}
- public ConfigurationManagerImpl(Kernel kernel, Collection stores) {
+ public ConfigurationManagerImpl(Kernel kernel, Collection stores, ManageableAttributeStore attributeStore) {
this.kernel = kernel;
this.stores = stores;
+ this.attributeStore = attributeStore;
shutdownHook = new ShutdownHook(kernel);
-
}
public List listStores() {
@@ -99,12 +100,31 @@
for (int i = 0; i < storeSnapshot.size(); i++) {
ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
if (store.containsConfiguration(configID)) {
- return store.loadConfiguration(configID);
+ ObjectName configName = store.loadConfiguration(configID);
+ return configName;
}
}
throw new NoSuchConfigException("No configuration with id: " + configID);
}
+ public void loadGBeans(ObjectName configName) throws InvalidConfigException {
+ try {
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {attributeStore}, new String[] {ManageableAttributeStore.class.getName()});
+ } catch (Exception e) {
+ throw new InvalidConfigException("Could not extract gbean data from configuration", e);
+ }
+ }
+
+ public void start(ObjectName configName) throws InvalidConfigException {
+ loadGBeans(configName);
+ try {
+ kernel.invoke(configName, "startRecursiveGBeans");
+ } catch (Exception e) {
+ throw new InvalidConfigException("Could not extract gbean data from configuration", e);
+ }
+ }
+
public List loadRecursive(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
LinkedList ancestors = new LinkedList();
Set preloaded = kernel.listGBeans(CONFIGURATION_NAME_QUERY);
@@ -181,8 +201,9 @@
GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ConfigurationManagerImpl.class, "ConfigurationManager");
infoFactory.addAttribute("kernel", Kernel.class, false);
infoFactory.addReference("Stores", ConfigurationStore.class, "ConfigurationStore");
+ infoFactory.addReference("AttributeStore", ManageableAttributeStore.class, ManageableAttributeStore.ATTRIBUTE_STORE);
infoFactory.addInterface(ConfigurationManager.class);
- infoFactory.setConstructor(new String[]{"kernel", "Stores"});
+ infoFactory.setConstructor(new String[]{"kernel", "Stores", "AttributeStore"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Tue Oct 11 19:27:12 2005
@@ -25,6 +25,8 @@
import javax.management.ObjectName;
+import org.apache.geronimo.gbean.GBeanData;
+
/**
* Interface to a store for Configurations.
*
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ManageableAttributeStore.java Tue Oct 11 19:27:12 2005
@@ -17,9 +17,12 @@
package org.apache.geronimo.kernel.config;
import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanData;
import javax.management.ObjectName;
import java.io.IOException;
+import java.net.URI;
+import java.util.Collection;
/**
* Able to retrieve the values of certain "manageable" attributes from a
@@ -29,6 +32,10 @@
* @version $Rev: 169154 $ $Date: 2005-05-08 15:35:23 -0400 (Sun, 08 May 2005) $
*/
public interface ManageableAttributeStore {
+
+ public static final String ATTRIBUTE_STORE = "AttributeStore";
+
+ public Collection setAttributes(URI configurationName, Collection datas) throws InvalidConfigException;
/**
* Return the object name of this store
* @return the object name of this store
Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/jmx/JMXProxyMethodInterceptor.java Tue Oct 11 19:27:12 2005
@@ -234,7 +234,7 @@
}
public Object invoke(ObjectName objectName, Object[] arguments) throws Throwable {
- kernel.startRecursiveGBean(objectName);
+ kernel.startGBean(objectName);
return null;
}
}
Modified: geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/trunk/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java Tue Oct 11 19:27:12 2005
@@ -25,6 +25,7 @@
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.kernel.config.ConfigurationManagerImpl;
import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.management.State;
/**
@@ -50,7 +51,9 @@
// load and start the config
kernel.loadGBean(config, this.getClass().getClassLoader());
- kernel.startRecursiveGBean(configName);
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configName));
assertNotNull(kernel.getAttribute(configName, "configurationClassLoader"));
@@ -104,7 +107,9 @@
// load and start the config
kernel.loadGBean(config, this.getClass().getClassLoader());
- kernel.startRecursiveGBean(configName);
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
assertEquals(State.RUNNING_INDEX, kernel.getGBeanState(configName));
assertNotNull(kernel.getAttribute(configName, "configurationClassLoader"));
Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalAttributeManager.java Tue Oct 11 19:27:12 2005
@@ -16,32 +16,40 @@
*/
package org.apache.geronimo.system.configuration;
-import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import java.beans.PropertyEditor;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.propertyeditor.PropertyEditors;
import org.apache.geronimo.gbean.GAttributeInfo;
-import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.common.propertyeditor.PropertyEditors;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
-
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Iterator;
-import java.beans.PropertyEditor;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
* Stores managed attributes in an XML file on the local filesystem.
@@ -50,9 +58,9 @@
*/
public class LocalAttributeManager implements ManageableAttributeStore, GBeanLifecycle {
private final static Log log = LogFactory.getLog(LocalAttributeManager.class);
- private final static String BACKUP_EXTENSION=".bak";
- private final static String TEMP_EXTENSION=".working";
- private final static int SAVE_BUFFER_MS=5000;
+ private final static String BACKUP_EXTENSION = ".bak";
+ private final static String TEMP_EXTENSION = ".working";
+ private final static int SAVE_BUFFER_MS = 5000;
private final ServerInfo serverInfo;
private final String configFile;
@@ -79,71 +87,109 @@
this.readOnly = readOnly;
}
+ public Collection setAttributes(URI configurationName, Collection datas) throws InvalidConfigException {
+ String configName = configurationName.toString();
+ Map configInfo = (Map) configurations.get(configName);
+ if (configInfo != null) {
+ for (Iterator iterator = datas.iterator(); iterator.hasNext();) {
+ GBeanData data = (GBeanData) iterator.next();
+ setAttributes(data, configInfo, configName);
+ }
+ }
+ return datas;
+ }
+
+ private void setAttributes(GBeanData data, Map configInfo, String configName) throws InvalidConfigException {
+ ObjectName gbeanName = data.getName();
+ GBeanInfo gBeanInfo = data.getGBeanInfo();
+ Map attributeMap = (Map) configInfo.get(gbeanName);
+ if (attributeMap == null) {
+ attributeMap = (Map) configInfo.get(gbeanName.getKeyProperty("name"));
+ if (attributeMap != null) {
+ for (Iterator iterator = attributeMap.entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String attributeName = (String) entry.getKey();
+ GAttributeInfo attributeInfo = gBeanInfo.getAttribute(attributeName);
+ if (attributeInfo == null) {
+ throw new InvalidConfigException("No attribute: " + attributeName + " for gbean: " + data.getName());
+ }
+ String valueString = (String) entry.getValue();
+ Object value = getValue(attributeInfo, valueString, configName, gbeanName);
+ data.setAttribute(attributeName, value);
+ }
+ }
+ }
+ }
+
public String getObjectName() {
return objectName;
}
public Object getValue(String configurationName, ObjectName gbean, GAttributeInfo attribute) {
Map config = (Map) configurations.get(configurationName);
- if(config == null) {
+ if (config == null) {
return null; // nothing specified for this configuration
}
Map atts = (Map) config.get(gbean);
- if(atts == null) {
- atts = (Map)config.get(gbean.getKeyProperty("name"));
+ if (atts == null) {
+ atts = (Map) config.get(gbean.getKeyProperty("name"));
}
- if(atts == null) {
+ if (atts == null) {
return null; // nothing specified for this GBean
}
String value = (String) atts.get(attribute.getName());
- if(value == null) {
+ if (value == null) {
return null; // nothing specified for this attribute
}
+ return getValue(attribute, value, configurationName, gbean);
+ }
+
+ private Object getValue(GAttributeInfo attribute, String value, String configurationName, ObjectName gbeanName) {
try {
PropertyEditor editor = PropertyEditors.findEditor(attribute.getType(), getClass().getClassLoader());
if (editor == null) {
- log.debug("Unable to parse attribute of type "+attribute.getType()+"; no editor found");
+ log.debug("Unable to parse attribute of type " + attribute.getType() + "; no editor found");
return null;
}
editor.setAsText(value);
- log.debug("Setting value for "+configurationName+"/"+gbean+"/" + attribute.getName() + " to value " + value);
+ log.debug("Setting value for " + configurationName + "/" + gbeanName + "/" + attribute.getName() + " to value " + value);
return editor.getValue();
} catch (ClassNotFoundException e) {
//todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
- log.error("Unable to load attribute type "+attribute.getType());
+ log.error("Unable to load attribute type " + attribute.getType());
return null;
}
}
public synchronized void setValue(String configurationName, ObjectName gbean, GAttributeInfo attribute, Object value) {
- if(readOnly) {
+ if (readOnly) {
return;
}
Map config = (Map) configurations.get(configurationName);
- if(config == null) {
+ if (config == null) {
config = new HashMap();
configurations.put(configurationName, config);
}
Map atts = (Map) config.get(gbean);
- if(atts == null) {
+ if (atts == null) {
atts = (Map) config.get(gbean.getKeyProperty("name"));
- if(atts == null) {
+ if (atts == null) {
atts = new HashMap();
config.put(gbean, atts);
}
}
try {
String string = null;
- if(value != null) {
+ if (value != null) {
PropertyEditor editor = PropertyEditors.findEditor(attribute.getType(), getClass().getClassLoader());
if (editor == null) {
- log.error("Unable to format attribute of type "+attribute.getType()+"; no editor found");
+ log.error("Unable to format attribute of type " + attribute.getType() + "; no editor found");
return;
}
editor.setValue(value);
string = editor.getAsText();
}
- if(string == null) {
+ if (string == null) {
atts.remove(attribute.getName());
} else {
atts.put(attribute.getName(), string);
@@ -151,13 +197,13 @@
updater.attributeChanged();
} catch (ClassNotFoundException e) {
//todo: use the Configuration's ClassLoader to load the attribute, if this ever becomes an issue
- log.error("Unable to store attribute type "+attribute.getType());
+ log.error("Unable to store attribute type " + attribute.getType());
}
}
public void load() throws IOException {
ensureParentDirectory();
- if(!attributeFile.exists()) {
+ if (!attributeFile.exists()) {
return;
}
configurations.clear();
@@ -168,31 +214,31 @@
Document doc = dfactory.newDocumentBuilder().parse(in);
Element root = doc.getDocumentElement();
NodeList configs = root.getElementsByTagName("configuration");
- for(int c=0; c<configs.getLength(); c++) {
- Element config = (Element)configs.item(c);
+ for (int c = 0; c < configs.getLength(); c++) {
+ Element config = (Element) configs.item(c);
String configName = config.getAttribute("name");
Map configMap = new LinkedHashMap();
results.put(configName, configMap);
NodeList gbeans = config.getElementsByTagName("gbean");
- for(int g=0; g<gbeans.getLength(); g++) {
- Element gbean = (Element)gbeans.item(g);
+ for (int g = 0; g < gbeans.getLength(); g++) {
+ Element gbean = (Element) gbeans.item(g);
String gbeanName = gbean.getAttribute("name");
Map gbeanMap = new LinkedHashMap();
- if(gbeanName.indexOf(':') > -1) {
+ if (gbeanName.indexOf(':') > -1) {
ObjectName name = ObjectName.getInstance(gbeanName);
configMap.put(name, gbeanMap);
} else {
configMap.put(gbeanName, gbeanMap);
}
NodeList attributes = gbean.getElementsByTagName("attribute");
- for(int a=0; a<attributes.getLength(); a++) {
- Element attribute = (Element)attributes.item(a);
+ for (int a = 0; a < attributes.getLength(); a++) {
+ Element attribute = (Element) attributes.item(a);
String attName = attribute.getAttribute("name");
String value = "";
NodeList text = attribute.getChildNodes();
- for(int t=0; t<text.getLength(); t++) {
+ for (int t = 0; t < text.getLength(); t++) {
Node n = text.item(t);
- if(n.getNodeType() == Node.TEXT_NODE) {
+ if (n.getNodeType() == Node.TEXT_NODE) {
value += n.getNodeValue();
}
}
@@ -211,15 +257,15 @@
}
public synchronized void save() throws IOException {
- if(readOnly) {
+ if (readOnly) {
return;
}
ensureParentDirectory();
- if(!tempFile.exists() && !tempFile.createNewFile()) {
- throw new IOException("Unable to create manageable attribute working file for save "+tempFile.getAbsolutePath());
+ if (!tempFile.exists() && !tempFile.createNewFile()) {
+ throw new IOException("Unable to create manageable attribute working file for save " + tempFile.getAbsolutePath());
}
- if(!tempFile.canWrite()) {
- throw new IOException("Unable to write to manageable attribute working file for save "+tempFile.getAbsolutePath());
+ if (!tempFile.canWrite()) {
+ throw new IOException("Unable to write to manageable attribute working file for save " + tempFile.getAbsolutePath());
}
PrintWriter out = new PrintWriter(new FileWriter(tempFile), true);
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
@@ -227,17 +273,17 @@
out.println("<attributes xmlns=\"http://geronimo.apache.org/xml/ns/attributes\">");
for (Iterator it = configurations.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
- out.println(" <configuration name=\""+entry.getKey()+"\">");
+ out.println(" <configuration name=\"" + entry.getKey() + "\">");
Map map = (Map) entry.getValue();
for (Iterator gb = map.entrySet().iterator(); gb.hasNext();) {
Map.Entry gbean = (Map.Entry) gb.next();
- String gbeanName = gbean.getKey() instanceof String ? (String)gbean.getKey() : ((ObjectName)gbean.getKey()).getCanonicalName();
- out.println(" <gbean name=\""+gbeanName+"\">");
- Map atts = (Map)gbean.getValue();
+ String gbeanName = gbean.getKey() instanceof String ? (String) gbean.getKey() : ((ObjectName) gbean.getKey()).getCanonicalName();
+ out.println(" <gbean name=\"" + gbeanName + "\">");
+ Map atts = (Map) gbean.getValue();
for (Iterator att = atts.entrySet().iterator(); att.hasNext();) {
Map.Entry attribute = (Map.Entry) att.next();
- out.print(" <attribute name=\""+attribute.getKey()+"\">");
- out.print((String)attribute.getValue());
+ out.print(" <attribute name=\"" + attribute.getKey() + "\">");
+ out.print((String) attribute.getValue());
out.println("</attribute>");
}
out.println(" </gbean>");
@@ -246,44 +292,44 @@
}
out.println("</attributes>");
out.close();
- if(backupFile.exists()) {
- if(!backupFile.delete()) {
+ if (backupFile.exists()) {
+ if (!backupFile.delete()) {
throw new IOException("Unable to delete old backup file in order to back up current manageable attribute working file for save");
}
}
- if(attributeFile.exists()) {
- if(!attributeFile.renameTo(backupFile)) {
- throw new IOException("Unable to rename "+attributeFile.getAbsolutePath()+" to "+backupFile.getAbsolutePath()+" in order to back up manageable attribute save file");
+ if (attributeFile.exists()) {
+ if (!attributeFile.renameTo(backupFile)) {
+ throw new IOException("Unable to rename " + attributeFile.getAbsolutePath() + " to " + backupFile.getAbsolutePath() + " in order to back up manageable attribute save file");
}
}
- if(!tempFile.renameTo(attributeFile)) {
- throw new IOException("EXTREMELY CRITICAL! Unable to move manageable attributes working file to proper file name! Configuration will revert to defaults unless this is manually corrected! (could not rename "+tempFile.getAbsolutePath()+" to "+attributeFile.getAbsolutePath()+")");
+ if (!tempFile.renameTo(attributeFile)) {
+ throw new IOException("EXTREMELY CRITICAL! Unable to move manageable attributes working file to proper file name! Configuration will revert to defaults unless this is manually corrected! (could not rename " + tempFile.getAbsolutePath() + " to " + attributeFile.getAbsolutePath() + ")");
}
}
public void doStart() throws Exception {
load();
- if(!readOnly) {
+ if (!readOnly) {
updater = new UpdateThread();
updater.start();
}
- log.info("Started LocalAttributeManager with data on "+configurations.size()+" configurations");
+ log.info("Started LocalAttributeManager with data on " + configurations.size() + " configurations");
}
public void doStop() throws Exception {
- if(updater != null) {
+ if (updater != null) {
updater.shutdown();
- if(updater.isPending()) {
+ if (updater.isPending()) {
save();
}
updater = null;
}
- log.info("Stopped LocalAttributeManager with data on "+configurations.size()+" configurations");
+ log.info("Stopped LocalAttributeManager with data on " + configurations.size() + " configurations");
configurations.clear();
}
public void doFail() {
- if(updater != null) {
+ if (updater != null) {
updater.shutdown();
updater = null;
}
@@ -291,10 +337,10 @@
}
private void ensureParentDirectory() throws IOException {
- if(attributeFile == null) {
+ if (attributeFile == null) {
attributeFile = serverInfo.resolve(configFile);
- tempFile = new File(attributeFile.getAbsolutePath()+TEMP_EXTENSION);
- backupFile = new File(attributeFile.getAbsolutePath()+BACKUP_EXTENSION);
+ tempFile = new File(attributeFile.getAbsolutePath() + TEMP_EXTENSION);
+ backupFile = new File(attributeFile.getAbsolutePath() + BACKUP_EXTENSION);
}
File parent = attributeFile.getParentFile();
if (!parent.isDirectory()) {
@@ -302,8 +348,8 @@
throw new IOException("Unable to create directory for list:" + parent);
}
}
- if(!parent.canRead() || !parent.canWrite()) {
- throw new IOException("Unable to write manageable attribute files to directory "+parent.getAbsolutePath());
+ if (!parent.canRead() || !parent.canWrite()) {
+ throw new IOException("Unable to write manageable attribute files to directory " + parent.getAbsolutePath());
}
}
@@ -331,16 +377,17 @@
}
public void run() {
- while(!isDone()) {
+ while (!isDone()) {
// Wait until at least one change has been made
- synchronized(LocalAttributeManager.this) {
- if(!pending) {
+ synchronized (LocalAttributeManager.this) {
+ if (!pending) {
try {
LocalAttributeManager.this.wait();
pending = true;
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ }
}
- if(done) {
+ if (done) {
return;
}
}
@@ -349,11 +396,12 @@
// Don't synchronize this as it holds monitors while sleeping
try {
sleep(SAVE_BUFFER_MS);
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ }
// Save
synchronized (LocalAttributeManager.this) {
- if(!isDone()) {
+ if (!isDone()) {
try {
save();
} catch (IOException e) {
@@ -396,7 +444,7 @@
infoFactory.addAttribute("objectName", String.class, false);
infoFactory.addInterface(ManageableAttributeStore.class);
- infoFactory.setConstructor(new String[]{"ServerInfo","configFile","objectName"});
+ infoFactory.setConstructor(new String[]{"ServerInfo", "configFile", "objectName"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/configuration/LocalConfigStore.java Tue Oct 11 19:27:12 2005
@@ -255,13 +255,7 @@
throw new InvalidConfigException("Cannot convert id to ObjectName: ", e);
}
config.setName(name);
- ObjectName pattern;
- try {
- pattern = attributeStore == null ? null : new ObjectName(attributeStore.getObjectName());
- } catch (MalformedObjectNameException e) {
- throw new InvalidConfigException("Invalid ObjectName for AttributeStore: " + attributeStore.getObjectName());
- }
- config.setReferencePattern("AttributeStore", pattern);
+ config.setAttribute("baseURL", getRoot(configId).toURL());
try {
kernel.loadGBean(config, Configuration.class.getClassLoader());
@@ -269,16 +263,6 @@
throw new InvalidConfigException("Unable to register configuration", e);
}
- try {
- kernel.setAttribute(name, "baseURL", getRoot(configId).toURL());
- } catch (Exception e) {
- try {
- kernel.unloadGBean(name);
- } catch (Exception ignored) {
- // ignore
- }
- throw new InvalidConfigException("Cannot set baseURL", e);
- }
log.info("Loaded Configuration " + name);
return name;
Modified: geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java?rev=314753&r1=314752&r2=314753&view=diff
==============================================================================
--- geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java (original)
+++ geronimo/trunk/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java Tue Oct 11 19:27:12 2005
@@ -33,6 +33,7 @@
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ManageableAttributeStore;
import org.apache.geronimo.kernel.log.GeronimoLogging;
@@ -105,6 +106,7 @@
URI configurationId = (URI) configuration.getAttribute("id");
ObjectName configName = Configuration.getConfigurationObjectName(configurationId);
configuration.setName(configName);
+ configuration.setAttribute("baseURL", classLoader.getResource("/"));
// boot the kernel
kernel = KernelFactory.newInstance().createKernel("geronimo");
@@ -112,8 +114,9 @@
// load this configuration into the kernel
kernel.loadGBean(configuration, classLoader);
- kernel.setAttribute(configName, "baseURL", classLoader.getResource("/"));
- kernel.startRecursiveGBean(configName);
+ kernel.startGBean(configName);
+ kernel.invoke(configName, "loadGBeans", new Object[] {null}, new String[] {ManageableAttributeStore.class.getName()});
+ kernel.invoke(configName, "startRecursiveGBeans");
// load and start the configurations
ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
@@ -123,7 +126,7 @@
List list = configurationManager.loadRecursive(configID);
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
ObjectName name = (ObjectName) iterator.next();
- kernel.startRecursiveGBean(name);
+ configurationManager.start(name);
}
}
} finally {