本文整理汇总了Java中org.jboss.modules.ModuleIdentifier.create方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleIdentifier.create方法的具体用法?Java ModuleIdentifier.create怎么用?Java ModuleIdentifier.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.modules.ModuleIdentifier
的用法示例。
在下文中一共展示了ModuleIdentifier.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: execute
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
ModelNode model = new ModelNode();
populateModel(operation, model);
String moduleName = MODULE_NAME.resolveModelAttribute(context, model).asString();
String slot = MODULE_SLOT.resolveModelAttribute(context, model).asString();
ModuleIdentifier id = ModuleIdentifier.create(moduleName, slot);
ModuleLoader loader = Module.getBootModuleLoader();
try {
ModuleLoaderMXBean mxBean = getMxBean(loader);
ModuleInfo moduleInfo = mxBean.getModuleDescription(id.toString());
context.getResult().set(populateModuleInfo(moduleInfo));
} catch (Exception e) {
throw ServerLogger.ROOT_LOGGER.couldNotGetModuleInfo(id.toString(), e);
}
}
示例3: start
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
@Override
public synchronized void start(StartContext context) throws StartException {
try {
this.jarFile = new JarFile(file);
} catch (IOException e) {
throw new StartException(e);
}
final ModuleSpec.Builder specBuilder = ModuleSpec.build(moduleIdentifier);
addResourceRoot(specBuilder, jarFile);
//TODO: We need some way of configuring module dependencies for external archives
ModuleIdentifier javaee = ModuleIdentifier.create("javaee.api");
specBuilder.addDependency(DependencySpec.createModuleDependencySpec(javaee));
specBuilder.addDependency(DependencySpec.createLocalDependencySpec());
// TODO: external resource need some kind of dependency mechanism
ModuleSpec moduleSpec = specBuilder.create();
this.moduleDefinition = new ModuleDefinition(moduleIdentifier, Collections.<ModuleDependency>emptySet(), moduleSpec);
ServiceModuleLoader.installModuleResolvedService(context.getChildTarget(), moduleIdentifier);
}
示例4: moduleIdentifier
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
public static ModuleIdentifier moduleIdentifier(final String name, final String minSpecVersion,
final String minImplVersion, final String requiredVendorId) {
StringBuilder nameBuilder = new StringBuilder();
nameBuilder.append(MODULE_PREFIX);
nameBuilder.append(name);
if (minSpecVersion != null) {
nameBuilder.append(".spec-");
nameBuilder.append(minSpecVersion);
}
if (minImplVersion != null) {
nameBuilder.append(".impl-");
nameBuilder.append(minImplVersion);
}
if (requiredVendorId != null) {
nameBuilder.append(".vendor-");
nameBuilder.append(requiredVendorId);
}
return ModuleIdentifier.create(nameBuilder.toString());
}
示例5: addMongoCDIDependency
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void addMongoCDIDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
try {
moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.MONGOCLIENTCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a MongoDB module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a MongoDB driver
ModuleIdentifier mongoCDIExtensionModule = ModuleIdentifier.create(NoSQLConstants.MONGOCDIEXTENSIONMODULE);
addDependency(moduleSpecification, moduleLoader, mongoCDIExtensionModule);
}
示例6: addNeo4jCDIDependency
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void addNeo4jCDIDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
try {
moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.NEO4JDRIVERCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a Neo4j module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a Neo4j driver
ModuleIdentifier mongoCDIExtensionModule = ModuleIdentifier.create(NoSQLConstants.NEO4JCDIEXTENSIONMODULE);
addDependency(moduleSpecification, moduleLoader, mongoCDIExtensionModule);
}
示例7: addCassandraCDIDependency
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void addCassandraCDIDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
try {
moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.CASSANDRACLUSTERCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a Cassandra module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a Cassandra driver
ModuleIdentifier mongoCDIExtensionModule = ModuleIdentifier.create(NoSQLConstants.CASSANDRACDIEXTENSIONMODULE);
addDependency(moduleSpecification, moduleLoader, mongoCDIExtensionModule);
}
示例8: addOrientCDIDependency
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void addOrientCDIDependency(ModuleSpecification moduleSpecification, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
try {
moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.ORIENTDBPARTIONEDDBPOOLCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a OrientDB module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a OrientDB driver
ModuleIdentifier mongoCDIExtensionModule = ModuleIdentifier.create(NoSQLConstants.ORIENTDBCDIEXTENSIONMODULE);
addDependency(moduleSpecification, moduleLoader, mongoCDIExtensionModule);
}
示例9: mongoSetup
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void mongoSetup(DeploymentUnit deploymentUnit, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
Class mongoClientClass, mongoDatabaseClass;
MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
try {
mongoClientClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.MONGOCLIENTCLASS);
mongoDatabaseClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.MONGODATABASECLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a MongoDB module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a MongoDB driver
try {
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
ModuleIdentifier mongoCDIExtensionModule = ModuleIdentifier.create(NoSQLConstants.MONGOCDIEXTENSIONMODULE);
methodHandleBuilder.classLoader(mongoCDIExtensionModule);
methodHandleBuilder.className(NoSQLConstants.MONGOCDIEXTENSIONCLASS);
MethodHandle extensionCtor = methodHandleBuilder.constructor(MethodType.methodType(void.class, Class.class, Class.class));
Extension extension = (Extension) extensionCtor.invoke(mongoClientClass, mongoDatabaseClass);
extensions.registerExtensionInstance(extension, parent);
}
} catch (Throwable throwable) {
throw new RuntimeException("unexpected error constructing " + methodHandleBuilder.getTargetClass().getName(), throwable);
}
}
示例10: orientSetup
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void orientSetup(DeploymentUnit deploymentUnit, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
Class oPartitionedDatabasePoolClass;
MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
try {
oPartitionedDatabasePoolClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.ORIENTDBPARTIONEDDBPOOLCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a OrientDB module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a Orient driver
try {
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
ModuleIdentifier cdiExtensionModule = ModuleIdentifier.create(NoSQLConstants.ORIENTDBCDIEXTENSIONMODULE);
methodHandleBuilder.classLoader(cdiExtensionModule);
methodHandleBuilder.className(NoSQLConstants.ORIENTCDIEXTENSIONCLASS);
MethodHandle extensionCtor = methodHandleBuilder.constructor(MethodType.methodType(void.class, Class.class));
Extension extension = (Extension) extensionCtor.invoke(oPartitionedDatabasePoolClass);
extensions.registerExtensionInstance(extension, parent);
}
} catch (Throwable throwable) {
throw new RuntimeException("unexpected error constructing " + methodHandleBuilder.getTargetClass().getName(), throwable);
}
}
示例11: neo4jSetup
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void neo4jSetup(DeploymentUnit deploymentUnit, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
Class driverClass;
MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
try {
driverClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.NEO4JDRIVERCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a Neo4j module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a Neo4j driver
try {
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
ModuleIdentifier cdiExtensionModule = ModuleIdentifier.create(NoSQLConstants.NEO4JCDIEXTENSIONMODULE);
methodHandleBuilder.classLoader(cdiExtensionModule);
methodHandleBuilder.className(NoSQLConstants.NEO4JCDIEXTENSIONCLASS);
MethodHandle extensionCtor = methodHandleBuilder.constructor(MethodType.methodType(void.class, Class.class));
Extension extension = (Extension) extensionCtor.invoke(driverClass);
extensions.registerExtensionInstance(extension, parent);
}
} catch (Throwable throwable) {
throw new RuntimeException("unexpected error constructing " + methodHandleBuilder.getTargetClass().getName(), throwable);
}
}
示例12: cassandraSetup
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private void cassandraSetup(DeploymentUnit deploymentUnit, ModuleLoader moduleLoader, String nosqlDriverModuleName) {
Class clusterClass;
Class sessionClass;
MethodHandleBuilder methodHandleBuilder = new MethodHandleBuilder();
try {
clusterClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.CASSANDRACLUSTERCLASS);
sessionClass = moduleLoader.loadModule(ModuleIdentifier.fromString(nosqlDriverModuleName)).getClassLoader().loadClass(NoSQLConstants.CASSANDRASESSIONCLASS);
} catch (ClassNotFoundException expected) {
// ignore CNFE which just means that module is not a Cassandra module
return;
} catch (ModuleLoadException e) {
throw new RuntimeException("could not load NoSQL driver module " + nosqlDriverModuleName, e);
}
// only reach this point if module is a Cassandra driver
try {
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
WeldPortableExtensions extensions = WeldPortableExtensions.getPortableExtensions(parent);
ModuleIdentifier cdiExtensionModule = ModuleIdentifier.create(NoSQLConstants.CASSANDRACDIEXTENSIONMODULE);
methodHandleBuilder.classLoader(cdiExtensionModule);
methodHandleBuilder.className(NoSQLConstants.CASSANDRACDIEXTENSIONCLASS);
MethodHandle extensionCtor = methodHandleBuilder.constructor(MethodType.methodType(void.class, Class.class, Class.class));
Extension extension = (Extension) extensionCtor.invoke(clusterClass, sessionClass);
extensions.registerExtensionInstance(extension, parent);
}
} catch (Throwable throwable) {
throw new RuntimeException("unexpected error constructing " + methodHandleBuilder.getTargetClass().getName(), throwable);
}
}
示例13: setupVfsModule
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private static void setupVfsModule(final ModuleLoader moduleLoader) {
final ModuleIdentifier vfsModuleID = ModuleIdentifier.create(MODULE_ID_VFS);
final Module vfsModule;
try {
vfsModule = moduleLoader.loadModule(vfsModuleID);
} catch (final ModuleLoadException mle) {
throw EmbeddedLogger.ROOT_LOGGER.moduleLoaderError(mle,MODULE_ID_VFS, moduleLoader);
}
Module.registerURLStreamHandlerFactoryModule(vfsModule);
}
示例14: createAdditionalModule
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
private ModuleIdentifier createAdditionalModule(final ResourceRoot resourceRoot, final DeploymentUnit topLevelDeployment, final VirtualFile topLevelRoot, final Map<VirtualFile, AdditionalModuleSpecification> additionalModules, final VirtualFile classPathFile, final ArrayDeque<RootEntry> resourceRoots) throws DeploymentUnitProcessingException {
final ResourceRoot root = createResourceRoot(classPathFile, topLevelDeployment, topLevelRoot);
final String pathName = root.getRoot().getPathNameRelativeTo(topLevelRoot);
ModuleIdentifier identifier = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + topLevelDeployment.getName() + "." + pathName);
AdditionalModuleSpecification module = new AdditionalModuleSpecification(identifier, root);
topLevelDeployment.addToAttachmentList(Attachments.ADDITIONAL_MODULES, module);
additionalModules.put(classPathFile, module);
resourceRoot.addToAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS, root);
//add this to the list of roots to be processed, so transitive class path entries will be respected
resourceRoots.add(new RootEntry(module, root));
return identifier;
}
示例15: createModuleIdentifier
import org.jboss.modules.ModuleIdentifier; //导入方法依赖的package包/类
public static ModuleIdentifier createModuleIdentifier(final String deploymentUnitName, final ResourceRoot deploymentRoot, final DeploymentUnit topLevelDeployment, final VirtualFile toplevelRoot, final boolean topLevel) {
// generate the module identifier for the deployment
final ModuleIdentifier moduleIdentifier;
if (topLevel) {
moduleIdentifier = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + deploymentUnitName);
} else {
String relativePath = deploymentRoot.getRoot().getPathNameRelativeTo(toplevelRoot);
moduleIdentifier = ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + topLevelDeployment.getName() + '.' + relativePath.replace('/', '.'));
}
return moduleIdentifier;
}