当前位置: 首页>>代码示例>>Java>>正文


Java Extension类代码示例

本文整理汇总了Java中org.jboss.as.controller.Extension的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Extension类属于org.jboss.as.controller包,在下文中一共展示了Extension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createServiceActivatorListenerArchiveForModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
public static void createServiceActivatorListenerArchiveForModule(File destination, String targetName, Class listenerClass) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    archive.addClass(JMXNotificationsService.class);
    archive.addClass(listenerClass);
    archive.addClass(JMXControlledStateNotificationListenerExtension.class);
    archive.addClass(EmptySubsystemParser.class);
    archive.addAsServiceProvider(Extension.class, JMXControlledStateNotificationListenerExtension.class);
    StringBuilder sb = new StringBuilder();
    sb.append(ServiceActivatorDeployment.LISTENER_CLASS_NAME);
    sb.append('=');
    sb.append(listenerClass.getName());
    sb.append("\n");
    sb.append(ServiceActivatorDeployment.LISTENER_OBJECT_NAME);
    sb.append('=');
    sb.append(targetName);
    sb.append("\n");
    sb.append("keep.after.stop=true\n");
    archive.addAsResource(new StringAsset(sb.toString()), JMXNotificationsService.PROPERTIES_RESOURCE);
    archive.as(ZipExporter.class).exportTo(destination);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:ServiceActivatorDeploymentUtil.java

示例2: createExtensionModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
public static void createExtensionModule(File extensionModuleRoot, Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    deleteRecursively(extensionModuleRoot.toPath());

    if (extensionModuleRoot.exists() && !extensionModuleRoot.isDirectory()) {
        throw new IllegalArgumentException(extensionModuleRoot + " already exists and is not a directory");
    }
    File file = new File(extensionModuleRoot, "main");
    if (!file.mkdirs() && !file.exists()) {
        throw new IllegalArgumentException("Could not create " + file);
    }
    final InputStream is = createResourceRoot(extension, additionalPackages).exportAsInputStream();
    try {
        copyFile(new File(file, JAR_NAME), is);
    } finally {
        IoUtils.safeClose(is);
    }

    URL url = extension.getResource("module.xml");
    if (url == null) {
        throw new IllegalStateException("Could not find module.xml");
    }
    copyFile(new File(file, "module.xml"), url.openStream());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ExtensionUtils.java

示例3: createTestModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
private static void createTestModule() throws Exception {
    final File moduleXml = new File(DuplicateExtCommandTestCase.class.getResource(DuplicateExtCommandTestCase.class.getSimpleName() + "-module.xml").toURI());
    testModule = new TestModule(MODULE_NAME, moduleXml);

    final JavaArchive archive = testModule.addResource("test-cli-duplicate-commands-module.jar")
            .addClass(DuplicateExtCommandHandler.class)
            .addClass(DuplicateExtCommandHandlerProvider.class)
            .addClass(DuplicateExtCommandsExtension.class)
            .addClass(CliExtCommandsParser.class)
            .addClass(DuplicateExtCommand.class)
            .addClass(DuplicateExtCommandSubsystemResourceDescription.class);

    ArchivePath services = ArchivePaths.create("/");
    services = ArchivePaths.create(services, "services");

    final ArchivePath extService = ArchivePaths.create(services, Extension.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommandsExtension.class), extService);

    final ArchivePath cliCmdService = ArchivePaths.create(services, CommandHandlerProvider.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommandHandlerProvider.class), cliCmdService);

    final ArchivePath cliAeshCmdService = ArchivePaths.create(services, Command.class.getName());
    archive.addAsManifestResource(getResource(DuplicateExtCommand.class), cliAeshCmdService);
    testModule.create(true);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:DuplicateExtCommandTestCase.java

