Ejemplo n.º 1
0
  @Override
  public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystem =
        context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    final ManagementResourceRegistration registration =
        subsystem.registerSubsystemModel(UndertowRootDefinition.INSTANCE);
    registration.registerOperationHandler(
        GenericSubsystemDescribeHandler.DEFINITION,
        GenericSubsystemDescribeHandler.INSTANCE,
        false);

    final ManagementResourceRegistration deployments =
        subsystem.registerDeploymentModel(DeploymentDefinition.INSTANCE);
    deployments.registerSubModel(DeploymentServletDefinition.INSTANCE);

    subsystem.registerXMLElementWriter(UndertowSubsystemParser_3_0.INSTANCE);
  }
Ejemplo n.º 2
0
  public void initialize(ExtensionContext context) {
    final SubsystemRegistration subsystemRegistration =
        context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystemRegistration.registerXMLElementWriter(MessagingSubsystemParser_1_0.INSTANCE);

    boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();

    // Root resource
    final ManagementResourceRegistration subsystem =
        subsystemRegistration.registerSubsystemModel(
            MessagingSubsystemRootResourceDefinition.INSTANCE);
    subsystem.registerOperationHandler(
        GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);

    // ActiveMQ Servers
    final ManagementResourceRegistration server =
        subsystem.registerSubModel(new ServerDefinition(registerRuntimeOnly));

    for (PathDefinition path :
        new PathDefinition[] {
          PathDefinition.JOURNAL_INSTANCE,
          PathDefinition.BINDINGS_INSTANCE,
          PathDefinition.LARGE_MESSAGES_INSTANCE,
          PathDefinition.PAGING_INSTANCE
        }) {
      ManagementResourceRegistration pathRegistry = server.registerSubModel(path);
      PathDefinition.registerResolveOperationHandler(context, pathRegistry);
    }

    subsystem.registerSubModel(JMSBridgeDefinition.INSTANCE);

    if (registerRuntimeOnly) {
      final ManagementResourceRegistration deployment =
          subsystemRegistration.registerDeploymentModel(
              new SimpleResourceDefinition(
                  SUBSYSTEM_PATH, getResourceDescriptionResolver("deployed")));
      final ManagementResourceRegistration deployedServer =
          deployment.registerSubModel(
              new SimpleResourceDefinition(SERVER_PATH, getResourceDescriptionResolver(SERVER)));
      deployedServer.registerSubModel(JMSQueueDefinition.DEPLOYMENT_INSTANCE);
      deployedServer.registerSubModel(JMSTopicDefinition.DEPLOYMENT_INSTANCE);
      deployedServer.registerSubModel(PooledConnectionFactoryDefinition.DEPLOYMENT_INSTANCE);
    }
  }
Ejemplo n.º 3
0
  @Override
  public void initialize(ExtensionContext context) {
    SubsystemRegistration registration =
        context.registerSubsystem(
            SUBSYSTEM_NAME, MANAGEMENT_API_MAJOR_VERSION, MANAGEMENT_API_MINOR_VERSION);
    final ManagementResourceRegistration nodeRegistration =
        registration.registerSubsystemModel(DESCRIPTION);
    PersistenceUnitRegistryImpl persistenceUnitRegistry = new PersistenceUnitRegistryImpl();
    JPASubSystemAdd subsystemAdd = new JPASubSystemAdd(persistenceUnitRegistry);
    nodeRegistration.registerOperationHandler(
        JPASubSystemAdd.OPERATION_NAME, subsystemAdd, subsystemAdd, false);
    nodeRegistration.registerOperationHandler(
        JPASubSystemRemove.OPERATION_NAME,
        JPASubSystemRemove.INSTANCE,
        JPASubSystemRemove.INSTANCE,
        false);
    nodeRegistration.registerOperationHandler(
        DESCRIBE,
        JPADescribeHandler.INSTANCE,
        JPADescribeHandler.INSTANCE,
        false,
        OperationEntry.EntryType.PRIVATE);
    nodeRegistration.registerReadWriteAttribute(
        CommonAttributes.DEFAULT_DATASOURCE,
        null,
        JPADefaultDatasourceWriteHandler.INSTANCE,
        Storage.CONFIGURATION);
    registration.registerXMLElementWriter(parser);

    try {
      PersistenceProviderLoader.loadDefaultProvider();
    } catch (ModuleLoadException e) {
      JPA_LOGGER.errorPreloadingDefaultProvider(e);
    }

    try {
      // load the default persistence provider adaptor
      PersistenceProviderAdaptor provider =
          PersistenceProviderAdaptorLoader.loadPersistenceAdapterModule(
              Configuration.ADAPTER_MODULE_DEFAULT);
      final ManagementAdaptor managementAdaptor = provider.getManagementAdaptor();
      if (managementAdaptor != null && context.isRuntimeOnlyRegistrationValid()) {
        DescriptionProvider JPA_SUBSYSTEM =
            new DescriptionProvider() {
              @Override
              public ModelNode getModelDescription(Locale locale) {
                ModelNode subsystem = new ModelNode();
                subsystem
                    .get(org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION)
                    .set("Runtime information about JPA use in the deployment.");
                subsystem.get(ATTRIBUTES).setEmptyObject();
                subsystem.get("operations"); // placeholder

                subsystem
                    .get(
                        CHILDREN,
                        managementAdaptor.getIdentificationLabel(),
                        org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIPTION)
                    .set(
                        "Runtime information about "
                            + managementAdaptor.getIdentificationLabel()
                            + " use in the deployment.");

                subsystem
                    .get(CHILDREN, managementAdaptor.getIdentificationLabel(), MIN_OCCURS)
                    .set(0);
                return subsystem;
              }
            };

        final ManagementResourceRegistration jpaSubsystemDeployments =
            registration.registerDeploymentModel(JPA_SUBSYSTEM);

        managementAdaptor.register(jpaSubsystemDeployments, persistenceUnitRegistry);
      }
    } catch (ModuleLoadException e) {
      JPA_LOGGER.errorPreloadingDefaultProviderAdaptor(e);
    }
  }