public void attach(
      JmsConnectionSource source, PhysicalConnectionTarget target, ChannelConnection connection)
      throws Fabric3Exception {
    URI serviceUri = source.getUri();
    ClassLoader sourceClassLoader = source.getClassLoader();

    JmsBindingMetadata metadata = source.getMetadata();

    ResolvedObjects objects = resolveAdministeredObjects(source);

    ContainerConfiguration configuration = new ContainerConfiguration();
    ConnectionFactory connectionFactory = objects.getRequestFactory();
    javax.jms.Destination destination = objects.getRequestDestination();
    EventStream stream = connection.getEventStream();
    EventStreamListener listener =
        new EventStreamListener(sourceClassLoader, stream.getHeadHandler(), monitor);
    configuration.setDestinationType(metadata.getDestination().geType());
    configuration.setDestination(destination);
    configuration.setFactory(connectionFactory);
    configuration.setMessageListener(listener);
    configuration.setUri(serviceUri);
    configuration.setSessionType(source.getSessionType());
    populateConfiguration(configuration, metadata);
    if (containerManager.isRegistered(serviceUri)) {
      // the wire has changed and it is being re-provisioned
      containerManager.unregister(serviceUri);
    }
    AdaptiveMessageContainer container = containerFactory.create(configuration);
    containerManager.register(container);
  }
 private ResolvedObjects resolveAdministeredObjects(JmsConnectionSource source)
     throws Fabric3Exception {
   JmsBindingMetadata metadata = source.getMetadata();
   ConnectionFactoryDefinition connectionFactory = metadata.getConnectionFactory();
   ConnectionFactory requestConnectionFactory = resolver.resolve(connectionFactory);
   Destination requestDestinationDefinition = metadata.getDestination();
   javax.jms.Destination requestDestination =
       resolver.resolve(requestDestinationDefinition, requestConnectionFactory);
   return new ResolvedObjects(requestConnectionFactory, requestDestination);
 }
 public void detach(JmsConnectionSource source, PhysicalConnectionTarget target)
     throws Fabric3Exception {
   containerManager.unregister(source.getUri());
   resolver.release(source.getMetadata().getConnectionFactory());
 }