You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2003/08/17 01:16:34 UTC
cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service MBeanDependency.java MBeanRelationship.java MBeanMetadata.java MBeanMetadataXMLLoader.java ServiceDeploymentPlanner.java MBeanOperation.java
dain 2003/08/16 16:16:34
Modified: modules/core/src/java/org/apache/geronimo/deployment/service
MBeanRelationship.java MBeanMetadata.java
MBeanMetadataXMLLoader.java
ServiceDeploymentPlanner.java
Added: modules/core/src/java/org/apache/geronimo/deployment/service
MBeanDependency.java
Removed: modules/core/src/java/org/apache/geronimo/deployment/service
MBeanOperation.java
Log:
Initial revision of deployment dependency management system.
Revision Changes Path
1.3 +6 -4 incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanRelationship.java
Index: MBeanRelationship.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanRelationship.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MBeanRelationship.java 13 Aug 2003 21:17:24 -0000 1.2
+++ MBeanRelationship.java 16 Aug 2003 23:16:34 -0000 1.3
@@ -55,6 +55,8 @@
*/
package org.apache.geronimo.deployment.service;
+import javax.management.ObjectName;
+
/**
* This class contains metadata necessary to enroll an MBean in a relationship.
*
@@ -80,7 +82,7 @@
* The name of the target MBean to which this MBean will be related. This is only used if a new relationship
* is created during deployment.
*/
- private final String target;
+ private final ObjectName target;
/**
* The name of the role to assign the target MBean. This is only used if a new relationship is created during
@@ -97,7 +99,7 @@
* @param target the object name of another MBean to add to relationship if a new relationship is created
* @param targetRole the role to assign the target MBean
*/
- public MBeanRelationship(String name, String type, String role, String target, String targetRole) {
+ public MBeanRelationship(String name, String type, String role, ObjectName target, String targetRole) {
this.name = name;
this.type = type;
this.role = role;
@@ -134,7 +136,7 @@
* is created during deployment.
* @return object name of the target MBean
*/
- public String getTarget() {
+ public ObjectName getTarget() {
return target;
}
1.3 +24 -6 incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadata.java
Index: MBeanMetadata.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadata.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MBeanMetadata.java 11 Aug 2003 19:46:28 -0000 1.2
+++ MBeanMetadata.java 16 Aug 2003 23:16:34 -0000 1.3
@@ -71,11 +71,13 @@
public class MBeanMetadata {
private String code;
private ObjectName name;
+ private ObjectName loaderName;
+ private ObjectName parentName;
private final List constructorTypes = new ArrayList();
private final List constructorArgs = new ArrayList();
private final Map attributeValues = new HashMap();
private final Set relationships = new HashSet();
- private final List operations = new ArrayList();
+ private final Set dependencies = new HashSet();
public String getCode() {
return code;
@@ -93,6 +95,22 @@
this.name = name;
}
+ public ObjectName getLoaderName() {
+ return loaderName;
+ }
+
+ public void setLoaderName(ObjectName loaderName) {
+ this.loaderName = loaderName;
+ }
+
+ public ObjectName getParentName() {
+ return parentName;
+ }
+
+ public void setParentName(ObjectName parentName) {
+ this.parentName = parentName;
+ }
+
public Map getAttributeValues() {
return attributeValues;
}
@@ -105,11 +123,11 @@
return constructorTypes;
}
- public Set getRelationships() {
- return relationships;
+ public Set getDependencies() {
+ return dependencies;
}
- public List getOperations() {
- return operations;
+ public Set getRelationships() {
+ return relationships;
}
}
1.4 +16 -16 incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadataXMLLoader.java
Index: MBeanMetadataXMLLoader.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadataXMLLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MBeanMetadataXMLLoader.java 13 Aug 2003 21:17:24 -0000 1.3
+++ MBeanMetadataXMLLoader.java 16 Aug 2003 23:16:34 -0000 1.4
@@ -114,27 +114,27 @@
String name = argElement.getAttribute("name");
String type = argElement.getAttribute("type");
String role = argElement.getAttribute("role");
- String target = argElement.getAttribute("target");
+
+ ObjectName target = null;
+ String targetString = argElement.getAttribute("target");
+ if(targetString != null && targetString.length() > 0) {
+ try {
+ target = new ObjectName(targetString);
+ } catch (MalformedObjectNameException e) {
+ throw new DeploymentException("Invalid ObjectName" + s, e);
+ }
+ }
String targetRole = argElement.getAttribute("targetRole");
MBeanRelationship relationship = new MBeanRelationship(name, type, role, target, targetRole);
relationships.add(relationship);
}
- nl = element.getElementsByTagName("invoke");
- List operations = md.getOperations();
+ nl = element.getElementsByTagName("depends");
+ Set dependancies = md.getDependencies();
for (int i = 0; i < nl.getLength(); i++) {
- Element invokeElement = (Element) nl.item(i);
- String operation = invokeElement.getAttribute("operation");
- NodeList argList = invokeElement.getElementsByTagName("arg");
- List types = new ArrayList(argList.getLength());
- List args = new ArrayList(argList.getLength());
- for (int j=0; j < argList.getLength(); j++) {
- Element argElement = (Element) argList.item(j);
- String type = argElement.getAttribute("type");
- types.add(type);
- args.add(getValue(argElement));
- }
- operations.add(new MBeanOperation(operation, types, args));
+ Element argElement = (Element) nl.item(i);
+ String name = argElement.getAttribute("name");
+ dependancies.add(new MBeanDependency(name));
}
return md;
1.4 +24 -13 incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java
Index: ServiceDeploymentPlanner.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServiceDeploymentPlanner.java 15 Aug 2003 15:27:42 -0000 1.3
+++ ServiceDeploymentPlanner.java 16 Aug 2003 23:16:34 -0000 1.4
@@ -78,7 +78,6 @@
import javax.xml.parsers.ParserConfigurationException;
import org.apache.geronimo.deployment.DeploymentException;
-import org.apache.geronimo.deployment.scanner.URLType;
import org.apache.geronimo.deployment.goal.DeployURL;
import org.apache.geronimo.deployment.goal.DeploymentGoal;
import org.apache.geronimo.deployment.goal.RedeployURL;
@@ -89,6 +88,9 @@
import org.apache.geronimo.deployment.plan.DeploymentTask;
import org.apache.geronimo.deployment.plan.DestroyMBeanInstance;
import org.apache.geronimo.deployment.plan.RegisterMBeanInstance;
+import org.apache.geronimo.deployment.plan.InitializeMBeanInstance;
+import org.apache.geronimo.deployment.plan.StartMBeanInstance;
+import org.apache.geronimo.deployment.scanner.URLType;
import org.apache.geronimo.jmx.JMXUtil;
import org.w3c.dom.Document;
@@ -152,7 +154,7 @@
if (goal instanceof DeployURL) {
progress = addURL((DeployURL) goal, goals, plans);
} else if (goal instanceof RedeployURL) {
- progress = verifyURL((RedeployURL) goal, goals, plans);
+ progress = verifyURL((RedeployURL) goal, goals);
} else if (goal instanceof UndeployURL) {
progress = removeURL((UndeployURL) goal, goals, plans);
}
@@ -195,7 +197,8 @@
throw new DeploymentException(e);
}
- DeploymentPlan createPlan = new DeploymentPlan();
+ // Create a plan to register the deployment unit and create the class loader
+ DeploymentPlan createDeploymentUnitPlan = new DeploymentPlan();
ObjectName deploymentName = null;
try {
deploymentName = new ObjectName("geronimo.deployment:role=DeploymentUnit,type=Service,url=" + ObjectName.quote(url.toString()));
@@ -203,23 +206,33 @@
throw new DeploymentException(e);
}
ServiceDeployment serviceInfo = new ServiceDeployment(deploymentName, null, url);
- createPlan.addTask(new RegisterMBeanInstance(server, deploymentName, serviceInfo));
+ createDeploymentUnitPlan.addTask(new RegisterMBeanInstance(server, deploymentName, serviceInfo));
- ObjectName loaderName = addClassSpaces(doc.getElementsByTagName("class-space"), createPlan, url);
+ ObjectName loaderName = addClassSpaces(doc.getElementsByTagName("class-space"), createDeploymentUnitPlan, url);
+ plans.add(createDeploymentUnitPlan);
+ // register a plan to create each mbean
NodeList nl = doc.getElementsByTagName("mbean");
for (int i = 0; i < nl.getLength(); i++) {
+ DeploymentPlan createPlan = new DeploymentPlan();
+
Element mbeanElement = (Element) nl.item(i);
MBeanMetadata md = mbeanLoader.loadXML(mbeanElement);
if (server.isRegistered(md.getName())) {
throw new DeploymentException("MBean already exists " + md.getName());
}
-
- CreateMBeanInstance createTask = new CreateMBeanInstance(plans, server, deploymentName, md, loaderName);
+ md.setLoaderName(loaderName);
+ md.setParentName(deploymentName);
+ CreateMBeanInstance createTask = new CreateMBeanInstance(server, md);
createPlan.addTask(createTask);
+ InitializeMBeanInstance initTask = new InitializeMBeanInstance(server, md);
+ createPlan.addTask(initTask);
+ StartMBeanInstance startTask = new StartMBeanInstance(server, md);
+ createPlan.addTask(startTask);
+
+ plans.add(createPlan);
}
- plans.add(createPlan);
goals.remove(goal);
return true;
}
@@ -275,15 +288,13 @@
return true;
}
- private boolean verifyURL(RedeployURL goal, Set goals, Set plans) throws DeploymentException {
+ private boolean verifyURL(RedeployURL goal, Set goals) throws DeploymentException {
URL url = goal.getUrl();
- ObjectName deploymentName = null;
try {
- deploymentName = new ObjectName("geronimo.deployment:role=DeploymentUnit,type=Service,url=" + ObjectName.quote(url.toString()));
+ new ObjectName("geronimo.deployment:role=DeploymentUnit,type=Service,url=" + ObjectName.quote(url.toString()));
} catch (MalformedObjectNameException e) {
throw new DeploymentException(e);
}
-
goals.remove(goal);
return true;
}
1.1 incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanDependency.java
Index: MBeanDependency.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;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2003/08/16 23:16:34 $
*/
public class MBeanDependency {
private String name;
public MBeanDependency(String name) {
this.name = name;
}
public String getName() {
return name;
}
public String toString() {
return "MBeanDependency on " + name;
}
}