portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r647801 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/ components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/ jetspeed-api/src/main/java/org/apa...
Date Mon, 14 Apr 2008 14:03:30 GMT
Author: ate
Date: Mon Apr 14 07:03:24 2008
New Revision: 647801

URL: http://svn.apache.org/viewvc?rev=647801&view=rev
Log:
Provide JetspeedDeploy with the concrete target contextName instead of having it determine
it itself based on the target war file which turns out to be quite unreliable.
Warning: this adds a new method parameter (contextName) to the api!  

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/deploy/DeployFactory.java
    portals/jetspeed-2/portal/trunk/maven/jetspeed-deploy-maven-plugin/src/main/java/org/apache/jetspeed/maven/plugins/DeployMojo.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java?rev=647801&r1=647800&r2=647801&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeploy.java
Mon Apr 14 07:03:24 2008
@@ -46,7 +46,7 @@
 {
     public static void main(String[] args) throws Exception
     {
-        if (args.length < 2)
+        if (args.length < 3)
         {
             printUsage();
             System.exit(1);
@@ -55,11 +55,11 @@
         
         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++;
             } else {
@@ -70,11 +70,11 @@
             }
         }
         
-        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");
+        System.out.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");
         System.out.println("                     (required when targetting application servers
like JBoss)");
@@ -84,11 +84,11 @@
 
     private final byte[] buffer = new byte[4096];
 
-    public JetspeedDeploy(String inputName, String outputName, boolean stripLoggers) throws
Exception {
-        this(inputName, outputName, stripLoggers, null);
+    public JetspeedDeploy(String inputName, String outputName, String contextName, boolean
stripLoggers) throws Exception {
+        this(inputName, outputName, contextName, stripLoggers, null);
     }
     
-    public JetspeedDeploy(String inputName, String outputName, boolean stripLoggers, String
forcedVersion) throws Exception
+    public JetspeedDeploy(String inputName, String outputName, String contextName, boolean
stripLoggers, String forcedVersion) throws Exception
     {
         File tempFile = null;
         JarFile jin = null;
@@ -98,7 +98,7 @@
 
         try
         {
-            String portletApplicationName = getPortletApplicationName(outputName);
+            String portletApplicationName = contextName;
             tempFile = File.createTempFile(portletApplicationName, "");
             tempFile.deleteOnExit();
 
@@ -333,27 +333,5 @@
                 jos.closeEntry();
             }
         }
-    }
-
-    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;
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java?rev=647801&r1=647800&r2=647801&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-deploy-tools/src/main/java/org/apache/jetspeed/tools/deploy/JetspeedDeployFactory.java
Mon Apr 14 07:03:24 2008
@@ -39,9 +39,9 @@
      * @param stripLoggers
      * @return JetspeedDeploy instance
      */
-    public Deploy getInstance(String inputWarPath, String outputWarPath, boolean stripLoggers)
throws Exception
+    public Deploy getInstance(String inputWarPath, String outputWarPath, String contextName,
boolean stripLoggers) throws Exception
     {
-        return new JetspeedDeploy(inputWarPath, outputWarPath, stripLoggers);
+        return new JetspeedDeploy(inputWarPath, outputWarPath, contextName, stripLoggers);
     }
 
     /**
@@ -53,8 +53,8 @@
      * @param forcedVersion
      * @return JetspeedDeploy instance
      */
-    public Deploy getInstance(String inputWarPath, String outputWarPath, boolean stripLoggers,
String forcedVersion) throws Exception
+    public Deploy getInstance(String inputWarPath, String outputWarPath, String contextName,
boolean stripLoggers, String forcedVersion) throws Exception
     {
-        return new JetspeedDeploy(inputWarPath, outputWarPath, stripLoggers, forcedVersion);
+        return new JetspeedDeploy(inputWarPath, outputWarPath, contextName, stripLoggers,
forcedVersion);
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java?rev=647801&r1=647800&r2=647801&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/deployment/impl/DeployPortletAppEventListener.java
Mon Apr 14 07:03:24 2008
@@ -216,7 +216,7 @@
         try
         {
             File toFile = new File(webAppDir, event.getName());
-            new JetspeedDeploy(event.getPath(), toFile.getAbsolutePath(), stripLoggers);
+            new JetspeedDeploy(event.getPath(), toFile.getAbsolutePath(), event.getName(),
stripLoggers);
             event.setStatus(DeploymentStatus.STATUS_OKAY);
         }
         catch (Exception e)

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/deploy/DeployFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/deploy/DeployFactory.java?rev=647801&r1=647800&r2=647801&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/deploy/DeployFactory.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/deploy/DeployFactory.java
Mon Apr 14 07:03:24 2008
@@ -32,7 +32,7 @@
      * @param stripLoggers
      * @return Deploy instance
      */
-    public Deploy getInstance(String inputWarPath, String outputWarPath, boolean stripLoggers)
throws Exception;
+    public Deploy getInstance(String inputWarPath, String outputWarPath, String contextName,
boolean stripLoggers) throws Exception;
 
     /**
      * getInstance
@@ -43,5 +43,5 @@
      * @param forcedVersion
      * @return Deploy instance
      */
-    public Deploy getInstance(String inputWarPath, String outputWarPath, boolean stripLoggers,
String forcedVersion) throws Exception;
+    public Deploy getInstance(String inputWarPath, String outputWarPath, String contextName,
boolean stripLoggers, String forcedVersion) throws Exception;
 }

Modified: portals/jetspeed-2/portal/trunk/maven/jetspeed-deploy-maven-plugin/src/main/java/org/apache/jetspeed/maven/plugins/DeployMojo.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/maven/jetspeed-deploy-maven-plugin/src/main/java/org/apache/jetspeed/maven/plugins/DeployMojo.java?rev=647801&r1=647800&r2=647801&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/maven/jetspeed-deploy-maven-plugin/src/main/java/org/apache/jetspeed/maven/plugins/DeployMojo.java
(original)
+++ portals/jetspeed-2/portal/trunk/maven/jetspeed-deploy-maven-plugin/src/main/java/org/apache/jetspeed/maven/plugins/DeployMojo.java
Mon Apr 14 07:03:24 2008
@@ -419,12 +419,7 @@
                 File tmpTarget = null;
                 try
                 {
-                    String contextName = dobj.deployment.targetName;
-                    if (contextName.endsWith(".war"))
-                    {
-                        contextName = contextName.substring(0,contextName.length()-4);
-                    }
-                    tmpTarget = File.createTempFile(contextName+"-infused.war", "");
+                    tmpTarget = File.createTempFile(dobj.src.getName()+".infused-", "");
                     tmpTarget.deleteOnExit();
                 }
                 catch (IOException e)
@@ -433,7 +428,7 @@
                 }
                 try
                 {
-                    deployFactory.getInstance(dobj.src.getAbsolutePath(), tmpTarget.getAbsolutePath(),
dobj.deployment.infusionStripLoggers.booleanValue(), dobj.deployment.infusionForcedVersion);
+                    deployFactory.getInstance(dobj.src.getAbsolutePath(), tmpTarget.getAbsolutePath(),
dobj.deployment.targetName, dobj.deployment.infusionStripLoggers.booleanValue(), dobj.deployment.infusionForcedVersion);
                     dobj.src = tmpTarget;
                 }
                 catch (Exception e)



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message