@Override public FSEntry getChild(String name) { FSEntry result = null; if( file.exists() && file.isDirectory() ){ File childFile = new File(file,name); if( childFile.exists() ) { result = new FSEntryFile(_Internal.INTERNAL, childFile); } } return result; }
@Override public List<FSEntry> getChildren() { return getChildren(FSEntryNameFilter.all); }
@Override public String getExtension() { return FSEntrySupport.extensionFromName(getName()); }
FSEntry positionedHtDocs = FSEntryFile.getPositionedFile("d/_attachments", htdocsDir); mergedEntries.add(positionedHtDocs); FSEntry siteEntry = new FSEntryFile(siteDir); mergedEntries.add(siteEntry); FSEntry templateDir = new FSEntryFile(siteDesignDocDir); mergedEntries.add(templateDir); } else {
private Map<String, FSEntry> computeDocIds() throws Exception { HashMap<String, FSEntry> map = new HashMap<String, FSEntry>(); FSEntryFile topDir = new FSEntryFile(dumpDir); for(FSEntry entry : topDir.getChildren()) { try { Document doc = DocumentFile.createDocument(entry);
} else { File validateFile = new File(atlasDesignDir,"vendor/nunaliit2/validate.js"); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/validate.js", validateFile); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchUtils.js", file); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchTiles.js", file); entries.add(f); FSEntry f = new FSEntryFile(submissionDesignDir); entries.add(f);
@Override public List<FSEntry> getChildren(FSEntryNameFilter filter) { if( null == filter ){ filter = FSEntryNameFilter.all; } List<FSEntry> result = new Vector<FSEntry>(); if( file.exists() && file.isDirectory() ){ String[] childrenNames = file.list(); if( null != childrenNames ){ for(String childName : childrenNames){ // Check if we should include this file if( filter.accept(this, childName) ) { File childFile = new File(file,childName); FSEntryFile childEntry = new FSEntryFile(_Internal.INTERNAL, childFile); result.add(childEntry); } } } } return result; }
FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchUtils.js", file); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchTiles.js", file); entries.add(f); FSEntry f = new FSEntryFile(mobileDesignDir); entries.add(f);
static public Map<String,File> listDocumentsFromDir( GlobalSettings gs ,File docsDir ) throws Exception { Map<String,File> docIds = new HashMap<String,File>(); if( docsDir.exists() && docsDir.isDirectory() ){ // Iterate over each subdirectory, attempting to // load each document String[] subDirNames = docsDir.list( gs.getFilenameFilter() ); for(String subDirName : subDirNames){ File subDir = new File(docsDir, subDirName); if( subDir.exists() && subDir.isDirectory() ) { // OK, let's create a document based on this Document doc = null; try { FSEntryFile entry = new FSEntryFile(subDir); doc = DocumentFile.createDocument(entry); } catch(Exception e){ throw new Exception("Unable to read document at: "+subDir.getName(), e); } docIds.put(doc.getId(), subDir); } } } return docIds; }
throw new Exception("Can not find _design/atlas template"); } else { FSEntryFile f = new FSEntryFile(atlasDesignDir); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/_attachments/nunaliit2", n2Dir); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchUtils.js", file); entries.add(f); FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchTiles.js", file); entries.add(f); throw new Exception("Can not find external javascript library"); } else { FSEntry f = FSEntryFile.getPositionedFile("a/_attachments/js-external", externalDir); entries.add(f);
/** * Create a virtual tree hierarchy with a file supporting the leaf. * @param path Position of the file in the hierarchy, including its name * @param file The actual file, or directory , abcking the end leaf * @return The FSEntry root for this hierarchy * @throws Exception Invalid parameter */ static public FSEntry getPositionedFile(String path, File file) throws Exception { List<String> pathFrags = FSEntrySupport.interpretPath(path); // Start at leaf and work our way back int index = pathFrags.size() - 1; FSEntry root = new FSEntryFile(pathFrags.get(index), file); --index; while(index >= 0){ FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory(pathFrags.get(index)); parent.addChildEntry(root); root = parent; --index; } return root; }
FSEntryFile entry = new FSEntryFile(subDir); doc = DocumentFile.createDocument(entry); } catch(Exception e){
FSEntry entry = new FSEntryFile(ddDir); doc = DocumentFile.createDocument(entry); } catch(Exception e){
FSEntryFile entry = new FSEntryFile(subDir); doc = DocumentFile.createDocument(entry); } catch(Exception e){
private void writeExtras(GlobalSettings gs, File atlasDir, Properties props) throws Exception { CopyMachine copyMachine = new CopyMachine(); copyMachine.setAcceptFileFilter(gs.getFsEntryNameFilter()); File binDir = PathComputer.computeBinDir(gs.getInstallDir()); if( null != binDir ) { copyMachine.addTextConversion("NUNALIIT_BIN_DIR", binDir.getAbsolutePath()); } copyMachine.addTextConversion("ATLAS_DIR", atlasDir.getAbsolutePath()); copyMachine.addTextConversion("ATLAS_NAME", props.getProperty("atlas.name")); File templateDir = PathComputer.computeTemplatesDir( gs.getInstallDir() ); File sourceExtra = new File(templateDir, "extra"); File destExtra = new File(atlasDir, "extra"); copyMachine.copyDir(new FSEntryFile(sourceExtra), destExtra); } }
copyMachine.addTextConversion("ATLAS_NAME", "unknown"); copyMachine.copyDir(new FSEntryFile(templateDir), atlasDir);