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 2004/01/16 23:19:51 UTC
cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service GBeanDefault.java ServiceDeployer.java ServiceModule.java
djencks 2004/01/16 14:19:51
Modified: modules/deployment/src/java/org/apache/geronimo/deployment/service
GBeanDefault.java ServiceDeployer.java
ServiceModule.java
Log:
add endpoint support
Revision Changes Path
1.2 +13 -5 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanDefault.java
Index: GBeanDefault.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/GBeanDefault.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GBeanDefault.java 16 Jan 2004 03:48:42 -0000 1.1
+++ GBeanDefault.java 16 Jan 2004 22:19:51 -0000 1.2
@@ -60,8 +60,8 @@
import org.apache.geronimo.gbean.GBeanInfo;
/**
- *
- *
+ *
+ *
* @version $Revision$ $Date$
*/
public class GBeanDefault {
@@ -69,18 +69,21 @@
private final GBeanInfo info;
private final String objectName;
private final Map values;
+ private final Map endpoints;
- public GBeanDefault(GBeanInfo info, String objectName, Map values) {
+ public GBeanDefault(GBeanInfo info, String objectName, Map values, Map endpoints) {
this.info = info;
this.objectName = objectName;
this.values = values;
+ this.endpoints = endpoints;
this.className = null;
}
- public GBeanDefault(String className, String objectName, Map values) {
+ public GBeanDefault(String className, String objectName, Map values, Map endpoints) {
this.className = className;
this.objectName = objectName;
this.values = values;
+ this.endpoints = endpoints;
this.info = null;
}
@@ -99,4 +102,9 @@
public String getClassName() {
return className;
}
+
+ public Map getEndpoints() {
+ return endpoints;
+ }
+
}
1.2 +30 -6 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceDeployer.java 16 Jan 2004 03:48:42 -0000 1.1
+++ ServiceDeployer.java 16 Jan 2004 22:19:51 -0000 1.2
@@ -64,7 +64,12 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+
import javax.xml.parsers.DocumentBuilder;
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
import org.apache.geronimo.deployment.ModuleFactory;
import org.apache.geronimo.deployment.DeploymentModule;
@@ -122,7 +127,7 @@
}
LinkedHashSet path = new LinkedHashSet();
- List gbeans = new ArrayList();
+ List gbeanDefaults = new ArrayList();
NodeList nl = documentElement.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
@@ -138,13 +143,13 @@
throw new DeploymentException("Invalid path URI: "+uri, e);
}
} else if ("gbean".equals(element.getNodeName())) {
- gbeans.add(loadDefault(element));
+ gbeanDefaults.add(loadDefault(element));
}
}
- return new ServiceModule(moduleID, urlInfo, new ArrayList(path), gbeans);
+ return new ServiceModule(moduleID, urlInfo, new ArrayList(path), gbeanDefaults);
}
- private GBeanDefault loadDefault(Element gbeanElement) {
+ private GBeanDefault loadDefault(Element gbeanElement) throws DeploymentException {
String className = gbeanElement.getAttribute("class");
String objectName = gbeanElement.getAttribute("objectName");
NodeList nl = gbeanElement.getElementsByTagName("default");
@@ -155,6 +160,25 @@
String value = (String) XMLUtil.getContent(defaultElement);
values.put(attr, value);
}
- return new GBeanDefault(className, objectName, values);
+ NodeList endpointList = gbeanElement.getElementsByTagName("endpoint");
+ Map endpoints = new HashMap(endpointList.getLength());
+ for (int i = 0; i < endpointList.getLength(); i++) {
+ Element endpointElement = (Element)endpointList.item(i);
+ String endpointName = endpointElement.getAttribute("name");
+ NodeList patternList = endpointElement.getElementsByTagName("pattern");
+ Set patterns = new HashSet(patternList.getLength());
+ for (int j = 0; j < patternList.getLength(); j++) {
+ Element patternElement = (Element) patternList.item(j);
+ ObjectName pattern = null;
+ try {
+ pattern = ObjectName.getInstance((String) XMLUtil.getContent(patternElement));
+ } catch (MalformedObjectNameException e) {
+ throw new DeploymentException("Invalid pattern for endpoint named: " + endpointName, e);
+ }
+ patterns.add(pattern);
+ }
+ endpoints.put(endpointName, patterns);
+ }
+ return new GBeanDefault(className, objectName, values, endpoints);
}
}
1.2 +10 -4 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceModule.java
Index: ServiceModule.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/service/ServiceModule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceModule.java 16 Jan 2004 03:48:42 -0000 1.1
+++ ServiceModule.java 16 Jan 2004 22:19:51 -0000 1.2
@@ -66,8 +66,10 @@
import java.util.List;
import java.util.Map;
import java.util.LinkedList;
+import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
@@ -102,7 +104,7 @@
}
public void generateClassPath(ConfigurationCallback callback) throws DeploymentException {
- URI moduleBase = URI.create(moduleID.toString()+"/");
+ URI moduleBase = URI.create(moduleID.toString() + "/");
if (urlInfo.getType() == URLType.PACKED_ARCHIVE) {
try {
InputStream is = urlInfo.getUrl().openStream();
@@ -131,7 +133,7 @@
//@todo support proper recursive file scanning (with WebDAV and filters)
URL url = urlInfo.getUrl();
if (!"file".equals(url.getProtocol())) {
- throw new DeploymentException("Unpacked archives not supported for URL "+url.toString());
+ throw new DeploymentException("Unpacked archives not supported for URL " + url.toString());
}
URI root = URI.create(url.toString());
for (Iterator i = pathURIs.iterator(); i.hasNext();) {
@@ -166,7 +168,7 @@
is.close();
}
} catch (IOException e) {
- throw new DeploymentException("Unable to add file:"+file, e);
+ throw new DeploymentException("Unable to add file:" + file, e);
}
}
}
@@ -212,6 +214,10 @@
} catch (Exception e) {
throw new DeploymentException("Unable to set GMBean attribute " + entry.getKey(), e);
}
+ }
+ for (Iterator iterator = defs.getEndpoints().entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ gbean.setEndpointPatterns((String) entry.getKey(), (Set) entry.getValue());
}
callback.addGBean(name, gbean);
}