public List<VirtualFile> getMetaDataLocations() { return getMetaDataLocations(MetaDataTypeFilter.DEFAULT); }
public VirtualFile getFile(String name) { return getResourceLoader().getFile(name); }
@Override public VFSDeploymentResourceLoader getResourceLoader() { if (loader != null) return loader; loader = new VFSDeploymentResourceLoaderImpl(getRoot()); return loader; }
/** * Search the metadata locations. * In this impl the first one matching is returned. * * @param name the file name to find * @return found file or null if not found */ protected VirtualFile searchMetaDataLocations(String name) { VirtualFile result = null; for(VirtualFile location : getMetaDataLocations()) { try { result = location.getChild(name); if (result != null) { if (log.isTraceEnabled()) log.trace("Found " + name + " in " + location.getName()); deployed(); break; } } catch (IOException e) { log.debug("Search exception invocation for metafile " + name + " in " + location.getName() + ", reason: " + e); } } return result; }
protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception { if (deployment instanceof VFSDeployment) { VFSDeployment vfsDeployment = (VFSDeployment) deployment; return new AbstractVFSDeploymentContext(vfsDeployment.getRoot(), ""); } return super.createRootDeploymentContext(deployment); }
/** * Search the metadata locations. * In this impl the first one matching is returned. * * @param name the file name to find * @return found file or null if not found */ protected VirtualFile searchMetaDataLocations(String name) { return searchMetaDataLocations(name, MetaDataTypeFilter.DEFAULT); }
log.trace("Found " + name + " in " + location.getName()); results.addAll(result); deployed();
public void setMetaDataPath(List<MetaDataEntry> paths) { if (paths == null) { setMetaDataLocations(null); return; } Map<VirtualFile, MetaDataType> locations = new LinkedHashMap<VirtualFile, MetaDataType>(); for (MetaDataEntry entry : paths) { if (entry == null) throw new IllegalArgumentException("Null entry in paths: " + paths); String path = entry.getPath(); VirtualFile child = root.getChild(path); if (child != null) locations.put(child, entry.getType()); else log.debugf("Meta data path does not exist: root=%1s path=%2s", root.getPathName(), path); } setMetaDataLocationsMap(locations); }
/** * Create a new AbstractVFSDeploymentContext. * * @param root the virtual file * @param relativePath the relative path */ public AbstractVFSDeploymentContext(VirtualFile root, String relativePath) { super(safeVirtualFileName(root), root.getName(), relativePath); this.root = root; }
public void setMetaDataPath(List<String> paths) { if (paths == null) { setMetaDataLocations(null); return; } try { List<VirtualFile> locations = new ArrayList<VirtualFile>(); for (String path : paths) { if (path == null) throw new IllegalArgumentException("Null path in paths: " + paths); VirtualFile child = root.getChild(path); if (child != null) locations.add(child); else log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path); } setMetaDataLocations(locations); } catch (IOException e) { log.warn("Exception while applying paths: root=" + root.getPathName() + " paths=" + paths); } }
public List<VirtualFile> getMetaDataFiles(String name, String suffix) { return getMetaDataFiles(name, suffix, MetaDataTypeFilter.DEFAULT); }
public VirtualFile getMetaDataFile(String name) { return getMetaDataFile(name, MetaDataTypeFilter.DEFAULT); }
protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception { if (deployment instanceof VFSDeployment) { VFSDeployment vfsDeployment = (VFSDeployment) deployment; String name = deployment.getName(); String simpleName = deployment.getSimpleName(); VirtualFile root = applyModification(vfsDeployment.getRoot(), metaData.getContext("")); if (name == null) { return new AbstractVFSDeploymentContext(root, ""); } else { if (simpleName == null) return new AbstractVFSDeploymentContext(name, name, root, ""); else return new AbstractVFSDeploymentContext(name, simpleName, root, ""); } } return super.createRootDeploymentContext(deployment); }
public VirtualFile getMetaDataFile(String name) { if (name == null) throw new IllegalArgumentException("Null name"); try { // There isn't a metadata locations so let's see whether the root matches. if (metaDataLocations == null || metaDataLocations.isEmpty()) { // It has to be a plain file if (root != null && SecurityActions.isLeaf(root)) { String fileName = root.getName(); if (fileName.equals(name)) return root; } // No match return null; } // Look in the meta data locations return searchMetaDataLocations(name); } catch (Exception e) { if (log.isTraceEnabled()) log.trace("Error retrieving meta data: " + name + " reason=" + e); return null; } }
log.trace("Found results with " + filter + " in " + location.getName()); results.addAll(result); deployed();
/** * Create a new AbstractVFSDeploymentContext. * * @param root the virtual file * @param relativePath the relative path */ public AbstractVFSDeploymentContext(VirtualFile root, String relativePath) { super(safeVirtualFileName(root), root.getName(), relativePath); this.root = root; }
public List<VirtualFile> getMetaDataFiles(VirtualFileFilter filter) { return getMetaDataFiles(filter, MetaDataTypeFilter.DEFAULT); }
protected DeploymentContext createChildDeploymentContext(DeploymentContext parent, ContextInfo child) throws Exception { if (parent instanceof VFSDeploymentContext) { VFSDeploymentContext vfsParent = (VFSDeploymentContext) parent; String path = child.getPath(); try { VirtualFile parentFile = vfsParent.getRoot(); VirtualFile file = parentFile.findChild(path); // leaving the findChild usage return new AbstractVFSDeploymentContext(file, path); } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Unable to determine child " + path + " from parent " + vfsParent.getRoot().getName(), t); } } return super.createChildDeploymentContext(parent, child); }
return searchMetaDataLocations(name, filter);
/** * Search the metadata locations. * In this impl the first one matching is returned. * * @param name the file name to find * @param filter the metadata type filter * @return found file or null if not found */ protected VirtualFile searchMetaDataLocations(String name, MetaDataTypeFilter filter) { VirtualFile result = null; for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet()) { if (filter.accepts(entry.getValue())) { VirtualFile location = entry.getKey(); result = location.getChild(name); if (result.exists()) { if (log.isTraceEnabled()) log.trace("Found " + name + " in " + location.getName()); deployed(); break; } } } return result != null && result.exists() ? result : null; }