示例4: createTestModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
private static void createTestModule() throws Exception {
    File moduleXml = new File(CustomSecurityVault.class.getResource(CustomVaultInModuleTestCase.class.getSimpleName() + "-module.xml").toURI());
    testModule = new TestModule(MODULE_NAME, moduleXml);

    JavaArchive archive = testModule.addResource("test-custom-vault-in-module.jar")
            .addClass(CustomSecurityVault.class)
            .addClass(TestVaultExtension.class)
            .addClass(TestVaultParser.class)
            .addClass(TestVaultRemoveHandler.class)
            .addClass(TestVaultResolveExpressionHandler.class)
            .addClass(TestVaultSubsystemResourceDescription.class);

    ArchivePath path = ArchivePaths.create("/");
    path = ArchivePaths.create(path, "services");
    path = ArchivePaths.create(path, Extension.class.getName());
    archive.addAsManifestResource(CustomSecurityVault.class.getPackage(), Extension.class.getName(), path);
    testModule.create(true);

    picketLink = PicketBoxModuleUtil.createTestModule();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:CustomVaultInModuleTestCase.java

示例5: loadModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
private XMLStreamException loadModule(final String moduleName, final XMLMapper xmlMapper) throws XMLStreamException {
    // Register element handlers for this extension
    try {
        final Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName));
        boolean initialized = false;
        for (final Extension extension : module.loadService(Extension.class)) {
            ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass());
            try {
                extension.initializeParsers(extensionRegistry.getExtensionParsingContext(moduleName, xmlMapper));
            } finally {
                WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
            }
            if (!initialized) {
                initialized = true;
            }
        }
        if (!initialized) {
            throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module.getIdentifier());
        }
        return null;
    } catch (final ModuleLoadException e) {
        throw ControllerLogger.ROOT_LOGGER.failedToLoadModule(e);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:25,代码来源:DeferredExtensionContext.java

示例6: outputModel

import org.jboss.as.controller.Extension; //导入依赖的package包/类
/**
 * Output the model to xml
 *
 * @param model the model to marshall
 * @return the xml
 */
String outputModel(ModelNode model) throws Exception {

    StringConfigurationPersister persister = new StringConfigurationPersister(Collections.emptyList(), testParser, true);

    // Use ProcessType.HOST_CONTROLLER for this ExtensionRegistry so we don't need to provide
    // a PathManager via the ExtensionContext. All we need the Extension to do here is register the xml writers
    ExtensionRegistry outputExtensionRegistry = new ExtensionRegistry(ProcessType.HOST_CONTROLLER, new RunningModeControl(RunningMode.NORMAL), null, null, null, RuntimeHostControllerInfoAccessor.SERVER);
    outputExtensionRegistry.setWriterRegistry(persister);


    Extension extension = mainExtension.getClass().newInstance();
    extension.initialize(outputExtensionRegistry.getExtensionContext("Test", MOCK_RESOURCE_REG, ExtensionRegistryType.SLAVE));

    ConfigurationPersister.PersistenceResource resource = persister.store(model, Collections.emptySet());
    resource.commit();
    return persister.getMarshalled();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:SubsystemTestDelegate.java

示例7: TestModelControllerService7_5_0

import org.jboss.as.controller.Extension; //导入依赖的package包/类
TestModelControllerService7_5_0(final Extension mainExtension, final ControllerInitializer controllerInitializer,
                                final AdditionalInitialization additionalInit, final RunningModeControl runningModeControl, final ExtensionRegistry extensionRegistry,
                                final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers) {
    super(AdditionalInitializationUtil.getProcessType(additionalInit), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter,
            DESC_PROVIDER, new ControlledProcessState(true), Controller74x.INSTANCE);
    this.extensionRegistry = extensionRegistry;
    this.additionalInit = additionalInit;
    this.controllerInitializer = controllerInitializer;
    this.mainExtension = mainExtension;
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:11,代码来源:TestModelControllerService7_5_0.java

示例8: TestModelControllerService11_0_0

import org.jboss.as.controller.Extension; //导入依赖的package包/类
TestModelControllerService11_0_0(final Extension mainExtension, final ControllerInitializer controllerInitializer,
                                 final AdditionalInitialization additionalInit, final RunningModeControl runningModeControl, final ExtensionRegistry extensionRegistry,
                                 final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers) {
    super(AdditionalInitializationUtil.getProcessType(additionalInit), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter,
            new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()), new ControlledProcessState(true), Controller90x.INSTANCE);
    this.mainExtension = mainExtension;
    this.additionalInit = additionalInit;
    this.controllerInitializer = controllerInitializer;
    this.extensionRegistry = extensionRegistry;
    this.runningModeControl = runningModeControl;
    this.registerTransformers = registerTransformers;
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:13,代码来源:TestModelControllerService11_0_0.java

示例9: create

import org.jboss.as.controller.Extension; //导入依赖的package包/类
@Override
public ModelTestModelControllerService create(Extension mainExtension, ControllerInitializer controllerInitializer,
        AdditionalInitialization additionalInit, ExtensionRegistry extensionRegistry, StringConfigurationPersister persister,
        ModelTestOperationValidatorFilter validateOpsFilter, boolean registerTransformers) {
    return new TestModelControllerService11_0_0(
            mainExtension,
            controllerInitializer,
            additionalInit,
            new RunningModeControl(AdditionalInitializationUtil.getRunningMode(additionalInit)),
            extensionRegistry,
            persister,
            validateOpsFilter,
            registerTransformers
    );
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:16,代码来源:TestModelControllerFactory11_0_0.java

示例10: TestModelControllerService10_0_0

import org.jboss.as.controller.Extension; //导入依赖的package包/类
TestModelControllerService10_0_0(final Extension mainExtension, final ControllerInitializer controllerInitializer,
                                 final AdditionalInitialization additionalInit, final RunningModeControl runningModeControl, final ExtensionRegistry extensionRegistry,
                                 final StringConfigurationPersister persister, final ModelTestOperationValidatorFilter validateOpsFilter, final boolean registerTransformers) {
    super(AdditionalInitializationUtil.getProcessType(additionalInit), runningModeControl, extensionRegistry.getTransformerRegistry(), persister, validateOpsFilter,
            new SimpleResourceDefinition(null, new NonResolvingResourceDescriptionResolver()), new ControlledProcessState(true), Controller90x.INSTANCE);
    this.mainExtension = mainExtension;
    this.additionalInit = additionalInit;
    this.controllerInitializer = controllerInitializer;
    this.extensionRegistry = extensionRegistry;
    this.runningModeControl = runningModeControl;
    this.registerTransformers = registerTransformers;
}
 
开发者ID:wildfly,项目名称:wildfly-legacy-test,代码行数:13,代码来源:TestModelControllerService10_0_0.java

示例11: createResourceRoot

import org.jboss.as.controller.Extension; //导入依赖的package包/类
private static StreamExporter createResourceRoot(Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    storePackage(extension.getPackage(), extension.getClassLoader(), archive);
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            storePackage(pkg, extension.getClassLoader(), archive);
        }
    }

    archive.addAsServiceProvider(Extension.class, extension);
    return archive.as(ZipExporter.class);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:ExtensionUtils.java

示例12: createResourceRoot

import org.jboss.as.controller.Extension; //导入依赖的package包/类
static StreamExporter createResourceRoot(Class<? extends Extension> extension, Package... additionalPackages) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    archive.addPackage(extension.getPackage());
    if (additionalPackages != null) {
        for (Package pkg : additionalPackages) {
            archive.addPackage(pkg);
        }
    }
    archive.addAsServiceProvider(Extension.class, extension);
    return archive.as(ZipExporter.class);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:ExtensionSetup.java

示例13: createTestModule

import org.jboss.as.controller.Extension; //导入依赖的package包/类
private static void createTestModule() throws Exception {
    final File moduleXml = new File(CliExtCommandsTestCase.class.getResource(CliExtCommandsTestCase.class.getSimpleName() + "-module.xml").toURI());
    testModule = new TestModule(MODULE_NAME, moduleXml);
    final JavaArchive archive = testModule.addResource("test-cli-ext-commands-module.jar")
            .addClass(CliExtCommandHandler.class)
            .addClass(CliExtCommand.class)
            .addClass(CliExtCommandHandlerProvider.class)
            .addClass(CliExtCommandsExtension.class)
            .addClass(CliExtCommandsParser.class)
            .addClass(CliExtCommandsSubsystemResourceDescription.class);

    ArchivePath services = ArchivePaths.create("/");
    services = ArchivePaths.create(services, "services");

    ArchivePath help = ArchivePaths.create("/");
    help = ArchivePaths.create(help, "help");

    final ArchivePath extService = ArchivePaths.create(services, Extension.class.getName());
    archive.addAsManifestResource(CliExtCommandHandler.class.getPackage(), Extension.class.getName(), extService);

    final ArchivePath cliCmdService = ArchivePaths.create(services, CommandHandlerProvider.class.getName());
    archive.addAsManifestResource(CliExtCommandHandler.class.getPackage(), CommandHandlerProvider.class.getName(), cliCmdService);

    final ArchivePath cliAeshCmdService = ArchivePaths.create(services, Command.class.getName());
    archive.addAsManifestResource(CliExtCommand.class.getPackage(), Command.class.getName(), cliAeshCmdService);

    final ArchivePath helpService = ArchivePaths.create(help, CliExtCommandHandler.NAME + ".txt");
    archive.addAsResource(CliExtCommandHandler.class.getPackage(), CliExtCommandHandler.NAME + ".txt", helpService);

    final ArchivePath help2Service = ArchivePaths.create("/"
            + CliExtCommand.class.getPackage().getName().replaceAll("\\.", "/"), "command_resources.properties");
    archive.addAsResource(CliExtCommand.class.getPackage(), "command_resources.properties", help2Service);

    testModule.create(true);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:CliExtCommandsTestCase.java

示例14: initializeExtension

import org.jboss.as.controller.Extension; //导入依赖的package包/类
protected void initializeExtension(String module, ManagementResourceRegistration rootRegistration) throws OperationFailedException {
    try {
        for (final Extension extension : Module.loadServiceFromCallerModuleLoader(ModuleIdentifier.fromString(module), Extension.class)) {
            ClassLoader oldTccl = SecurityActions.setThreadContextClassLoader(extension.getClass());
            try {
                extension.initializeParsers(extensionRegistry.getExtensionParsingContext(module, null));
                extension.initialize(extensionRegistry.getExtensionContext(module, rootRegistration, ExtensionRegistryType.SLAVE));
            } finally {
                SecurityActions.setThreadContextClassLoader(oldTccl);
            }
        }
    } catch (ModuleLoadException e) {
        throw DomainControllerLogger.ROOT_LOGGER.failedToLoadModule(e, module);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:16,代码来源:ApplyExtensionsHandler.java

示例15: registerIOExtension

import org.jboss.as.controller.Extension; //导入依赖的package包/类
static void registerIOExtension(ExtensionRegistry extensionRegistry, ManagementResourceRegistration rootRegistration) {
    ManagementResourceRegistration extReg = rootRegistration.registerSubModel(new SimpleResourceDefinition(PathElement.pathElement(EXTENSION, "org.wildfly.extension.io"),
            NonResolvingResourceDescriptionResolver.INSTANCE, new ModelOnlyAddStepHandler(), ModelOnlyRemoveStepHandler.INSTANCE));
    extReg.registerReadOnlyAttribute(new SimpleAttributeDefinitionBuilder("module", ModelType.STRING).build(), null);

    Extension ioe = new IOExtension();
    ioe.initialize(extensionRegistry.getExtensionContext("org.wildfly.extension.io", rootRegistration, ExtensionRegistryType.MASTER));

}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:RemotingSubsystemTestUtil.java


注:本文中的org.jboss.as.controller.Extension类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。