本文整理汇总了Java中org.jboss.as.server.deployment.module.ResourceRoot类的典型用法代码示例。如果您正苦于以下问题:Java ResourceRoot类的具体用法?Java ResourceRoot怎么用?Java ResourceRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceRoot类属于org.jboss.as.server.deployment.module包,在下文中一共展示了ResourceRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT) != null) {
return;
}
final String deploymentName = deploymentUnit.getName();
final VirtualFile deploymentContents = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_CONTENTS);
// internal deployments do not have any contents, so there is nothing to mount
if (deploymentContents == null)
return;
if (deploymentName.endsWith(DYNAMIC_VDB_STRUCTURE)) {
// use the contents directly
// nothing was mounted
final ResourceRoot resourceRoot = new ResourceRoot(deploymentContents, null);
ModuleRootMarker.mark(resourceRoot);
deploymentUnit.putAttachment(Attachments.DEPLOYMENT_ROOT, resourceRoot);
deploymentUnit.putAttachment(Attachments.MODULE_SPECIFICATION, new ModuleSpecification());
}
}
示例2: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if (TeiidAttachments.isTranslator(deploymentUnit)) {
return;
}
List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (ResourceRoot resourceRoot : resourceRoots) {
final VirtualFile deploymentRoot = resourceRoot.getRoot();
if (deploymentRoot.getChild("META-INF/services/org.teiid.translator.ExecutionFactory").exists()) { //$NON-NLS-1$
TeiidAttachments.setAsTranslatorDeployment(deploymentUnit);
//deploymentUnit.putAttachment(Attachments.IGNORE_OSGI, Boolean.TRUE);
break;
}
}
}
示例3: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public final void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
// If the log context is already defined, skip the rest of the processing
if (!hasRegisteredLogContext(deploymentUnit)) {
if (deploymentUnit.hasAttachment(Attachments.MODULE) && deploymentUnit.hasAttachment(Attachments.DEPLOYMENT_ROOT)) {
// don't process sub-deployments as they are processed by processing methods
final ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (SubDeploymentMarker.isSubDeployment(root)) return;
processDeployment(phaseContext, deploymentUnit, root);
// If we still don't have a context registered on the root deployment, register the current context.
// This is done to avoid any logging from the root deployment to have access to a sub-deployments log
// context. For example any library logging from a EAR/lib should use the EAR's configured log context,
// not a log context from a WAR or EJB library.
if (!hasRegisteredLogContext(deploymentUnit) && !deploymentUnit.hasAttachment(DEFAULT_LOG_CONTEXT_KEY)) {
// Register the current log context as this could be an embedded server or overridden another way
registerLogContext(deploymentUnit, DEFAULT_LOG_CONTEXT_KEY, deploymentUnit.getAttachment(Attachments.MODULE), LogContext.getLogContext());
}
}
}
}
示例4: undeploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public final void undeploy(final DeploymentUnit context) {
// OSGi bundles deployments may not have a module attached
if (context.hasAttachment(Attachments.MODULE)) {
// don't process sub-deployments as they are processed by processing methods
final ResourceRoot root = context.getAttachment(Attachments.DEPLOYMENT_ROOT);
if (SubDeploymentMarker.isSubDeployment(root)) return;
// Remove any log context selector references
final Module module = context.getAttachment(Attachments.MODULE);
// Remove either the default log context or a defined log context. It's safe to attempt to remove a
// nonexistent context.
unregisterLogContext(context, DEFAULT_LOG_CONTEXT_KEY, module);
unregisterLogContext(context, LOG_CONTEXT_KEY, module);
// Unregister all sub-deployments
final List<DeploymentUnit> subDeployments = getSubDeployments(context);
for (DeploymentUnit subDeployment : subDeployments) {
final Module subDeploymentModule = subDeployment.getAttachment(Attachments.MODULE);
// Sub-deployment should never have a default log context
unregisterLogContext(subDeployment, LOG_CONTEXT_KEY, subDeploymentModule);
}
}
}
示例5: isExplodedSubUnitOverlay
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
private boolean isExplodedSubUnitOverlay(DeploymentUnit deploymentUnit, VirtualFile mountPoint, String path) {
final List<ResourceRoot> childRes = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
if (childRes != null) {
for (ResourceRoot rs: childRes) {
if (path.startsWith(rs.getRoot().getName())) {
String relativePath = mountPoint.getPathNameRelativeTo(rs.getRoot());
if (relativePath != null
&& relativePath.length() > 0
&& SubExplodedDeploymentMarker.isSubExplodedResourceRoot(rs)) {
return true;
}
}
}
}
return false;
}
示例6: getAnnotationIndexes
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
public static Map<ResourceRoot, Index> getAnnotationIndexes(final DeploymentUnit deploymentUnit) {
final List<ResourceRoot> allResourceRoots = new ArrayList<ResourceRoot>();
allResourceRoots.addAll(deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS));
allResourceRoots.add(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT));
Map<ResourceRoot, Index> indexes = new HashMap<ResourceRoot, Index>();
for (ResourceRoot resourceRoot : allResourceRoots) {
if (resourceRoot == null)
continue;
Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
if (index != null) {
indexes.put(resourceRoot, index);
}
}
return indexes;
}
示例7: handleClassPathItems
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
/**
* Loops through all resource roots that have been made available transitively via Class-Path entries, and
* adds them to the list of roots to be processed.
*/
private Collection<? extends ResourceRoot> handleClassPathItems(final DeploymentUnit deploymentUnit) {
final Set<ResourceRoot> additionalRoots = new HashSet<ResourceRoot>();
final ArrayDeque<ResourceRoot> toProcess = new ArrayDeque<ResourceRoot>();
final List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
toProcess.addAll(resourceRoots);
final Set<ResourceRoot> processed = new HashSet<ResourceRoot>(resourceRoots);
while (!toProcess.isEmpty()) {
final ResourceRoot root = toProcess.pop();
final List<ResourceRoot> classPathRoots = root.getAttachmentList(Attachments.CLASS_PATH_RESOURCE_ROOTS);
for(ResourceRoot cpRoot : classPathRoots) {
if(!processed.contains(cpRoot)) {
additionalRoots.add(cpRoot);
toProcess.add(cpRoot);
processed.add(cpRoot);
}
}
}
return additionalRoots;
}
示例8: undeploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public void undeploy(final DeploymentUnit deploymentUnit) {
final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry();
final List<ResourceRoot> childRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
for (final ResourceRoot childRoot : childRoots) {
if (!SubDeploymentMarker.isSubDeployment(childRoot)) {
continue;
}
final ServiceName serviceName = Services.deploymentUnitName(deploymentUnit.getName(), childRoot.getRootName());
final ServiceController<?> serviceController = serviceRegistry.getService(serviceName);
if (serviceController != null) {
serviceController.setMode(ServiceController.Mode.REMOVE);
}
}
deploymentUnit.removeAttachment(Attachments.SUB_DEPLOYMENTS);
}
示例9: processAnnotationIndex
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
private void processAnnotationIndex(DeploymentUnit deploymentUnit) {
DotName dotName = DotName.createSimple(BootstrapDatabase.class.getName());
CompositeIndex index = deploymentUnit.getAttachment(COMPOSITE_ANNOTATION_INDEX);
if (index == null) {
return;
}
List<AnnotationInstance> indexAnnotations = index.getAnnotations(dotName);
if (indexAnnotations.isEmpty()) {
return;
}
ResourceRoot deploymentRoot = deploymentUnit.getAttachment(DEPLOYMENT_ROOT);
VirtualFile root = deploymentRoot.getRoot();
DbBootstrapLogger.ROOT_LOGGER.tracef("match on %s", root.getPathName());
try {
final Module module = deploymentUnit.getAttachment(MODULE);
processAnnotatedClasses(indexAnnotations, module.getClassLoader());
} catch (Exception e) {
DbBootstrapLogger.ROOT_LOGGER.error("Unable to process the internal jar files", e);
}
}
示例10: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final ServiceModuleLoader moduleLoader = deploymentUnit.getAttachment(Attachments.SERVICE_MODULE_LOADER);
final ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS);
//List<VirtualFile> jars = getJarList(deploymentRoot.getRoot());
try {
processBlackList(resourceRoots);
} catch (IOException e) {
SDDLogger.ROOT_LOGGER.couldNotProcessBlacklist(e);
}
}
示例11: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit depUnit = phaseContext.getDeploymentUnit();
Resource resource = depUnit.getAttachment(GraviaConstants.RESOURCE_KEY);
if (resource != null)
return;
resource = NamedResourceAssociation.getResource(depUnit.getName());
if (resource == null) {
ResourceRoot deploymentRoot = depUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
Manifest manifest = deploymentRoot != null ? deploymentRoot.getAttachment(Attachments.MANIFEST) : null;
if (manifest != null) {
ManifestResourceBuilder builder = new ManifestResourceBuilder().load(manifest);
if (builder.isValid()) {
resource = builder.getResource();
}
}
}
if (resource != null) {
depUnit.putAttachment(GraviaConstants.RESOURCE_KEY, resource);
}
}
示例12: undeploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
public void undeploy(DeploymentUnit context) {
final ResourceRoot resourceRoot = context.removeAttachment(Attachments.DEPLOYMENT_ROOT);
if (resourceRoot != null) {
final Closeable mountHandle = resourceRoot.getMountHandle();
VFSUtils.safeClose(mountHandle);
}
}
示例13: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile switchyardXml;
if (DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit)) {
// switchyard.xml file located in /WEB-INF
final VirtualFile warSwitchYardXml = deploymentRoot.getRoot().getChild(SWITCHYARD_XML_WAR);
if (warSwitchYardXml.exists()) {
switchyardXml = warSwitchYardXml;
} else {
// fall back to original location
switchyardXml = deploymentRoot.getRoot().getChild(SWITCHYARD_XML);
}
} else {
switchyardXml = deploymentRoot.getRoot().getChild(SWITCHYARD_XML);
}
if (!switchyardXml.exists()) {
return;
}
final String archiveName = deploymentUnit.getName();
final String deploymentName = archiveName.substring(0, archiveName.lastIndexOf('.'));
final SwitchYardMetaData switchYardMetaData = new SwitchYardMetaData(archiveName, deploymentName);
switchYardMetaData.setSwitchYardFile(switchyardXml);
deploymentUnit.putAttachment(SwitchYardMetaData.ATTACHMENT_KEY, switchYardMetaData);
SwitchYardDeploymentMarker.mark(deploymentUnit);
}
示例14: findLoggingProfile
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
/**
* Find the logging profile attached to any resource.
*
* @param resourceRoot the root resource
*
* @return the logging profile name or {@code null} if one was not found
*/
private String findLoggingProfile(final ResourceRoot resourceRoot) {
final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST);
if (manifest != null) {
final String loggingProfile = manifest.getMainAttributes().getValue(LOGGING_PROFILE);
if (loggingProfile != null) {
LoggingLogger.ROOT_LOGGER.debugf("Logging profile '%s' found in '%s'.", loggingProfile, resourceRoot);
return loggingProfile;
}
}
return null;
}
示例15: findConfigFile
import org.jboss.as.server.deployment.module.ResourceRoot; //导入依赖的package包/类
/**
* Finds the configuration file to be used and returns the first one found.
* <p/>
* Preference is for {@literal logging.properties} or {@literal jboss-logging.properties}.
*
* @param resourceRoot the resource to check.
*
* @return the configuration file if found, otherwise {@code null}.
*
* @throws DeploymentUnitProcessingException if an error occurs.
*/
private VirtualFile findConfigFile(ResourceRoot resourceRoot) throws DeploymentUnitProcessingException {
final VirtualFile root = resourceRoot.getRoot();
// First check META-INF
VirtualFile file = root.getChild("META-INF");
VirtualFile result = findConfigFile(file);
if (result == null) {
file = root.getChild("WEB-INF/classes");
result = findConfigFile(file);
}
return result;
}