From: Steve L. <st...@us...> - 2004-04-28 16:44:39
|
Update of /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22879/extras/ant/src/org/smartfrog/tools/ant Modified Files: TaskBase.java SmartFrogSign.java Security.java Parse.java DeployingTaskBase.java Log Message: tweaking this as we use it. Index: TaskBase.java =================================================================== RCS file: /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant/TaskBase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TaskBase.java 22 Apr 2004 10:26:22 -0000 1.3 --- TaskBase.java 28 Apr 2004 16:44:28 -0000 1.4 *************** *** 47,51 **** * flag set to include the ant runtime if class or classpath defined */ ! protected boolean includeAntRuntime = false; --- 47,51 ---- * flag set to include the ant runtime if class or classpath defined */ ! protected boolean includeAntRuntime = true; Index: DeployingTaskBase.java =================================================================== RCS file: /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant/DeployingTaskBase.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DeployingTaskBase.java 22 Apr 2004 10:26:22 -0000 1.9 --- DeployingTaskBase.java 28 Apr 2004 16:44:28 -0000 1.10 *************** *** 59,62 **** --- 59,69 ---- /** + * keep in sync with whatever the classloader uses, including + * the format it takes + * @see org.smartfrog.sfcore.security.SFClassLoader#SF_CODEBASE_PROPERTY + */ + protected static final String CODEBASE_PROPERTY = "org.smartfrog.codebase"; + + /** * add a new application to the list. */ *************** *** 131,134 **** --- 138,145 ---- } + /** + * set up the codebase params on the command line, if needed + * @see org.smartfrog.sfcore.security.SFClassLoader#SF_CODEBASE_PROPERTY + */ private void setupCodebase() { if (codebase != null && !codebase.isEmpty()) { *************** *** 136,140 **** String codelist = Codebase.getCodebaseString(codebase); log("Codebase set to " + codelist, Project.MSG_VERBOSE); ! addJVMProperty("org.smartfrog.codebase", codelist); } } --- 147,151 ---- String codelist = Codebase.getCodebaseString(codebase); log("Codebase set to " + codelist, Project.MSG_VERBOSE); ! addJVMProperty(CODEBASE_PROPERTY, codelist); } } *************** *** 147,150 **** --- 158,164 ---- public static class Application { + /** + * owner task + */ private Task owner; *************** *** 227,233 **** */ public void addText(String text) { ! this.text = owner.getProject().replaceProperties(text); File tempfile = FileUtils.newFileUtils().createTempFile("deploy", ".sf", null); OutputStream out = null; OutputStreamWriter writer = null; --- 241,254 ---- */ public void addText(String text) { ! //convert properties ! text = owner.getProject().replaceProperties(text); ! this.text=text; ! //create a temp file File tempfile = FileUtils.newFileUtils().createTempFile("deploy", ".sf", null); + //mark for cleanup later + tempfile.deleteOnExit(); + owner.log("Saving to temporary file "+tempfile,Project.MSG_VERBOSE); + owner.log(text, Project.MSG_VERBOSE); OutputStream out = null; OutputStreamWriter writer = null; Index: SmartFrogSign.java =================================================================== RCS file: /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant/SmartFrogSign.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SmartFrogSign.java 22 Apr 2004 10:26:22 -0000 1.2 --- SmartFrogSign.java 28 Apr 2004 16:44:28 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- import java.io.File; + import java.io.IOException; /** *************** *** 121,125 **** throw new BuildException("No security settings provided"); } ! sec.applySecuritySettings(signer); signer.execute(); } --- 122,131 ---- throw new BuildException("No security settings provided"); } ! try { ! sec.applySecuritySettings(signer); ! } catch (IOException e) { ! throw new BuildException("Could not apply security settings with " ! +sec.toString(),e); ! } signer.execute(); } Index: Parse.java =================================================================== RCS file: /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant/Parse.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Parse.java 22 Apr 2004 10:26:22 -0000 1.7 --- Parse.java 28 Apr 2004 16:44:28 -0000 1.8 *************** *** 56,61 **** --- 56,67 ---- + /** + * verbose flag + */ private boolean verbose = false; + /** + * extra quiet flag + */ private boolean quiet = false; Index: Security.java =================================================================== RCS file: /cvsroot/smartfrog/core/extras/ant/src/org/smartfrog/tools/ant/Security.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Security.java 22 Apr 2004 10:26:22 -0000 1.2 --- Security.java 28 Apr 2004 16:44:28 -0000 1.3 *************** *** 29,32 **** --- 29,36 ---- import java.io.File; + import java.io.InputStream; + import java.io.FileInputStream; + import java.io.IOException; + import java.util.Properties; /** *************** *** 42,45 **** --- 46,50 ---- private File passFile; private File policyFile; + protected static final String KEYSTORE_PASSWORD = "org.smartfrog.sfcore.security.keyStorePassword"; public File getKeystore() { *************** *** 160,168 **** * @param signJar task to configure */ ! public void applySecuritySettings(SignJar signJar) { validate(); signJar.setKeystore(keystore.getAbsolutePath()); ! //todo: get the pass in. ! signJar.setKeypass(""); } } --- 165,204 ---- * @param signJar task to configure */ ! public void applySecuritySettings(SignJar signJar) throws IOException { validate(); signJar.setKeystore(keystore.getAbsolutePath()); ! //todo: get the pass in. ! Properties securityProps = loadPassFile(); ! signJar.setKeypass(securityProps.getProperty(KEYSTORE_PASSWORD)); ! } ! ! /** ! * load the passfile into a properties structure ! * @return ! * @throws IOException ! */ ! private Properties loadPassFile() throws IOException { ! Properties securityProps=new Properties(); ! InputStream instream=null; ! try { ! instream=new FileInputStream(passFile); ! securityProps.load(instream); ! return securityProps; ! } finally { ! if(instream!=null) { ! try { ! instream.close(); ! } catch (IOException e) { ! ! } ! } ! } ! } ! ! /** ! * @return a string representation of the object. ! */ ! public String toString() { ! return "Security: keystore="+keystore+" passfile="+passFile; } } |