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


Java ModuleIdentifier类代码示例

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


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

示例1: Neo4jInteraction

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
public Neo4jInteraction(ConfigurationBuilder configurationBuilder) {
    MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
    // specify NoSQL driver classloader
    methodHandleBuilder.classLoader(ModuleIdentifier.fromString(configurationBuilder.getModuleName()));

    // auth handling
    Class authTokenClass = methodHandleBuilder.className(NoSQLConstants.NEO4JAUTHTOKENCLASS).getTargetClass();
    methodHandleBuilder.className(NoSQLConstants.NEO4JAUTHTOKENSCLASS).getTargetClass();
    basicAuthMethod = methodHandleBuilder.staticMethod( "basic", MethodType.methodType(authTokenClass, String.class,String.class));

    driverClass = methodHandleBuilder.className(NoSQLConstants.NEO4JDRIVERCLASS).getTargetClass();
    closeDriverMethod = methodHandleBuilder.method("close");
    methodHandleBuilder.className(NoSQLConstants.NEO4JGRAPHDATABASECLASS);
    buildMethod = methodHandleBuilder.staticMethod("driver", MethodType.methodType(driverClass, String.class));
    // builder with auth
    buildWithAuthMethod = methodHandleBuilder.staticMethod("driver", MethodType.methodType(driverClass, String.class, authTokenClass));
    securityDomain = configurationBuilder.getSecurityDomain();
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:19,代码来源:Neo4jInteraction.java

示例2: OrientInteraction

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
public OrientInteraction(Configuration configuration) {
    this.configuration = configuration;
    MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
    // specify NoSQL driver classloader
    methodHandleBuilder.classLoader(ModuleIdentifier.fromString(configuration.getModuleName()));
    oPartitionedDatabasePool = methodHandleBuilder.className(NoSQLConstants.ORIENTDBPARTIONEDDBPOOLCLASS).getTargetClass();
    // OPartitionedDatabasePool(String url, String userName, String password, int maxPartitionSize, int maxPoolSize)
    oPartitionedDatabasePoolCtorMethod = methodHandleBuilder.declaredConstructor(
            String.class, String.class, String.class, int.class, int.class);
    oPartitionedDatabasePoolDefaultSizeCtorMethod = methodHandleBuilder.declaredConstructor(
                    String.class, String.class, String.class);
    oPartitionedDatabasePoolCloseMethod = methodHandleBuilder.method("close");
    methodHandleBuilder.className(NoSQLConstants.ORIENTDBDATABASERECORDTHREADLOCALCLASS);
    MethodHandle oDatabaseRecordThreadLocalInstanceField = methodHandleBuilder.staticField("INSTANCE");
    MethodHandle isDefinedMethod = methodHandleBuilder.method("isDefined");
    try {
        // call ODatabaseRecordThreadLocal.INSTANCE.isDefined(), which seems to be a bug. Needs call on INSTANCE to work later.
        // TODO: does this leak anything on the deployment thread?
        isDefinedMethod.invoke(oDatabaseRecordThreadLocalInstanceField.invoke());
    } catch (Throwable throwable) {
        throw new RuntimeException("could not reference " +methodHandleBuilder.getTargetClass().getName() + " INSTANCE field", throwable);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:24,代码来源:OrientInteraction.java

示例3: CassandraInteraction

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
public CassandraInteraction(ConfigurationBuilder configurationBuilder) {
    MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
    methodHandleBuilder.classLoader(ModuleIdentifier.fromString(configurationBuilder.getModuleName()));
    clusterBuilderClass = methodHandleBuilder.className(NoSQLConstants.CASSANDRACLUSTERBUILDERCLASS).getTargetClass();
    builderBuildMethod = methodHandleBuilder.method("build");
    builderWithClusterNameMethod = methodHandleBuilder.method("withClusterName", String.class);
    builderWithCredentials = methodHandleBuilder.method("withCredentials", String.class, String.class);
    builderWithPortMethod = methodHandleBuilder.method("withPort", int.class);
    builderAddContactPointMethod = methodHandleBuilder.method("addContactPoint", String.class);
    builderwithSSLMethod = methodHandleBuilder.method("withSSL");

    clusterClass = methodHandleBuilder.className(NoSQLConstants.CASSANDRACLUSTERCLASS).getTargetClass();
    clusterConnectMethod = methodHandleBuilder.method("connect", String.class);
    clusterCloseMethod = methodHandleBuilder.method("close");
    clusterBuilderMethod = methodHandleBuilder.staticMethod("builder", MethodType.methodType(clusterBuilderClass));
    sessionClass = methodHandleBuilder.className(NoSQLConstants.CASSANDRASESSIONCLASS).getTargetClass();
    sessionCloseMethod = methodHandleBuilder.method("close");
    securityDomain = configurationBuilder.getSecurityDomain();
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:20,代码来源:CassandraInteraction.java

示例4: deploy

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
/**
 * Add dependencies for modules required for NoSQL deployments
 */
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
    final Map<String, String> nosqlDriverModuleNameMap = DriverScanDependencyProcessor.getPerDeploymentDeploymentModuleName(deploymentUnit);
    if (nosqlDriverModuleNameMap == null) {
        return;
    }
    for (String nosqlDriverModuleName : nosqlDriverModuleNameMap.values()) {
        if (nosqlDriverModuleName != null) {
            final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
            final ModuleLoader moduleLoader = Module.getBootModuleLoader();
            addDependency(moduleSpecification, moduleLoader, ModuleIdentifier.fromString(nosqlDriverModuleName));
            addMongoCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addCassandraCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addNeo4jCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
            addOrientCDIDependency(moduleSpecification, moduleLoader, nosqlDriverModuleName);
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-nosql,代码行数:22,代码来源:DriverDependencyProcessor.java

示例5: start

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    try {
        final String artifactName = System.getProperty(BootstrapProperties.APP_ARTIFACT);
        if (artifactName == null) {
            throw new StartException("Failed to find artifact name under " + BootstrapProperties.APP_ARTIFACT);
        }

        final ModuleLoader serviceLoader = this.serviceLoader.getValue();
        final String moduleName = "deployment." + artifactName;
        final Module module = serviceLoader.loadModule(ModuleIdentifier.create(moduleName));
        if (module == null) {
            throw new StartException("Failed to find deployment module under " + moduleName);
        }

        //TODO: allow overriding the default port?
        this.server = Server.create("localhost", 12345, module.getClassLoader());
        this.server.start();
    } catch (ModuleLoadException | ServerLifecycleException e) {
        throw new StartException(e);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:23,代码来源:DaemonServiceActivator.java

示例6: main

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
/**
 * Main entry-point.
 *
 * @param args Ignored.
 * @throws Exception if an error occurs.
 */
public static void main(String... args) throws Exception {
    if (System.getProperty("boot.module.loader") == null) {
        System.setProperty("boot.module.loader", "org.wildfly.swarm.bootstrap.modules.BootModuleLoader");
    }
    Module bootstrap = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application"));

    ServiceLoader<ContainerFactory> factory = bootstrap.loadService(ContainerFactory.class);
    Iterator<ContainerFactory> factoryIter = factory.iterator();

    if (!factoryIter.hasNext()) {
        simpleMain(args);
    } else {
        factoryMain(factoryIter.next(), args);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:22,代码来源:Swarm.java

示例7: createShrinkWrapDomain

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
private void createShrinkWrapDomain() throws ModuleLoadException {
    ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
    try {
        if (isFatJar()) {
            Thread.currentThread().setContextClassLoader(Container.class.getClassLoader());
            Module appModule = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("swarm.application"));
            Thread.currentThread().setContextClassLoader(appModule.getClassLoader());
        }
        this.domain = ShrinkWrap.getDefaultDomain();
        this.domain.getConfiguration().getExtensionLoader().addOverride(ZipExporter.class, ZipExporterImpl.class);
        this.domain.getConfiguration().getExtensionLoader().addOverride(JavaArchive.class, JavaArchiveImpl.class);
        this.domain.getConfiguration().getExtensionLoader().addOverride(WebArchive.class, WebArchiveImpl.class);
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        Thread.currentThread().setContextClassLoader(originalCl);
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:19,代码来源:Container.java

示例8: createServer

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
private void createServer(boolean debugBootstrap, URL xmlConfig) throws Exception {
    if (System.getProperty("boot.module.loader") == null) {
        System.setProperty("boot.module.loader", BootModuleLoader.class.getName());
    }
    if (debugBootstrap) {
        Module.setModuleLogger(new StreamModuleLogger(System.err));
    }
    Module module = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.wildfly.swarm.container", "runtime"));
    Class<?> serverClass = module.getClassLoader().loadClass("org.wildfly.swarm.container.runtime.RuntimeServer");
    try {
        this.server = (Server) serverClass.newInstance();
        if (this.xmlConfig != null)
            this.server.setXmlConfig(this.xmlConfig);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:18,代码来源:Container.java

示例9: RuntimeServer

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
@SuppressWarnings("unused")
public RuntimeServer() {
    try {
        Module loggingModule = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.wildfly.swarm.logging", "runtime"));

        ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(loggingModule.getClassLoader());
            System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
            System.setProperty("org.jboss.logmanager.configurator", LoggingConfigurator.class.getName());
            //force logging init
            LogManager.getLogManager();
            BootstrapLogger.setBackingLoggerManager(new JBossLoggingManager());
        } finally {
            Thread.currentThread().setContextClassLoader(originalCl);
        }
    } catch (ModuleLoadException e) {
        System.err.println("[WARN] logging not available, logging will not be configured");
    }
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:21,代码来源:RuntimeServer.java

示例10: toResponse

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
public Response toResponse(NotFoundException e) {
    if (e.getMessage().contains("favicon.ico")) {
        try {
            Module module = Module.getBootModuleLoader().loadModule(ModuleIdentifier.create("org.wildfly.swarm.undertow", "runtime"));
            ClassLoader cl = module.getClassLoader();
            final InputStream in = cl.getResourceAsStream("favicon.ico");
            if (in != null) {
                Response.ResponseBuilder builder = Response.ok();
                builder.entity(in);
                return builder.build();
            }
        } catch (ModuleLoadException e1) {
            throw e;
        }
    }

    // can't handle it, rethrow.
    throw e;
}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:20,代码来源:FaviconHandler.java

示例11: createFromModule

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
static ServerConnection createFromModule(Properties info)
		throws ConnectionException, TeiidException {
	ClassLoader tccl = Thread.currentThread().getContextClassLoader();
       try {
       	ModuleLoader callerModuleLoader = Module.getCallerModuleLoader();
       	if (callerModuleLoader == null) {
       		throw new ConnectionException(JDBCPlugin.Event.TEIID20033, null, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID20033));
       	}
		final Module module = callerModuleLoader.loadModule(ModuleIdentifier.create("org.jboss.teiid")); //$NON-NLS-1$
       	Thread.currentThread().setContextClassLoader(module.getClassLoader());
       	return (ServerConnection)ReflectionHelper.create("org.teiid.transport.LocalServerConnection", Arrays.asList(info, PropertiesUtils.getBooleanProperty(info, EmbeddedProfile.USE_CALLING_THREAD, true)), Thread.currentThread().getContextClassLoader()); //$NON-NLS-1$
       } catch (ModuleLoadException e) {
       	 throw new ConnectionException(JDBCPlugin.Event.TEIID20008, e, JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID20008));
	} finally {
       	Thread.currentThread().setContextClassLoader(tccl);
       }
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:18,代码来源:ModuleHelper.java

示例12: start

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
@Override
public void start(StartContext context) throws StartException {
    Class<?> componentClass;
    String className = _model.get(CommonAttributes.IMPLCLASS).asString();
    try {
        componentClass = Module.loadClassFromCallerModuleLoader(ModuleIdentifier.fromString(_moduleId), className);
        try {
            _component = (Component) componentClass.newInstance();
            ModelNode properties = _model.hasDefined(CommonAttributes.PROPERTIES) ? _model.get(CommonAttributes.PROPERTIES) : null;
            _component.init(createEnvironmentConfig(properties));
            LOG.debug("Initialized component " + _component);
            _component.addResourceDependency(_resourceAdapterRepository.getValue());
        } catch (InstantiationException ie) {
            ExtensionLogger.ROOT_LOGGER.unableToInstantiateClass(className, ie);
        } catch (IllegalAccessException iae) {
            ExtensionLogger.ROOT_LOGGER.unableToAccessConstructor(className, iae);
        }
    } catch (ClassNotFoundException cnfe) {
        ExtensionLogger.ROOT_LOGGER.unableToLoadClass(className, cnfe);
    } catch (ModuleLoadException mle) {
        ExtensionLogger.ROOT_LOGGER.unableToLoadModule(_moduleId, mle);
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:24,代码来源:SwitchYardComponentService.java

示例13: loadClass

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
private static Class<?> loadClass(final String fqn, final String module) {
   try {
      Class<?> passwdClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
          @Override
          public Class<?> run() throws Exception {
              if (fqn == null || fqn.isEmpty()) {
                  throw PicketBoxMessages.MESSAGES.loadingNullorEmptyClass();
              } else if (module == null ) {
                  ClassLoader cl = Thread.currentThread().getContextClassLoader();
                  return cl.loadClass(fqn);
              } else {
                  ModuleLoader loader = Module.getCallerModuleLoader();
                  final Module pwdClassModule = loader.loadModule(ModuleIdentifier.fromString(module));
                  return pwdClassModule.getClassLoader().loadClass(fqn);
              }
          }
      });
      return passwdClass;
  } catch (PrivilegedActionException e) {
      throw PicketBoxMessages.MESSAGES.unableToLoadPasswordClass(e.getCause(), fqn);
  }
}
 
开发者ID:picketbox,项目名称:picketbox,代码行数:23,代码来源:Util.java

示例14: setupLoggingSystem

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
private static void setupLoggingSystem(ModuleLoader moduleLoader) {
    final ModuleIdentifier logModuleId = ModuleIdentifier.create(MODULE_ID_LOGMANAGER);
    final Module logModule;
    try {
        logModule = moduleLoader.loadModule(logModuleId);
    } catch (final ModuleLoadException mle) {
        throw EmbeddedLogger.ROOT_LOGGER.moduleLoaderError(mle, MODULE_ID_LOGMANAGER, moduleLoader);
    }

    final ModuleClassLoader logModuleClassLoader = logModule.getClassLoader();
    final ClassLoader tccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
    try {
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(logModuleClassLoader);
        WildFlySecurityManager.setPropertyPrivileged(SYSPROP_KEY_LOGMANAGER, SYSPROP_VALUE_JBOSS_LOGMANAGER);

        final Class<?> actualLogManagerClass = LogManager.getLogManager().getClass();
        if (actualLogManagerClass == LogManager.class) {
            System.err.println("Cannot not load JBoss LogManager. The LogManager has likely been accessed prior to this initialization.");
        } else {
            Module.setModuleLogger(new JDKModuleLogger());
        }
    } finally {
        // Reset TCCL
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(tccl);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:27,代码来源:EmbeddedProcessFactory.java

示例15: installService

import org.jboss.modules.ModuleIdentifier; //导入依赖的package包/类
private static void installService(final ServiceTarget serviceTarget, final ModuleIdentifier moduleIdentifier, int phaseNumber, final Set<ModuleDependency> nextPhaseIdentifiers, final Set<ModuleIdentifier> nextAlreadySeen) {
    final ModuleResolvePhaseService nextPhaseService = new ModuleResolvePhaseService(moduleIdentifier, nextAlreadySeen, phaseNumber);
    ServiceBuilder<ModuleResolvePhaseService> builder = serviceTarget.addService(moduleSpecServiceName(moduleIdentifier, phaseNumber), nextPhaseService);
    for (ModuleDependency module : nextPhaseIdentifiers) {
        builder.addDependency(module.isOptional() ? OPTIONAL : REQUIRED, ServiceModuleLoader.moduleSpecServiceName(module.getIdentifier()), ModuleDefinition.class, new Injector<ModuleDefinition>() {

            ModuleDefinition definition;

            @Override
            public synchronized void inject(final ModuleDefinition o) throws InjectionException {
                nextPhaseService.getModuleSpecs().add(o);
                this.definition = o;
            }

            @Override
            public synchronized void uninject() {
                nextPhaseService.getModuleSpecs().remove(definition);
                this.definition = null;
            }
        });
    }
    builder.install();
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:ModuleResolvePhaseService.java


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