@Override
 public void deploy(final DeploymentPhaseContext phaseContext)
     throws DeploymentUnitProcessingException {
   final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
   if (!DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) {
     if (deploymentUnit.getParent() == null) {
       deploymentUnit.putAttachment(AppClientAttachments.START_APP_CLIENT, true);
     }
     return;
   }
   final List<DeploymentUnit> appClients = new ArrayList<DeploymentUnit>();
   for (DeploymentUnit subDeployment :
       deploymentUnit.getAttachmentList(
           org.jboss.as.server.deployment.Attachments.SUB_DEPLOYMENTS)) {
     if (DeploymentTypeMarker.isType(DeploymentType.APPLICATION_CLIENT, subDeployment)) {
       if (deploymentName != null && deploymentName.equals(subDeployment.getName())) {
         subDeployment.putAttachment(AppClientAttachments.START_APP_CLIENT, true);
         return;
       }
       appClients.add(subDeployment);
     }
   }
   if (deploymentName != null && !deploymentName.isEmpty()) {
     throw AppClientLogger.ROOT_LOGGER.cannotFindAppClient(deploymentName);
   }
   if (appClients.size() == 1) {
     appClients.get(0).putAttachment(AppClientAttachments.START_APP_CLIENT, true);
   } else if (appClients.isEmpty()) {
     throw AppClientLogger.ROOT_LOGGER.cannotFindAppClient();
   } else {
     throw AppClientLogger.ROOT_LOGGER.multipleAppClientsFound();
   }
 }
  public static void init() {

    addArguments(CommandLineConstants.APPCLIENT_CONFIG + "=<config>");
    instructions.add(AppClientLogger.ROOT_LOGGER.argAppClientConfig());

    addArguments(CommandLineConstants.SHORT_HELP, CommandLineConstants.HELP);
    instructions.add(AppClientLogger.ROOT_LOGGER.argHelp());

    addArguments(CommandLineConstants.HOST + "=<url>", CommandLineConstants.SHORT_HOST + "=<url>");
    instructions.add(AppClientLogger.ROOT_LOGGER.argHost());

    addArguments(
        CommandLineConstants.SHORT_PROPERTIES + "=<url>",
        CommandLineConstants.PROPERTIES + "=<url>");
    instructions.add(AppClientLogger.ROOT_LOGGER.argProperties());

    addArguments(CommandLineConstants.CONNECTION_PROPERTIES + "=<url>");
    instructions.add(AppClientLogger.ROOT_LOGGER.argConnectionProperties());

    addArguments(CommandLineConstants.SYS_PROP + "<name>[=value]");
    instructions.add(AppClientLogger.ROOT_LOGGER.argSystemProperty());

    addArguments(CommandLineConstants.SHORT_VERSION, CommandLineConstants.VERSION);
    instructions.add(AppClientLogger.ROOT_LOGGER.argVersion());

    addArguments(CommandLineConstants.SECMGR);
    instructions.add(AppClientLogger.ROOT_LOGGER.argSecMgr());
  }
示例#3
0
  private void parseServerProfile(
      final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list)
      throws XMLStreamException {
    // Attributes
    requireNoAttributes(reader);

    // Content
    final Set<String> configuredSubsystemTypes = new HashSet<String>();
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
      if (Element.forName(reader.getLocalName()) != Element.SUBSYSTEM) {
        throw unexpectedElement(reader);
      }
      if (!configuredSubsystemTypes.add(reader.getNamespaceURI())) {
        throw AppClientLogger.ROOT_LOGGER.duplicateSubsystemDeclaration(reader.getLocation());
      }
      // parse subsystem
      final List<ModelNode> subsystems = new ArrayList<ModelNode>();
      reader.handleAny(subsystems);

      // Process subsystems
      for (final ModelNode update : subsystems) {
        // Process relative subsystem path address
        final ModelNode subsystemAddress = address.clone();
        for (final Property path : update.get(OP_ADDR).asPropertyList()) {
          subsystemAddress.add(path.getName(), path.getValue().asString());
        }
        update.get(OP_ADDR).set(subsystemAddress);
        list.add(update);
      }
    }
  }
 public synchronized void close() {
   try {
     if (connection != null) {
       connection.close();
     }
   } catch (IOException e) {
     AppClientLogger.ROOT_LOGGER.exceptionClosingConnection(e);
   }
   try {
     if (endpoint != null) {
       endpoint.close();
     }
   } catch (IOException e) {
     AppClientLogger.ROOT_LOGGER.exceptionClosingConnection(e);
   }
 }
 public static void printUsage(final PrintStream out) {
   init();
   out.print(AppClientLogger.ROOT_LOGGER.usageDescription());
   out.print(usage("appclient"));
 }