You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/01/17 04:44:38 UTC
cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/scanner URLInfo.java
jboynes 2004/01/16 19:44:38
Modified: modules/deployment project.xml
modules/deployment/src/java/org/apache/geronimo/deployment
BatchDeployer.java Bootstrap.java
modules/deployment/src/java/org/apache/geronimo/deployment/service
ServiceDeployer.java
modules/deployment/src/java/org/apache/geronimo/deployment/tools
DeployCommand.java
modules/deployment/src/test-resources/services service1.xml
service2.jar
modules/deployment/src/test-resources/services/service3/META-INF
geronimo-service.xml
modules/deployment/src/test/org/apache/geronimo/deployment
MockGBean.java
modules/deployment/src/test/org/apache/geronimo/deployment/service
ServiceDeployerTest.java
modules/kernel/src/java/org/apache/geronimo/kernel
Kernel.java
modules/kernel/src/java/org/apache/geronimo/kernel/deployment/scanner
URLInfo.java
Added: modules/deployment/src/test/org/apache/geronimo/deployment/service
ParentDeployerTest.java
Log:
fix problem with non-String default values during deployment
allow deployer to take a parent configuration
Revision Changes Path
1.2 +9 -1 incubator-geronimo/modules/deployment/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 16 Jan 2004 03:48:42 -0000 1.1
+++ project.xml 17 Jan 2004 03:44:38 -0000 1.2
@@ -63,6 +63,14 @@
</properties>
</dependency>
+ <dependency>
+ <groupId>geronimo</groupId>
+ <artifactId>geronimo-common</artifactId>
+ <version>DEV</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
</dependencies>
1.3 +11 -3 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/BatchDeployer.java
Index: BatchDeployer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/BatchDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BatchDeployer.java 16 Jan 2004 23:02:02 -0000 1.2
+++ BatchDeployer.java 17 Jan 2004 03:44:38 -0000 1.3
@@ -81,6 +81,7 @@
import javax.management.ObjectName;
import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationParent;
import org.apache.geronimo.kernel.deployment.DeploymentException;
import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
import org.apache.geronimo.gbean.GAttributeInfo;
@@ -93,6 +94,7 @@
* @version $Revision$ $Date$
*/
public class BatchDeployer implements ConfigurationCallback {
+ private final ConfigurationParent parent;
private final URI configRoot;
private final List deployers;
private final Set moduleIDs = new HashSet();
@@ -102,11 +104,12 @@
private final Map gbeans = new HashMap();
private final byte[] buffer = new byte[4096];
- public BatchDeployer(URI configID, List deployers, File workingDir) {
+ public BatchDeployer(ConfigurationParent parent, URI configID, List deployers, File workingDir) {
if (!workingDir.isDirectory()) {
throw new IllegalArgumentException("workingDir is not a directory");
}
+ this.parent = parent;
this.configRoot = workingDir.toURI();
this.deployers = deployers;
try {
@@ -188,7 +191,12 @@
throw new DeploymentException("Unable to convert classPath URI to absolute URL: " + uri, e);
}
}
- ClassLoader cl = new URLClassLoader(urls);
+ ClassLoader cl;
+ if (parent == null) {
+ cl = new URLClassLoader(urls);
+ } else {
+ cl = new URLClassLoader(urls, parent.getClassLoader());
+ }
// get the GBeans from each module
for (Iterator i = modules.iterator(); i.hasNext();) {
1.2 +2 -2 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Bootstrap.java
Index: Bootstrap.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/Bootstrap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Bootstrap.java 16 Jan 2004 23:01:17 -0000 1.1
+++ Bootstrap.java 17 Jan 2004 03:44:38 -0000 1.2
@@ -136,7 +136,7 @@
try {
File workDir = new File(tmpDir, "deployment");
workDir.mkdir();
- BatchDeployer deployer = new BatchDeployer(CONFIG_ID, deployers, workDir);
+ BatchDeployer deployer = new BatchDeployer(null, CONFIG_ID, deployers, workDir);
deployer.addSource(new URLInfo(serviceURL, URLType.getType(serviceURL)));
deployer.deploy();
1.4 +15 -2 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceDeployer.java
Index: ServiceDeployer.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceDeployer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceDeployer.java 17 Jan 2004 01:32:38 -0000 1.3
+++ ServiceDeployer.java 17 Jan 2004 03:44:38 -0000 1.4
@@ -64,6 +64,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@@ -75,6 +77,7 @@
import org.apache.geronimo.kernel.deployment.DeploymentException;
import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
import org.apache.geronimo.kernel.deployment.service.XMLUtil;
+import org.apache.geronimo.common.Classes;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -136,7 +139,17 @@
for (int i = 0; i < nl.getLength(); i++) {
Element defaultElement = (Element) nl.item(i);
String attr = defaultElement.getAttribute("attribute");
- String value = (String) XMLUtil.getContent(defaultElement);
+ String type = defaultElement.getAttribute("type");
+ Object value = XMLUtil.getContent(defaultElement);
+ try {
+ PropertyEditor editor = PropertyEditorManager.findEditor(Classes.loadClass(type));
+ if (editor != null) {
+ editor.setAsText((String) value);
+ value = editor.getValue();
+ }
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException("Could not load attribute class", e);
+ }
values.put(attr, value);
}
NodeList endpointList = gbeanElement.getElementsByTagName("endpoint");
1.2 +2 -2 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/tools/DeployCommand.java
Index: DeployCommand.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/tools/DeployCommand.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeployCommand.java 16 Jan 2004 03:48:42 -0000 1.1
+++ DeployCommand.java 17 Jan 2004 03:44:38 -0000 1.2
@@ -87,7 +87,7 @@
public DeployCommand(File configFile, URI configID, File workDir, List deployers) {
this.configFile = configFile;
- batcher = new BatchDeployer(configID, deployers, workDir);
+ batcher = new BatchDeployer(null, configID, deployers, workDir);
}
public void add(URL url) throws IOException, DeploymentException, NoDeployerException {
1.2 +2 -1 incubator-geronimo/modules/deployment/src/test-resources/services/service1.xml
Index: service1.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/test-resources/services/service1.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- service1.xml 16 Jan 2004 03:48:43 -0000 1.1
+++ service1.xml 17 Jan 2004 03:44:38 -0000 1.2
@@ -1,5 +1,6 @@
<gbeans>
<gbean class="org.apache.geronimo.deployment.MockGBean" objectName="geronimo.test:name=MyMockGMBean">
- <default attribute="Value">1234</default>
+ <default attribute="Value" type="java.lang.String">1234</default>
+ <default attribute="IntValue" type="int">1234</default>
</gbean>
</gbeans>
1.2 +2 -1 incubator-geronimo/modules/deployment/src/test-resources/services/service2.jar
<<Binary file>>
1.3 +2 -1 incubator-geronimo/modules/deployment/src/test-resources/services/service3/META-INF/geronimo-service.xml
Index: geronimo-service.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/test-resources/services/service3/META-INF/geronimo-service.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- geronimo-service.xml 16 Jan 2004 23:11:02 -0000 1.2
+++ geronimo-service.xml 17 Jan 2004 03:44:38 -0000 1.3
@@ -1,7 +1,8 @@
<gbeans>
<path>classes/</path>
<gbean class="org.apache.geronimo.deployment.MockGBean" objectName="geronimo.test:name=MyMockGMBean">
- <default attribute="Value">1234</default>
+ <default attribute="Value" type="java.lang.String">1234</default>
+ <default attribute="IntValue" type="int">1234</default>
<endpoint name="MockEndpoint">
<pattern>geronimo.test:name=MockEndpoint</pattern>
</endpoint>
1.3 +11 -1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/MockGBean.java
Index: MockGBean.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/MockGBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MockGBean.java 16 Jan 2004 23:31:21 -0000 1.2
+++ MockGBean.java 17 Jan 2004 03:44:38 -0000 1.3
@@ -73,6 +73,7 @@
private static final GBeanInfo GBEAN_INFO;
private final String name;
private String value;
+ private int intValue;
private MockEndpoint endpoint;
@@ -84,6 +85,7 @@
GBeanInfoFactory infoFactory = new GBeanInfoFactory("MockGBean", MockGBean.class.getName());
infoFactory.addAttribute(new GAttributeInfo("Name", true));
infoFactory.addAttribute(new GAttributeInfo("Value", true));
+ infoFactory.addAttribute(new GAttributeInfo("IntValue", true));
infoFactory.addOperation(new GOperationInfo("checkResource", new String[]{"java.lang.String"}));
infoFactory.addOperation(new GOperationInfo("checkEndpoint"));
infoFactory.addOperation(new GOperationInfo("doSomething", new String[]{"java.lang.String"}));
@@ -106,6 +108,14 @@
public void setValue(String value) {
this.value = value;
+ }
+
+ public int getIntValue() {
+ return intValue;
+ }
+
+ public void setIntValue(int intValue) {
+ this.intValue = intValue;
}
public MockEndpoint getMockEndpoint() {
1.4 +7 -18 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/service/ServiceDeployerTest.java
Index: ServiceDeployerTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/service/ServiceDeployerTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceDeployerTest.java 16 Jan 2004 23:11:02 -0000 1.3
+++ ServiceDeployerTest.java 17 Jan 2004 03:44:38 -0000 1.4
@@ -75,6 +75,7 @@
import org.apache.geronimo.deployment.ConfigurationCallback;
import org.apache.geronimo.deployment.BatchDeployer;
+import org.apache.geronimo.deployment.util.FileUtil;
import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
import org.apache.geronimo.kernel.deployment.scanner.URLType;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
@@ -130,6 +131,7 @@
try {
assertEquals(new ObjectName("geronimo.test:name=MyMockGMBean"), name);
assertEquals("1234", gbean.getAttribute("Value"));
+ assertEquals(new Integer(1234), gbean.getAttribute("IntValue"));
} catch (Exception e) {
fail();
}
@@ -171,6 +173,7 @@
try {
assertEquals(new ObjectName("geronimo.test:name=MyMockGMBean"), name);
assertEquals("1234", gbean.getAttribute("Value"));
+ assertEquals(new Integer(1234), gbean.getAttribute("IntValue"));
} catch (Exception e) {
fail();
}
@@ -212,6 +215,7 @@
try {
assertEquals(new ObjectName("geronimo.test:name=MyMockGMBean"), name);
assertEquals("1234", gbean.getAttribute("Value"));
+ assertEquals(new Integer(1234), gbean.getAttribute("IntValue"));
assertEquals(Collections.singleton(ObjectName.getInstance("geronimo.test:name=MockEndpoint")), gbean.getEndpointPatterns("MockEndpoint"));
} catch (Exception e) {
fail(e.getMessage());
@@ -268,26 +272,11 @@
workDir = new File(tmpDir, "test.car.work");
workDir.mkdir();
configFile = new File(tmpDir, "test.car");
- batcher = new BatchDeployer(URI.create("test"), Collections.singletonList(deployer), workDir);
+ batcher = new BatchDeployer(null, URI.create("test"), Collections.singletonList(deployer), workDir);
}
protected void tearDown() throws Exception {
- recursiveDelete(workDir);
+ FileUtil.recursiveDelete(workDir);
configFile.delete();
- }
-
- private static void recursiveDelete(File root) throws Exception {
- File[] files = root.listFiles();
- if (files != null) {
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- if (file.isDirectory()) {
- recursiveDelete(file);
- } else {
- file.delete();
- }
- }
- }
- root.delete();
}
}
1.1 incubator-geronimo/modules/deployment/src/test/org/apache/geronimo/deployment/service/ParentDeployerTest.java
Index: ParentDeployerTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.deployment.service;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.ObjectOutputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.management.ObjectName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.geronimo.deployment.BatchDeployer;
import org.apache.geronimo.deployment.util.FileUtil;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationParent;
import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
import org.apache.geronimo.kernel.jmx.MBeanProxyFactory;
import junit.framework.TestCase;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/17 03:44:38 $
*/
public class ParentDeployerTest extends TestCase {
private DocumentBuilder parser;
private ServiceDeployer deployer;
private File workDir;
private Kernel kernel;
private byte[] state;
public void testParent() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
ObjectName parentName = new ObjectName("geronimo.test:name=Parent");
GBeanMBean parentGBean = new GBeanMBean(Configuration.GBEAN_INFO);
List parentPath = new ArrayList();
parentPath.add(new URI(cl.getResource("services/").toString()));
parentGBean.setAttribute("ClassPath", parentPath);
parentGBean.setAttribute("GBeanState", state);
kernel.load(parentGBean, null, parentName);
kernel.getMBeanServer().invoke(parentName, "start", null, null);
ConfigurationParent parent = (ConfigurationParent) MBeanProxyFactory.getProxy(ConfigurationParent.class, kernel.getMBeanServer(), parentName);
ClassLoader parentCL = parent.getClassLoader();
assertNotNull(parentCL.getResource("service1.xml"));
assertNull(parentCL.getResource("test-resource.dat"));
ObjectName childName = new ObjectName("geronimo.test:name=Child");
BatchDeployer batcher = new BatchDeployer(parent, URI.create("test"), Collections.singletonList(deployer), workDir);
batcher.addSource(new URLInfo(cl.getResource("services/service3/")));
batcher.deploy();
GBeanMBean childConfig = batcher.getConfiguration();
childConfig.setEndpointPatterns("Parent", Collections.singleton(new ObjectName("*:name=Parent")));
kernel.load(childConfig, cl.getResource("services/"), childName);
kernel.getMBeanServer().invoke(childName, "start", null, null);
ClassLoader childCL = (ClassLoader) kernel.getMBeanServer().getAttribute(childName, "ClassLoader");
assertNotNull(childCL.getResource("service1.xml")); // loaded by parent
assertNotNull(childCL.getResource("test-resource.dat")); // loaded by child
}
protected void setUp() throws Exception {
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
deployer = new ServiceDeployer(parser);
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
workDir = new File(tmpDir, "test.car.work");
workDir.mkdir();
kernel = new Kernel("geronimo");
kernel.boot();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.close();
state = baos.toByteArray();
}
protected void tearDown() throws Exception {
kernel.shutdown();
FileUtil.recursiveDelete(workDir);
}
}
1.4 +37 -16 incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java
Index: Kernel.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/Kernel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Kernel.java 14 Jan 2004 22:16:38 -0000 1.3
+++ Kernel.java 17 Jan 2004 03:44:38 -0000 1.4
@@ -140,6 +140,14 @@
}
/**
+ * Construct a Kernel which does not have a config store.
+ * @param domainName
+ */
+ public Kernel(String domainName) {
+ this(domainName, null, null);
+ }
+
+ /**
* Get the MBeanServer used by this kernel
* @return the MBeanServer used by this kernel
*/
@@ -154,11 +162,16 @@
* @throws org.apache.geronimo.kernel.config.NoSuchConfigException if the store does not contain the specified Configuratoin
* @throws java.io.IOException if the Configuration could not be read from the store
* @throws org.apache.geronimo.kernel.config.InvalidConfigException if the Configuration is not valid
+ * @throws java.lang.UnsupportedOperationException if this kernel does not have a store
*/
public ObjectName load(URI configID) throws NoSuchConfigException, IOException, InvalidConfigException {
if (!running) {
throw new IllegalStateException("Kernel is not running");
}
+ if (store == null) {
+ throw new UnsupportedOperationException("Kernel does not have a ConfigurationStore");
+ }
+
GBeanMBean config = store.getConfig(configID);
URL baseURL = store.getBaseURL(configID);
return load(config, baseURL);
@@ -180,7 +193,7 @@
}
ObjectName configName;
try {
- configName = new ObjectName("geronimo.config:name="+ObjectName.quote(configID.toString()));
+ configName = new ObjectName("geronimo.config:name=" + ObjectName.quote(configID.toString()));
} catch (MalformedObjectNameException e) {
throw new InvalidConfigException("Cannot convert ID to ObjectName: ", e);
}
@@ -230,7 +243,7 @@
}
throw new InvalidConfigException("Cannot set MBeanServer info", e);
}
- log.info("Loaded Configuration "+configName);
+ log.info("Loaded Configuration " + configName);
}
/**
@@ -245,11 +258,11 @@
try {
mbServer.unregisterMBean(configName);
} catch (InstanceNotFoundException e) {
- throw new NoSuchConfigException("No config registered: "+configName, e);
+ throw new NoSuchConfigException("No config registered: " + configName, e);
} catch (MBeanRegistrationException e) {
- throw (IllegalStateException) new IllegalStateException("Error deregistering configuration "+configName).initCause(e);
+ throw (IllegalStateException) new IllegalStateException("Error deregistering configuration " + configName).initCause(e);
}
- log.info("Unloaded Configuration "+configName);
+ log.info("Unloaded Configuration " + configName);
}
/**
@@ -266,11 +279,13 @@
mbServer = MBeanServerFactory.createMBeanServer(domainName);
mbServer.registerMBean(this, KERNEL);
mbServer.registerMBean(new DependencyService2(), DEPENDENCY_SERVICE);
- storeGBean = new GBeanMBean(storeInfo);
- storeGBean.setAttribute("root", configStore);
- mbServer.registerMBean(storeGBean, CONFIG_STORE);
- storeGBean.start();
- store = (ConfigurationStore) storeGBean.getTarget();
+ if (storeInfo != null) {
+ storeGBean = new GBeanMBean(storeInfo);
+ storeGBean.setAttribute("root", configStore);
+ mbServer.registerMBean(storeGBean, CONFIG_STORE);
+ storeGBean.start();
+ store = (ConfigurationStore) storeGBean.getTarget();
+ }
running = true;
log.info("Booted");
}
@@ -288,15 +303,21 @@
store = null;
try {
- storeGBean.stop();
+ if (storeGBean != null) {
+ storeGBean.stop();
+ }
} catch (Exception e) {
// ignore
}
try {
- mbServer.unregisterMBean(CONFIG_STORE);
+ if (storeGBean != null) {
+ mbServer.unregisterMBean(CONFIG_STORE);
+ }
} catch (Exception e) {
// ignore
}
+ storeGBean = null;
+
try {
mbServer.unregisterMBean(DEPENDENCY_SERVICE);
} catch (Exception e) {
@@ -332,7 +353,7 @@
*/
public static void main(String[] args) {
if (args.length < 2) {
- System.err.println("usage: "+Kernel.class.getName()+" <config-store-dir> <config-id>");
+ System.err.println("usage: " + Kernel.class.getName() + " <config-store-dir> <config-id>");
System.exit(1);
}
File storeDir = new File(args[0]);
@@ -347,12 +368,12 @@
String domain = "geronimo";
if (storeDir.exists()) {
if (!storeDir.isDirectory() || !storeDir.canWrite()) {
- System.err.println("Store location is not a writable directory: "+storeDir);
+ System.err.println("Store location is not a writable directory: " + storeDir);
System.exit(1);
}
} else {
if (!storeDir.mkdirs()) {
- System.err.println("Could not create store directory: "+storeDir);
+ System.err.println("Could not create store directory: " + storeDir);
System.exit(1);
}
}
1.2 +6 -1 incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/scanner/URLInfo.java
Index: URLInfo.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/scanner/URLInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- URLInfo.java 8 Sep 2003 04:38:33 -0000 1.1
+++ URLInfo.java 17 Jan 2004 03:44:38 -0000 1.2
@@ -56,6 +56,7 @@
package org.apache.geronimo.kernel.deployment.scanner;
import java.net.URL;
+import java.io.IOException;
/**
*
@@ -71,6 +72,10 @@
assert type != null : "type was null";
this.url = url;
this.type = type;
+ }
+
+ public URLInfo(URL url) throws IOException {
+ this(url, URLType.getType(url));
}
public URLType getType() {