1 22 package org.enhydra.kelp.common.node; 23 24 import org.enhydra.kelp.common.importer.ImportTool; 26 import org.enhydra.kelp.common.importer.ImportPaths; 27 28 import java.io.File ; 30 31 37 public abstract class OtterNodeFactory { 38 39 49 abstract public OtterFolderNode createFolderNode(OtterNode node, 50 String name); 51 52 61 abstract public OtterDocumentNode createDocumentNode(OtterNode node, 62 String file); 63 64 73 abstract public OtterImageFileNode createImageFileNode(OtterNode node, 74 String file); 75 76 85 abstract public OtterJavaFileNode createJavaFileNode(OtterNode node, 86 String file); 87 88 97 abstract public OtterTextFileNode createTextFileNode(OtterNode node, 98 String file); 99 100 109 abstract public OtterTemplateNode createTemplateNode(OtterNode node, 110 String file); 111 112 abstract public OtterTemplateNode getTemplateNode(OtterNode node); 113 114 115 125 abstract public OtterJavaFileNode[] replaceGeneratedSource(OtterProject project, 126 OtterNode node, String [] files); 127 128 public void importFile(OtterProject project, File newFile) { 131 File source = null; 132 File [] files = new File [1]; 133 ImportPaths paths = null; 134 ImportTool tool = null; 135 136 files[0] = newFile; 137 source = new File (project.getSourcePathArray()[0]); 138 if (!source.exists()) { 139 source = new File (project.getRootPath()); 140 } 141 paths = new ImportPaths(); 142 tool = new ImportTool(); 143 try { 144 paths.setSourcePath(source.getAbsolutePath()); 145 } catch (Exception e) { 146 e.printStackTrace(); 147 } 148 paths.setDeployRootPath(project.getDeployRootPath()); 149 paths.setProject(project); 150 tool.setPaths(paths); 151 tool.addFiles(files); 152 } 153 154 } 155 | Popular Tags |