本文整理汇总了Java中org.jboss.as.server.deployment.module.ResourceRoot.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceRoot.getRoot方法的具体用法?Java ResourceRoot.getRoot怎么用?Java ResourceRoot.getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.as.server.deployment.module.ResourceRoot
的用法示例。
在下文中一共展示了ResourceRoot.getRoot方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
}
示例2: 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);
}
}
示例3: 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;
}
示例4: deploy
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的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;
}
}
}
}
示例5: processRoot
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processRoot(final ResourceRoot resourceRoot, final Map<String, List<String>> foundServices) throws DeploymentUnitProcessingException {
final VirtualFile virtualFile = resourceRoot.getRoot();
final VirtualFile child = virtualFile.getChild("META-INF/services");
for (VirtualFile serviceType : child.getChildren()) {
final String name = serviceType.getName();
try {
List<String> list = foundServices.get(name);
if (list == null) {
foundServices.put(name, list = new ArrayList<String>());
}
final InputStream stream = serviceType.openStream();
try {
final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
final int commentIdx = line.indexOf('#');
final String className;
if (commentIdx == -1) {
className = line.trim();
} else {
className = line.substring(0, commentIdx).trim();
}
if (className.length() == 0) {
continue;
}
list.add(className);
}
} finally {
VFSUtils.safeClose(stream);
}
} catch (IOException e) {
throw ServerLogger.ROOT_LOGGER.failedToReadVirtualFile(child, e);
}
}
}
示例6: processBlackList
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
for (String blackListed : blackList) {
PathFilter filter = PathFilters.match(blackListed);
for (ResourceRoot root : jars) {
VirtualFile jar = root.getRoot();
SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));
if (filter.accept(jar.getName())) {
SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
}
}
}
}
示例7: processBlackList
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private void processBlackList(final List<ResourceRoot> jars) throws IOException {
for (String blackListed : blackList) {
PathFilter filter = PathFilters.match(blackListed);
for (ResourceRoot root : jars) {
VirtualFile jar = root.getRoot();
SDDLogger.ROOT_LOGGER.tracef("Processing jar %s, matches: %s", jar.getName(), filter.accept(jar.getName()));
if (filter.accept(jar.getName())) {
SDDLogger.ROOT_LOGGER.jarBlacklisted(jar);
}
}
}
}
示例8: parseResourceRoot
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private static void parseResourceRoot(final DeploymentUnit deploymentUnit, final XMLStreamReader reader,
final ModuleStructureSpec specBuilder) throws XMLStreamException {
String name = null;
String path = null;
final Set<Attribute> required = EnumSet.of(Attribute.PATH);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i));
required.remove(attribute);
switch (attribute) {
case NAME:
name = reader.getAttributeValue(i);
break;
case PATH:
path = reader.getAttributeValue(i);
break;
default:
throw unexpectedContent(reader);
}
}
if (!required.isEmpty()) {
throw missingAttributes(reader.getLocation(), required);
}
if (name == null)
name = path;
List<FilterSpecification> resourceFilters = new ArrayList<FilterSpecification>();
final Set<Element> encountered = EnumSet.noneOf(Element.class);
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
if (path.startsWith("/")) {
throw ServerLogger.ROOT_LOGGER.externalResourceRootsNotSupported(path);
} else {
try {
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRootFile = deploymentRoot.getRoot();
VirtualFile child = deploymentRootFile.getChild(path);
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
MountedDeploymentOverlay overlay = overlays.get(path);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(child.isFile()) {
closable = VFS.mountZip(child, child, TempFileProviderService.provider());
}
final MountHandle mountHandle = new MountHandle(closable);
ResourceRoot resourceRoot = new ResourceRoot(name, child, mountHandle);
for (FilterSpecification filter : resourceFilters) {
resourceRoot.getExportFilters().add(filter);
}
specBuilder.addResourceRoot(resourceRoot);
} catch (IOException e) {
throw new XMLStreamException(e);
}
}
return;
}
case XMLStreamConstants.START_ELEMENT: {
final Element element = Element.of(reader.getName());
if (!encountered.add(element))
throw unexpectedContent(reader);
switch (element) {
case FILTER:
parseFilterList(reader, resourceFilters);
break;
default:
throw unexpectedContent(reader);
}
break;
}
default: {
throw unexpectedContent(reader);
}
}
}
}
示例9: parseResourceRoot
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
private static void parseResourceRoot(final DeploymentUnit deploymentUnit, final XMLStreamReader reader,
final ModuleStructureSpec specBuilder) throws XMLStreamException {
String name = null;
String path = null;
boolean usePhysicalCodeSource = false;
final Set<Attribute> required = EnumSet.of(Attribute.PATH);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final Attribute attribute = Attribute.of(reader.getAttributeName(i));
required.remove(attribute);
switch (attribute) {
case NAME:
name = reader.getAttributeValue(i);
break;
case PATH:
path = reader.getAttributeValue(i);
break;
case USE_PHYSICAL_CODE_SOURCE:
usePhysicalCodeSource = Boolean.parseBoolean(reader.getAttributeValue(i));
break;
default:
throw unexpectedContent(reader);
}
}
if (!required.isEmpty()) {
throw missingAttributes(reader.getLocation(), required);
}
if (name == null)
name = path;
final List<FilterSpecification> resourceFilters = new ArrayList<FilterSpecification>();
final Set<Element> encountered = EnumSet.noneOf(Element.class);
while (reader.hasNext()) {
switch (reader.nextTag()) {
case XMLStreamConstants.END_ELEMENT: {
try {
final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
final VirtualFile deploymentRootFile = deploymentRoot.getRoot();
final VirtualFile child = deploymentRootFile.getChild(path);
Map<String, MountedDeploymentOverlay> overlays = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_OVERLAY_LOCATIONS);
MountedDeploymentOverlay overlay = overlays.get(path);
Closeable closable = null;
if(overlay != null) {
overlay.remountAsZip(false);
} else if(child.isFile()) {
closable = VFS.mountZip(child, child, TempFileProviderService.provider());
}
final MountHandle mountHandle = new MountHandle(closable);
final ResourceRoot resourceRoot = new ResourceRoot(name, child, mountHandle);
for (final FilterSpecification filter : resourceFilters) {
resourceRoot.getExportFilters().add(filter);
}
resourceRoot.setUsePhysicalCodeSource(usePhysicalCodeSource);
specBuilder.addResourceRoot(resourceRoot);
} catch (IOException e) {
throw new XMLStreamException(e);
}
return;
}
case XMLStreamConstants.START_ELEMENT: {
final Element element = Element.of(reader.getName());
if (!encountered.add(element))
throw unexpectedContent(reader);
switch (element) {
case FILTER:
parseFilterList(reader, resourceFilters);
break;
default:
throw unexpectedContent(reader);
}
break;
}
default: {
throw unexpectedContent(reader);
}
}
}
}
示例10: VirtualFileEntriesProvider
import org.jboss.as.server.deployment.module.ResourceRoot; //导入方法依赖的package包/类
public VirtualFileEntriesProvider(ResourceRoot resourceRoot) {
IllegalArgumentAssertion.assertNotNull(resourceRoot, "resourceRoot");
this.rootFile = resourceRoot.getRoot();
}