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


Java ServiceActivator类代码示例

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


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

示例1: createServiceActivatorDeployment

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
public static void createServiceActivatorDeployment(File destination, String objectName, Class mbeanClass) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    archive.addClass(ServiceActivatorDeployment.class);
    archive.addClass(mbeanClass);
    archive.addAsServiceProvider(ServiceActivator.class, ServiceActivatorDeployment.class);
    StringBuilder sb = new StringBuilder();
    sb.append(ServiceActivatorDeployment.MBEAN_CLASS_NAME);
    sb.append('=');
    sb.append(mbeanClass.getName());
    sb.append("\n");
    sb.append(ServiceActivatorDeployment.MBEAN_OBJECT_NAME);
    sb.append('=');
    sb.append(objectName);
    sb.append("\n");
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            getMBeanPermission(mbeanClass, objectName, "registerMBean"),
            getMBeanPermission(mbeanClass, objectName, "unregisterMBean"),
            new MBeanTrustPermission("register")),
            "permissions.xml");
    archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc,org.jboss.as.jmx,org.jboss.as.server,org.jboss.as.controller\n"), "MANIFEST.MF");
    archive.addAsResource(new StringAsset(sb.toString()), ServiceActivatorDeployment.PROPERTIES_RESOURCE);
    archive.as(ZipExporter.class).exportTo(destination);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ServiceActivatorDeploymentUtil.java

示例2: createServiceActivatorDeploymentArchive

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
public static JavaArchive createServiceActivatorDeploymentArchive(String name, Map<String, String> properties) throws IOException {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
    archive.addClass(ServiceActivatorDeployment.class);
    archive.addAsServiceProvider(ServiceActivator.class, ServiceActivatorDeployment.class);
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            new PropertyPermission("test.deployment.trivial.prop", "write"),
            new PropertyPermission("service", "write"),
            new PropertyPermission("rbac", "write")
    ), "permissions.xml");
    if (properties != null && properties.size() > 0) {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, String> prop : properties.entrySet()) {
            sb.append(prop.getKey());
            sb.append('=');
            sb.append(prop.getValue());
            sb.append("\n");
        }
        archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc\n"), "MANIFEST.MF");
        archive.addAsResource(new StringAsset(sb.toString()), ServiceActivatorDeployment.PROPERTIES_RESOURCE);
    }
    return archive;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:ServiceActivatorDeploymentUtil.java

示例3: deploy

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@BeforeClass
public static void deploy() throws Exception {
    //ServerDeploymentHelper helper = new ServerDeploymentHelper(managementClient.getControllerClient());
    JavaArchive war = ShrinkWrap.create(JavaArchive.class, WEB_SUSPEND_JAR);
    war.addPackage(SuspendResumeHandler.class.getPackage());
    war.addAsServiceProvider(ServiceActivator.class, TestSuspendServiceActivator.class);
    war.addAsResource(new StringAsset("Dependencies: org.jboss.dmr, org.jboss.as.controller, io.undertow.core, org.jboss.as.server,org.wildfly.extension.request-controller, org.jboss.as.network\n"), "META-INF/MANIFEST.MF");
    war.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
        new RuntimePermission("createXnioWorker"),
        new SocketPermission(TestSuiteEnvironment.getServerAddress() + ":8080", "listen,resolve"),
        new SocketPermission("*", "accept,resolve")
    ), "permissions.xml");
    //helper.deploy(WEB_SUSPEND_JAR, war.as(ZipExporter.class).exportAsInputStream());
    serverController.deploy(war, WEB_SUSPEND_JAR);

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

