View Javadoc
1 package com.bonevich.erj.app; 2 3 import com.bonevich.erj.xml.ProjectPropertiesDigester; 4 5 import org.tigris.gef.ocl.OCLExpander; 6 import org.tigris.gef.ocl.TemplateReader; 7 import org.xml.sax.InputSource; 8 9 import java.io.*; 10 import java.util.Hashtable; 11 12 public final class ProjectProperties extends ProjectComponent 13 { 14 ////////////////////////////////////////////////////////// 15 // Constants 16 public static final String PROJECT_PROPERTIES_EXTENSION = "." + ERJ; 17 public static final String PROJECT_TEE = "/com/bonevich/erj/xml/dtd/erj-project.tee"; 18 19 ////////////////////////////////////////////////////////// 20 // Attributes 21 private static Hashtable _templates = TemplateReader.readFile(PROJECT_TEE); 22 private static OCLExpander _expander = new OCLExpander(_templates); 23 24 ////////////////////////////////////////////////////////// 25 // Constructors 26 public ProjectProperties(Project project) 27 { 28 super(project); 29 setType(ERJ); 30 } 31 32 public String getEntryExtension() 33 { 34 return PROJECT_PROPERTIES_EXTENSION; 35 } 36 37 public void initEntryFilename() 38 { 39 _entryFilename = _project.getName() + PROJECT_PROPERTIES_EXTENSION; 40 } 41 42 public void load(InputStream in) throws IOException 43 { 44 InputSource src = new InputSource(in); 45 File path = new File(_project.getFilepath()); 46 src.setSystemId(path.toURL().toString() + "$" + getEntryFilename()); 47 48 ProjectPropertiesDigester digester = new ProjectPropertiesDigester(_project); 49 digester.digest(src); 50 initEntryFilename(); 51 } 52 53 public void save(OutputStream out) throws IOException 54 { 55 OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); 56 _expander.expand(writer, _project, "", ""); 57 // DO NOT CLOSE THE WRITER - this messes with out and can cause problems 58 writer.flush(); 59 } 60 61 } /* end class ProjectProperties */

This page was automatically generated by Maven