You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/12/19 15:29:55 UTC
svn commit: r605551 - in /servicemix/smx4/nmr/trunk/jbi/deployer/src:
main/java/org/apache/servicemix/jbi/deployer/
main/java/org/apache/servicemix/jbi/deployer/descriptor/
main/java/org/apache/servicemix/jbi/deployer/impl/
test/java/org/apache/service...
Author: gnodet
Date: Wed Dec 19 06:29:53 2007
New Revision: 605551
URL: http://svn.apache.org/viewvc?rev=605551&view=rev
Log:
Draft implementation of SA deployment
Added:
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceUnit.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ComponentDesc.java
- copied, changed from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssemblyDesc.java
- copied, changed from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnitDesc.java
- copied, changed from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryDesc.java
- copied, changed from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/FileUtil.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceUnitImpl.java
Removed:
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java
Modified:
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceAssembly.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyImpl.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactoryTest.java
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceAssembly.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceAssembly.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceAssembly.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceAssembly.java Wed Dec 19 06:29:53 2007
@@ -16,9 +16,38 @@
*/
package org.apache.servicemix.jbi.deployer;
+import javax.jbi.JBIException;
+
/**
* This interface represents a JBI Service Assembly and will be registered
* in the OSGi registry
*/
public interface ServiceAssembly {
+
+ /**
+ * Retrieves the name of this service assembly
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Retrieves the description of this service assembly
+ * @return the description
+ */
+ String getDescription();
+
+ /**
+ * Get the list of service units included in this Service Assembly
+ * @return
+ */
+ ServiceUnit[] getServiceUnits();
+
+ void init() throws JBIException;
+
+ void start() throws JBIException;
+
+ void stop() throws JBIException;
+
+ void shutdown() throws JBIException;
+
}
Added: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceUnit.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceUnit.java?rev=605551&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceUnit.java (added)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/ServiceUnit.java Wed Dec 19 06:29:53 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.deployer;
+
+import java.io.File;
+
+import javax.jbi.JBIException;
+
+
+public interface ServiceUnit {
+
+ /**
+ * Retrieves the name of this service assembly
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Retrieves the description of this service assembly
+ * @return the description
+ */
+ String getDescription();
+
+}
Copied: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ComponentDesc.java (from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ComponentDesc.java?p2=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ComponentDesc.java&p1=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java&r1=604138&r2=605551&rev=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Component.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ComponentDesc.java Wed Dec 19 06:29:53 2007
@@ -21,7 +21,7 @@
/**
* @version $Revision: 426415 $
*/
-public class Component {
+public class ComponentDesc {
private String type;
private String componentClassLoaderDelegation = "parent-first";
private String bootstrapClassLoaderDelegation = "parent-first";
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/Descriptor.java Wed Dec 19 06:29:53 2007
@@ -16,16 +16,16 @@
*/
package org.apache.servicemix.jbi.deployer.descriptor;
-import org.apache.servicemix.jbi.deployer.descriptor.Component;
+import org.apache.servicemix.jbi.deployer.descriptor.ComponentDesc;
/**
* @version $Revision: 426415 $
*/
public class Descriptor {
private double version;
- private Component component;
- private SharedLibrary sharedLibrary;
- private ServiceAssembly serviceAssembly;
+ private ComponentDesc component;
+ private SharedLibraryDesc sharedLibrary;
+ private ServiceAssemblyDesc serviceAssembly;
private Services services;
public double getVersion() {
@@ -36,27 +36,27 @@
this.version = version;
}
- public Component getComponent() {
+ public ComponentDesc getComponent() {
return component;
}
- public void setComponent(Component component) {
+ public void setComponent(ComponentDesc component) {
this.component = component;
}
- public SharedLibrary getSharedLibrary() {
+ public SharedLibraryDesc getSharedLibrary() {
return sharedLibrary;
}
- public void setSharedLibrary(SharedLibrary sharedLibrary) {
+ public void setSharedLibrary(SharedLibraryDesc sharedLibrary) {
this.sharedLibrary = sharedLibrary;
}
- public ServiceAssembly getServiceAssembly() {
+ public ServiceAssemblyDesc getServiceAssembly() {
return serviceAssembly;
}
- public void setServiceAssembly(ServiceAssembly serviceAssembly) {
+ public void setServiceAssembly(ServiceAssemblyDesc serviceAssembly) {
this.serviceAssembly = serviceAssembly;
}
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactory.java Wed Dec 19 06:29:53 2007
@@ -146,7 +146,7 @@
desc.setVersion(Double.parseDouble(getAttribute(jbi, "version")));
Element child = getFirstChildElement(jbi);
if ("component".equals(child.getLocalName())) {
- Component component = new Component();
+ ComponentDesc component = new ComponentDesc();
component.setType(child.getAttribute("type"));
component.setComponentClassLoaderDelegation(getAttribute(child, "component-class-loader-delegation"));
component.setBootstrapClassLoaderDelegation(getAttribute(child, "bootstrap-class-loader-delegation"));
@@ -200,7 +200,7 @@
}
desc.setComponent(component);
} else if ("shared-library".equals(child.getLocalName())) {
- SharedLibrary sharedLibrary = new SharedLibrary();
+ SharedLibraryDesc sharedLibrary = new SharedLibraryDesc();
sharedLibrary.setClassLoaderDelegation(getAttribute(child, "class-loader-delegation"));
sharedLibrary.setVersion(getAttribute(child, "version"));
for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
@@ -220,13 +220,13 @@
}
desc.setSharedLibrary(sharedLibrary);
} else if ("service-assembly".equals(child.getLocalName())) {
- ServiceAssembly serviceAssembly = new ServiceAssembly();
- ArrayList<ServiceUnit> sus = new ArrayList<ServiceUnit>();
+ ServiceAssemblyDesc serviceAssembly = new ServiceAssemblyDesc();
+ ArrayList<ServiceUnitDesc> sus = new ArrayList<ServiceUnitDesc>();
for (Element e = getFirstChildElement(child); e != null; e = getNextSiblingElement(e)) {
if ("identification".equals(e.getLocalName())) {
serviceAssembly.setIdentification(readIdentification(e));
} else if ("service-unit".equals(e.getLocalName())) {
- ServiceUnit su = new ServiceUnit();
+ ServiceUnitDesc su = new ServiceUnitDesc();
for (Element e2 = getFirstChildElement(e); e2 != null; e2 = getNextSiblingElement(e2)) {
if ("identification".equals(e2.getLocalName())) {
su.setIdentification(readIdentification(e2));
@@ -270,7 +270,7 @@
serviceAssembly.setConnections(connections);
}
}
- serviceAssembly.setServiceUnits(sus.toArray(new ServiceUnit[sus.size()]));
+ serviceAssembly.setServiceUnits(sus.toArray(new ServiceUnitDesc[sus.size()]));
desc.setServiceAssembly(serviceAssembly);
} else if ("services".equals(child.getLocalName())) {
Services services = new Services();
@@ -379,7 +379,7 @@
* @param component
* The component descriptor that is being checked
*/
- private static void checkComponent(List<String> violations, Component component) {
+ private static void checkComponent(List<String> violations, ComponentDesc component) {
if (component.getIdentification() == null) {
violations.add("The component has not identification");
} else {
@@ -404,7 +404,7 @@
* @param serviceAssembly
* The service assembly descriptor that is being checked
*/
- private static void checkServiceAssembly(List<String> violations, ServiceAssembly serviceAssembly) {
+ private static void checkServiceAssembly(List<String> violations, ServiceAssemblyDesc serviceAssembly) {
if (serviceAssembly.getIdentification() == null) {
violations.add("The service assembly has not identification");
} else {
@@ -437,7 +437,7 @@
* @param sharedLibrary
* The shared library descriptor that is being checked
*/
- private static void checkSharedLibrary(List<String> violations, SharedLibrary sharedLibrary) {
+ private static void checkSharedLibrary(List<String> violations, SharedLibraryDesc sharedLibrary) {
if (sharedLibrary.getIdentification() == null) {
violations.add("The shared library has not identification");
} else {
Copied: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssemblyDesc.java (from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssemblyDesc.java?p2=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssemblyDesc.java&p1=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java&r1=604138&r2=605551&rev=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssembly.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceAssemblyDesc.java Wed Dec 19 06:29:53 2007
@@ -19,13 +19,13 @@
/**
* @version $Revision: 426415 $
*/
-public class ServiceAssembly {
+public class ServiceAssemblyDesc {
private Connections connections = new Connections();
private Identification identification;
- private ServiceUnit[] serviceUnits;
+ private ServiceUnitDesc[] serviceUnits;
private String state = "";
@@ -37,7 +37,7 @@
return identification;
}
- public ServiceUnit[] getServiceUnits() {
+ public ServiceUnitDesc[] getServiceUnits() {
return serviceUnits;
}
@@ -56,7 +56,7 @@
this.identification = identification;
}
- public void setServiceUnits(ServiceUnit[] serviceUnits) {
+ public void setServiceUnits(ServiceUnitDesc[] serviceUnits) {
this.serviceUnits = serviceUnits;
}
Copied: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnitDesc.java (from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnitDesc.java?p2=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnitDesc.java&p1=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java&r1=604138&r2=605551&rev=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnit.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/ServiceUnitDesc.java Wed Dec 19 06:29:53 2007
@@ -19,7 +19,7 @@
/**
* @version $Revision: 426415 $
*/
-public class ServiceUnit {
+public class ServiceUnitDesc {
private Identification identification;
private Target target;
Copied: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryDesc.java (from r604138, servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryDesc.java?p2=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryDesc.java&p1=servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java&r1=604138&r2=605551&rev=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibrary.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/descriptor/SharedLibraryDesc.java Wed Dec 19 06:29:53 2007
@@ -19,13 +19,13 @@
/**
* @version $Revision: 426415 $
*/
-public class SharedLibrary {
+public class SharedLibraryDesc {
private String classLoaderDelegation = "parent-first";
private String version;
private Identification identification;
private ClassPath sharedLibraryClassPath;
- public SharedLibrary() {
+ public SharedLibraryDesc() {
}
public String getClassLoaderDelegation() {
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java Wed Dec 19 06:29:53 2007
@@ -16,29 +16,43 @@
*/
package org.apache.servicemix.jbi.deployer.impl;
+import java.io.File;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Dictionary;
import java.util.Hashtable;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.jbi.JBIException;
import javax.jbi.component.Component;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.deployer.ServiceAssembly;
import org.apache.servicemix.jbi.deployer.SharedLibrary;
+import org.apache.servicemix.jbi.deployer.descriptor.ComponentDesc;
import org.apache.servicemix.jbi.deployer.descriptor.Descriptor;
import org.apache.servicemix.jbi.deployer.descriptor.DescriptorFactory;
+import org.apache.servicemix.jbi.deployer.descriptor.ServiceAssemblyDesc;
+import org.apache.servicemix.jbi.deployer.descriptor.ServiceUnitDesc;
+import org.apache.servicemix.jbi.deployer.descriptor.SharedLibraryDesc;
import org.apache.servicemix.jbi.deployer.descriptor.SharedLibraryList;
import org.apache.xbean.classloader.MultiParentClassLoader;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.osgi.context.BundleContextAware;
import org.springframework.osgi.internal.context.support.BundleDelegatingClassLoader;
+import org.springframework.osgi.util.OsgiServiceReferenceUtils;
+import org.springframework.osgi.util.OsgiServiceUtils;
+import org.springframework.osgi.util.OsgiStringUtils;
/**
* Deployer for JBI artifacts
@@ -46,19 +60,27 @@
*/
public class Deployer implements BundleListener, BundleContextAware, InitializingBean, DisposableBean {
+ public static final String NAME = "NAME";
+ public static final String TYPE = "TYPE";
+
private static final Log LOGGER = LogFactory.getLog(Deployer.class);
private static final String JBI_DESCRIPTOR = "META-INF/jbi.xml";
- private static final String NAME = "NAME";
- private static final String TYPE = "TYPE";
-
private BundleContext context;
private Map<String, SharedLibrary> sharedLibraries;
- public Deployer() {
+ private Map<String, ServiceAssembly> serviceAssemblies;
+
+ private File jbiRootDir;
+
+ public Deployer() throws JBIException{
sharedLibraries = new ConcurrentHashMap<String, SharedLibrary>();
+ serviceAssemblies = new ConcurrentHashMap<String, ServiceAssembly>();
+ // TODO: control that using properties
+ jbiRootDir = new File(System.getProperty("servicemix.base"), "jbi");
+ jbiRootDir.mkdirs();
}
public void setBundleContext(BundleContext context) {
@@ -67,6 +89,9 @@
public void afterPropertiesSet() throws Exception {
this.context.addBundleListener(this);
+ for (Bundle bundle : this.context.getBundles()) {
+ checkInstalledBundle(bundle);
+ }
}
public void destroy() throws Exception {
@@ -74,48 +99,107 @@
}
public void bundleChanged(BundleEvent event) {
- try {
if (event.getType() == BundleEvent.INSTALLED) {
- LOGGER.debug("Checking bundle: " + event.getBundle().getSymbolicName());
- URL url = event.getBundle().getResource(JBI_DESCRIPTOR);
- Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
- // TODO: check descriptor
- if (descriptor.getComponent() != null) {
- LOGGER.debug("Bundle '" + event.getBundle().getSymbolicName() + "' is a JBI component");
- // Create component class loader
- ClassLoader classLoader = createComponentClassLoader(descriptor.getComponent(), event.getBundle());
- // Instanciate component
- Class clazz = classLoader.loadClass(descriptor.getComponent().getComponentClassName());
- Component component = (Component) clazz.newInstance();
- Dictionary<String, String> props = new Hashtable<String, String>();
- // populate props from the component meta-data
- props.put(NAME, descriptor.getComponent().getIdentification().getName());
- props.put(TYPE, descriptor.getComponent().getType());
- // register the component in the OSGi registry
- LOGGER.debug("Registering JBI component");
- context.registerService(Component.class.getName(), component, props);
- } else if (descriptor.getServiceAssembly() != null) {
- LOGGER.debug("Bundle '" + event.getBundle().getSymbolicName() + "' is a JBI service assembly");
- // TODO:
- } else if (descriptor.getSharedLibrary() != null) {
- LOGGER.debug("Bundle '" + event.getBundle().getSymbolicName() + "' is a JBI shared library");
- SharedLibraryImpl sl = new SharedLibraryImpl(descriptor.getSharedLibrary(), event.getBundle());
- sharedLibraries.put(sl.getName(), sl);
- Dictionary<String, String> props = new Hashtable<String, String>();
- // populate props from the library meta-data
- props.put(NAME, descriptor.getSharedLibrary().getIdentification().getName());
- LOGGER.debug("Registering JBI Shared Library");
- context.registerService(SharedLibrary.class.getName(), sl, props);
- } else {
- // WARN: unhandled JBI artifact
- }
+ checkInstalledBundle(event.getBundle());
+ } else if (event.getType() == BundleEvent.UNINSTALLED) {
+ //TODO: uninstall the bundle.
+ }
+ }
+
+ private void checkInstalledBundle(Bundle bundle) {
+ try {
+ LOGGER.debug("Checking bundle: '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "'");
+ URL url = bundle.getResource(JBI_DESCRIPTOR);
+ if (url == null) {
+ LOGGER.debug("Bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' does not contain any JBI descriptor.");
+ return;
+ }
+ Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
+ DescriptorFactory.checkDescriptor(descriptor);
+ if (descriptor.getComponent() != null) {
+ installComponent(descriptor.getComponent(), bundle);
+ } else if (descriptor.getServiceAssembly() != null) {
+ deployServiceAssembly(descriptor.getServiceAssembly(), bundle);
+ } else if (descriptor.getSharedLibrary() != null) {
+ installSharedLibrary(descriptor.getSharedLibrary(), bundle);
+ } else {
+ // WARN: unhandled JBI artifact
}
} catch (Exception e) {
LOGGER.error("Error handling bundle event", e);
}
}
- private ClassLoader createComponentClassLoader(org.apache.servicemix.jbi.deployer.descriptor.Component component, Bundle bundle) {
+ protected void installComponent(ComponentDesc componentDesc, Bundle bundle) throws Exception {
+ LOGGER.debug("Bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' is a JBI component");
+ // Create component class loader
+ ClassLoader classLoader = createComponentClassLoader(componentDesc, bundle);
+ // Instanciate component
+ Class clazz = classLoader.loadClass(componentDesc.getComponentClassName());
+ Component component = (Component) clazz.newInstance();
+ // populate props from the component meta-data
+ Dictionary<String, String> props = new Hashtable<String, String>();
+ props.put(NAME, componentDesc.getIdentification().getName());
+ props.put(TYPE, componentDesc.getType());
+ // register the component in the OSGi registry
+ LOGGER.debug("Registering JBI component");
+ context.registerService(Component.class.getName(), component, props);
+ }
+
+ protected void deployServiceAssembly(ServiceAssemblyDesc serviceAssembyDesc, Bundle bundle) throws Exception {
+ LOGGER.debug("Bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' is a JBI service assembly");
+ // Create the SA directory
+ File saDir = new File(jbiRootDir, Long.toString(bundle.getBundleId()));
+ FileUtil.deleteFile(saDir);
+ FileUtil.buildDirectory(saDir);
+ // Iterate each SU and deploy it
+ List<ServiceUnitImpl> sus = new ArrayList<ServiceUnitImpl>();
+ for (ServiceUnitDesc sud : Arrays.asList(serviceAssembyDesc.getServiceUnits())) {
+ // Create directory for this SU
+ File suRootDir = new File(saDir, sud.getIdentification().getName());
+ suRootDir.mkdirs();
+ // Unpack it
+ String zip = sud.getTarget().getArtifactsZip();
+ URL zipUrl = bundle.getResource(zip);
+ FileUtil.unpackArchive(zipUrl, suRootDir);
+ // Find component
+ String componentName = sud.getTarget().getComponentName();
+ Component component = getComponent(componentName);
+ // Create service unit object
+ ServiceUnitImpl su = new ServiceUnitImpl(sud, suRootDir, component);
+ su.deploy();
+ // Add it to the list
+ sus.add(su);
+ }
+ // Now create the SA and initialize it
+ ServiceAssemblyImpl sa = new ServiceAssemblyImpl(serviceAssembyDesc, sus);
+ sa.init();
+ // populate props from the component meta-data
+ Dictionary<String, String> props = new Hashtable<String, String>();
+ props.put(NAME, serviceAssembyDesc.getIdentification().getName());
+ // register the service assembly in the OSGi registry
+ LOGGER.debug("Registering JBI service assembly");
+ context.registerService(ServiceAssembly.class.getName(), sa, props);
+ }
+
+ protected void installSharedLibrary(SharedLibraryDesc sharedLibraryDesc, Bundle bundle) {
+ LOGGER.debug("Bundle '" + OsgiStringUtils.nullSafeNameAndSymName(bundle) + "' is a JBI shared library");
+ SharedLibraryImpl sl = new SharedLibraryImpl(sharedLibraryDesc, bundle);
+ sharedLibraries.put(sl.getName(), sl);
+ Dictionary<String, String> props = new Hashtable<String, String>();
+ // populate props from the library meta-data
+ props.put(NAME, sharedLibraryDesc.getIdentification().getName());
+ LOGGER.debug("Registering JBI Shared Library");
+ context.registerService(SharedLibrary.class.getName(), sl, props);
+ }
+
+ protected Component getComponent(String name) {
+ String filter = "(" + NAME + "=" + name + ")";
+ ServiceReference reference = OsgiServiceReferenceUtils.getServiceReference(context, Component.class.getName(), filter);
+ return (Component) OsgiServiceUtils.getService(context, reference);
+ }
+
+ protected ClassLoader createComponentClassLoader(ComponentDesc component, Bundle bundle) {
// Create parents classloaders
ClassLoader[] parents;
if (component.getSharedLibraries() != null) {
@@ -148,7 +232,7 @@
new String[] {"java.", "javax." });
}
- private ClassLoader getSharedLibraryClassLoader(SharedLibraryList sharedLibraryList) {
+ protected ClassLoader getSharedLibraryClassLoader(SharedLibraryList sharedLibraryList) {
SharedLibrary sl = sharedLibraries.get(sharedLibraryList.getName());
if (sl != null) {
return sl.createClassLoader();
Added: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/FileUtil.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/FileUtil.java?rev=605551&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/FileUtil.java (added)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/FileUtil.java Wed Dec 19 06:29:53 2007
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.deployer.impl;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * File utilities
+ *
+ * @version $Revision: 564900 $
+ */
+public final class FileUtil {
+
+ /**
+ * Buffer size used when copying the content of an input stream to
+ * an output stream.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 4096;
+
+ private FileUtil() {
+ }
+
+ /**
+ * Build a directory path - creating directories if neccesary
+ *
+ * @param file
+ * @return true if the directory exists, or making it was successful
+ */
+ public static boolean buildDirectory(File file) {
+ return file.exists() || file.mkdirs();
+ }
+
+ /**
+ * Copy in stream to an out stream
+ *
+ * @param in
+ * @param out
+ * @throws IOException
+ */
+ public static void copyInputStream(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ int len = in.read(buffer);
+ while (len >= 0) {
+ out.write(buffer, 0, len);
+ len = in.read(buffer);
+ }
+ out.close();
+ }
+
+ /**
+ * Unpack a zip file
+ *
+ * @param theFile
+ * @param targetDir
+ * @throws IOException
+ */
+ public static void unpackArchive(File theFile, File targetDir) throws IOException {
+ if (!theFile.exists()) {
+ throw new IOException(theFile.getAbsolutePath() + " does not exist");
+ }
+ InputStream is = new FileInputStream(theFile);
+ try {
+ unpackArchive(is, targetDir);
+ } finally {
+ is.close();
+ }
+ }
+
+ /**
+ * Unpack an archive from a URL
+ *
+ * @param url
+ * @param targetDir
+ * @return the file to the url
+ * @throws IOException
+ */
+ public static void unpackArchive(URL url, File targetDir) throws IOException {
+ InputStream is = url.openStream();
+ try {
+ unpackArchive(is, targetDir);
+ } finally {
+ try {
+ is.close();
+ } catch (Throwable t) {}
+ }
+ }
+
+ /**
+ * Unpack an archive from an input stream
+ *
+ * @param is
+ * @param targetDir
+ * @throws IOException
+ */
+ public static void unpackArchive(InputStream is, File targetDir) throws IOException {
+ if (!buildDirectory(targetDir)) {
+ throw new IOException("Could not create directory: " + targetDir);
+ }
+ ZipInputStream zip = new ZipInputStream(new BufferedInputStream(is));
+ for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
+ File file = new File(targetDir, File.separator + entry.getName());
+ // Take the sledgehammer approach to creating directories
+ // to work around ZIP's that incorrectly miss directories
+ if (!buildDirectory(file.getParentFile())) {
+ throw new IOException("Could not create directory: " + file.getParentFile());
+ }
+ if (!entry.isDirectory()) {
+ copyInputStream(zip, new BufferedOutputStream(new FileOutputStream(file)));
+ } else {
+ if (!buildDirectory(file)) {
+ throw new IOException("Could not create directory: " + file);
+ }
+ }
+ }
+ }
+
+ /**
+ * Delete a file
+ *
+ * @param fileToDelete
+ * @return true if the File is deleted
+ */
+ public static boolean deleteFile(File fileToDelete) {
+ if (fileToDelete == null || !fileToDelete.exists()) {
+ return true;
+ }
+ boolean result = true;
+ if (fileToDelete.isDirectory()) {
+ File[] files = fileToDelete.listFiles();
+ if (files == null) {
+ result = false;
+ } else {
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ if (file.getName().equals(".") || file.getName().equals("..")) {
+ continue;
+ }
+ if (file.isDirectory()) {
+ result &= deleteFile(file);
+ } else {
+ result &= file.delete();
+ }
+ }
+ }
+ }
+ result &= fileToDelete.delete();
+ return result;
+ }
+
+}
\ No newline at end of file
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyImpl.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceAssemblyImpl.java Wed Dec 19 06:29:53 2007
@@ -16,10 +16,112 @@
*/
package org.apache.servicemix.jbi.deployer.impl;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jbi.JBIException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.deployer.ServiceAssembly;
+import org.apache.servicemix.jbi.deployer.ServiceUnit;
+import org.apache.servicemix.jbi.deployer.descriptor.ServiceAssemblyDesc;
+import org.osgi.framework.BundleContext;
/**
* ServiceAssembly object
*/
public class ServiceAssemblyImpl implements ServiceAssembly {
+
+ private static final Log Logger = LogFactory.getLog(ServiceAssemblyImpl.class);
+
+ protected enum State {
+ Unknown,
+ Initialized,
+ Started,
+ Stopped,
+ Shutdown,
+ }
+
+ private ServiceAssemblyDesc serviceAssemblyDesc;
+
+ private List<ServiceUnitImpl> serviceUnits;
+
+ private State state = State.Unknown;
+
+ public ServiceAssemblyImpl(ServiceAssemblyDesc serviceAssemblyDesc, List<ServiceUnitImpl> serviceUnits) {
+ this.serviceAssemblyDesc = serviceAssemblyDesc;
+ this.serviceUnits = serviceUnits;
+ }
+
+ public String getName() {
+ return serviceAssemblyDesc.getIdentification().getName();
+ }
+
+ public String getDescription() {
+ return serviceAssemblyDesc.getIdentification().getDescription();
+ }
+
+ public ServiceUnit[] getServiceUnits() {
+ return serviceUnits.toArray(new ServiceUnit[serviceUnits.size()]);
+ }
+
+ public void init() throws JBIException {
+ transition(State.Initialized);
+ }
+
+ public void shutdown() throws JBIException {
+ transition(State.Shutdown);
+ }
+
+ public void start() throws JBIException {
+ transition(State.Started);
+ }
+
+ public void stop() throws JBIException {
+ transition(State.Stopped);
+ }
+
+ protected void transition(State to) throws JBIException {
+ // TODO: reject invalid transitions, for example Started -> Shutdown
+ // we need to either automatically follow the intermediate steps, or just throw an exception
+ State from = state;
+ List<ServiceUnitImpl> success = new ArrayList<ServiceUnitImpl>();
+ for (ServiceUnitImpl su : serviceUnits) {
+ try {
+ changeState(su, to);
+ success.add(su);
+ } catch (JBIException e) {
+ if (from != State.Unknown) {
+ for (ServiceUnitImpl su2 : success) {
+ try {
+ changeState(su2, from);
+ } catch (JBIException e2) {
+ // Ignore
+ }
+ }
+ }
+ throw e;
+ }
+ }
+ state = to;
+ }
+
+ protected void changeState(ServiceUnitImpl su, State state) throws JBIException {
+ switch (state) {
+ case Initialized:
+ su.init();
+ break;
+ case Started:
+ su.start();
+ break;
+ case Stopped:
+ su.stop();
+ break;
+ case Shutdown:
+ su.shutdown();
+ break;
+ }
+ }
+
}
Added: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceUnitImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceUnitImpl.java?rev=605551&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceUnitImpl.java (added)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/ServiceUnitImpl.java Wed Dec 19 06:29:53 2007
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.deployer.impl;
+
+import java.io.File;
+
+import javax.jbi.JBIException;
+import javax.jbi.component.Component;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.deployer.ServiceUnit;
+import org.apache.servicemix.jbi.deployer.descriptor.ServiceUnitDesc;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+
+public class ServiceUnitImpl implements ServiceUnit {
+
+ private static final Log Logger = LogFactory.getLog(ServiceUnitImpl.class);
+
+ private ServiceUnitDesc serviceUnitDesc;
+
+ private File rootDir;
+
+ private Component component;
+
+ public ServiceUnitImpl(ServiceUnitDesc serviceUnitDesc, File rootDir, Component component) {
+ this.serviceUnitDesc = serviceUnitDesc;
+ this.rootDir = rootDir;
+ this.component = component;
+ }
+
+ public String getKey() {
+ return getComponentName() + "/" + getName();
+ }
+
+ public String getName() {
+ return serviceUnitDesc.getIdentification().getName();
+ }
+
+ public String getDescription() {
+ return serviceUnitDesc.getIdentification().getDescription();
+ }
+
+ public String getComponentName() {
+ return serviceUnitDesc.getTarget().getComponentName();
+ }
+
+ public File getRootDir() {
+ return rootDir;
+ }
+
+ public void deploy() throws JBIException {
+ component.getServiceUnitManager().deploy(getName(), getRootDir().getAbsolutePath());
+ }
+
+ public void init() throws JBIException {
+ component.getServiceUnitManager().init(getName(), getRootDir().getAbsolutePath());
+ }
+
+ public void shutdown() throws JBIException {
+ component.getServiceUnitManager().shutDown(getName());
+ }
+
+ public void start() throws JBIException {
+ component.getServiceUnitManager().start(getName());
+ }
+
+ public void stop() throws JBIException {
+ component.getServiceUnitManager().stop(getName());
+ }
+
+}
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/SharedLibraryImpl.java Wed Dec 19 06:29:53 2007
@@ -16,13 +16,11 @@
*/
package org.apache.servicemix.jbi.deployer.impl;
-import java.io.File;
-import java.net.MalformedURLException;
import java.net.URL;
import org.apache.servicemix.jbi.deployer.SharedLibrary;
import org.apache.servicemix.jbi.deployer.descriptor.ClassPath;
-import org.apache.xbean.classloader.JarFileClassLoader;
+import org.apache.servicemix.jbi.deployer.descriptor.SharedLibraryDesc;
import org.apache.xbean.classloader.MultiParentClassLoader;
import org.osgi.framework.Bundle;
import org.springframework.osgi.internal.context.support.BundleDelegatingClassLoader;
@@ -32,10 +30,10 @@
*/
public class SharedLibraryImpl implements SharedLibrary {
- private org.apache.servicemix.jbi.deployer.descriptor.SharedLibrary library;
+ private SharedLibraryDesc library;
private Bundle bundle;
- public SharedLibraryImpl(org.apache.servicemix.jbi.deployer.descriptor.SharedLibrary library, Bundle bundle) {
+ public SharedLibraryImpl(SharedLibraryDesc library, Bundle bundle) {
this.library = library;
this.bundle = bundle;
}
Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactoryTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactoryTest.java?rev=605551&r1=605550&r2=605551&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactoryTest.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/test/java/org/apache/servicemix/jbi/deployer/descriptor/DescriptorFactoryTest.java Wed Dec 19 06:29:53 2007
@@ -52,7 +52,7 @@
Descriptor root = DescriptorFactory.buildDescriptor(getClass().getResource("sharedLibrary.xml"));
assertNotNull("Unable to parse descriptor", root);
- SharedLibrary sl = root.getSharedLibrary();
+ SharedLibraryDesc sl = root.getSharedLibrary();
Identification identification = sl.getIdentification();
assertEquals("getName", "TestSharedLibrary", identification.getName());
assertEquals("getDescription", "This is a test shared library.", identification.getDescription());
@@ -63,7 +63,7 @@
Descriptor root = DescriptorFactory.buildDescriptor(getClass().getResource("serviceAssembly.xml"));
assertNotNull("Unable to parse descriptor", root);
- ServiceAssembly serviceAssembly = root.getServiceAssembly();
+ ServiceAssemblyDesc serviceAssembly = root.getServiceAssembly();
assertNotNull("serviceAssembly is null", serviceAssembly);
Identification identification = serviceAssembly.getIdentification();
@@ -71,7 +71,7 @@
assertEquals("getName", "ServiceAssembly_041207153211-0800_saId", identification.getName());
assertEquals("getDescription", "Description of Service Assembly : ServiceAssembly", identification.getDescription());
- ServiceUnit[] serviceUnits = serviceAssembly.getServiceUnits();
+ ServiceUnitDesc[] serviceUnits = serviceAssembly.getServiceUnits();
assertNotNull("serviceUnits are null", serviceUnits);
assertEquals("serviceUnits size", 4, serviceUnits.length);
@@ -102,7 +102,7 @@
assertNotNull("Unable to parse descriptor", root);
// component stuff
- Component component = root.getComponent();
+ ComponentDesc component = root.getComponent();
assertNotNull("component is null", component);
assertEquals("getBootstrapClassName", "com.foo.Engine1Bootstrap", component.getBootstrapClassName());
assertEquals("getComponentClassName", "com.foo.Engine1", component.getComponentClassName());