示例#1
0
  private void writeJmsBridge(XMLExtendedStreamWriter writer, String bridgeName, ModelNode value)
      throws XMLStreamException {
    writer.writeStartElement(Element.JMS_BRIDGE.getLocalName());

    if (!DEFAULT.equals(bridgeName)) {
      writer.writeAttribute(Attribute.NAME.getLocalName(), bridgeName);
    }

    JMSBridgeDefinition.MODULE.marshallAsAttribute(value, writer);

    writer.writeStartElement(SOURCE.getLocalName());
    for (AttributeDefinition attr : JMSBridgeDefinition.JMS_SOURCE_ATTRIBUTES) {
      attr.marshallAsElement(value, writer);
    }
    writer.writeEndElement();

    writer.writeStartElement(TARGET.getLocalName());
    for (AttributeDefinition attr : JMSBridgeDefinition.JMS_TARGET_ATTRIBUTES) {
      attr.marshallAsElement(value, writer);
    }
    writer.writeEndElement();

    for (AttributeDefinition attr : JMSBridgeDefinition.JMS_BRIDGE_ATTRIBUTES) {
      if (attr == JMSBridgeDefinition.MODULE) {
        // handled as a XML attribute
        continue;
      }
      attr.marshallAsElement(value, writer);
    }

    writer.writeEndElement();
  }
 @Override
 public Object getMatch(Class target, Set set) {
   if (target.getName().contains("$$EnhancerByCGLIB$$")) {
     log.warn("Found Lazy-References in Hibernate object " + target.getName());
     return org.hibernate.proxy.HibernateProxy.class;
   }
   return DEFAULT.getMatch(target, set);
 }
  /** {@inheritDoc} */
  @Override
  public Runner launchRunner() {
    CurrentProject currentProject = appContext.getCurrentProject();
    if (currentProject == null) {
      throw new IllegalStateException(
          "Can't launch runner for current project. Current project is absent...");
    }

    int ram = DEFAULT.getValue();

    RunnersDescriptor runnersDescriptor = currentProject.getProjectDescription().getRunners();
    String defaultRunner = runnersDescriptor.getDefault();

    if (!EnvironmentIdValidator.isValid(defaultRunner)) {
      defaultRunner = URL.encode(defaultRunner);
    }

    RunnerConfiguration defaultConfigs = runnersDescriptor.getConfigs().get(defaultRunner);

    if (defaultRunner != null && defaultConfigs != null) {
      ram = defaultConfigs.getRam();
    }

    RunOptions runOptions =
        dtoFactory
            .createDto(RunOptions.class)
            .withSkipBuild(Boolean.valueOf(currentProject.getAttributeValue("runner:skipBuild")))
            .withEnvironmentId(defaultRunner)
            .withMemorySize(ram);

    Environment environment = chooseRunnerAction.selectEnvironment();
    if (environment != null) {
      if (defaultRunner != null && defaultRunner.equals(environment.getId())) {
        Runner runner = modelsFactory.createRunner(runOptions);
        if (defaultRunner.startsWith(PROJECT_PREFIX)) {
          runner.setScope(PROJECT);
        }
        return launchRunner(runner);
      }
      runOptions =
          runOptions
              .withOptions(environment.getOptions())
              .withMemorySize(environment.getRam())
              .withEnvironmentId(environment.getId());
      Runner runner =
          modelsFactory.createRunner(runOptions, environment.getScope(), environment.getName());
      if (environment.getId().startsWith(PROJECT_PREFIX)) {
        runner.setScope(PROJECT);
      }
      return launchRunner(runner);
    }

    Runner runner = modelsFactory.createRunner(runOptions);
    if (defaultRunner != null && defaultRunner.startsWith(PROJECT_PREFIX)) {
      runner.setScope(PROJECT);
    }
    return launchRunner(modelsFactory.createRunner(runOptions));
  }
示例#4
0
  private static void writeHornetQServer(
      final XMLExtendedStreamWriter writer, final String serverName, final ModelNode node)
      throws XMLStreamException {

    writer.writeStartElement(Element.HORNETQ_SERVER.getLocalName());

    if (!DEFAULT.equals(serverName)) {
      writer.writeAttribute(Attribute.NAME.getLocalName(), serverName);
    }

    for (AttributeDefinition simpleAttribute : CommonAttributes.SIMPLE_ROOT_RESOURCE_ATTRIBUTES) {
      simpleAttribute.marshallAsElement(node, writer);
    }

    final ModelNode paths = node.get(ModelDescriptionConstants.PATH);
    writeDirectory(writer, Element.PAGING_DIRECTORY, paths);
    writeDirectory(writer, Element.BINDINGS_DIRECTORY, paths);
    writeDirectory(writer, Element.JOURNAL_DIRECTORY, paths);
    writeDirectory(writer, Element.LARGE_MESSAGES_DIRECTORY, paths);

    // New line after the simpler elements
    writeNewLine(writer);

    writeConnectors(writer, node);
    writeAcceptors(writer, node);
    writeBroadcastGroups(writer, node.get(BROADCAST_GROUP));
    writeDiscoveryGroups(writer, node.get(DISCOVERY_GROUP));
    writeDiverts(writer, node.get(DIVERT));
    writeQueues(writer, node.get(CommonAttributes.QUEUE));
    writeBridges(writer, node.get(CommonAttributes.BRIDGE));
    writeClusterConnections(writer, node.get(CommonAttributes.CLUSTER_CONNECTION));
    writeGroupingHandler(writer, node.get(GROUPING_HANDLER));
    writeSecuritySettings(writer, node.get(CommonAttributes.SECURITY_SETTING));
    writeAddressSettings(writer, node.get(ADDRESS_SETTING));
    writeConnectorServices(writer, node.get(CommonAttributes.CONNECTOR_SERVICE));

    if (node.hasDefined(CONNECTION_FACTORY) || node.hasDefined(POOLED_CONNECTION_FACTORY)) {
      ModelNode cf = node.get(CONNECTION_FACTORY);
      ModelNode pcf = node.get(POOLED_CONNECTION_FACTORY);
      boolean hasCf = cf.isDefined() && cf.keys().size() > 0;
      boolean hasPcf = pcf.isDefined() && pcf.keys().size() > 0;
      if (hasCf || hasPcf) {
        writer.writeStartElement(JMS_CONNECTION_FACTORIES);
        writeConnectionFactories(writer, cf);
        writePooledConnectionFactories(writer, pcf);
        writer.writeEndElement();
        writeNewLine(writer);
      }
    }

    if (node.hasDefined(JMS_QUEUE) || node.hasDefined(JMS_TOPIC)) {
      ModelNode queue = node.get(JMS_QUEUE);
      ModelNode topic = node.get(JMS_TOPIC);
      boolean hasQueue = queue.isDefined() && queue.keys().size() > 0;
      boolean hasTopic = topic.isDefined() && topic.keys().size() > 0;
      if (hasQueue || hasTopic) {
        writer.writeStartElement(JMS_DESTINATIONS);
        writeJmsQueues(writer, node.get(JMS_QUEUE));
        writeTopics(writer, node.get(JMS_TOPIC));
        writer.writeEndElement();
      }
    }

    writer.writeEndElement();
  }