[jboss-svn-commits] JBL Code SVN: r22854 - in labs/jbossesb/workspace/skeagh/runtime/src: main/java/org/jboss/esb/deploy/config and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 17 12:14:45 EDT 2008
Author: tfennelly
Date: 2008-09-17 12:14:44 -0400 (Wed, 17 Sep 2008)
New Revision: 22854
Added:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentServiceSetsTest.java
Removed:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java
Modified:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/DeploymentUnit.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessageListener.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java
Log:
more bus work. Getting closer. Main body of cod is in there. Just need to get it working now and get the bugs out of it now with tests :-)
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -27,11 +27,13 @@
import org.jboss.esb.deploy.config.DeploymentUnit;
import org.jboss.esb.deploy.config.InboundRouterConfig;
import org.jboss.esb.deploy.config.OutboundRouterConfig;
+import org.jboss.esb.deploy.config.PropertiesUtil;
import org.jboss.esb.deploy.config.ServiceConfig;
-import org.jboss.esb.deploy.config.PropertiesUtil;
-import org.jboss.esb.dispatch.DispatcherProxy;
import org.jboss.esb.dispatch.LocalDispatcher;
import org.jboss.esb.federate.DeploymentCoordinator;
+import org.jboss.esb.federate.bus.BusDispatcher;
+import org.jboss.esb.federate.bus.BusInboundRouter;
+import org.jboss.esb.federate.bus.BusOutboundRouter;
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.properties.ApplicationProperties;
import org.jboss.esb.schedule.JobScheduler;
@@ -72,14 +74,22 @@
*/
private String deploymentName = "$UNKNOWN$";
/**
+ * Deployment properties.
+ */
+ private ApplicationProperties deploymentProperties;
+ /**
* Unique deployment ID.
*/
- private String deploymentId = UUID.randomUUID().toString().replace('-', 'x');
+ private String deploymentId = UUID.randomUUID().toString();
/**
* The list of configurations associated with this deployment instance.
*/
private List<DeploymentUnit> deploymentUnits = new ArrayList<DeploymentUnit>();
/**
+ * Aggregated deployment unit.
+ */
+ private DeploymentUnit aggregatedDeploymentUnit = new DeploymentUnit();
+ /**
* Deployed Objects Map.
*/
private Map<Object, Object> deployedObjects = new LinkedHashMap<Object, Object>()
@@ -180,11 +190,13 @@
* Add a {@link org.jboss.esb.deploy.config.DeploymentUnit} to this Runtime.
*
* @param deployment Configuration Unit to be added.
+ * @throws DeploymentException Cannot add deployment to this runtime.
*/
- public final void add(final DeploymentUnit deployment)
+ public final void add(final DeploymentUnit deployment) throws DeploymentException
{
AssertArgument.isNotNull(deployment, "deployment");
deploymentUnits.add(deployment);
+ aggregatedDeploymentUnit.addDeployment(deployment);
}
/**
@@ -202,6 +214,10 @@
throw new DeploymentException("Runtime already deployed.");
}
+ deploymentProperties = PropertiesUtil.getDeploymentConfig(deploymentName);
+ deploymentId = deploymentProperties.getProperty("deployment.id", UUID.randomUUID().toString());
+ deploymentId += ":" + deploymentName;
+
context = new DeploymentContext();
logger.info("Starting JBoss ESB deployment: '" + deploymentName + "'.");
@@ -306,33 +322,30 @@
// Expose the deployed resources via the DeploymentContext...
context.setResources(deployedResources);
- for (DeploymentUnit deploymentUnit : deploymentUnits)
+ Map<String, Object> resourceMap = aggregatedDeploymentUnit.getResources();
+
+ // Make sure we deploy the JobScheduler resource before deploying any
+ // other resources...
+ JobScheduler scheduler = (JobScheduler) resourceMap.get(JobScheduler.SCHEDULER_RESOURCE_ID);
+ if (scheduler == null)
{
- Map<String, Object> resourceMap = deploymentUnit.getResources();
+ scheduler = new JobScheduler();
+ }
+ deployResource(JobScheduler.SCHEDULER_RESOURCE_ID, scheduler, deployedResources);
- // Make sure we deploy the JobScheduler resource before deploying any
- // other resources...
- JobScheduler scheduler = (JobScheduler) resourceMap.get(JobScheduler.SCHEDULER_RESOURCE_ID);
- if (scheduler == null)
- {
- scheduler = new JobScheduler();
- }
- deployResource(JobScheduler.SCHEDULER_RESOURCE_ID, scheduler, deployedResources);
-
- // Now deploy the other resources...
- Set<Map.Entry<String, Object>> resources = resourceMap.entrySet();
- for (Map.Entry<String, Object> resource : resources)
- {
- deployResource(resource.getKey(), resource.getValue(), deployedResources);
- }
+ // Now deploy the other resources...
+ Set<Map.Entry<String, Object>> resources = resourceMap.entrySet();
+ for (Map.Entry<String, Object> resource : resources)
+ {
+ deployResource(resource.getKey(), resource.getValue(), deployedResources);
}
}
/**
* Deploy resource.
*
- * @param key Resource key.
- * @param resource Resource object instance.
+ * @param key Resource key.
+ * @param resource Resource object instance.
* @param resources The list of already deployed resources.
* @throws DeploymentException Unable to deploy resource.
*/
@@ -364,27 +377,24 @@
*/
private void deployServices() throws DeploymentException
{
- for (DeploymentUnit deploymentUnit : deploymentUnits)
+ Map<ServiceName, ServiceConfig> serviceMap = aggregatedDeploymentUnit.getServices();
+ Set<Map.Entry<ServiceName, ServiceConfig>> services = serviceMap.entrySet();
+
+ for (Map.Entry<ServiceName, ServiceConfig> service : services)
{
- Map<ServiceName, ServiceConfig> serviceMap = deploymentUnit.getServices();
- Set<Map.Entry<ServiceName, ServiceConfig>> services = serviceMap.entrySet();
-
- for (Map.Entry<ServiceName, ServiceConfig> service : services)
+ try
{
- try
- {
- deployObject(service.getValue().getService(), null, service.getKey());
- logger.debug("Deployed service '" + service.getKey() + "' (" + service.getValue().getClass().getName() + ").");
- }
- catch (InvocationTargetException e)
- {
- throw new DeploymentException("Unable to deploy service '" + service.getKey() + "' (" + service.getValue().getService().getClass().getName() + ").", e.getCause());
- }
- catch (Exception e)
- {
- throw new DeploymentException("Unable to deploy service '" + service.getKey() + "' (" + service.getValue().getService().getClass().getName() + ").", e);
- }
+ deployObject(service.getValue().getService(), null, service.getKey());
+ logger.debug("Deployed service '" + service.getKey() + "' (" + service.getValue().getClass().getName() + ").");
}
+ catch (InvocationTargetException e)
+ {
+ throw new DeploymentException("Unable to deploy service '" + service.getKey() + "' (" + service.getValue().getService().getClass().getName() + ").", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unable to deploy service '" + service.getKey() + "' (" + service.getValue().getService().getClass().getName() + ").", e);
+ }
}
}
@@ -395,52 +405,46 @@
*/
private void deployInboundRouters() throws DeploymentException
{
- for (DeploymentUnit deploymentUnit : deploymentUnits)
+ Map<ServiceName, List<InboundRouterConfig>> routerMap = aggregatedDeploymentUnit.getInboundRouters();
+ Set<Map.Entry<ServiceName, List<InboundRouterConfig>>> routers = routerMap.entrySet();
+
+ for (Map.Entry<ServiceName, List<InboundRouterConfig>> routerConfigMap : routers)
{
- Map<ServiceName, List<InboundRouterConfig>> routerMap = deploymentUnit.getInboundRouters();
- Set<Map.Entry<ServiceName, List<InboundRouterConfig>>> routers = routerMap.entrySet();
+ ServiceName serviceName = routerConfigMap.getKey();
- for (Map.Entry<ServiceName, List<InboundRouterConfig>> routerConfigMap : routers)
+ List<InboundRouterConfig> routerList = routerConfigMap.getValue();
+ for (InboundRouterConfig routerConfig : routerList)
{
- ServiceName serviceName = routerConfigMap.getKey();
-
- List<InboundRouterConfig> routerList = routerConfigMap.getValue();
- for (InboundRouterConfig routerConfig : routerList)
+ try
{
- try
- {
- // Deploy the transformers first...
- deployTransformers(serviceName, routerConfig.getTransformers(), routerConfig.getName());
+ // Deploy the transformers first...
+ deployTransformers(serviceName, routerConfig.getTransformers(), routerConfig.getName());
- // Create a LocalDispatcher and hook it into the DispatcherProxy. This may
- // get updated later...
- LocalDispatcher dispatcher = new LocalDispatcher(context);
- dispatcher.setServiceName(serviceName);
- dispatcher.setService(getService(deploymentUnit, serviceName));
- dispatcher.setTransformers(routerConfig.getTransformers());
- dispatcher.setOutboundRouters(deploymentUnit.getOutboundRouters().get(serviceName));
- dispatcher.initialize();
+ // Create a LocalDispatcher and hook it into the DispatcherProxy...
+ LocalDispatcher dispatcher = new LocalDispatcher(context);
+ dispatcher.setServiceName(serviceName);
+ dispatcher.setService(getService(aggregatedDeploymentUnit, serviceName));
+ dispatcher.setTransformers(routerConfig.getTransformers());
+ dispatcher.setOutboundRouters(aggregatedDeploymentUnit.getOutboundRouters().get(serviceName));
+ dispatcher.initialize();
- // We set a DispatcherProxy on the actual router because we may need to update
- // the "effective" dispatcher later, depending on other deployments that
- // come online...
- DispatcherProxy dispatcherProxy = new DispatcherProxy(dispatcher);
- routerConfig.setDispatcherProxy(dispatcherProxy);
- routerConfig.getRouter().setDispatcher(dispatcherProxy);
+ // Set the dispacther on both the router and the routerconfig. We set it on the config
+ // so we can access it later...
+ routerConfig.getRouter().setDispatcher(dispatcher);
+ routerConfig.setDispatcher(dispatcher);
- // Now deploy the router...
- deployObject(routerConfig.getRouter(), routerConfig.getName(), serviceName);
- logger.debug("Deployed InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").");
- }
- catch (InvocationTargetException e)
- {
- throw new DeploymentException("Unable to deploy InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e.getCause());
- }
- catch (Exception e)
- {
- throw new DeploymentException("Unable to deploy InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e);
- }
+ // Now deploy the router...
+ deployObject(routerConfig.getRouter(), routerConfig.getName(), serviceName);
+ logger.debug("Deployed InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").");
}
+ catch (InvocationTargetException e)
+ {
+ throw new DeploymentException("Unable to deploy InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unable to deploy InboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e);
+ }
}
}
}
@@ -508,39 +512,101 @@
*/
private void deployOutboundRouters() throws DeploymentException
{
- for (DeploymentUnit deploymentUnit : deploymentUnits)
+ Map<ServiceName, List<OutboundRouterConfig>> routerMap;
+
+ aggregatedDeploymentUnit.expandOutboundRouters();
+ routerMap = aggregatedDeploymentUnit.getOutboundRouters();
+
+ Set<Map.Entry<ServiceName, List<OutboundRouterConfig>>> routers = routerMap.entrySet();
+ for (Map.Entry<ServiceName, List<OutboundRouterConfig>> routerConfigMap : routers)
{
- Map<ServiceName, List<OutboundRouterConfig>> routerMap = deploymentUnit.getOutboundRouters();
- Set<Map.Entry<ServiceName, List<OutboundRouterConfig>>> routers = routerMap.entrySet();
-
- for (Map.Entry<ServiceName, List<OutboundRouterConfig>> routerConfigMap : routers)
+ List<OutboundRouterConfig> routerList = routerConfigMap.getValue();
+ for (OutboundRouterConfig routerConfig : routerList)
{
- List<OutboundRouterConfig> routerList = routerConfigMap.getValue();
- for (OutboundRouterConfig routerConfig : routerList)
+ try
{
- try
- {
- // Deploy the transformers first...
- deployTransformers(routerConfigMap.getKey(), routerConfig.getTransformers(), routerConfig.getName());
+ // Deploy the transformers first...
+ deployTransformers(routerConfigMap.getKey(), routerConfig.getTransformers(), routerConfig.getName());
- // Now deploy the router...
- deployObject(routerConfig.getRouter(), routerConfig.getName(), routerConfigMap.getKey());
- logger.debug("Deployed OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").");
- }
- catch (InvocationTargetException e)
- {
- throw new DeploymentException("Unable to deploy OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e.getCause());
- }
- catch (Exception e)
- {
- throw new DeploymentException("Unable to deploy OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e);
- }
+ // Now deploy the router...
+ deployObject(routerConfig.getRouter(), routerConfig.getName(), routerConfigMap.getKey());
+ logger.debug("Deployed OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").");
}
+ catch (InvocationTargetException e)
+ {
+ throw new DeploymentException("Unable to deploy OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e.getCause());
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unable to deploy OutboundRouter '" + routerConfig.getName() + "' (" + routerConfig.getRouter().getClass().getName() + ").", e);
+ }
}
}
}
/**
+ * Add a {@link BusOutboundRouter} for each Inbound Router Dispatcher.
+ * <p/>
+ * Add a {@link BusOutboundRouter} for every service, updating the supplied busRouters
+ * Map.
+ *
+ * @param busRouters The Map to which the routers are to be added.
+ */
+ public void addBusOutboundRouters(Map<ServiceName, BusOutboundRouter> busRouters)
+ {
+ Set<Map.Entry<ServiceName, List<OutboundRouterConfig>>> outRouters = aggregatedDeploymentUnit.getOutboundRouters().entrySet();
+
+ for (Map.Entry<ServiceName, List<OutboundRouterConfig>> serviceOutRouters : outRouters)
+ {
+ ServiceName serviceName = serviceOutRouters.getKey();
+ BusOutboundRouter busRouter = busRouters.get(serviceName);
+
+ if (busRouter == null)
+ {
+ busRouter = new BusOutboundRouter(serviceName);
+ busRouters.put(serviceName, busRouter);
+ }
+
+ List<OutboundRouterConfig> routerList = serviceOutRouters.getValue();
+ OutboundRouterConfig busRouterConfig = new OutboundRouterConfig();
+
+ busRouterConfig.setName("BusRouter:" + serviceName);
+ busRouterConfig.setRouter(busRouter);
+ routerList.add(busRouterConfig);
+ }
+ }
+
+ /**
+ * Add {@link BusInboundRouter} for all the services (and outbound routers)
+ * serviced by this deployment.
+ *
+ * @param busRouters The bus dispatchers table to be updated.
+ */
+ public final void addBusInboundRouters(final Map<ServiceName, BusInboundRouter> busRouters)
+ {
+ Set<Map.Entry<ServiceName, List<OutboundRouterConfig>>> outRouters = aggregatedDeploymentUnit.getOutboundRouters().entrySet();
+
+ for (Map.Entry<ServiceName, List<OutboundRouterConfig>> serviceOutRouters : outRouters)
+ {
+ ServiceName serviceName = serviceOutRouters.getKey();
+ BusInboundRouter inRouter = new BusInboundRouter();
+ BusDispatcher dispatcher = new BusDispatcher(context);
+ ServiceConfig serviceConfig = aggregatedDeploymentUnit.getServices().get(serviceName);
+ List<OutboundRouterConfig> outRouterList = serviceOutRouters.getValue();
+
+ busRouters.put(serviceName, inRouter);
+ inRouter.setDispatcher(dispatcher);
+
+ dispatcher.setServiceName(serviceName);
+ if (serviceConfig != null)
+ {
+ dispatcher.setService(serviceConfig.getService());
+ }
+ dispatcher.setOutboundRouters(outRouterList);
+ }
+ }
+
+ /**
* Deploy the transformers.
*
* @param serviceName The service with which the transformer set is associated.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/DeploymentUnit.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/DeploymentUnit.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/DeploymentUnit.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -19,12 +19,15 @@
*/
package org.jboss.esb.deploy.config;
+import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* JBoss ESB Deployment Configuration Unit.
@@ -51,6 +54,71 @@
private Map<ServiceName, List<OutboundRouterConfig>> outboundRouters = new LinkedHashMap<ServiceName, List<OutboundRouterConfig>>();
/**
+ * Add the supplied deployment unit to this deployment unit.
+ *
+ * @param deployment The deployment unit to be added.
+ * @throws DeploymentException Cannot add deployment to this deployment.
+ */
+ public final void addDeployment(final DeploymentUnit deployment) throws DeploymentException
+ {
+ // Add the Services....
+ Set<Map.Entry<ServiceName, ServiceConfig>> newServices = deployment.getServices().entrySet();
+ for (Map.Entry<ServiceName, ServiceConfig> newService : newServices)
+ {
+ ServiceName serviceName = newService.getKey();
+ if (services.containsKey(serviceName))
+ {
+ throw new DeploymentException("Cannot add DeploymentUnit. Service '" + serviceName + "' already defined. Service names must be unique per deployment.");
+ }
+ services.put(serviceName, newService.getValue());
+ }
+
+ // Add the Resources....
+ Set<Map.Entry<String, Object>> newResources = deployment.getResources().entrySet();
+ for (Map.Entry<String, Object> newResource : newResources)
+ {
+ String resourceName = newResource.getKey();
+ if (resources.containsKey(resourceName))
+ {
+ throw new DeploymentException("Cannot add DeploymentUnit. Resource '" + resourceName + "' already defined. Resource names must be unique per deployment.");
+ }
+ resources.put(resourceName, newResource.getValue());
+ }
+
+ // Add the InRouters...
+ Set<Map.Entry<ServiceName, List<InboundRouterConfig>>> newInRouters = deployment.getInboundRouters().entrySet();
+ for (Map.Entry<ServiceName, List<InboundRouterConfig>> serviceInRouters : newInRouters)
+ {
+ ServiceName serviceName = serviceInRouters.getKey();
+ List<InboundRouterConfig> routers = serviceInRouters.getValue();
+ List<InboundRouterConfig> aggregateRouterList = inboundRouters.get(serviceName);
+
+ if (aggregateRouterList == null)
+ {
+ aggregateRouterList = new ArrayList<InboundRouterConfig>();
+ inboundRouters.put(serviceName, aggregateRouterList);
+ }
+ aggregateRouterList.addAll(routers);
+ }
+
+ // Add the OutRouters...
+ Set<Map.Entry<ServiceName, List<OutboundRouterConfig>>> newOutRouters = deployment.getOutboundRouters().entrySet();
+ for (Map.Entry<ServiceName, List<OutboundRouterConfig>> serviceOutRouters : newOutRouters)
+ {
+ ServiceName serviceName = serviceOutRouters.getKey();
+ List<OutboundRouterConfig> routers = serviceOutRouters.getValue();
+ List<OutboundRouterConfig> aggregateRouterList = outboundRouters.get(serviceName);
+
+ if (aggregateRouterList == null)
+ {
+ aggregateRouterList = new ArrayList<OutboundRouterConfig>();
+ outboundRouters.put(serviceName, aggregateRouterList);
+ }
+ aggregateRouterList.addAll(routers);
+ }
+ }
+
+ /**
* Add an inbounder router for a service.
*
* @param id The resource ID.
@@ -184,4 +252,23 @@
{
this.outboundRouters = outboundRouters;
}
+
+ /**
+ * Expand the outbound routers list for this DeploymentUnit.
+ * <p/>
+ * This involves adding an empty outbound routers list for all Services
+ * that do not define any outbound routers.
+ */
+ public final void expandOutboundRouters()
+ {
+ Set<Map.Entry<ServiceName, ServiceConfig>> serviceList = services.entrySet();
+
+ for (Map.Entry<ServiceName, ServiceConfig> service : serviceList)
+ {
+ if(!outboundRouters.containsKey(service.getKey()))
+ {
+ outboundRouters.put(service.getKey(), new ArrayList<OutboundRouterConfig>());
+ }
+ }
+ }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/InboundRouterConfig.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -21,7 +21,7 @@
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.routing.InboundRouter;
-import org.jboss.esb.dispatch.DispatcherProxy;
+import org.jboss.esb.routing.MessageDispatcher;
import java.util.List;
@@ -41,9 +41,9 @@
*/
private InboundRouter router;
/**
- * Dispatcher proxy.
+ * Dispatcher.
*/
- private DispatcherProxy dispatcherProxy;
+ private MessageDispatcher dispatcher;
/**
* Router transformers.
*/
@@ -90,21 +90,21 @@
}
/**
- * Get the {@link DispatcherProxy} associated with this router config.
+ * Get the {@link MessageDispatcher} associated with this router config.
* @return The DispatcherProxy instance.
*/
- public final DispatcherProxy getDispatcherProxy()
+ public final MessageDispatcher getDispatcher()
{
- return dispatcherProxy;
+ return dispatcher;
}
/**
- * Get the {@link DispatcherProxy} associated with this router config.
- * @param dispatcherProxy The DispatcherProxy instance.
+ * Get the {@link MessageDispatcher} associated with this router config.
+ * @param dispatcher The DispatcherProxy instance.
*/
- public final void setDispatcherProxy(final DispatcherProxy dispatcherProxy)
+ public final void setDispatcher(final MessageDispatcher dispatcher)
{
- this.dispatcherProxy = dispatcherProxy;
+ this.dispatcher = dispatcher;
}
/**
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/DigestUtil.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -258,6 +258,7 @@
DeploymentRuntime runtime = new DeploymentRuntime();
DefaultConfigurationDigester digester = new DefaultConfigurationDigester();
DeploymentUnit deploymentUnit = digester.digest(config);
+
runtime.add(deploymentUnit);
return runtime;
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -0,0 +1,312 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.dispatch;
+
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.deploy.config.OutboundRouterConfig;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.message.MessageTransformer;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.routing.OutboundRouter;
+import org.jboss.esb.service.Service;
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.federate.bus.BusOutboundRouter;
+
+import java.util.List;
+
+/**
+ * Abstract message dispatcher.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public abstract class AbstractDispatcher implements MessageDispatcher
+{
+ /**
+ * The associated deployment context.
+ */
+ private DeploymentContext deploymentContext;
+ /**
+ * Inbound transformers to be applied before invoking
+ * the service (can be null).
+ */
+ private List<MessageTransformer> transformers;
+ /**
+ * The service name.
+ */
+ private ServiceName serviceName;
+ /**
+ * The Service instance (can be null).
+ */
+ private Service service;
+ /**
+ * The outbound routers, to which the message is passed after
+ * Service invocation (can be null).
+ */
+ private List<OutboundRouterConfig> outboundRouters;
+ /**
+ * Clone outbound routing transforms.
+ */
+ private boolean cloneOnOutboundTransforms = false;
+
+ /**
+ * Public constructor.
+ *
+ * @param deploymentContext The deployment context.
+ */
+ public AbstractDispatcher(final DeploymentContext deploymentContext)
+ {
+ this.deploymentContext = deploymentContext;
+ }
+
+ /**
+ * Initialize the dispatcher.
+ */
+ public final void initialize()
+ {
+ if (outboundRouters != null && !outboundRouters.isEmpty())
+ {
+ int numTransformationSets = 0;
+ for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
+ {
+ if (outboundRouterConfig.getTransformers() != null)
+ {
+ numTransformationSets++;
+ }
+ }
+ // If we have multiple outbound routers performing transforms
+ // on the message before routing, we need to clone the message,
+ // otherwise the message will be corrupted between routing
+ // operations...
+ cloneOnOutboundTransforms = (numTransformationSets > 1);
+ }
+ }
+
+ /**
+ * Get the associated deployment context.
+ *
+ * @return The deployment context.
+ */
+ public final DeploymentContext getDeploymentContext()
+ {
+ return deploymentContext;
+ }
+
+ /**
+ * Apply the inbound transform set.
+ *
+ * @param message The message.
+ * @throws org.jboss.esb.routing.RoutingException
+ * Error applying transformer.
+ */
+ protected final void applyInboundTransforms(final Message message) throws RoutingException
+ {
+ if (transformers != null && !transformers.isEmpty())
+ {
+ for (MessageTransformer transformer : transformers)
+ {
+ try
+ {
+ transformer.transform(message);
+ }
+ catch (Throwable t)
+ {
+ throw new RoutingException("Error applying inbound transformer.", t);
+ }
+ }
+ }
+ }
+
+ /**
+ * Dispatch the message to the Service instance.
+ *
+ * @param theMessage The message.
+ * @return The processed message. Can be a new Message instance.
+ * @throws org.jboss.esb.routing.RoutingException
+ * Error processing message message in the Service.
+ */
+ protected final Message dispatchToService(final Message theMessage) throws RoutingException
+ {
+ if (service != null)
+ {
+ try
+ {
+ Message outMessage = service.process(theMessage);
+ AddressingContext.getContext().setFrom(getServiceName());
+ return outMessage;
+ }
+ catch (Throwable t)
+ {
+ throw new RoutingException("Error processing message.", t);
+ }
+ }
+
+ return theMessage;
+ }
+
+ /**
+ * Apply the outbound routers to the message.
+ *
+ * @param outMessage The message.
+ * @throws org.jboss.esb.routing.RoutingException
+ * Error routing message.
+ */
+ protected final void applyOutboundRouters(final Message outMessage) throws RoutingException
+ {
+ if (outboundRouters != null && !outboundRouters.isEmpty())
+ {
+ // If this deployment doesn't specifiy this service, see is there a
+ // Service by this name on one of the monitored deployments, and route
+ // it there...
+ if(service == null)
+ {
+ for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
+ {
+ OutboundRouter outRouter = outboundRouterConfig.getRouter();
+ if(outRouter instanceof BusOutboundRouter)
+ {
+ if(((BusOutboundRouter)outRouter).hasService(serviceName))
+ {
+ outRouter.route(outMessage);
+ // In this case, we don't pass the message to the other outrouters (below).
+ // We leave it to the other deployment to manage sending the message
+ // to outrouters after it's Service instance has processed it...
+ return;
+ }
+ }
+ }
+ }
+
+ for (OutboundRouterConfig outboundRouter : outboundRouters)
+ {
+ // TODO: cloneOnOutboundTransforms
+ applyOutboundTransformers(outMessage, outboundRouter.getTransformers());
+ outboundRouter.getRouter().route(outMessage);
+ }
+ }
+ }
+
+ /**
+ * Apply the supplied set of transformers on the supplied message.
+ *
+ * @param outMessage The message.
+ * @param outboundTransformers The transformers to be applied.
+ * @throws org.jboss.esb.routing.RoutingException
+ * Error applying transformer.
+ */
+ private void applyOutboundTransformers(final Message outMessage, final List<MessageTransformer> outboundTransformers) throws RoutingException
+ {
+ if (outboundTransformers != null && !outboundTransformers.isEmpty())
+ {
+ for (MessageTransformer transformer : outboundTransformers)
+ {
+ try
+ {
+ transformer.transform(outMessage);
+ }
+ catch (Throwable t)
+ {
+ throw new RoutingException("Error applying outbound transformer.", t);
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the ServiceName.
+ *
+ * @return The ServiceName.
+ */
+ public final ServiceName getServiceName()
+ {
+ return serviceName;
+ }
+
+ /**
+ * Get the ServiceName.
+ *
+ * @param serviceName The ServiceName.
+ */
+ public final void setServiceName(final ServiceName serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * Get inbound transformers.
+ *
+ * @return The inbound transformers.
+ */
+ public final List<MessageTransformer> getTransformers()
+ {
+ return transformers;
+ }
+
+ /**
+ * Set inbound transformers.
+ *
+ * @param transformers The inbound transformers.
+ */
+ public final void setTransformers(final List<MessageTransformer> transformers)
+ {
+ this.transformers = transformers;
+ }
+
+ /**
+ * Get the Service.
+ *
+ * @return The Service.
+ */
+ public final Service getService()
+ {
+ return service;
+ }
+
+ /**
+ * Set the Service.
+ *
+ * @param service The Service.
+ */
+ public final void setService(final Service service)
+ {
+ this.service = service;
+ }
+
+ /**
+ * Set the Outbound Routers.
+ *
+ * @return The Outbound Routers.
+ */
+ public final List<OutboundRouterConfig> getOutboundRouters()
+ {
+ return outboundRouters;
+ }
+
+ /**
+ * Get the Outbound Routers.
+ *
+ * @param outboundRouters The Outbound Routers.
+ */
+ public final void setOutboundRouters(final List<OutboundRouterConfig> outboundRouters)
+ {
+ this.outboundRouters = outboundRouters;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/DispatcherProxy.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.dispatch;
-
-import org.jboss.esb.context.InvocationContext;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.MessageDispatcher;
-import org.jboss.esb.routing.RoutingException;
-
-/**
- * Dispatcher proxy.
- * <p/>
- * This dispatcher allows post deployment update of the effective dispatcher
- * used by an {@link org.jboss.esb.routing.InboundRouter}.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class DispatcherProxy implements MessageDispatcher
-{
- /**
- * The effective dispacher.
- */
- private MessageDispatcher dispatcher;
-
- /**
- * Public constructor.
- * @param dispatcher The effective dispatcher.
- */
- public DispatcherProxy(final MessageDispatcher dispatcher)
- {
- this.dispatcher = dispatcher;
- }
-
- /**
- * Dispatch the message to the target service.
- *
- * @param message The message to be dispatched.
- * @param invocationContext The InvocationContext for the message dispatch.
- * @throws RoutingException An exception occured while dispatching the message.
- */
- public final void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
- {
- dispatcher.dispatch(message, invocationContext);
- }
-
- /**
- * Get the effective dispatcher instance.
- * @return The dispatcher instance.
- */
- public final MessageDispatcher getDispatcher()
- {
- return dispatcher;
- }
-
- /**
- * Set the effective dispatcher instance.
- * @param dispatcher The dispatcher instance.
- */
- public final void setDispatcher(final MessageDispatcher dispatcher)
- {
- this.dispatcher = dispatcher;
- }
-}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -22,52 +22,17 @@
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
-import org.jboss.esb.deploy.config.OutboundRouterConfig;
import org.jboss.esb.message.Message;
-import org.jboss.esb.message.MessageTransformationException;
-import org.jboss.esb.message.MessageTransformer;
-import org.jboss.esb.routing.MessageDispatcher;
import org.jboss.esb.routing.RoutingException;
-import org.jboss.esb.service.Service;
-import org.jboss.esb.service.ServiceException;
-import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
-import java.util.List;
-
/**
* Local message dispatcher.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public class LocalDispatcher implements MessageDispatcher
+public class LocalDispatcher extends AbstractDispatcher
{
- /**
- * The associated deployment context.
- */
- private DeploymentContext deploymentContext;
- /**
- * Inbound transformers to be applied before invoking
- * the service (can be null).
- */
- private List<MessageTransformer> transformers;
- /**
- * The service name.
- */
- private ServiceName serviceName;
- /**
- * The Service instance (can be null).
- */
- private Service service;
- /**
- * The outbound routers, to which the message is passed after
- * Service invocation (can be null).
- */
- private List<OutboundRouterConfig> outboundRouters;
- /**
- * Clone outbound routing transforms.
- */
- private boolean cloneOnOutboundTransforms = false;
/**
* Public constructor.
@@ -77,33 +42,10 @@
*/
public LocalDispatcher(final DeploymentContext deploymentContext)
{
- this.deploymentContext = deploymentContext;
+ super(deploymentContext);
}
/**
- * Initialize the dispatcher.
- */
- public final void initialize()
- {
- if (outboundRouters != null && !outboundRouters.isEmpty())
- {
- int numTransformationSets = 0;
- for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
- {
- if (outboundRouterConfig.getTransformers() != null)
- {
- numTransformationSets++;
- }
- }
- // If we have multiple outbound routers performing transforms
- // on the message before routing, we need to clone the message,
- // otherwise the message will be corrupted between routing
- // operations...
- cloneOnOutboundTransforms = (numTransformationSets > 1);
- }
- }
-
- /**
* Dispatch method.
* <p/>
* Receives a message, applies the set of transforms to it, passes it to
@@ -120,12 +62,12 @@
AssertArgument.isNotNull(invocationContext, "invocationContext");
Message outMessage;
- DeploymentContext.setContext(deploymentContext);
+ DeploymentContext.setContext(getDeploymentContext());
try
{
AddressingContext addressingContext = new AddressingContext();
- addressingContext.setTo(serviceName);
+ addressingContext.setTo(getServiceName());
AddressingContext.setContext(addressingContext);
try
{
@@ -135,6 +77,8 @@
applyInboundTransforms(message);
outMessage = dispatchToService(message);
applyOutboundRouters(outMessage);
+
+ // TODO; Use the faultTo address if there's an issue??
} finally
{
InvocationContext.setContext(null);
@@ -148,174 +92,4 @@
DeploymentContext.setContext(null);
}
}
-
- /**
- * Apply the inbound transform set.
- *
- * @param message The message.
- * @throws RoutingException Error applying transformer.
- */
- private void applyInboundTransforms(final Message message)
- throws RoutingException
- {
- if (transformers != null && !transformers.isEmpty())
- {
- for (MessageTransformer transformer : transformers)
- {
- try
- {
- transformer.transform(message);
- } catch (MessageTransformationException e)
- {
- throw new RoutingException("Error applying inbound transformer.", e);
- }
- }
- }
- }
-
- /**
- * Dispatch the message to the Service instance.
- *
- * @param theMessage The message.
- * @return The processed message. Can be a new Message instance.
- * @throws RoutingException Error processing message message in the Service.
- */
- private Message dispatchToService(final Message theMessage) throws RoutingException
- {
- if (service != null)
- {
- try
- {
- return service.process(theMessage);
- } catch (ServiceException e)
- {
- throw new RoutingException("Error processing message.", e);
- }
- }
-
- return theMessage;
- }
-
- /**
- * Apply the outbound routers to the message.
- *
- * @param outMessage The message.
- * @throws RoutingException Error routing message.
- */
- private void applyOutboundRouters(final Message outMessage) throws RoutingException
- {
- if (outboundRouters != null && !outboundRouters.isEmpty())
- {
- for (OutboundRouterConfig outboundRouter : outboundRouters)
- {
- // TODO: cloneOnOutboundTransforms
- applyOutboundTransformers(outMessage, outboundRouter.getTransformers());
- outboundRouter.getRouter().route(outMessage);
- }
- }
- }
-
- /**
- * Apply the supplied set of transformers on the supplied message.
- *
- * @param outMessage The message.
- * @param outboundTransformers The transformers to be applied.
- * @throws RoutingException Error applying transformer.
- */
- private void applyOutboundTransformers(final Message outMessage, final List<MessageTransformer> outboundTransformers) throws RoutingException
- {
- if (outboundTransformers != null && !outboundTransformers.isEmpty())
- {
- for (MessageTransformer transformer : outboundTransformers)
- {
- try
- {
- transformer.transform(outMessage);
- } catch (MessageTransformationException e)
- {
- throw new RoutingException("Error applying outbound transformer.", e);
- }
- }
- }
- }
-
- /**
- * Set the ServiceName.
- *
- * @return The ServiceName.
- */
- public final ServiceName getServiceName()
- {
- return serviceName;
- }
-
- /**
- * Get the ServiceName.
- *
- * @param serviceName The ServiceName.
- */
- public final void setServiceName(final ServiceName serviceName)
- {
- this.serviceName = serviceName;
- }
-
- /**
- * Get inbound transformers.
- *
- * @return The inbound transformers.
- */
- public final List<MessageTransformer> getTransformers()
- {
- return transformers;
- }
-
- /**
- * Set inbound transformers.
- *
- * @param transformers The inbound transformers.
- */
- public final void setTransformers(final List<MessageTransformer> transformers)
- {
- this.transformers = transformers;
- }
-
- /**
- * Get the Service.
- *
- * @return The Service.
- */
- public final Service getService()
- {
- return service;
- }
-
- /**
- * Set the Service.
- *
- * @param service The Service.
- */
- public final void setService(final Service service)
- {
- this.service = service;
- }
-
- /**
- * Set the Outbound Routers.
- *
- * @return The Outbound Routers.
- */
- public final List<OutboundRouterConfig> getOutboundRouters()
- {
- return outboundRouters;
- }
-
- /**
- * Get the Outbound Routers.
- *
- * @param outboundRouters The Outbound Routers.
- */
- public final void setOutboundRouters(final List<OutboundRouterConfig> outboundRouters)
- {
- this.outboundRouters = outboundRouters;
- }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -22,10 +22,15 @@
import org.apache.log4j.Logger;
import org.jboss.esb.annotations.Initialize;
import org.jboss.esb.annotations.Uninitialize;
+import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.deploy.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.config.PropertiesUtil;
import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.federate.bus.BusInboundRouter;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.federate.bus.BusMessageListener;
+import org.jboss.esb.federate.bus.BusOutboundRouter;
import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
import org.jboss.esb.federate.notify.DeploymentDetailsNotification;
import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
@@ -35,9 +40,11 @@
import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.schedule.AbstractScheduleListener;
import org.jboss.esb.schedule.SchedulingException;
+import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -94,6 +101,14 @@
* Coordinator monitor timeout. The number of milliseconds before a deployment is marked as offline.
*/
private long monitorTimeout;
+ /**
+ * Bus Outbound Routers - sending messages out onto a bus.
+ */
+ private Map<ServiceName, BusOutboundRouter> busOutRouters = new HashMap<ServiceName, BusOutboundRouter>();
+ /**
+ * Bus Inbound Routers - receiving messages from a bus and dispatching them to the target service.
+ */
+ private Map<ServiceName, BusInboundRouter> busInRouters = new HashMap<ServiceName, BusInboundRouter>();
/**
* Public constructor.
@@ -120,15 +135,21 @@
{
ApplicationProperties deploymentProperties = PropertiesUtil.getDeploymentConfig(runtime.getDeploymentName());
- // Set the monitoring timeout - 4 heartbeats...
- monitorTimeout = (deploymentProperties.getLongProperty(COORDINATOR_HEARTBEAT_FREQUENCY_KEY, COORDINATOR_HEARTBEAT_DEFAULT_FREQUENCY) * 4);
+ // Set the deploymnt monitor timeout - 3 missed heartbeats...
+ monitorTimeout = (deploymentProperties.getLongProperty(COORDINATOR_HEARTBEAT_FREQUENCY_KEY, COORDINATOR_HEARTBEAT_DEFAULT_FREQUENCY) * 3);
- // Connect all configured buses...
+ // Add the bus outbound and inbound routers before starting the local bus interfaces.
+ // This way they're available to have DeploymentMonitors attached and receive messages
+ // as soon as this deployment gets "online" notifications from other deployments...
+ runtime.addBusOutboundRouters(busOutRouters);
+ runtime.addBusInboundRouters(busInRouters);
+
+ // Start all configured bus interfaces...
Set<Map.Entry<Object, Object>> configEntries = deploymentProperties.entrySet();
for (Map.Entry<Object, Object> configEntry : configEntries)
{
String propertyName = (String) configEntry.getKey();
- if(propertyName.startsWith("bus."))
+ if (propertyName.startsWith("bus."))
{
String busProtocol = propertyName.substring("bus.".length());
String busClassName = (String) configEntry.getValue();
@@ -137,7 +158,7 @@
{
Bus bus = Bus.Factory.newInstance(busClassName);
ApplicationProperties busProperties = PropertiesUtil.getBusConfig(busProtocol, runtime.getDeploymentName());
-
+
bus.setDeploymentName(runtime.getDeploymentName());
bus.setDeploymentId(runtime.getDeploymentId());
bus.setProperties(busProperties);
@@ -165,7 +186,7 @@
uninitialize();
throw e;
}
- catch(Throwable t)
+ catch (Throwable t)
{
uninitialize();
throw new DeploymentException("Unexpected exception while starting Deployment Bus interfaces.", t);
@@ -188,7 +209,7 @@
{
busDeployment.getBus().sendNotification(DeploymentUndeployNotification.toNotification(runtime));
}
- catch(Throwable t)
+ catch (Throwable t)
{
logger.error("Error sending undeploy notification on Bus '" + busDeployment.getBus().getClass().getName() + "'.", t);
}
@@ -196,7 +217,7 @@
{
busDeployment.getBus().close();
}
- catch(Throwable t)
+ catch (Throwable t)
{
logger.error("Error closing Bus '" + busDeployment.getBus().getClass().getName() + "'.", t);
}
@@ -217,12 +238,12 @@
{
try
{
- if(broadcastHeartbeat)
+ if (broadcastHeartbeat)
{
busDeployment.getBus().sendNotification(heartbeatNotification);
}
}
- catch(Throwable t)
+ catch (Throwable t)
{
logger.error("Error sending heartbeat notification on Bus '" + busDeployment.getBus().getClass().getName() + "'.", t);
}
@@ -230,7 +251,7 @@
{
busDeployment.checkMonitors();
}
- catch(Throwable t)
+ catch (Throwable t)
{
logger.error("Error checking monitors on Bus '" + busDeployment.getBus().getClass().getName() + "'.", t);
}
@@ -259,6 +280,55 @@
}
/**
+ * Attach the specified DeploymentMonitor instance to all
+ * BusOutboundRouter instances that manage a service or out routers
+ * for the Service associated with the BusOutboundRouter instance.
+ *
+ * @param monitor The DeploymentMonitor.
+ * @see #detachDeploymentMonitor(DeploymentMonitor)
+ */
+ private void attachDeploymentMonitor(final DeploymentMonitor monitor)
+ {
+ synchronized (busOutRouters)
+ {
+ Set<Map.Entry<ServiceName, BusOutboundRouter>> serviceOutRouterSet = busOutRouters.entrySet();
+
+ for (Map.Entry<ServiceName, BusOutboundRouter> serviceOutRouter : serviceOutRouterSet)
+ {
+ ServiceName serviceName = serviceOutRouter.getKey();
+
+ if (monitor.hasService(serviceName) || monitor.hasServiceRouter(serviceName))
+ {
+ BusOutboundRouter router = serviceOutRouter.getValue();
+ router.addMonitor(monitor);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Detach the specified DeploymentMonitor instance from any
+ * BusOutboundRouter instances that hold a reference to it.
+ *
+ * @param monitor The DeploymentMonitor.
+ * @see #attachDeploymentMonitor(DeploymentMonitor)
+ */
+ private void detachDeploymentMonitor(final DeploymentMonitor monitor)
+ {
+ synchronized (busOutRouters)
+ {
+ Set<Map.Entry<ServiceName, BusOutboundRouter>> serviceOutRouterSet = busOutRouters.entrySet();
+
+ for (Map.Entry<ServiceName, BusOutboundRouter> serviceOutRouter : serviceOutRouterSet)
+ {
+ BusOutboundRouter router = serviceOutRouter.getValue();
+ router.removeMonitor(monitor);
+ }
+ }
+ }
+
+ /**
* JBoss ESB Deployment.
*/
public final class BusDeployment
@@ -272,6 +342,10 @@
*/
private NotificationListener notificationListener = new BusNotificationListener();
/**
+ * Bus message listener for the local deployment.
+ */
+ private DeploymentBusMessageListener busMessageListener = new DeploymentBusMessageListener();
+ /**
* Deployment monitors - monitoring other deployments using this bus.
*/
private Map<String, DeploymentMonitor> deploymentMonitors = new ConcurrentHashMap<String, DeploymentMonitor>();
@@ -285,13 +359,29 @@
{
this.bus = bus;
bus.setNotificationListener(notificationListener);
+ bus.setBusMessageListener(busMessageListener);
}
+ /**
+ * Get the Bus instance associated with the BusDeployment instance.
+ *
+ * @return The Bus instance associated with the BusDeployment instance.
+ */
public Bus getBus()
{
return bus;
}
+ public NotificationListener getNotificationListener()
+ {
+ return notificationListener;
+ }
+
+ /**
+ * Get all active Deployment Monitors for this Bus deployment.
+ *
+ * @return All active Deployment Monitors for this Bus deployment.
+ */
public Map<String, DeploymentMonitor> getDeploymentMonitors()
{
return deploymentMonitors;
@@ -302,16 +392,21 @@
*/
private class BusNotificationListener implements NotificationListener
{
-
/**
* Deployment notification handler.
*
* @param notification The notification.
+ * @throws DeploymentException Invalid deployment detected.
*/
- public final void onNotification(final AbstractDeploymentNotification notification)
+ public final void onNotification(final AbstractDeploymentNotification notification) throws DeploymentException
{
- String deploymentId = notification.getId();
+ String deploymentId = notification.getDeploymentId();
+ if (runtime.getDeploymentId().equals(deploymentId))
+ {
+ throw new DeploymentException("Cannot accept deployment notification for deployment '" + deploymentId + "'. Deployment IDs must be unique!");
+ }
+
if (notification instanceof DeploymentHeartbeatNotification)
{
DeploymentMonitor deploymentMonitor = deploymentMonitors.get(deploymentId);
@@ -322,37 +417,119 @@
}
else
{
- logger.warn("Deployment '" + runtime.getDeploymentName() + ":" + runtime.getDeploymentId() + "' received heartbeat from unknown deployment '" + notification.getName() + ":" + notification.getId() + "'.");
+ logger.warn("Deployment '" + runtime.getDeploymentName() + ":" + runtime.getDeploymentId() + "' received heartbeat from unknown deployment '" + notification.getDeploymentName() + ":" + notification.getDeploymentId() + "'.");
+ // Send our deployment details... will trigger the other deployment
+ // to send its details...
+ sendDeploymentDetailsNotification();
}
}
else if (notification instanceof DeploymentDetailsNotification)
{
- if (!deploymentMonitors.containsKey(deploymentId))
+ DeploymentMonitor monitor = deploymentMonitors.get(deploymentId);
+ DeploymentDetailsNotification deployNotification = (DeploymentDetailsNotification) notification;
+
+ if (monitor != null)
{
- DeploymentDetailsNotification deployNotification = (DeploymentDetailsNotification) notification;
-
- // New deployment. Add a monitor...
- deploymentMonitors.put(deploymentId, new DeploymentMonitor(deployNotification.getServiceSet()));
- // Send out the deployment details of this deployment so the new deployment
- // can register them....
- try
+ // If the monitor for the current deployment says the deployment is not online, and the
+ // new deployment looks to be the same as the current deployment, just mark
+ // the current deployment as being online again...
+ if (!monitor.isOnline() && monitor.getServiceSets().equals(deployNotification.getServiceSet()))
{
- bus.sendNotification(detailsNotification);
+ monitor.setOnline(true);
}
- catch (RoutingException e)
+
+ // If the other deployment is already monitoring this deployment, no
+ // need to notify... just return...
+ if (deployNotification.getMonitoredDeployments().contains(runtime.getDeploymentId()))
{
- logger.error("Failed to send DeploymentDetails notification broadcast out onto Bus (" + bus.getClass().getName() + ").", e);
+ return;
}
}
+ else
+ {
+ // New deployment. Add a monitor...
+ monitor = new DeploymentMonitor(deployNotification.getServiceSet(), bus);
+ attachDeploymentMonitor(monitor);
+ deploymentMonitors.put(deploymentId, monitor);
+ detailsNotification.getMonitoredDeployments().add(deploymentId);
+ }
+
+ // Send out the deployment details of this deployment so the new deployment
+ // can register them....
+ sendDeploymentDetailsNotification();
}
else if (notification instanceof DeploymentUndeployNotification)
{
- deploymentMonitors.remove(notification.getId());
+ DeploymentMonitor monitor = deploymentMonitors.get(deploymentId);
+
+ if (monitor != null)
+ {
+ detachDeploymentMonitor(monitor);
+ deploymentMonitors.remove(deploymentId);
+ detailsNotification.getMonitoredDeployments().remove(deploymentId);
+ }
+ else
+ {
+ logger.warn("Received undeploy notification for deployment with deploymentId '" + deploymentId + "'. Unknown deployment.");
+ }
}
}
+
+ /**
+ * Send the deployment details for this deployment out onto the bus.
+ *
+ * @throws DeploymentException Failed to send.
+ */
+ private void sendDeploymentDetailsNotification() throws DeploymentException
+ {
+ try
+ {
+ bus.sendNotification(detailsNotification);
+ }
+ catch (RoutingException e)
+ {
+ throw new DeploymentException("Failed to send DeploymentDetails notification broadcast out onto Bus (" + bus.getClass().getName() + ").", e);
+ }
+ }
}
/**
+ * Bus notification listener.
+ */
+ private class DeploymentBusMessageListener implements BusMessageListener
+ {
+ /**
+ * BusMessage handler.
+ *
+ * @param busMessage The message.
+ * @throws RoutingException Error handling the bus message.
+ */
+ public void onMessage(final BusMessage busMessage) throws RoutingException
+ {
+ AddressingContext addressing = busMessage.getAddressingContext();
+ if (addressing == null)
+ {
+ throw new RoutingException("Invalid ESB Message. AddressingContext not set on BusMessage.");
+ }
+
+ ServiceName toService = addressing.getTo();
+ if (toService == null)
+ {
+ throw new RoutingException("Invalid ESB Message. To address not set. Message from '" + addressing.getFrom() + "'.");
+ }
+
+ BusInboundRouter inRouter = busInRouters.get(toService);
+ if (inRouter == null)
+ {
+ throw new RoutingException("Invalid ESB Message from '" + addressing.getFrom() + "'. Service '" + toService + "' unknown on this deployment.");
+ }
+
+ // And hand it off to the inrouter to manage the processing of it...
+ inRouter.receive(busMessage);
+ }
+ }
+
+ /**
* Check the monitors.
* <p/>
* Checks are the monitored deployments still online.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -19,6 +19,8 @@
*/
package org.jboss.esb.federate;
+import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
/**
@@ -42,8 +44,11 @@
* Deployment Service Sets.
*/
private DeploymentServiceSets serviceSets;
-
/**
+ * The Bus to the target deployment.
+ */
+ private Bus bus;
+ /**
* Deployment online/offline flag.
*/
private boolean online;
@@ -52,17 +57,20 @@
* Constructor.
*
* @param serviceSets Deployment Service sets.
+ * @param bus The bus to the services on the associated deployment.
*/
- public DeploymentMonitor(final DeploymentServiceSets serviceSets)
+ public DeploymentMonitor(final DeploymentServiceSets serviceSets, final Bus bus)
{
AssertArgument.isNotNull(serviceSets, "serviceSets");
this.lastHeartbeat = System.currentTimeMillis();
this.serviceSets = serviceSets;
+ this.bus = bus;
this.online = true;
}
/**
* Get the time of the last heartbeat received on this monitored deployment.
+ *
* @return The time of the last heartbeat.
*/
public final long getLastHeartbeat()
@@ -72,6 +80,7 @@
/**
* Get the time of the last heartbeat received on this monitored deployment.
+ *
* @param lastHeartbeat The time of the last heartbeat.
*/
public final void setLastHeartbeat(final long lastHeartbeat)
@@ -91,6 +100,7 @@
/**
* Set the deployment online/offline.
+ *
* @param online True if the deployment is online, otherwise false.
*/
public final void setOnline(final boolean online)
@@ -109,6 +119,41 @@
}
/**
+ * Does the target deployment have the specified service.
+ * @param serviceName The Service name.
+ * @return True if the target deployment has a Service instance with the specified name, otherwise false.
+ */
+ public final boolean hasService(final ServiceName serviceName)
+ {
+ return serviceSets.getServices().contains(serviceName);
+ }
+
+ /**
+ * Does the target deployment have any {@link org.jboss.esb.routing.OutboundRouter}
+ * instances for the specified service.
+ * @param serviceName The Service name.
+ * @return True if the target deployment has any {@link org.jboss.esb.routing.OutboundRouter}
+ * instances for the specified service, otherwise false.
+ */
+ public final boolean hasServiceRouter(final ServiceName serviceName)
+ {
+ return serviceSets.getOutboundRoutedServices().contains(serviceName);
+ }
+
+ /**
+ * Get the bus assoicated with the monitor.
+ * <p/>
+ * This is the bus through which messages for the services on the
+ * associated deployment are sent.
+ *
+ * @return The bus.
+ */
+ public final Bus getBus()
+ {
+ return bus;
+ }
+
+ /**
* Monitor toString.
*
* @return String representation of the monitor.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -58,6 +58,7 @@
/**
* Get the deployment name.
+ *
* @return The deployment name.
*/
public final String getDeploymentName()
@@ -67,6 +68,7 @@
/**
* Set the deployment name.
+ *
* @param deploymentName The deployment name.
*/
public final void setDeploymentName(final String deploymentName)
@@ -76,6 +78,7 @@
/**
* Get the deployment ID.
+ *
* @return The deployment ID.
*/
public final String getDeploymentId()
@@ -85,6 +88,7 @@
/**
* Set the deployment ID.
+ *
* @param deploymentId The deployment ID.
*/
public final void setDeploymentId(final String deploymentId)
@@ -134,10 +138,68 @@
/**
* Deployment Service Sets toString.
+ *
* @return String representation of the deployment coordintation info.
*/
public final String toString()
{
return deploymentName + ":" + deploymentId + "[Services: " + services + "][OutboundRoutedServices: " + outboundRoutedServices + "]";
}
+
+ /**
+ * Object equals.
+ *
+ * @param object Object to compare against.
+ * @return True if the specific object is also a DeploymentServiceSets instance and defines the
+ * same Service Sets and also specifies the same deploymentId and deploymentName.
+ */
+ public final boolean equals(final Object object)
+ {
+ if (this == object)
+ {
+ return true;
+ }
+ if (object == null || getClass() != object.getClass())
+ {
+ return false;
+ }
+
+ DeploymentServiceSets that = (DeploymentServiceSets) object;
+
+ if (!deploymentId.equals(that.deploymentId))
+ {
+ return false;
+ }
+ if (!deploymentName.equals(that.deploymentName))
+ {
+ return false;
+ }
+ if (outboundRoutedServices != null ? !outboundRoutedServices.equals(that.outboundRoutedServices) : that.outboundRoutedServices != null)
+ {
+ return false;
+ }
+ if (services != null ? !services.equals(that.services) : that.services != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Object hash code.
+ *
+ * @return The DeploymentServiceSets hashcode.
+ */
+ public final int hashCode()
+ {
+ int result;
+
+ result = deploymentName.hashCode();
+ result = 31 * result + deploymentId.hashCode();
+ result = 31 * result + (services != null ? services.hashCode() : 0);
+ result = 31 * result + (outboundRoutedServices != null ? outboundRoutedServices.hashCode() : 0);
+
+ return result;
+ }
}
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus;
+
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.dispatch.AbstractDispatcher;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.util.AssertArgument;
+
+/**
+ * Bus dispatcher.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusDispatcher extends AbstractDispatcher
+{
+ /**
+ * Public constructor.
+ *
+ * @param deploymentContext The deployment context with which this
+ * dispatcher is associated.
+ */
+ public BusDispatcher(final DeploymentContext deploymentContext)
+ {
+ super(deploymentContext);
+ }
+
+ /**
+ * Dispatch the message to the target service and then the configured out routers.
+ *
+ * @param message The message to be dispatched.
+ * @param invocationContext The InvocationContext for the message dispatch.
+ * @throws RoutingException An exception occured while dispatching the message.
+ */
+ public void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
+ {
+ AssertArgument.isNotNull(message, "message");
+ AssertArgument.isNotNull(invocationContext, "invocationContext");
+
+ Message outMessage;
+ DeploymentContext.setContext(getDeploymentContext());
+ try
+ {
+ // The addressing context should have been set for
+ // this dispacther. It should have been received from the Bus...
+ AddressingContext addressingContext = AddressingContext.getContext();
+ if(addressingContext != null)
+ {
+ throw new IllegalStateException("");
+ }
+
+ // The InvocationContext should have also come from the bus...
+ InvocationContext.setContext(invocationContext);
+ try
+ {
+ ServiceName from = addressingContext.getFrom();
+
+ // Only pass the message to the service if the from address
+ // is null (i.e. it's from an InRouter or client), or it is from
+ // a different service....
+ if(from == null || !from.equals(getServiceName()))
+ {
+ outMessage = dispatchToService(message);
+ }
+ else
+ {
+ outMessage = message;
+ }
+ applyOutboundRouters(outMessage);
+
+ // TODO; Use the faultTo address if there's an issue??
+ } finally
+ {
+ InvocationContext.setContext(null);
+ }
+ } finally
+ {
+ DeploymentContext.setContext(null);
+ }
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus;
+
+import org.jboss.esb.routing.InboundRouter;
+import org.jboss.esb.routing.MessageDispatcher;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.message.Message;
+
+/**
+ * Bus inbound router for a specific Service.
+ * <p/>
+ * Receives a message from a {@link Bus} and dispatches it to the
+ * target service and router chain.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusInboundRouter implements InboundRouter
+{
+ /**
+ * Message dispatcher.
+ */
+ private MessageDispatcher dispatcher;
+
+ /**
+ * Set the {@link MessageDispatcher} for the router.
+ *
+ * @param dispatcher The {@link MessageDispatcher} instance.
+ */
+ public final void setDispatcher(final MessageDispatcher dispatcher)
+ {
+ this.dispatcher = dispatcher;
+ }
+
+ public final void receive(final BusMessage busMessage) throws RoutingException
+ {
+ if(dispatcher == null)
+ {
+ throw new IllegalStateException("Message Dispatcher instance not set on router instance.");
+ }
+
+ AddressingContext addressingContext = busMessage.getAddressingContext();
+ InvocationContext invocationContext = busMessage.getInvocationContext();
+ Message esbMessage = busMessage.getMessage();
+
+ dispatcher.dispatch(esbMessage, invocationContext);
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessageListener.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessageListener.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessageListener.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -19,6 +19,8 @@
*/
package org.jboss.esb.federate.bus;
+import org.jboss.esb.routing.RoutingException;
+
/**
* {@link BusMessage} Listener interface.
*
@@ -30,6 +32,7 @@
* Message handler.
*
* @param busMessage The bus message.
+ * @throws RoutingException Message routing exception.
*/
- void onMessage(BusMessage busMessage);
+ void onMessage(BusMessage busMessage) throws RoutingException;
}
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate.bus;
+
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.federate.DeploymentMonitor;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.OutboundRouter;
+import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Outbound router for a Bus.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusOutboundRouter implements OutboundRouter
+{
+ /**
+ * The service name.
+ */
+ private ServiceName serviceName;
+ /**
+ * Target Service deployment monitors.
+ * <p/>
+ * The deployment monitor list for routing messages to the target service
+ * via one of the connected buses. Will be empty if no bus interfaces are
+ * available that expose this Service.
+ */
+ private List<DeploymentMonitor> deploymentMonitors = new ArrayList<DeploymentMonitor>();
+
+ /**
+ * Public constructor.
+ *
+ * @param serviceName The target Service name.
+ */
+ public BusOutboundRouter(final ServiceName serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ /**
+ * Route the message.
+ *
+ * @param message The message to be routed.
+ * @throws RoutingException An exception occured while routing the message.
+ */
+ public final void route(final Message message) throws RoutingException
+ {
+ if (!deploymentMonitors.isEmpty())
+ {
+ AddressingContext addressingContext = AddressingContext.getContext();
+ ServiceName from = addressingContext.getFrom();
+ boolean messageWasRouted = false;
+
+ // Set the To address...
+ addressingContext.setTo(serviceName);
+
+ // Package up the message for shiping over the bus...
+ BusMessage busMessage = new BusMessage();
+ busMessage.setAddressingContext(addressingContext);
+ busMessage.setInvocationContext(InvocationContext.getContext());
+ busMessage.setMessage(message);
+
+ boolean localServiceApplied = (from != null && from.equals(serviceName));
+
+ if (localServiceApplied)
+ {
+ // So we only route to deployments that only contain outrouters for this
+ // service i.e. if they also define a Service, don't route to it because
+ // the assumption is that such deployments are just other instances of
+ // this deployment....
+ messageWasRouted = routeToOutRouters(busMessage);
+ }
+ else
+ {
+ // If we route to a Service, we don't route to outbound routers. The target
+ // Service will handle that....
+ if (routeToService(busMessage))
+ {
+ return;
+ }
+ else
+ {
+ // There are no known deployments defining such a Service. Route to all
+ // known outrouters...
+ messageWasRouted = routeToOutRouters(busMessage);
+ }
+ }
+
+ if (!messageWasRouted)
+ {
+ // Failed to deliver message...
+ throw new RoutingException("Failed to route message to Service '" + serviceName + "'. All monitored deployments for this Service are currently offline.");
+ }
+ }
+ }
+
+ /**
+ * Add a deployment monitor for the target Service.
+ *
+ * @param monitor The monitor.
+ */
+ public final void addMonitor(final DeploymentMonitor monitor)
+ {
+ deploymentMonitors.add(monitor);
+ }
+
+ /**
+ * Remove a deployment monitor for the target Service.
+ *
+ * @param monitor The monitor to be removed.
+ */
+ public final void removeMonitor(final DeploymentMonitor monitor)
+ {
+ // We could just perform a remove on the list, but we will
+ // manually iterate the list in case the equals method
+ // ever gets overriden on DeploymentMonitor.
+ for (int i = 0; i < deploymentMonitors.size(); i++)
+ {
+ if (deploymentMonitors.get(i) == monitor)
+ {
+ deploymentMonitors.remove(i);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Attempt to route the message to a Service on another deployment.
+ *
+ * @param busMessage The message to route.
+ * @return True if the message was successfully routed, otherwise false.
+ * @throws RoutingException Bus exception during routing operation.
+ */
+ private boolean routeToService(final BusMessage busMessage) throws RoutingException
+ {
+ for (DeploymentMonitor deploymentMonitor : deploymentMonitors)
+ {
+ if (deploymentMonitor.isOnline())
+ {
+ Set<ServiceName> services = deploymentMonitor.getServiceSets().getServices();
+
+ if (services.contains(serviceName))
+ {
+ deploymentMonitor.getBus().send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId());
+ // we're done...
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Attempt to route the message to all outbound routers on deployments
+ * not defining a service with the same name as the service associate with this
+ * router.
+ *
+ * @param busMessage The message to route.
+ * @return True if the message was successfully routed, otherwise false.
+ * @throws RoutingException Bus exception during routing operation.
+ */
+ private boolean routeToOutRouters(final BusMessage busMessage) throws RoutingException
+ {
+ boolean messageWasRouted = false;
+
+ for (DeploymentMonitor deploymentMonitor : deploymentMonitors)
+ {
+ if (deploymentMonitor.isOnline())
+ {
+ Set<ServiceName> services = deploymentMonitor.getServiceSets().getServices();
+ Set<ServiceName> outRoutedServices = deploymentMonitor.getServiceSets().getOutboundRoutedServices();
+
+ if (!services.contains(serviceName) && outRoutedServices.contains(serviceName))
+ {
+ deploymentMonitor.getBus().send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId());
+ messageWasRouted = true;
+ }
+ }
+ }
+
+ return messageWasRouted;
+ }
+
+ /**
+ * Does this bus router have an active monitor for a deployment
+ * that has the specifid service.
+ *
+ * @param serviceName The Service name.
+ * @return True if this router has an active monitor for a deployment
+ * that has the specifid service.
+ */
+ public final boolean hasService(final ServiceName serviceName)
+ {
+ for (DeploymentMonitor deploymentMonitor : deploymentMonitors)
+ {
+ // Purposely not checking the monitor's online status!
+ if(deploymentMonitor.hasService(serviceName))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -502,7 +502,14 @@
if (objectMessage instanceof AbstractDeploymentNotification)
{
- coordinationCallback.onNotification((AbstractDeploymentNotification) objectMessage);
+ try
+ {
+ coordinationCallback.onNotification((AbstractDeploymentNotification) objectMessage);
+ }
+ catch (DeploymentException e)
+ {
+ logger.error("Error processing deployment coodination notification: " + objectMessage, e);
+ }
}
}
catch (JMSException e)
@@ -546,7 +553,14 @@
if (objectMessage instanceof BusMessage)
{
- busMessageCallback.onMessage((BusMessage) objectMessage);
+ try
+ {
+ busMessageCallback.onMessage((BusMessage) objectMessage);
+ }
+ catch(RoutingException e)
+ {
+ logger.error("Error processing ESB Message: " + objectMessage, e);
+ }
}
}
catch (JMSException e)
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/AbstractDeploymentNotification.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -31,30 +31,30 @@
/**
* The deployment name.
*/
- private String name;
+ private String deploymentName;
/**
* The deployment ID.
*/
- private String id;
+ private String deploymentId;
/**
* Get the deployment name.
*
* @return The deployment name.
*/
- public final String getName()
+ public final String getDeploymentName()
{
- return name;
+ return deploymentName;
}
/**
* Set the deployment name.
*
- * @param name The deployment name.
+ * @param deploymentName The deployment name.
*/
- public final void setName(final String name)
+ public final void setDeploymentName(final String deploymentName)
{
- this.name = name;
+ this.deploymentName = deploymentName;
}
/**
@@ -62,18 +62,18 @@
*
* @return The deployment ID.
*/
- public final String getId()
+ public final String getDeploymentId()
{
- return id;
+ return deploymentId;
}
/**
* Set the deployment ID.
*
- * @param id The deployment ID.
+ * @param deploymentId The deployment ID.
*/
- public final void setId(final String id)
+ public final void setDeploymentId(final String deploymentId)
{
- this.id = id;
+ this.deploymentId = deploymentId;
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -23,6 +23,7 @@
import org.jboss.esb.deploy.config.DeploymentUnit;
import org.jboss.esb.federate.DeploymentServiceSets;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -39,6 +40,10 @@
* The list of services contained in the deployment.
*/
private DeploymentServiceSets serviceSet = new DeploymentServiceSets();
+ /**
+ * The list of deployments being monitored by the deployment.
+ */
+ private List<String> monitoredDeployments = new ArrayList<String>();
/**
* Get the Deployment Service Sets.
@@ -61,6 +66,24 @@
}
/**
+ * Get the list of monitored deployments.
+ * @return The list of monitored deployments.
+ */
+ public final List<String> getMonitoredDeployments()
+ {
+ return monitoredDeployments;
+ }
+
+ /**
+ * Set the list of monitored deployments.
+ * @param monitoredDeployments The list of monitored deployments.
+ */
+ public final void setMonitoredDeployments(final List<String> monitoredDeployments)
+ {
+ this.monitoredDeployments = monitoredDeployments;
+ }
+
+ /**
* DeploymentRuntime to DeploymentDetailsNotification helper method.
*
* @param runtime The DeploymentRuntime instance.
@@ -70,9 +93,9 @@
{
DeploymentDetailsNotification notification = new DeploymentDetailsNotification();
- notification.setName(runtime.getDeploymentName());
+ notification.setDeploymentName(runtime.getDeploymentName());
notification.serviceSet.setDeploymentName(runtime.getDeploymentName());
- notification.setId(runtime.getDeploymentId());
+ notification.setDeploymentId(runtime.getDeploymentId());
notification.serviceSet.setDeploymentId(runtime.getDeploymentId());
List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -42,8 +42,8 @@
{
DeploymentHeartbeatNotification notification = new DeploymentHeartbeatNotification();
- notification.setName(runtime.getDeploymentName());
- notification.setId(runtime.getDeploymentId());
+ notification.setDeploymentName(runtime.getDeploymentName());
+ notification.setDeploymentId(runtime.getDeploymentId());
return notification;
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -41,8 +41,8 @@
{
DeploymentUndeployNotification notification = new DeploymentUndeployNotification();
- notification.setName(runtime.getDeploymentName());
- notification.setId(runtime.getDeploymentId());
+ notification.setDeploymentName(runtime.getDeploymentName());
+ notification.setDeploymentId(runtime.getDeploymentId());
return notification;
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/NotificationListener.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -19,6 +19,8 @@
*/
package org.jboss.esb.federate.notify;
+import org.jboss.esb.deploy.DeploymentException;
+
/**
* Notification Listener interface.
*
@@ -30,6 +32,7 @@
* Deployment notification handler.
*
* @param notification The notification.
+ * @throws DeploymentException Invalid deployment detected.
*/
- void onNotification(AbstractDeploymentNotification notification);
+ void onNotification(AbstractDeploymentNotification notification) throws DeploymentException;
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-17 16:14:44 UTC (rev 22854)
@@ -2,6 +2,13 @@
# Default JMS ESB config.
##########################################################################################
+# Deployment ID...
+# NOTE: A default random deployment ID is generated per deployment. Set the following config to manually set the deployment ID. This ensures
+# that the deployment has the same ID across restarts/redeploys. This would be required to allow a deployment pick up messages left on
+# a bus while the deployment was offline.
+#
+# deployment.id=${env.deploymentId}
+
# Coordination settings...
coordinator.heartbeat.frequency=5000
Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentServiceSetsTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentServiceSetsTest.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentServiceSetsTest.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.federate;
+
+import junit.framework.TestCase;
+import org.jboss.esb.service.ServiceName;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * @author
+ */
+public class DeploymentServiceSetsTest extends TestCase
+{
+
+ public void test_equals()
+ {
+ DeploymentServiceSets serviceSets1 = new DeploymentServiceSets();
+ DeploymentServiceSets serviceSets2 = new DeploymentServiceSets();
+ ServiceName service1 = new ServiceName("cat", "ser1");
+ ServiceName service2 = new ServiceName("cat", "ser1"); // same as service1
+ ServiceName service3 = new ServiceName("cat", "ser3");
+ Set<ServiceName> services1 = new LinkedHashSet<ServiceName>();
+ Set<ServiceName> services2 = new LinkedHashSet<ServiceName>(); // same as services1
+
+ serviceSets1.setDeploymentId("dId");
+ serviceSets1.setDeploymentName("a");
+
+ serviceSets2.setDeploymentId("dId");
+ serviceSets2.setDeploymentName("a");
+
+ // No services... should be the same...
+ assertEquals(serviceSets1, serviceSets2);
+
+ services1.add(service1);
+ services2.add(service2);
+
+ serviceSets1.setOutboundRoutedServices(services1);
+ serviceSets1.setServices(services1);
+ serviceSets2.setOutboundRoutedServices(services2);
+ serviceSets2.setServices(services2);
+
+ // Same services... should be the same...
+ assertEquals(serviceSets1, serviceSets1);
+ assertEquals(serviceSets1, serviceSets2);
+ services2.clear();
+
+ // Different services... should not be the same...
+ services2.add(service3);
+ assertNotSame(serviceSets1, serviceSets2);
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentServiceSetsTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -19,9 +19,9 @@
DeploymentRuntime rt = DigestUtil.digestConfig(getClass().getResourceAsStream("jbossesb-config.xml"));
DeploymentDetailsNotification notification = DeploymentDetailsNotification.toNotification(rt);
- assertEquals("$UNKNOWN$", notification.getName());
- assertNotNull(notification.getId());
- assertEquals(36, notification.getId().length());
+ assertEquals("$UNKNOWN$", notification.getDeploymentName());
+ assertNotNull(notification.getDeploymentId());
+ assertEquals(36, notification.getDeploymentId().length());
assertEquals("[a:a, c:c]", notification.getServiceSet().getServices().toString());
assertEquals("[a:a, b:b]", notification.getServiceSet().getOutboundRoutedServices().toString());
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -37,7 +37,7 @@
DeploymentHeartbeatNotification notification = DeploymentHeartbeatNotification.toNotification(rt);
- assertEquals("name", notification.getName());
- assertEquals("XXX", notification.getId());
+ assertEquals("name", notification.getDeploymentName());
+ assertEquals("XXX", notification.getDeploymentId());
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java 2008-09-17 15:59:03 UTC (rev 22853)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java 2008-09-17 16:14:44 UTC (rev 22854)
@@ -37,7 +37,7 @@
DeploymentUndeployNotification notification = DeploymentUndeployNotification.toNotification(rt);
- assertEquals("name", notification.getName());
- assertEquals("XXX", notification.getId());
+ assertEquals("name", notification.getDeploymentName());
+ assertEquals("XXX", notification.getDeploymentId());
}
}
\ No newline at end of file
More information about the jboss-svn-commits
mailing list