adc 2003/12/14 08:18:50
Modified: modules/kernel/src/java/org/apache/geronimo/kernel/deployment
DeploymentHelper.java
Log:
Enhancements to o.a.g.kernel.deployment.DeploymentHelper's javadoc and
'throws' removes
Jacek Laskowski
http://jira.codehaus.org/secure/ViewIssue.jspa?key=GERONIMO-127
Revision Changes Path
1.6 +70 -54
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/DeploymentHelper.java
Index: DeploymentHelper.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/DeploymentHelper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeploymentHelper.java 24 Nov 2003 00:04:32 -0000 1.5
+++ DeploymentHelper.java 14 Dec 2003 16:18:50 -0000 1.6
@@ -70,11 +70,11 @@
import org.apache.geronimo.kernel.jmx.JMXUtil;
/**
- *
- *
+ * Helper class that handles locating files in META-INF directory, building
+ * class space and dealing with deployments
+ *
* @version $Revision$ $Date$
- *
- * */
+ */
public class DeploymentHelper {
protected final URL url;
protected final URLType urlType;
@@ -83,16 +83,29 @@
private final String objectNameTypeName;
/**
- * Creates an helper related to the specified deployment URL.
- *
- * @param url Deployment URL.
- * @param urlType Type of the URL.
+ * Create an helper related to the specified deployment URL with META-INF
+ * as the directory with the given files
+ *
+ * @see #DeploymentHelper(URL, URLType, String, String, String, String)
*/
- public DeploymentHelper(URL url, URLType urlType, String
objectNameTypeName, String j2eeDDName, String geronimoDDName) throws
DeploymentException {
+ public DeploymentHelper(URL url, URLType urlType, String
objectNameTypeName, String j2eeDDName,
+ String geronimoDDName) throws DeploymentException {
this(url, urlType, objectNameTypeName, j2eeDDName, geronimoDDName,
"META-INF");
}
- public DeploymentHelper(URL url, URLType urlType, String
objectNameTypeName, String j2eeDDName, String geronimoDDName, String infDir)
throws DeploymentException {
+ /**
+ * Creates an helper related to the specified deployment URL.
+ *
+ * @param url Deployment URL.
+ * @param urlType Type of the URL.
+ * @param objectNameTypeName type's name of the ObjectName
+ * @param j2eeDDName name of the J2EE deployment descriptor file
+ * @param geronimoDDName name of the Geronimo deployment descriptor file
+ * @param infDir the directory where deployment descriptors are to be
looked up
+ * @throws DeploymentException when the deployment doesn't exist
+ */
+ public DeploymentHelper(URL url, URLType urlType, String
objectNameTypeName, String j2eeDDName,
+ String geronimoDDName, String infDir) throws DeploymentException
{
this.url = url;
this.urlType = urlType;
this.objectNameTypeName = objectNameTypeName;
@@ -122,47 +135,46 @@
if (is != null) {
try {
is.close();
- } catch (IOException e) { //ignore
+ } catch (IOException ignore) {
}
}
}
-
}
/**
- * Locates the URL referencing the ra.xml deployment descriptor.
- *
- * @return URL referening ra.xml or null if no deployment descriptor is
- * found.
- *
- * @throws org.apache.geronimo.kernel.deployment.DeploymentException
+ * Locates J2EE deployment descriptor.
+ *
+ * @return URL referencing the J2EE DD or null if no deployment
descriptor
+ * is found.
*/
- public URL locateJ2EEDD() throws DeploymentException {
+ public URL locateJ2EEDD() {
return j2eeURL;
}
- public URL locateGeronimoDD() throws DeploymentException {
+ /**
+ * Locates Geronimo's deployment descriptor
+ *
+ * @return URL referencing Geronimo's DD or null if no deployment
+ * descriptor is found
+ */
+ public URL locateGeronimoDD() {
return geronimoURL;
}
/**
- * Build a ClassSpaceMetadata abstracting the connector archives.
- * <P>
- * The connector archives are all the .jar, .so or .dll files contained
- * by the deployment unit.
- *
+ * Builds a ClassSpaceMetadata
+ *
* @return ClassSpaceMetadata referencing the connector archives.
- *
+ *
* @throws org.apache.geronimo.kernel.deployment.DeploymentException
*/
public ClassSpaceMetadata buildClassSpace() throws DeploymentException {
ClassSpaceMetadata classSpaceMetaData = new ClassSpaceMetadata();
-// classSpaceMetaData.setName(buildClassSpaceName());
+ // classSpaceMetaData.setName(buildClassSpaceName());
classSpaceMetaData.setName(JMXUtil.getObjectName("geronimo.system:role=ClassSpace,name=System"));
-
classSpaceMetaData.setGeronimoMBeanInfo(GeronimoMBeanInfoXMLLoader.loadMBean(
-
ClassLoader.getSystemResource("org/apache/geronimo/kernel/classspace/classspace-mbean.xml")
- ));
-//
classSpaceMetaData.setParent(JMXUtil.getObjectName("geronimo.system:role=ClassSpace,name=System"));
+
classSpaceMetaData.setGeronimoMBeanInfo(GeronimoMBeanInfoXMLLoader.loadMBean(ClassLoader
+
.getSystemResource("org/apache/geronimo/kernel/classspace/classspace-mbean.xml")));
+ //
classSpaceMetaData.setParent(JMXUtil.getObjectName("geronimo.system:role=ClassSpace,name=System"));
classSpaceMetaData.setDeploymentName(buildDeploymentName());
List archives = classSpaceMetaData.getUrls();
@@ -172,53 +184,57 @@
} else if (URLType.UNPACKED_ARCHIVE == urlType) {
findUnpackedArchives(archives);
} else {
- throw new DeploymentException("Should never occurs");
+ throw new DeploymentException("Unsupported URLType: " + urlType);
}
return classSpaceMetaData;
}
/**
- * Intended to be overridden for all but the simplest packages
- * @param archives
- * @throws DeploymentException
+ * Finds unpacked archives
+ * <p>
+ * Intended to be overriden as by default it merely adds the URL to
+ * archives
+ *
+ * @param archives a list of archives (not necessarily unpacked)
+ *
+ * @throws DeploymentException never thrown
*/
protected void findUnpackedArchives(List archives) throws
DeploymentException {
archives.add(url);
}
/**
- * Intended to be overridden for all but the simplest packages
- * @param archives
- * @throws DeploymentException
+ * Finds packed archives
+ * <p>
+ * Intended to be overriden as by default it merely adds the URL to
+ * archives
+ *
+ * @param archives a list of archives (not necessarily packed)
+ *
+ * @throws DeploymentException never thrown
*/
protected void findPackedArchives(List archives) throws
DeploymentException {
archives.add(url);
}
/**
- * Build a connector deployment name.
- *
- * @return Connector deployment name.
+ * Build deployment unit's object name.
+ *
+ * @return ObjectName of the deployment unit
*/
public ObjectName buildDeploymentName() {
- return JMXUtil.getObjectName(
- "geronimo.deployment:role=DeploymentUnit,url="
- + ObjectName.quote(url.toString())
+ return
JMXUtil.getObjectName("geronimo.deployment:role=DeploymentUnit,url=" +
ObjectName.quote(url.toString())
+ ",type=" + objectNameTypeName);
}
/**
* Build the name of the ClassSpace which is used as the ClassLoader of
the
* URL to be deployed.
- *
- * @return ClassSpace name.
+ *
+ * @return ObjectName of the ClassSpace of the URL to be deployed
*/
public ObjectName buildClassSpaceName() {
- return JMXUtil.getObjectName(
- "geronimo.deployment:role=DeploymentUnitClassSpace,url="
- + ObjectName.quote(url.toString())
- + ",type=" + objectNameTypeName);
+ return
JMXUtil.getObjectName("geronimo.deployment:role=DeploymentUnitClassSpace,url="
+ + ObjectName.quote(url.toString()) + ",type=" +
objectNameTypeName);
}
-
-
-}
+}
\ No newline at end of file