本文整理汇总了Java中org.jboss.as.server.deployment.DeploymentUnit.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java DeploymentUnit.getParent方法的具体用法?Java DeploymentUnit.getParent怎么用?Java DeploymentUnit.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.server.deployment.DeploymentUnit
的用法示例。
在下文中一共展示了DeploymentUnit.getParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!SwitchYardDeploymentMarker.isSwitchYardDeployment(deploymentUnit)) {
return;
}
final DeploymentUnit parent = deploymentUnit.getParent();
Boolean initializeInOrder = false;
if (parent != null) {
final EarMetaData earConfig = deploymentUnit.getParent().getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
if (earConfig != null) {
initializeInOrder = earConfig.getInitializeInOrder();
}
}
doDeploy(phaseContext, deploymentUnit, initializeInOrder);
}
示例2: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (!SwitchYardDeploymentMarker.isSwitchYardDeployment(deploymentUnit)) {
return;
}
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
// Add the Weld portable extension
final DeploymentUnit parent = deploymentUnit.getParent() == null ? deploymentUnit : deploymentUnit.getParent();
synchronized (parent) {
checkExtension(SWITCHYARD_CDI_EXTENSION, deploymentUnit, parent);
checkExtension(DELTASPIKE_CDI_EXTENSION, deploymentUnit, parent);
}
} else {
_logger.debug("SwitchYard Application for deployment unit '" + deploymentUnit.getName() + "' does not appear to contain CDI Beans "
+ "(no META-INF/beans.xml file in unit). Not attaching SwitchYard CDI Discovery Extension to deployment.");
}
}
示例3: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.hasAttachment(DeploymentDependencies.ATTACHMENT_KEY)) {
if (deploymentUnit.getParent() != null) {
ServerLogger.DEPLOYMENT_LOGGER.deploymentDependenciesAreATopLevelElement(deploymentUnit.getName());
} else {
processDependencies(phaseContext, deploymentUnit);
}
}
if (deploymentUnit.getParent() != null) {
DeploymentUnit parent = deploymentUnit.getParent();
if (parent.hasAttachment(DeploymentDependencies.ATTACHMENT_KEY)) {
processDependencies(phaseContext, parent);
}
}
}
示例4: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
String deploymentName = deploymentUnit.getName();
if (deploymentUnit.getParent() != null) {
deploymentName = deploymentUnit.getParent().getName();
}
if (deploymentName.equals(filename)) {
long before = System.currentTimeMillis();
try {
processAnnotationIndex(deploymentUnit);
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
long duration = System.currentTimeMillis() - before;
DbBootstrapLogger.ROOT_LOGGER.infof("Database bootstrapping took [%s] ms", duration);
} else {
DbBootstrapLogger.ROOT_LOGGER.tracef("%s did not match %s", filename, deploymentName);
}
}
示例5: savePerDeploymentModuleName
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
private void savePerDeploymentModuleName(DeploymentUnit deploymentUnit, String module, String vendorKey) {
if (deploymentUnit.getParent() != null) {
deploymentUnit = deploymentUnit.getParent();
}
synchronized (deploymentUnit) {
Map currentValue = deploymentUnit.getAttachment(perModuleNameKey);
// setup up Map<vendorKey, driver module name) that ensures that only one driver
// module per vendor type, is used by deployments.
// It is legal for deployments to use one MongoDB driver module and one Cassandra driver Module.
// It is illegal for deployments to use two different MongoDB driver modules.
if (currentValue == null) {
currentValue = new HashMap();
deploymentUnit.putAttachment(perModuleNameKey, currentValue);
}
// check if there are two different NoSQL driver modules being used for the same NoSQL backend vendor
if (currentValue.get(vendorKey) != null && !currentValue.get(vendorKey).equals(module)) {
// deployment is using two different MongoDB (or whichever database type) driver modules, fail deployment.
throw ROOT_LOGGER.cannotAddReferenceToModule(module, currentValue.get(vendorKey), deploymentUnit.getName());
}
currentValue.put(vendorKey, module);
}
// register CDI extensions for each NoSQL driver that is used by deployment
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
mongoSetup(deploymentUnit, moduleLoader, module);
cassandraSetup(deploymentUnit, moduleLoader, module);
neo4jSetup(deploymentUnit, moduleLoader, module);
orientSetup(deploymentUnit, moduleLoader, module);
}
示例6: getPerDeploymentDeploymentModuleName
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
protected static Map<String,String> getPerDeploymentDeploymentModuleName(DeploymentUnit deploymentUnit) {
if (deploymentUnit.getParent() != null) {
deploymentUnit = deploymentUnit.getParent();
}
synchronized (deploymentUnit) {
return deploymentUnit.getAttachment(perModuleNameKey);
}
}
示例7: mongoSetup
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的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);
}
}
示例8: orientSetup
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的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);
}
}
示例9: neo4jSetup
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的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);
}
}
示例10: cassandraSetup
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的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);
}
}
示例11: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (deploymentUnit.getParent() != null) {
return;
}
final List<DeploymentUnit> deploymentUnits = new ArrayList<DeploymentUnit>();
deploymentUnits.add(deploymentUnit);
deploymentUnits.addAll(deploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS));
for (DeploymentUnit unit : deploymentUnits) {
final ResourceRoot mainRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (mainRoot == null)
continue;
VirtualFile root = mainRoot.getRoot();
for (String path : SEAM_FILES) {
if (root.getChild(path).exists()) {
final ModuleSpecification moduleSpecification = deploymentUnit
.getAttachment(Attachments.MODULE_SPECIFICATION);
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, VFS_MODULE, false, false, false,
false)); // for VFS scanner
try {
ResourceLoader resourceLoader = ResourceLoaders.createJarResourceLoader(SEAM_INT_JAR, new JarFile(
getSeamIntResourceRoot().getRoot().getPathName()));
moduleSpecification.addResourceLoader(ResourceLoaderSpec.createResourceLoaderSpec(resourceLoader));
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
unit.addToAttachmentList(Attachments.RESOURCE_ROOTS, getSeamIntResourceRoot());
return;
}
}
}
}
示例12: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
// we only want to process top level jar deployments
if (deploymentUnit.getParent() != null) {
return;
}
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (!deploymentRoot.getRoot().getName().endsWith(".jar")) {
return;
}
// we are only interested in the root manifest
// there should not be any additional resource roots for this type of deployment anyway
final Manifest manifest = deploymentRoot.getAttachment(Attachments.MANIFEST);
if (manifest == null) {
return;
}
final Attributes mainAttributes = manifest.getMainAttributes();
final String extensionName = mainAttributes.getValue(EXTENSION_NAME);
ServerLogger.DEPLOYMENT_LOGGER.debugf("Found Extension-Name manifest entry %s in %s", extensionName, deploymentRoot.getRoot().getPathName());
if (extensionName == null) {
// no entry
return;
}
final String implVersion = mainAttributes.getValue(IMPLEMENTATION_VERSION);
final String implVendorId = mainAttributes.getValue(IMPLEMENTATION_VENDOR_ID);
final String specVersion = mainAttributes.getValue(SPECIFICATION_VERSION);
final ExtensionInfo info = new ExtensionInfo(extensionName, specVersion, implVersion, implVendorId);
deploymentUnit.putAttachment(Attachments.EXTENSION_INFORMATION, info);
phaseContext.addToAttachmentList(Attachments.NEXT_PHASE_DEPS, Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX);
}
示例13: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
/**
* Process the deployment root for module dependency information.
*
* @param phaseContext the deployment unit context
* @throws DeploymentUnitProcessingException
*/
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpecification.addUserDependencies(deploymentUnit.getAttachmentList(Attachments.MANIFEST_DEPENDENCIES));
if (deploymentUnit.getParent() != null) {
// propagate parent manifest dependencies
final List<ModuleDependency> parentDependencies = deploymentUnit.getParent().getAttachmentList(Attachments.MANIFEST_DEPENDENCIES);
moduleSpecification.addUserDependencies(parentDependencies);
}
}
示例14: deploy
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final DeploymentUnit parent = deploymentUnit.getParent();
final DeploymentUnit topLevelDeployment = parent == null ? deploymentUnit : parent;
final VirtualFile toplevelRoot = topLevelDeployment.getAttachment(Attachments.DEPLOYMENT_ROOT).getRoot();
final ModuleIdentifier moduleIdentifier = createModuleIdentifier(deploymentUnit.getName(), deploymentRoot, topLevelDeployment, toplevelRoot, deploymentUnit.getParent() == null);
deploymentUnit.putAttachment(Attachments.MODULE_IDENTIFIER, moduleIdentifier);
}
示例15: createDeploymentUnitName
import org.jboss.as.server.deployment.DeploymentUnit; //导入方法依赖的package包/类
private static String createDeploymentUnitName(DeploymentUnit depUnit) {
String depUnitName = depUnit.getName();
DeploymentUnit parent;
if((parent = depUnit.getParent()) != null) {
depUnitName = parent.getName() + "." + depUnitName;
}
return depUnitName;
}