/** * This method returns a newsrack DTD being referenced by the XML profile files. * * @param dtd Name of the dtd being requested. * @return Returns an input stream for reading the dtd, if the dtd exists and is accessible. Else * throws an IO exception */ public InputStream getDTD(String dtd) throws java.io.IOException { if (dtd.indexOf(File.separator) != -1) throw new java.io.IOException("Cannot have / in dtd name. Access denied"); String DTD_DIR = NewsRack.getWebappPath() + File.separator + NewsRack.getProperty("dtdDir"); String dtdPath = DTD_DIR + File.separator + dtd; System.out.println("Returning IS for " + dtdPath); return new FileInputStream(dtdPath); }
public static void main(String[] args) { if (args.length < 2) { System.out.println( "Usage: java newsrack.database.sql.scripts.UserMigration <properties-file> <action> [<other-optional-args>]"); System.exit(0); } String appPropertiesFile = args[0]; String action = args[1]; System.out.println("Properties file: " + appPropertiesFile); NewsRack.startup(null, appPropertiesFile); if (action.equals("migrate")) { migrateAllV1UsersToV2(); } else if (action.equals("update")) { updateArtCounts(); } else if (action.equals("migrate-user")) { migrateUser(args[2]); } else if (action.equals("fixup-feeds")) { updateFeedNames(); } else { System.out.println("Unknown action:" + action); } System.out.println("All Done!"); System.exit(0); }