示例4: startContainer

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@Before
public void startContainer() throws Exception {
    // Start the server
    container.startSuspended();
    managementClient = container.getClient();

    //ServerDeploymentHelper helper = new ServerDeploymentHelper(managementClient.getControllerClient());
    JavaArchive war = ShrinkWrap.create(JavaArchive.class, WEB_SUSPEND_JAR);
    war.addPackage(SuspendResumeHandler.class.getPackage());
    war.addAsServiceProvider(ServiceActivator.class, TestSuspendServiceActivator.class);
    war.addAsResource(new StringAsset("Dependencies: org.jboss.dmr, org.jboss.as.controller, io.undertow.core, org.jboss.as.server,org.wildfly.extension.request-controller, org.jboss.as.network\n"), "META-INF/MANIFEST.MF");
    war.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
        new RuntimePermission("createXnioWorker"),
        new SocketPermission(TestSuiteEnvironment.getServerAddress() + ":8080", "listen,resolve"),
        new SocketPermission("*", "accept,resolve")
    ), "permissions.xml");
    //helper.deploy(WEB_SUSPEND_JAR, war.as(ZipExporter.class).exportAsInputStream());
    serverController.deploy(war, WEB_SUSPEND_JAR);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:StartSuspendedTestCase.java

示例5: setupDomain

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@BeforeClass
public static void setupDomain() throws Exception {
    testSupport = DomainTestSuite.createSupport(DeploymentRolloutFailureTestCase.class.getSimpleName());
    masterClient = testSupport.getDomainMasterLifecycleUtil().getDomainClient();

    File tmpRoot = new File(System.getProperty("java.io.tmpdir"));
    tmpDir = new File(tmpRoot, DeploymentRolloutFailureTestCase.class.getSimpleName() + System.currentTimeMillis());
    Files.createDirectory(tmpDir.toPath());
    deployment = new File(tmpDir, BROKEN_DEPLOYMENT);
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, BROKEN_DEPLOYMENT);
    archive.addClass(ServiceActivatorDeployment.class);
    archive.addAsServiceProvider(ServiceActivator.class, ServiceActivatorDeployment.class);
    archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc\n"), "MANIFEST.MF");
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            new PropertyPermission("test.deployment.broken.fail", "read")),
            "permissions.xml");
    archive.as(ZipExporter.class).exportTo(deployment);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:DeploymentRolloutFailureTestCase.java

示例6: createDeployment

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private File createDeployment(Class<? extends ServiceActivator> clazz) throws Exception{
    File tmpRoot = new File(System.getProperty("java.io.tmpdir"));
    File tmpDir = new File(tmpRoot, this.getClass().getSimpleName() + System.currentTimeMillis());
    Files.createDirectory(tmpDir.toPath());
    tmpDirs.add(tmpDir);
    String deploymentName = DEPLOYMENT_NAME;
    File deployment = new File(tmpDir, deploymentName);
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, deploymentName);
    archive.addClasses(clazz, ServiceActivatorBaseDeployment.class);
    archive.addAsServiceProvider(ServiceActivator.class, clazz);
    archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc\n"), "MANIFEST.MF");
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            new PropertyPermission("test.deployment.broken.fail", "read"),
            new PropertyPermission("test.deployment.prop.one", "write"),
            new PropertyPermission("test.deployment.prop.two", "write"),
            new PropertyPermission("test.deployment.prop.three", "write"),
            new PropertyPermission("test.deployment.prop.four", "write"),
            new PropertyPermission("test.overlay.prop.one", "write"),
            new PropertyPermission("test.overlay.prop.two", "write"),
            new PropertyPermission("test.overlay.prop.three", "write"),
            new PropertyPermission("test.overlay.prop.four", "write")
    ), "permissions.xml");
    archive.as(ZipExporter.class).exportTo(deployment);
    return deployment;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:DeploymentOverlayScenario.java

