Changeset 2083d8c6


Ignore:
Timestamp:
Dec 23, 2011 9:27:38 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5a4becb
Parents:
8ea587a
Message:

basic jetty.xml migration tool

Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • build.xml

    r8ea587a r2083d8c6  
    933933      -->
    934934    <target name="prepjupdate" depends="prepupdate, buildWEB">
    935         <copy todir="pkg-temp" >
    936             <fileset dir="build/lib" includes="jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.jetty.jar" />
     935        <copy todir="pkg-temp/lib" >
     936            <fileset dir="build" includes="jasper*.jar javax*.jar jetty*.jar jsp*.jar org.mortbay.jetty.jar" />
     937        </copy>
     938        <copy todir="pkg-temp/eepsite" >
     939            <fileset dir="installer/resources/eepsite" includes="jetty.xml contexts/* etc/*" />
    937940        </copy>
    938941    </target>
  • router/java/src/net/i2p/router/startup/ClientAppConfig.java

    r8ea587a r2083d8c6  
    132132    /*
    133133     * Go through the properties, and return a List of ClientAppConfig structures
     134     * This is for the router.
    134135     */
    135136    public static List<ClientAppConfig> getClientApps(RouterContext ctx) {
    136137        Properties clientApps = getClientAppProps(ctx);
    137         return getClientApps(clientApps);
     138        List<ClientAppConfig> rv = getClientApps(clientApps);
     139        MigrateJetty.migrate(ctx, rv);
     140        return rv;
    138141    }
    139142
    140143    /*
    141144     * Go through the properties, and return a List of ClientAppConfig structures
     145     * This is for plugins.
    142146     *
    143147     * @since 0.7.12
     
    191195
    192196    /** classpath and stopargs not supported */
    193     public static void writeClientAppConfig(RouterContext ctx, List apps) {
     197    public static void writeClientAppConfig(RouterContext ctx, List<ClientAppConfig> apps) {
    194198        File cfgFile = configFile(ctx);
    195199        FileOutputStream fos = null;
     
    198202            StringBuilder buf = new StringBuilder(2048);
    199203            for(int i = 0; i < apps.size(); i++) {
    200                 ClientAppConfig app = (ClientAppConfig) apps.get(i);
     204                ClientAppConfig app = apps.get(i);
    201205                buf.append(PREFIX).append(i).append(".main=").append(app.className).append("\n");
    202206                buf.append(PREFIX).append(i).append(".name=").append(app.clientName).append("\n");
  • router/java/src/net/i2p/router/startup/WorkingDir.java

    r8ea587a r2083d8c6  
    148148        boolean success = migrate(MIGRATE_BASE, oldDirf, dirf);
    149149        // this one must be after MIGRATE_BASE
    150         success &= migrateJettyXml(oldDirf, dirf, "jetty.xml");
    151         success &= migrateJettyXml(oldDirf, dirf, "contexts/base-context.xml");
    152         success &= migrateJettyXml(oldDirf, dirf, "contexts/cgi-context.xml");
     150        File oldEep = new File(oldDirf, "eepsite");
     151        File newEep = new File(oldDirf, "eepsite");
     152        String newPath = newEep.getAbsolutePath() + File.separatorChar;
     153        success &= migrateJettyXml(oldEep, newEep, "jetty.xml", "./eepsite/", newPath);
     154        success &= migrateJettyXml(oldEep, newEep, "contexts/base-context.xml", "./eepsite/", newPath);
     155        success &= migrateJettyXml(oldEep, newEep, "contexts/cgi-context.xml", "./eepsite/", newPath);
    153156        success &= migrateClientsConfig(oldDirf, dirf);
    154157        // for later news.xml updates (we don't copy initialNews.xml over anymore)
     
    261264     *  do it again with modifications.
    262265     */
    263     private static boolean migrateJettyXml(File olddir, File todir, String filename) {
    264         File eepsite1 = new File(olddir, "eepsite");
    265         File oldFile = new File(eepsite1, filename);
    266         File eepsite2 = new File(todir, "eepsite");
    267         File newFile = new File(eepsite2, filename);
     266    static boolean migrateJettyXml(File olddir, File todir, String filename, String oldString, String newString) {
     267        File oldFile = new File(olddir, filename);
     268        File newFile = new File(todir, filename);
    268269        FileInputStream in = null;
    269270        PrintWriter out = null;
     
    273274            String s = null;
    274275            while ((s = DataHelper.readLine(in)) != null) {
    275                 if (s.indexOf("./eepsite/") >= 0) {
    276                     s = s.replace("./eepsite/", todir.getAbsolutePath() + File.separatorChar + "eepsite" + File.separatorChar);
     276                if (s.indexOf(oldString) >= 0) {
     277                    s = s.replace(oldString, newString);
    277278                }
    278279                out.println(s);
     
    339340     * @return true if it was copied successfully
    340341     */
    341     private static boolean copyFile(File src, File dst) {
     342    static boolean copyFile(File src, File dst) {
    342343        if (!src.exists()) return false;
    343344        boolean rv = true;
Note: See TracChangeset for help on using the changeset viewer.