1 26 27 package org.objectweb.jonas.ant; 28 29 import java.io.File ; 30 31 import org.apache.tools.ant.Project; 32 import org.apache.tools.ant.Task; 33 import org.apache.tools.ant.types.FileSet; 34 import org.apache.tools.ant.types.PatternSet.NameEntry; 35 36 import org.objectweb.jonas.ant.jonasbase.Apps; 37 import org.objectweb.jonas.ant.jonasbase.Archives; 38 import org.objectweb.jonas.ant.jonasbase.Ejbjars; 39 import org.objectweb.jonas.ant.jonasbase.Rars; 40 import org.objectweb.jonas.ant.jonasbase.Wars; 41 42 46 public class JOnASAntTool { 47 48 51 public static final String JONAS_CONF_FILE = "jonas.properties"; 52 53 56 public static final String JORAM_CONF_FILE = "a3servers.xml"; 57 58 61 public static final String JORAM_ADMIN_CONF_FILE = "joram-admin.cfg"; 62 63 66 public static final String CAROL_CONF_FILE = "carol.properties"; 67 68 71 public static final String TOMCAT_CONF_FILE = "server.xml"; 72 73 76 public static final String JETTY_CONF_FILE = "jetty5.xml"; 77 78 81 public static final String P6SPY_CONF_FILE = "spy.properties"; 82 83 86 public static final String [] WARS_LIST = new String [] {"juddi.war", "autoload/jonasAdmin.war"}; 87 88 91 public static final String [] RARS_LIST = new String [] {"autoload/JOnAS_jdbcCP.rar", "autoload/JOnAS_jdbcDM.rar", "autoload/JOnAS_jdbcDS.rar", "autoload/JOnAS_jdbcXA.rar", "autoload/joram_for_jonas_ra.rar"}; 92 93 96 public static final String [] EJBJARS_LIST = new String [] {""}; 97 98 101 public static final String [] APPS_LIST = new String [] {"autoload/mejb.ear"}; 102 103 106 private JOnASAntTool() { 107 108 } 109 110 116 public static void updateJonasBase(Task antTask, File jonasRoot, File destDir) { 117 Archives wars = new Wars(); 118 updateJonasBaseForArchives(antTask, jonasRoot, destDir, wars, "webapps", WARS_LIST); 119 120 Archives ejbjars = new Ejbjars(); 121 updateJonasBaseForArchives(antTask, jonasRoot, destDir, ejbjars, "ejbjars", EJBJARS_LIST); 122 123 Archives rars = new Rars(); 124 updateJonasBaseForArchives(antTask, jonasRoot, destDir, rars, "rars", RARS_LIST); 125 126 Archives apps = new Apps(); 127 updateJonasBaseForArchives(antTask, jonasRoot, destDir, apps, "apps", APPS_LIST); 128 129 130 } 131 132 141 public static void updateJonasBaseForArchives(Task antTask, File jonasRoot, File destDir, Archives archives, String folderName, String [] listOfIncludes) { 142 configure(antTask, archives); 143 archives.setDestDir(destDir); 144 FileSet fileSet = new FileSet(); 145 fileSet.setDir(new File (jonasRoot, folderName)); 146 for (int f = 0; f < listOfIncludes.length; f++) { 147 NameEntry ne = fileSet.createInclude(); 148 ne.setName(listOfIncludes[f]); 149 } 150 archives.addFileset(fileSet); 151 archives.setOverwrite(true); 152 String info = archives.getLogInfo(); 153 if (info != null) { 154 antTask.log(info, Project.MSG_INFO); 155 } 156 archives.execute(); 157 } 158 159 164 public static void configure(Task srcTask, Task dstTask) { 165 dstTask.setTaskName(srcTask.getTaskName()); 166 dstTask.setProject(srcTask.getProject()); 167 } 168 169 } | Popular Tags |