Diff
Modified: trunk/core/src/main/java/org/servicemix/jbi/container/EnvironmentContext.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/container/EnvironmentContext.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/container/EnvironmentContext.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -133,7 +133,9 @@
* @return Returns the tmpDir
*/
public File getTmpDir() {
- FileUtil.buildDirectory(tmpDir);
+ if (tmpDir != null) {
+ FileUtil.buildDirectory(tmpDir);
+ }
return tmpDir;
}
@@ -274,23 +276,26 @@
* @throws JBIException
*/
public ComponentEnvironment registerComponent(ComponentEnvironment result,
- LocalComponentConnector connector) throws JBIException {
- if (result == null) {
- result = new ComponentEnvironment();
- // add workspace root and stats root ..
- try {
- if (!connector.isPojo()) {
- String name = connector.getComponentNameSpace().getName();
- File componentRoot = getComponentRootDirectory(name);
- FileUtil.buildDirectory(componentRoot);
- File privateWorkspace = createWorkspaceDirectory(name);
- result.setWorkspaceRoot(privateWorkspace);
- result.setComponentRoot(componentRoot);
- }
- } catch (IOException e) {
- throw new JBIException(e);
- }
- }
+ LocalComponentConnector connector) throws JBIException {
+ if (result == null) {
+ result = new ComponentEnvironment();
+ }
+ if (!connector.isPojo()) {
+ if (container.isEmbedded()) {
+ throw new JBIException("JBI component can not be installed in embedded mode");
+ }
+ // add workspace root and stats root ..
+ try {
+ String name = connector.getComponentNameSpace().getName();
+ File componentRoot = getComponentRootDirectory(name);
+ FileUtil.buildDirectory(componentRoot);
+ File privateWorkspace = createWorkspaceDirectory(name);
+ result.setWorkspaceRoot(privateWorkspace);
+ result.setComponentRoot(componentRoot);
+ } catch (IOException e) {
+ throw new JBIException(e);
+ }
+ }
result.setLocalConnector(connector);
envMap.put(connector, result);
return result;
@@ -464,10 +469,15 @@
private void buildDirectoryStructure() throws JBIException {
if (!jbiRootDir.exists()) {
- log.warn("Directory does not exist: " + jbiRootDir.getAbsolutePath());
+ // We want ServiceMix to be able to run embedded
+ // so do not create the directory structure if the root does not exist
+ if (container.isEmbedded()) {
+ return;
+ }
if (!jbiRootDir.mkdirs()) {
throw new JBIException("Directory could not be created: "+jbiRootDir.getAbsolutePath());
}
+ return;
} else if (!jbiRootDir.isDirectory()) {
throw new JBIException("Not a directory: " + jbiRootDir.getAbsolutePath());
}
Modified: trunk/core/src/main/java/org/servicemix/jbi/container/JBIContainer.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/container/JBIContainer.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/container/JBIContainer.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -109,6 +109,7 @@
protected boolean autoEnlistInTransaction = false;
protected boolean persistent = false;
protected List listeners = new CopyOnWriteArrayList();
+ protected boolean embedded = false;
/**
* Default Constructor
@@ -889,7 +890,7 @@
lcc.setPojo(pojo);
ComponentEnvironment env = environmentContext.registerComponent(context.getEnvironment(),lcc);
env.setInstallRoot(installationDir);
- context.activate(component, dc, env, activationSpec, installationDir);
+ context.activate(component, dc, env, activationSpec);
lcc.setContext(context);
lcc.setActivationSpec(activationSpec);
component.getLifeCycle().init(context);
@@ -1055,4 +1056,12 @@
sendExchange(me.getMirror());
}
+ public boolean isEmbedded() {
+ return embedded;
+ }
+
+ public void setEmbedded(boolean embedded) {
+ this.embedded = embedded;
+ }
+
}
\ No newline at end of file
Modified: trunk/core/src/main/java/org/servicemix/jbi/container/SubscriptionSpec.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/container/SubscriptionSpec.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/container/SubscriptionSpec.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -38,6 +38,9 @@
*/
public class SubscriptionSpec implements Serializable {
+ /**
+ * Generated serial version UID
+ */
private static final long serialVersionUID = 8458586342841647313L;
private QName service;
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/AutoDeploymentService.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/AutoDeploymentService.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/AutoDeploymentService.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -143,7 +143,9 @@
this.installationService = container.getInstallationService();
this.deploymentService = container.getDeploymentService();
// clean-up tmp directory
- FileUtil.deleteFile(environmentContext.getTmpDir());
+ if (environmentContext.getTmpDir() != null) {
+ FileUtil.deleteFile(environmentContext.getTmpDir());
+ }
this.buildState(environmentContext.getInstallationDir());
this.buildState(environmentContext.getDeploymentDir());
container.getManagementContext().registerSystemService(this, LifeCycleMBean.class);
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentContextImpl.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentContextImpl.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentContextImpl.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -16,8 +16,8 @@
* limitations under the License.
*
**/
+package org.servicemix.jbi.framework;
-package org.servicemix.jbi.framework;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.servicemix.jbi.container.ActivationSpec;
@@ -42,7 +42,6 @@
import javax.resource.spi.work.WorkManager;
import javax.xml.namespace.QName;
-import java.io.File;
import java.util.MissingResourceException;
import java.util.logging.Logger;
@@ -59,7 +58,6 @@
private Component component;
private DeliveryChannel deliveryChannel;
private ActivationSpec activationSpec;
- private File installRoot;
private boolean activated;
/**
@@ -83,12 +81,11 @@
* @param installRoot
*/
public void activate(Component component, DeliveryChannelImpl channel, ComponentEnvironment env,
- ActivationSpec spec, File installRoot) {
+ ActivationSpec spec) {
this.component = component;
this.deliveryChannel = channel;
this.environment = env;
this.activationSpec = spec;
- this.installRoot = installRoot;
channel.setContext(this);
activated = true;
//activate and subscriptions
@@ -269,7 +266,10 @@
* @return the root directory path
*/
public String getWorkspaceRoot() {
- return environment.getWorkspaceRoot().getAbsolutePath();
+ if (environment.getWorkspaceRoot() != null) {
+ return environment.getWorkspaceRoot().getAbsolutePath();
+ }
+ return null;
}
/**
@@ -440,7 +440,10 @@
* @return the installation root directory path, in platform-specific form; must be non-null and non-empty.
*/
public String getInstallRoot() {
- return installRoot.getAbsolutePath();
+ if (environment.getInstallRoot() != null) {
+ return environment.getInstallRoot().getAbsolutePath();
+ }
+ return null;
}
/**
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentNameSpace.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentNameSpace.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentNameSpace.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -24,12 +24,15 @@
import java.io.ObjectOutput;
/**
- * Component Name is used internally to identify a Component
+ * Component Name is used internally to identify a Component.
*
* @version $Revision$
*/
-public class ComponentNameSpace implements Externalizable{
+public class ComponentNameSpace implements Externalizable {
+ /**
+ * Generated serial version UID
+ */
private static final long serialVersionUID = -9130913368962887486L;
protected String containerName;
@@ -140,7 +143,6 @@
out.writeUTF(containerName != null ? containerName : "");
out.writeUTF(name != null ? name : "");
out.writeUTF(componentId != null ? componentId : "");
-
}
/**
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacket.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacket.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacket.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -33,9 +33,13 @@
*
* @version $Revision$
*/
-public class ComponentPacket implements Serializable{
+public class ComponentPacket implements Serializable {
+ /**
+ * Generated serial version UID
+ */
private static final long serialVersionUID = 6229348132456423265L;
+
private ComponentNameSpace componentName;
private String description = "POJO Component";
private Set endpoints = new CopyOnWriteArraySet();
@@ -49,14 +53,14 @@
* Default Constructor
*
*/
- public ComponentPacket(){
+ public ComponentPacket() {
}
/**
* Construct with it's id and delivery channel Id
* @param componentName
*/
- public ComponentPacket(ComponentNameSpace componentName){
+ public ComponentPacket(ComponentNameSpace componentName) {
this.componentName = componentName;
}
@@ -78,7 +82,7 @@
* Add an activated endpoint
* @param endpoint
*/
- public void addActiveEndpoint(ServiceEndpoint endpoint){
+ public void addActiveEndpoint(ServiceEndpoint endpoint) {
endpoints.add(endpoint);
}
@@ -86,7 +90,7 @@
* remove an activated endpoint
* @param endpoint
*/
- public void removeActiveEndpoint(ServiceEndpoint endpoint){
+ public void removeActiveEndpoint(ServiceEndpoint endpoint) {
endpoints.remove(endpoint);
}
@@ -94,7 +98,7 @@
* Get the Set of activated endpoints
* @return the activated endpoint Set
*/
- public Set getActiveEndpoints(){
+ public Set getActiveEndpoints() {
return endpoints;
}
@@ -102,7 +106,7 @@
* Add an external activated endpoint
* @param endpoint
*/
- public void addExternalActiveEndpoint(ServiceEndpoint endpoint){
+ public void addExternalActiveEndpoint(ServiceEndpoint endpoint) {
externalEndpoints.add(endpoint);
}
@@ -110,7 +114,7 @@
* remove an external activated endpoint
* @param endpoint
*/
- public void removeExternalActiveEndpoint(ServiceEndpoint endpoint){
+ public void removeExternalActiveEndpoint(ServiceEndpoint endpoint) {
externalEndpoints.remove(endpoint);
}
@@ -118,17 +122,17 @@
* Get the Set of external activated endpoints
* @return the activated endpoint Set
*/
- public Set getExternalActiveEndpoints(){
+ public Set getExternalActiveEndpoints() {
return externalEndpoints;
}
- public void addSubscriptionSpec(SubscriptionSpec ss){
+ public void addSubscriptionSpec(SubscriptionSpec ss) {
subscriptionSpecs.add(ss);
}
- public void removeSubscriptionSpec(SubscriptionSpec ss){
+ public void removeSubscriptionSpec(SubscriptionSpec ss) {
subscriptionSpecs.remove(ss);
}
@@ -136,7 +140,7 @@
* Get the Set of activated endpoints
* @return the activated endpoint Set
*/
- public Set getSubscriptionSpecs(){
+ public Set getSubscriptionSpecs() {
return subscriptionSpecs;
}
@@ -183,10 +187,10 @@
* @param obj
* @return true if obj equivalent to this
*/
- public boolean equals(Object obj){
+ public boolean equals(Object obj) {
boolean result = false;
- if (obj != null && obj instanceof ComponentPacket){
- ComponentPacket other =(ComponentPacket)obj;
+ if (obj != null && obj instanceof ComponentPacket) {
+ ComponentPacket other =(ComponentPacket) obj;
result = other.getComponentNameSpace().equals(this.getComponentNameSpace());
}
return result;
@@ -195,7 +199,7 @@
/**
* @return hashCodde
*/
- public int hashCode(){
+ public int hashCode() {
return getComponentNameSpace().hashCode();
}
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEvent.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEvent.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEvent.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -16,7 +16,6 @@
* limitations under the License.
*
**/
-
package org.servicemix.jbi.framework;
import java.io.Serializable;
@@ -26,8 +25,11 @@
*
* @version $Revision$
*/
-public class ComponentPacketEvent implements Serializable{
+public class ComponentPacketEvent implements Serializable {
+ /**
+ * Generated serial version UID
+ */
private static final long serialVersionUID = 6365244552146210991L;
/**
* ComponentConnector activated
@@ -44,8 +46,8 @@
public static final int STATE_CHANGE = 3;
- int status = ACTIVATED;
- ComponentPacket packet;
+ private int status = ACTIVATED;
+ private ComponentPacket packet;
/**
* Default Constructor
@@ -59,7 +61,7 @@
* @param packet
* @param status
*/
- public ComponentPacketEvent(ComponentPacket packet, int status){
+ public ComponentPacketEvent(ComponentPacket packet, int status) {
this.packet = packet;
this.status = status;
}
@@ -93,7 +95,7 @@
* @return pretty print
*/
public String toString(){
- return "ComponentPacketEvent: status = " + ComponentPacketEvent.getStatusAsString(status) + " packet= " + packet;
+ return "ComponentPacketEvent[status=" + ComponentPacketEvent.getStatusAsString(status) + ",packet=" + packet + "]";
}
/**
@@ -101,7 +103,7 @@
* @param status
* @return String representation of the status
*/
- public static String getStatusAsString(int status){
+ public static String getStatusAsString(int status) {
String result = null;
switch (status) {
case ACTIVATED:
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEventListener.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEventListener.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/ComponentPacketEventListener.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -16,10 +16,8 @@
* limitations under the License.
*
**/
-
package org.servicemix.jbi.framework;
-
/**
* Listen for changes to ComponentConnectors
*
@@ -27,7 +25,6 @@
*/
public interface ComponentPacketEventListener {
-
/**
* A ComponentConector has changed
* @param event
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/DeploymentService.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/DeploymentService.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/DeploymentService.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -552,7 +552,7 @@
protected void buildState() {
// walk through deployed SA's
File top = environmentContext.getSALibDir();
- if (top.exists() && top.isDirectory()) {
+ if (top != null && top.exists() && top.isDirectory()) {
File[] files = top.listFiles();
if (files != null) {
for (int i = 0;i < files.length;i++) {
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/InstallationService.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/InstallationService.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/InstallationService.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -463,7 +463,7 @@
protected void buildSharedLibs() {
// walk through shared libaries and add then to the ClassLoaderService
File top = environmentContext.getSharedLibDir();
- if (top.exists() && top.isDirectory()) {
+ if (top != null && top.exists() && top.isDirectory()) {
// directory structure is sharedlibraries/<lib name>stuff ...
File[] files = top.listFiles();
if (files != null) {
@@ -490,7 +490,7 @@
protected void buildComponents() {
// walk through components and add then to the ClassLoaderService
File top = environmentContext.getComponentsDir();
- if (top.exists() && top.isDirectory()) {
+ if (top != null && top.exists() && top.isDirectory()) {
// directory structure is components/<component name>/installation ...
File[] files = top.listFiles();
if (files != null) {
Modified: trunk/core/src/main/java/org/servicemix/jbi/framework/LocalComponentConnector.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/framework/LocalComponentConnector.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/framework/LocalComponentConnector.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -16,8 +16,8 @@
* limitations under the License.
*
**/
+package org.servicemix.jbi.framework;
-package org.servicemix.jbi.framework;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.servicemix.jbi.container.ActivationSpec;
Modified: trunk/core/src/main/java/org/servicemix/jbi/servicedesc/DynamicEndpoint.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/servicedesc/DynamicEndpoint.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/servicedesc/DynamicEndpoint.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -28,6 +28,11 @@
*/
public class DynamicEndpoint extends AbstractServiceEndpoint {
+ /**
+ * Generated serial version UID
+ */
+ private static final long serialVersionUID = -9084647509619730734L;
+
private final QName serviceName;
private final String endpointName;
private final transient DocumentFragment epr;
@@ -41,18 +46,30 @@
this.epr = epr;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
+ */
public DocumentFragment getAsReference(QName operationName) {
return epr;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
+ */
public String getEndpointName() {
return endpointName;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
+ */
public QName[] getInterfaces() {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
+ */
public QName getServiceName() {
return serviceName;
}
Modified: trunk/core/src/main/java/org/servicemix/jbi/servicedesc/ExternalEndpoint.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/servicedesc/ExternalEndpoint.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/servicedesc/ExternalEndpoint.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -28,9 +28,15 @@
* by [EMAIL PROTECTED] javax.jbi.component.ComponentContext#registerExternalEndpoint(ServiceEndpoint)}.
* These endpoints can not be used to address message exchanges.
*
+ * TODO: this class should be serializable
*/
public class ExternalEndpoint extends AbstractServiceEndpoint {
+ /**
+ * Generated serial version UID
+ */
+ private static final long serialVersionUID = 4257588916448457889L;
+
protected final ServiceEndpoint se;
public ExternalEndpoint(ComponentNameSpace cns, ServiceEndpoint se) {
@@ -38,26 +44,44 @@
this.se = se;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
+ */
public DocumentFragment getAsReference(QName operationName) {
return se.getAsReference(operationName);
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
+ */
public String getEndpointName() {
return se.getEndpointName();
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
+ */
public QName[] getInterfaces() {
return se.getInterfaces();
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
+ */
public QName getServiceName() {
return se.getServiceName();
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
public boolean equals(Object obj) {
return se.equals(obj);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
public int hashCode() {
return se.hashCode();
}
Modified: trunk/core/src/main/java/org/servicemix/jbi/servicedesc/InternalEndpoint.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/servicedesc/InternalEndpoint.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/servicedesc/InternalEndpoint.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -17,28 +17,29 @@
package org.servicemix.jbi.servicedesc;
-import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
import org.servicemix.jbi.framework.ComponentNameSpace;
import org.w3c.dom.DocumentFragment;
-import javax.jbi.servicedesc.ServiceEndpoint;
-import javax.xml.namespace.QName;
-
-import java.util.List;
-
/**
- * Reference generated by NMR ro refer to an endpoint registration
+ * Reference generated by NMR to refer to an endpoint registration
*
* @version $Revision$
*/
-public class InternalEndpoint extends AbstractServiceEndpoint implements ServiceEndpoint {
+public class InternalEndpoint extends AbstractServiceEndpoint {
+ /**
+ * Generated serial version UID
+ */
private static final long serialVersionUID = -2710298087712302015L;
private String endpointName;
private QName serviceName;
- private List interfaces = new CopyOnWriteArrayList();
+ private List interfaces = new ArrayList();
@@ -85,7 +86,7 @@
* @return array of all interfaces implemented by this service endpoint;
* must be non-null and non-empty.
*/
- public synchronized QName[] getInterfaces() {
+ public QName[] getInterfaces() {
QName[] result = new QName[interfaces.size()];
interfaces.toArray(result);
return result;
@@ -95,7 +96,7 @@
* Add an interface
* @param name
*/
- public synchronized void addInterface(QName name) {
+ public void addInterface(QName name) {
interfaces.add(name);
}
@@ -132,6 +133,6 @@
* @return a pretty print of this
*/
public String toString() {
- return "ServiceEndpoint[service: " + serviceName + "; endpoint: " + endpointName + "]";
+ return "ServiceEndpoint[service=" + serviceName + ",endpoint=" + endpointName + "]";
}
}
\ No newline at end of file
Modified: trunk/core/src/main/java/org/servicemix/jbi/servicedesc/LinkedEndpoint.java (930 => 931)
--- trunk/core/src/main/java/org/servicemix/jbi/servicedesc/LinkedEndpoint.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/main/java/org/servicemix/jbi/servicedesc/LinkedEndpoint.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -28,6 +28,11 @@
*/
public class LinkedEndpoint extends AbstractServiceEndpoint {
+ /**
+ * Generated serial version UID
+ */
+ private static final long serialVersionUID = 4615848436197469611L;
+
private final QName fromService;
private final String fromEndpoint;
private final QName toService;
@@ -48,30 +53,54 @@
this.linkType = linkType;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getAsReference(javax.xml.namespace.QName)
+ */
public DocumentFragment getAsReference(QName operationName) {
return EndpointReferenceBuilder.getReference(this);
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getEndpointName()
+ */
public String getEndpointName() {
return this.fromEndpoint;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getInterfaces()
+ */
public QName[] getInterfaces() {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.jbi.servicedesc.ServiceEndpoint#getServiceName()
+ */
public QName getServiceName() {
return this.fromService;
}
+ /**
+ * Get the link type.
+ * @return the link type
+ */
public String getLinkType() {
return linkType;
}
+ /**
+ * Get the destination endpoint.
+ * @return the destination endpoint
+ */
public String getToEndpoint() {
return toEndpoint;
}
+ /**
+ * Get the destination service.
+ * @return the destination service
+ */
public QName getToService() {
return toService;
}
Added: trunk/core/src/test/java/org/servicemix/jbi/framework/ComponentNameSpaceTest.java (930 => 931)
--- trunk/core/src/test/java/org/servicemix/jbi/framework/ComponentNameSpaceTest.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/test/java/org/servicemix/jbi/framework/ComponentNameSpaceTest.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -0,0 +1,99 @@
+/**
+ *
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ *
+ * Licensed 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.servicemix.jbi.framework;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.TestCase;
+
+public class ComponentNameSpaceTest extends TestCase {
+
+ /*
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.getComponentId()'
+ */
+ public void testAccessors() {
+ ComponentNameSpace cns = new ComponentNameSpace();
+ assertNull(cns.getContainerName());
+ assertNull(cns.getComponentId());
+ assertNull(cns.getName());
+ cns.setComponentId("id");
+ assertEquals("id", cns.getComponentId());
+ cns.setContainerName("container");
+ assertEquals("container", cns.getContainerName());
+ cns.setName("name");
+ assertEquals("name", cns.getName());
+ }
+
+ /*
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.equals(Object)'
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.hashCode()'
+ */
+ public void testHashCodeEqualsObject() {
+ ComponentNameSpace cns1 = new ComponentNameSpace("container", "name1", "id");
+ ComponentNameSpace cns2 = new ComponentNameSpace("container", "name2", "id");
+ assertTrue(cns1.equals(cns2));
+ assertTrue(cns1.hashCode() == cns2.hashCode());
+
+ ComponentNameSpace cns3 = new ComponentNameSpace("container1", "name", "id");
+ ComponentNameSpace cns4 = new ComponentNameSpace("container2", "name", "id");
+ assertFalse(cns3.equals(cns4));
+ assertFalse(cns3.hashCode() == cns4.hashCode());
+
+ ComponentNameSpace cns5 = new ComponentNameSpace("container", "name", "id1");
+ ComponentNameSpace cns6 = new ComponentNameSpace("container", "name", "id2");
+ assertFalse(cns5.equals(cns6));
+ assertFalse(cns5.hashCode() == cns6.hashCode());
+ }
+
+ /*
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.writeExternal(ObjectOutput)'
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.readExternal(ObjectInput)'
+ */
+ public void testSerialize() throws Exception {
+ ComponentNameSpace cns = new ComponentNameSpace("container", "name", "id");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(cns);
+ oos.close();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ Object out = ois.readObject();
+
+ assertNotNull(out);
+ assertTrue(out instanceof ComponentNameSpace);
+ ComponentNameSpace cnsOut = (ComponentNameSpace) out;
+ assertEquals(cns, cnsOut);
+ assertEquals(cns.getName(), cnsOut.getName());
+ }
+
+ /*
+ * Test method for 'org.servicemix.jbi.framework.ComponentNameSpace.copy()'
+ */
+ public void testCopy() {
+ ComponentNameSpace cns1 = new ComponentNameSpace("container", "name", "id");
+ ComponentNameSpace cns2 = cns1.copy();
+ assertEquals(cns1, cns1);
+ assertEquals(cns1.getName(), cns2.getName());
+ }
+
+}
Modified: trunk/core/src/test/java/org/servicemix/jbi/nmr/BrokerTest.java (930 => 931)
--- trunk/core/src/test/java/org/servicemix/jbi/nmr/BrokerTest.java 2005-11-25 08:27:03 UTC (rev 930)
+++ trunk/core/src/test/java/org/servicemix/jbi/nmr/BrokerTest.java 2005-11-25 08:59:36 UTC (rev 931)
@@ -45,7 +45,7 @@
container.start();
ReceiverComponent receiver = new ReceiverComponent() {
protected void init() throws JBIException {
- ServiceEndpoint ep = new ExternalEndpoint(getService(), getEndpoint());
+ ServiceEndpoint ep = new TestExternalEndpoint(getService(), getEndpoint());
getContext().registerExternalEndpoint(ep);
setService(null);
setEndpoint(null);
@@ -75,10 +75,10 @@
receiver.getMessageList().assertMessagesReceived(1);
}
- public static class ExternalEndpoint implements ServiceEndpoint {
+ public static class TestExternalEndpoint implements ServiceEndpoint {
private QName service;
private String endpoint;
- public ExternalEndpoint(QName service, String endpoint) {
+ public TestExternalEndpoint(QName service, String endpoint) {
this.service = service;
this.endpoint = endpoint;
}