示例7: deployToAffectedServerGroup

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private void deployToAffectedServerGroup(DomainClient masterClient, Class<? extends ServiceActivator> clazz) throws Exception {
    File deployment = createDeployment(clazz);

    ModelNode composite = createEmptyOperation(COMPOSITE, PathAddress.EMPTY_ADDRESS);
    ModelNode steps = composite.get(STEPS);
    ModelNode step1 = steps.add();
    step1.set(createAddOperation(PathAddress.pathAddress(DEPLOYMENT, deployment.getName())));
    String url = deployment.toURI().toURL().toString();
    ModelNode content = new ModelNode();
    content.get("url").set(url);
    step1.get(CONTENT).add(content);
    ModelNode sg = steps.add();
    sg.set(createAddOperation(
            PathAddress.pathAddress(SERVER_GROUP, "overlay-group-affected").append(DEPLOYMENT, deployment.getName())));
    sg.get(ENABLED).set(true);
    DomainTestUtils.executeForResult(composite, masterClient);
    deployed = true;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:DeploymentOverlayScenario.java

示例8: createDeployment

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private File createDeployment(Class<? extends ServiceActivator> clazz, String qualifier) throws Exception{
    File tmpRoot = new File(System.getProperty("java.io.tmpdir"));
    File tmpDir = new File(tmpRoot, this.getClass().getSimpleName() + System.currentTimeMillis());
    Files.createDirectory(tmpDir.toPath());
    tmpDirs.add(tmpDir);
    String deploymentName = getDeploymentName(qualifier);
    File deployment = new File(tmpDir, deploymentName);
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, deploymentName);
    archive.addClasses(clazz, ServiceActivatorBaseDeployment.class);
    archive.addAsServiceProvider(ServiceActivator.class, clazz);
    archive.addAsManifestResource(new StringAsset("Dependencies: org.jboss.msc\n"), "MANIFEST.MF");
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            new PropertyPermission("test.deployment.broken.fail", "read"),
            new PropertyPermission("test.deployment.prop.one", "write"),
            new PropertyPermission("test.deployment.prop.two", "write"),
            new PropertyPermission("test.deployment.prop.three", "write"),
            new PropertyPermission("test.deployment.prop.four", "write")
    ), "permissions.xml");
    archive.as(ZipExporter.class).exportTo(deployment);
    return deployment;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:22,代码来源:DeploymentScenario.java

