示例#1
0
  @Override
  protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
      throws OperationFailedException {

    ServiceRegistry registry = context.getServiceRegistry(false);
    final ServiceName serviceName =
        MessagingServices.getActiveMQServiceName(
            PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
    ServiceController<?> service = registry.getService(serviceName);
    if (service != null) {
      context.reloadRequired();
    } else {
      final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
      final String name = address.getLastElement().getValue();

      final ServiceTarget target = context.getServiceTarget();
      if (model.hasDefined(JGROUPS_CHANNEL.getName())) {
        // nothing to do, in that case, the clustering.jgroups subsystem will have setup the stack
      } else if (model.hasDefined(RemoteTransportDefinition.SOCKET_BINDING.getName())) {
        final GroupBindingService bindingService = new GroupBindingService();
        target
            .addService(
                GroupBindingService.getBroadcastBaseServiceName(serviceName).append(name),
                bindingService)
            .addDependency(
                SocketBinding.JBOSS_BINDING_NAME.append(model.get(SOCKET_BINDING).asString()),
                SocketBinding.class,
                bindingService.getBindingRef())
            .install();
      }
    }
  }
示例#2
0
  private static void writeAcceptorContent(
      final XMLExtendedStreamWriter writer, final Property property) throws XMLStreamException {
    writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
    final ModelNode value = property.getValue();

    RemoteTransportDefinition.SOCKET_BINDING.marshallAsAttribute(value, writer);
    InVMTransportDefinition.SERVER_ID.marshallAsAttribute(value, writer);
    CommonAttributes.FACTORY_CLASS.marshallAsElement(value, writer);

    writeTransportParam(writer, value.get(PARAM));
  }
示例#3
0
 private static void writeConnectors(final XMLExtendedStreamWriter writer, final ModelNode node)
     throws XMLStreamException {
   if (node.hasDefined(CONNECTOR)
       || node.hasDefined(REMOTE_CONNECTOR)
       || node.hasDefined(IN_VM_CONNECTOR)) {
     writer.writeStartElement(Element.CONNECTORS.getLocalName());
     if (node.hasDefined(REMOTE_CONNECTOR)) {
       for (final Property property : node.get(REMOTE_CONNECTOR).asPropertyList()) {
         writer.writeStartElement(Element.NETTY_CONNECTOR.getLocalName());
         writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
         RemoteTransportDefinition.SOCKET_BINDING.marshallAsAttribute(property.getValue(), writer);
         writeTransportParam(writer, property.getValue().get(PARAM));
         writer.writeEndElement();
       }
     }
     if (node.hasDefined(IN_VM_CONNECTOR)) {
       for (final Property property : node.get(IN_VM_CONNECTOR).asPropertyList()) {
         writer.writeStartElement(Element.IN_VM_CONNECTOR.getLocalName());
         writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
         InVMTransportDefinition.SERVER_ID.marshallAsAttribute(property.getValue(), writer);
         writeTransportParam(writer, property.getValue().get(PARAM));
         writer.writeEndElement();
       }
     }
     if (node.hasDefined(CONNECTOR)) {
       for (final Property property : node.get(CONNECTOR).asPropertyList()) {
         writer.writeStartElement(Element.CONNECTOR.getLocalName());
         writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
         GenericTransportDefinition.SOCKET_BINDING.marshallAsElement(property.getValue(), writer);
         CommonAttributes.FACTORY_CLASS.marshallAsElement(property.getValue(), writer);
         writeTransportParam(writer, property.getValue().get(PARAM));
         writer.writeEndElement();
       }
     }
     writer.writeEndElement();
     writeNewLine(writer);
   }
 }