/** * Get the parent deployment context * * @return the parent. */ public VirtualFile getParent() { return context.getFile(); }
/** * Add all children as candidates * * @param context the structure context * @param attributes the visitor attributes uses {@link VisitorAttributes#DEFAULT} when null * @throws Exception for any error */ protected void addChildren(StructureContext context, VisitorAttributes attributes) throws Exception { if (context == null) throw new IllegalArgumentException("Null context"); VirtualFile file = context.getFile(); VirtualFileVisitor visitor = candidateStructureVisitorFactory.createVisitor(context, attributes); file.visit(visitor); }
/** * Create a new child structure context * * @param file the candidate file * @param metaData the structure metadata to build * @param parentContext the parentContext * @throws IllegalArgumentException for a null parameter */ public StructureContext(VirtualFile file, StructureMetaData metaData, StructureContext parentContext) { this(getRoot(parentContext), parentContext.getFile(), file, metaData, parentContext.getDeployers(), parentContext); }
@SuppressWarnings({"UnusedDeclaration"}) protected void mountLinks(StructureContext context, VirtualFile parent, String path, List<LinkInfo> links) throws IOException { VirtualFile root = context.getFile(); VirtualFile link = parent.getChild(path); for (LinkInfo li : links) { VirtualFile linkChild = link.getChild(li.name); Closeable closeable = VFS.mountReal(new File(li.uri), linkChild); Automounter.addHandle(root, closeable); } }
protected void mountLinks(StructureContext context, String path) throws IOException { VirtualFile root = context.getFile(); VirtualFile link = root.getChild(path + VFS_LINK_PROPERTIES_SUFFIX); if (link.exists()) { List<LinkInfo> links = new ArrayList<LinkInfo>(); parseLinkProperties(link, links); mountLinks(context, link.getParent(), path, links); } else { log.warn("No " + VFS_LINK_PROPERTIES_SUFFIX + " match for link: " + path); } }
/** * Apply metadata on root to create context. * * @param context the structure context * @param metaDataPaths the metadata paths * @return the context info */ protected ContextInfo applyMetadataPaths(StructureContext context, String[] metaDataPaths) { if (context == null) throw new IllegalArgumentException("Null context"); VirtualFile root = context.getFile(); List<String> metaDataPath = CollectionsFactory.createLazyList(); // Determine whether the metadata paths exists if (metaDataPaths != null && metaDataPaths.length > 0) { for(String path : metaDataPaths) { VirtualFile child = root.getChild(path); if (child.exists()) metaDataPath.add(path); } } // Create and link the context if (metaDataPath.isEmpty()) return StructureMetaDataFactory.createContextInfo("", null); else return StructureMetaDataFactory.createContextInfo("", metaDataPath, null); }
public boolean determineStructure(StructureContext context) throws DeploymentException VirtualFile root = context.getFile(); VirtualFile vfslinks = root.getChild("META-INF/jboss-vfslinks.txt"); if (vfslinks.exists())
/** * Apply metadata on root to create context. * * @param context the context * @param metaDataPath the metadata path * @return the context info */ protected ContextInfo applyMetadataPath(StructureContext context, String metaDataPath) { if (context == null) throw new IllegalArgumentException("Null context"); // Determine whether the metadata path exists if (metaDataPath != null) { VirtualFile root = context.getFile(); VirtualFile child = root.getChild(metaDataPath); if (! child.exists()) metaDataPath = null; } // Create and link the context if (metaDataPath != null) return StructureMetaDataFactory.createContextInfo("", metaDataPath, null); else return StructureMetaDataFactory.createContextInfo("", null); }
/** * Create metadata entry. * * @param context the structure context * @param info the context info * @param path the path * @param type the type */ protected void addMetaDataPath(StructureContext context, ContextInfo info, String path, MetaDataType type) { VirtualFile root = context.getFile(); if (root.getChild(path).exists()) info.addMetaDataPath(createMetaDataEntry(path, type)); }
/** * Is the current context already part of metadata path. * * @param context the current structure context * @return true if already part of parent's context metadata path */ protected boolean isMetadataPath(StructureContext context) { StructureContext parentContext = context.getParentContext(); if (parentContext == null) return false; StructureMetaData smd = parentContext.getMetaData(); ContextInfo info = smd.getContext(""); List<MetaDataEntry> metadataPaths = info.getMetaDataPath(); if (metadataPaths != null && metadataPaths.isEmpty() == false) { String relativePath = AbstractStructureDeployer.getRelativePath(context.getParent(), context.getFile()); for (MetaDataEntry entry : metadataPaths) if (relativePath.equalsIgnoreCase(entry.getPath())) return true; } return false; } }
public boolean determineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile(); try
VirtualFile root = context.getFile(); boolean valid = false; try
public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile(); try
public boolean determineStructure(StructureContext context) throws DeploymentException { try { VirtualFile file = context.getFile(); // jar structure should already handle top level dirs if (context.isTopLevel() == false && isLeaf(file) == false && isMetadataPath(context) == false) { List<VirtualFile> children = file.getChildren(); if (children != null && children.isEmpty() == false) { VFSStructuralDeployers structuralDeployers = context.getDeployers(); // get top while (context.getParentContext() != null) context = context.getParentContext(); for (VirtualFile child : children) structuralDeployers.determineStructure(child, context); } } return false; } catch (Exception e) { throw DeploymentException.rethrowAsDeploymentException("Error determining structure.", e); } }
public boolean determineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile();
public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile(); try
public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile(); try
boolean valid; boolean trace = log.isTraceEnabled(); VirtualFile file = structureContext.getFile(); try
/** * Iterate through the contexts and mount anything that looks like an archive * * @param structureContext the context * @throws IOException if errors occur during mounting */ protected void mountChildren(StructureContext structureContext) throws IOException { final StructureMetaData structureMetaData = structureContext.getMetaData(); final VirtualFile structureRoot = structureContext.getFile(); for(ContextInfo contextInfo : structureMetaData.getContexts()) { final String contextPath = contextInfo.getPath(); if(hasValidSuffix(contextPath)) { final VirtualFile child = structureRoot.getChild(contextPath); if(child.exists() && child.isFile()) { if ((contextInfo.getModificationType() == ModificationType.EXPLODE) || isWAR(child)) performExpandedMount(child); else performMount(child); } } } }
public boolean doDetermineStructure(StructureContext structureContext) throws DeploymentException VirtualFile file = structureContext.getFile(); try