svnno****@sourc*****
svnno****@sourc*****
2008年 6月 25日 (水) 15:33:34 JST
Revision: 995 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=995 Author: sone Date: 2008-06-25 15:33:34 +0900 (Wed, 25 Jun 2008) Log Message: ----------- apply patch 'r669899: Fix incorrect setting of the target contextName of portlet apps when hot deploying from the deploy folder' Modified Paths: -------------- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/tools/deploy/DeployFactory.java -------------- next part -------------- Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java 2008-06-25 05:12:58 UTC (rev 994) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java 2008-06-25 06:33:34 UTC (rev 995) @@ -47,7 +47,7 @@ public static void main(String[] args) throws Exception { - if (args.length < 2) + if (args.length < 3) { printUsage(); System.exit(1); @@ -56,14 +56,14 @@ boolean stripLoggers = false; String version = null; - for (int i = 0; i < args.length - 2; i++) + for (int i = 0; i < args.length - 3; i++) { String option = args[i]; if (option.equals("-s")) { stripLoggers = true; } - else if (option.equals("-v") && i < args.length - 3) + else if (option.equals("-v") && i < args.length - 4) { version = args[i + 1]; i++; @@ -77,14 +77,14 @@ } } - new JetspeedDeploy(args[args.length - 2], args[args.length - 1], - stripLoggers, version); + new JetspeedDeploy(args[args.length - 3], args[args.length - 2], + args[args.length - 1], stripLoggers, version); } private static void printUsage() { System.out - .println("Usage: java -jar jetspeed-deploy-tools-<version>.jar [options] INPUT OUTPUT"); + .println("Usage: java -jar jetspeed-deploy-tools-<version>.jar [options] INPUT OUTPUT CONTEXT"); System.out.println("Options:"); System.out .println(" -s: stripLoggers - remove commons-logging[version].jar and/or log4j[version].jar from war"); @@ -99,14 +99,16 @@ private final byte[] buffer = new byte[4096]; public JetspeedDeploy(String inputName, String outputName, - boolean stripLoggers) throws Exception + String contextName, boolean stripLoggers) throws Exception { - this(inputName, outputName, stripLoggers, null); + this(inputName, outputName, contextName, stripLoggers, null); } public JetspeedDeploy(String inputName, String outputName, - boolean stripLoggers, String forcedVersion) throws Exception + String contextName, boolean stripLoggers, String forcedVersion) + throws Exception { + File tempFile = null; JarFile jin = null; JarOutputStream jout = null; @@ -115,7 +117,7 @@ try { - String portletApplicationName = getPortletApplicationName(outputName); + String portletApplicationName = contextName; tempFile = File.createTempFile(portletApplicationName, ""); tempFile.deleteOnExit(); @@ -355,26 +357,4 @@ } } } - - protected String getPortletApplicationName(String path) - { - File file = new File(path); - String name = file.getName(); - String portletApplicationName = name; - - int index = name.lastIndexOf("-infused.war"); - if (index > -1) - { - portletApplicationName = name.substring(0, index); - } - else - { - index = name.lastIndexOf("."); - if (index > -1) - { - portletApplicationName = name.substring(0, index); - } - } - return portletApplicationName; - } } \ No newline at end of file Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java 2008-06-25 05:12:58 UTC (rev 994) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/deploy-tool/src/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java 2008-06-25 06:33:34 UTC (rev 995) @@ -25,11 +25,23 @@ public class JetspeedDeployFactory implements DeployFactory { + public JetspeedDeployFactory() + { + } + /** - * JetspeedDeployFactory + * getInstance + * + * @param inputWarPath + * @param outputWarPath + * @param stripLoggers + * @return JetspeedDeploy instance */ - public JetspeedDeployFactory() + public Deploy getInstance(String inputWarPath, String outputWarPath, + String contextName, boolean stripLoggers) throws Exception { + return new JetspeedDeploy(inputWarPath, outputWarPath, contextName, + stripLoggers); } /** @@ -38,11 +50,14 @@ * @param inputWarPath * @param outputWarPath * @param stripLoggers + * @param forcedVersion * @return JetspeedDeploy instance */ public Deploy getInstance(String inputWarPath, String outputWarPath, - boolean stripLoggers) throws Exception + String contextName, boolean stripLoggers, String forcedVersion) + throws Exception { - return new JetspeedDeploy(inputWarPath, outputWarPath, stripLoggers); + return new JetspeedDeploy(inputWarPath, outputWarPath, contextName, + stripLoggers, forcedVersion); } } Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java 2008-06-25 05:12:58 UTC (rev 994) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/components/portal/src/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java 2008-06-25 06:33:34 UTC (rev 995) @@ -244,9 +244,12 @@ { try { - File toFile = new File(webAppDir, event.getName()); + String fileName = event.getName(); + File toFile = new File(webAppDir, fileName); + String contextName = fileName.substring(0, fileName.length() - 4); // strip + // ".war" new JetspeedDeploy(event.getPath(), toFile.getAbsolutePath(), - stripLoggers); + contextName, stripLoggers); event.setStatus(DeploymentStatus.STATUS_OKAY); } catch (Exception e) Modified: pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/tools/deploy/DeployFactory.java =================================================================== --- pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/tools/deploy/DeployFactory.java 2008-06-25 05:12:58 UTC (rev 994) +++ pal-portal/branches/pal-portal-1.x/portal/jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/tools/deploy/DeployFactory.java 2008-06-25 06:33:34 UTC (rev 995) @@ -22,6 +22,7 @@ * @author <a href="mailto:rwatl****@apach*****">Randy Watler</a> * @version $Id: DeployFactory.java 516881 2007-03-11 10:34:21Z ate $ */ + public interface DeployFactory { @@ -34,5 +35,18 @@ * @return Deploy instance */ public Deploy getInstance(String inputWarPath, String outputWarPath, - boolean stripLoggers) throws Exception; + String contextName, boolean stripLoggers) throws Exception; + + /** + * getInstance + * + * @param inputWarPath + * @param outputWarPath + * @param stripLoggers + * @param forcedVersion + * @return Deploy instance + */ + public Deploy getInstance(String inputWarPath, String outputWarPath, + String contextName, boolean stripLoggers, String forcedVersion) + throws Exception; }