示例9: deployToAffectedServerGroup

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private void deployToAffectedServerGroup(DomainClient masterClient, Class<? extends ServiceActivator> clazz,
                                         String qualifier) throws Exception {
    File deployment = createDeployment(clazz, qualifier);

    ModelNode composite = createEmptyOperation(COMPOSITE, PathAddress.EMPTY_ADDRESS);
    ModelNode steps = composite.get(STEPS);
    ModelNode step1 = steps.add();
    step1.set(createAddOperation(PathAddress.pathAddress(DEPLOYMENT, deployment.getName())));
    String url = deployment.toURI().toURL().toString();
    ModelNode content = new ModelNode();
    content.get("url").set(url);
    step1.get(CONTENT).add(content);
    ModelNode sg = steps.add();
    sg.set(createAddOperation(
            PathAddress.pathAddress(SERVER_GROUP, "deployment-group-affected").append(DEPLOYMENT, deployment.getName())));
    sg.get(ENABLED).set(true);
    DomainTestUtils.executeForResult(composite, masterClient);
    deployed.add(qualifier);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:DeploymentScenario.java

示例10: main

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
/**
 * The main method.
 *
 * @param args the command-line arguments
 */
public static void main(String[] args) {
    try {
        if (java.util.logging.LogManager.getLogManager().getClass().getName().equals("org.jboss.logmanager.LogManager")) {
            // Make sure our original stdio is properly captured.
            try {
                Class.forName(org.jboss.logmanager.handlers.ConsoleHandler.class.getName(), true, org.jboss.logmanager.handlers.ConsoleHandler.class.getClassLoader());
            } catch (Throwable ignored) {
            }
            // Install JBoss Stdio to avoid any nasty crosstalk, after command line arguments are processed.
            StdioContext.install();
            final StdioContext context = StdioContext.create(
                    new NullInputStream(),
                    new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stdout"), org.jboss.logmanager.Level.INFO),
                    new LoggingOutputStream(org.jboss.logmanager.Logger.getLogger("stderr"), org.jboss.logmanager.Level.ERROR)
            );
            StdioContext.setStdioContextSelector(new SimpleStdioContextSelector(context));
        }

        Module.registerURLStreamHandlerFactoryModule(Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.jboss.vfs")));
        ServerEnvironmentWrapper serverEnvironmentWrapper = determineEnvironment(args, WildFlySecurityManager.getSystemPropertiesPrivileged(),
                WildFlySecurityManager.getSystemEnvironmentPrivileged(), ServerEnvironment.LaunchType.STANDALONE,
                Module.getStartTime());
        if (serverEnvironmentWrapper.getServerEnvironment() == null) {
            if (serverEnvironmentWrapper.getServerEnvironmentStatus() == ServerEnvironmentWrapper.ServerEnvironmentStatus.ERROR) {
                abort(null);
            } else {
                SystemExiter.safeAbort();
            }
        } else {
            final Bootstrap bootstrap = Bootstrap.Factory.newInstance();
            final Bootstrap.Configuration configuration = new Bootstrap.Configuration(serverEnvironmentWrapper.getServerEnvironment());
            configuration.setModuleLoader(Module.getBootModuleLoader());
            bootstrap.bootstrap(configuration, Collections.<ServiceActivator>emptyList()).get();
            return;
        }
    } catch (Throwable t) {
        abort(t);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:45,代码来源:Main.java

示例11: createDeployment

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private static Archive<?> createDeployment() {
	WebArchive war = create(WebArchive.class, "singleton.war");
	war.addPackage(HAService.class.getPackage());
	war.setManifest(new StringAsset("Manifest-Version: 1.0\nDependencies: org.jboss.as.server\n"));
	war.addAsManifestResource(createPermissionsXmlAsset(new RuntimePermission("getClassLoader"), // See
																									// org.jboss.as.server.deployment.service.ServiceActivatorProcessor#deploy()
			new ServerPermission("useServiceRegistry"), // See
														// org.jboss.as.server.deployment.service.SecuredServiceRegistry
			new ServerPermission("getCurrentServiceContainer")), "permissions.xml");
	war.addAsServiceProvider(ServiceActivator.class, HAServiceActivator.class);
	return war;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:13,代码来源:SingletonServiceTestCase.java

示例12: createDeployment

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
private static Archive<?> createDeployment() {
	WebArchive war = create(WebArchive.class, "singleton.war");
	war.addPackage(HAService.class.getPackage());
	war.setManifest(new StringAsset("Manifest-Version: 1.0\nDependencies: org.jboss.as.server\n"));
	war.addAsServiceProvider(ServiceActivator.class, HAServicePolicyActivator.class);
	war.addAsManifestResource(createPermissionsXmlAsset(new RuntimePermission("getClassLoader"), // See
																									// org.jboss.as.server.deployment.service.ServiceActivatorProcessor#deploy()
			new ServerPermission("useServiceRegistry"), // See
														// org.jboss.as.server.deployment.service.SecuredServiceRegistry
			new ServerPermission("getCurrentServiceContainer")), "permissions.xml");
	return war;
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Java-EE-Development-with-WildFly,代码行数:13,代码来源:SingletonPolicyServiceTestCase.java

示例13: getServiceActivators

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@Override
public List<ServiceActivator> getServiceActivators(TopologyWebAppFraction fraction) {
    List<ServiceActivator> activators = new ArrayList<>();
    activators.add(new TopologyWebAppActivator(fraction.proxiedServiceMappings().keySet()));
    return activators;
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology,代码行数:7,代码来源:TopologyWebAppConfiguration.java

示例14: getServiceActivators

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@Override
public List<ServiceActivator> getServiceActivators(final CamelCoreFraction fraction) {
    List<ServiceActivator> activators = new ArrayList<>(super.getServiceActivators(fraction));
    activators.add(new ServiceActivator() {
        @Override
        public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
            BootstrapCamelContextService.addService(context.getServiceTarget(), fraction);
        }
    });
    return activators;
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-camel,代码行数:12,代码来源:CamelCoreConfiguration.java

示例15: getServiceActivators

import org.jboss.msc.service.ServiceActivator; //导入依赖的package包/类
@Override
public List<ServiceActivator> getServiceActivators(ConsulTopologyFraction fraction) {
    List<ServiceActivator> activators = new ArrayList<>();
    activators.add(new AgentActivator(fraction.url()));
    activators.add(new ConsulTopologyConnectorActivator());
    return activators;
}
 
开发者ID:wildfly-swarm-archive,项目名称:wildfly-swarm-topology-consul,代码行数:8,代码来源:ConsulTopologyConfiguration.java


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