[jboss-cvs] JBossAS SVN: r95327 - in projects/ejb3/trunk/package-manager: docs/guide/en/modules and 26 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 21 14:14:56 EDT 2009


Author: jaikiran
Date: 2009-10-21 14:14:55 -0400 (Wed, 21 Oct 2009)
New Revision: 95327

Added:
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageContext.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerContext.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/DependencyManager.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/IvyDependencyManager.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/DependencyResoultionException.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InvalidPackageException.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageManagerException.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageContext.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerContext.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/main/
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/main/Main.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackagedDependency.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackagedDependencyImpl.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/UnProcessedDependenciesImpl.java
   projects/ejb3/trunk/package-manager/src/main/resources/ivy-default-settings.xml
   projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/
   projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/
   projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/DependencyInstallTestCase.java
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/build.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-just-install-file.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-packaged-dependency.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-pre-install-script.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/build.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package1.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package2.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package3.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/ivy.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-multiple-packaged-dependencies.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-unprocessed-dependencies.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/post-install-build.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/pre-install-build.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/some-deployer-jboss-beans.xml
Removed:
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageSource.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InstallerException.java
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/build.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-just-install-file.xml
   projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-pre-install-script.xml
Modified:
   projects/ejb3/trunk/package-manager/docs/guide/en/modules/components.xml
   projects/ejb3/trunk/package-manager/pom.xml
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManager.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerEnvironment.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageRetrievalException.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/ScriptProcessingException.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerImpl.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/AbstractInstaller.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/DefaultInstaller.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/Installer.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/MergingInstaller.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Dependencies.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Script.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/DependenciesImpl.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/ScriptImpl.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/PackageRetriever.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/FileSystemPackageRetriever.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/HttpPackageRetriever.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/ScriptProcessor.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/impl/AntScriptProcessor.java
   projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/xml/PackageUnmarshaller.java
   projects/ejb3/trunk/package-manager/src/main/resources/package.xsd
   projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java
   projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/install/unit/BasicInstallTestCase.java
   projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml
Log:
EJBTHREE-1942 Dependency management support added and other refactorings

Modified: projects/ejb3/trunk/package-manager/docs/guide/en/modules/components.xml
===================================================================
--- projects/ejb3/trunk/package-manager/docs/guide/en/modules/components.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/docs/guide/en/modules/components.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -292,7 +292,7 @@
 
                         <tbody>
                             <row>
-                                <entry>script</entry>
+                                <entry>file</entry>
                                 <entry>Mandatory</entry>
                                 <entry></entry>
                                 <entry>The value of this attribute, is the relative path to the script file (including

Modified: projects/ejb3/trunk/package-manager/pom.xml
===================================================================
--- projects/ejb3/trunk/package-manager/pom.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/pom.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -145,6 +145,13 @@
             <version>4.0</version>
         </dependency>
 
+        <!-- We use Ivy by default, for dependency management -->
+        <dependency>
+            <groupId>org.apache.ivy</groupId>
+            <artifactId>ivy</artifactId>
+            <version>2.1.0</version>
+        </dependency>
+
         <!-- Tests -->
         <dependency>
             <groupId>junit</groupId>

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageContext.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageContext.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageContext.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,61 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.ejb3.packagemanager.metadata.Package;
+
+/**
+ * PackageContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PackageContext
+{
+
+   /**
+    * Returns the source of the package
+    * 
+    * @return
+    */
+   URL getPackageSource();
+   
+   /**
+    * The root of the package where it has been
+    * extracted
+    * @return
+    */
+   File getPackageRoot();
+   
+   /**
+    * Returns the package metadata parsed out of 
+    * the package.xml file available in the package source.
+    * 
+    *  @see #getPackageSource()
+    * 
+    * @return
+    */
+   Package getPackage();
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManager.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManager.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManager.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -23,7 +23,7 @@
 
 import java.net.URL;
 
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.installer.Installer;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 import org.jboss.ejb3.packagemanager.metadata.Script;
@@ -65,17 +65,17 @@
     * Installs a package 
     * 
     * @param packagePath The URL path of the package file
-    * @throws InstallerException If any exceptions occur during installation
+    * @throws PackageManagerException If any exceptions occur during installation
     */
-   void installPackage(String packagePath) throws InstallerException;
+   void installPackage(String packagePath) throws PackageManagerException;
    
    /**
     * Installs a package 
     * 
     * @param packageURL The URL of the package file
-    * @throws InstallerException If any exceptions occur during installation
+    * @throws PackageManagerException If any exceptions occur during installation
     */
-   void installPackage(URL packageURL) throws InstallerException;
+   void installPackage(URL packageURL) throws PackageManagerException;
    
    /**
     * Removes a package using the name of the package
@@ -90,12 +90,6 @@
     */
    Installer getInstaller(InstallFile fileMeta);
    
-   /**
-    * Returns an appropriate {@link ScriptProcessor} for the {@link Script}
-    * @param script The script in a package
-    * @return
-    */
-   ScriptProcessor getScriptProcessor(Script script);
    
    /**
     * A package manager works against a JBoss AS server. This method returns the 

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerContext.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerContext.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerContext.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.ejb3.packagemanager;
+
+
+/**
+ * Author: Jaikiran Pai
+ */
+public interface PackageManagerContext
+{
+    /**
+     * Returns the package manager environment
+     * associated with this context
+     * 
+     * @return
+     */
+    PackageManagerEnvironment getPackageManagerEnvironment();
+
+    /**
+     * Returns the JBoss Server Home absolute path
+      * @return
+     */
+    String getJBossServerHome();
+    
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerEnvironment.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerEnvironment.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManagerEnvironment.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -22,6 +22,9 @@
 package org.jboss.ejb3.packagemanager;
 
 import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * PackageManagerEnvironment
@@ -37,13 +40,22 @@
    private File packageManagerBuildDir;
 
    private File packageManagerTmpDir;
+   
+   private Map<String, String> properties = new HashMap<String, String>();
 
    /**
     * 
     */
    public PackageManagerEnvironment(String home)
    {
+      this(home, new HashMap<String, String>());
+   }
+   
+   public PackageManagerEnvironment(String home, Map<String, String> props)
+   {
       this.packageManagerHome = new File(home);
+      this.properties = props == null ? new HashMap<String, String>() : props;
+      
       if (!this.packageManagerHome.exists() || !this.packageManagerHome.isDirectory())
       {
          throw new RuntimeException("Package manager home " + home + " doesn't exist or is not a directory");
@@ -80,4 +92,20 @@
    {
       return this.packageManagerTmpDir;
    }
+   
+   public String getProperty(String propertyName)
+   {
+      return this.properties.get(propertyName);
+   }
+   
+   public void setProperty(String propertyName, String propertyValue)
+   {
+      this.properties.put(propertyName, propertyValue);
+      
+   }
+   
+   public Map<String, String> getProperties()
+   {
+      return Collections.unmodifiableMap(this.properties);
+   }
 }

Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageSource.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageSource.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageSource.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.packagemanager;
-
-import java.io.File;
-
-import org.jboss.ejb3.packagemanager.metadata.Package;
-import org.jboss.ejb3.packagemanager.xml.PackageUnmarshaller;
-
-/**
- * PackageSource
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class PackageSource
-{
-
-   private File pkgSource;
-
-   private Package packageMetadata;
-
-   /**
-    * 
-    */
-   public PackageSource(String packageFilePath)
-   {
-      this(new File(packageFilePath));
-   }
-
-   public PackageSource(File src)
-   {
-      this.pkgSource = src;
-      initMetadata();
-   }
-
-   private void initMetadata()
-   {
-      File packageXmlFile = new File(this.pkgSource, "package.xml");
-      try
-      {
-         this.packageMetadata = new PackageUnmarshaller().unmarshal(packageXmlFile.toURL());
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Could not create metadata from package.xml file " + packageXmlFile, e);
-      }
-   }
-
-   public Package getPackageMetadata()
-   {
-      return this.packageMetadata;
-   }
-
-   public File getSource()
-   {
-      return this.pkgSource;
-   }
-   
-   /**
-    * Returns the string representation of this {@link PackageSource}
-    */
-   public String toString()
-   {
-      StringBuffer sb = new StringBuffer();
-      sb.append("Package [source = ");
-      sb.append(this.pkgSource);
-      sb.append(" ,name = ");
-      sb.append(this.packageMetadata.getName());
-      sb.append(" ,version = ");
-      sb.append(this.packageMetadata.getVersion());
-      sb.append(" ]");
-      return sb.toString();
-   }
-}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/DependencyManager.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/DependencyManager.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/DependencyManager.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.dependency;
+
+import java.util.Set;
+
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.exception.DependencyResoultionException;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+
+/**
+ * DependencyManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface DependencyManager
+{
+
+   Set<PackageContext> resolveDepedencies(PackageManagerContext pkgMgrContext, PackageContext pkgCtx, UnProcessedDependencies deps)
+         throws DependencyResoultionException;
+}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/IvyDependencyManager.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/IvyDependencyManager.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/IvyDependencyManager.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,269 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.dependency.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.LogOptions;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.retrieve.RetrieveOptions;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.util.filter.Filter;
+import org.apache.ivy.util.filter.FilterHelper;
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.dependency.DependencyManager;
+import org.jboss.ejb3.packagemanager.exception.DependencyResoultionException;
+import org.jboss.ejb3.packagemanager.exception.InvalidPackageException;
+import org.jboss.ejb3.packagemanager.impl.DefaultPackageContext;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+import org.jboss.logging.Logger;
+
+/**
+ * IvyDependencyManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class IvyDependencyManager implements DependencyManager
+{
+
+   public static final String PROPERTY_IVY_SETTINGS_FILE = "ivy.settings.file";
+
+   /**
+    * Logger
+    */
+   private Logger logger = Logger.getLogger(IvyDependencyManager.class);
+
+   /**
+    * 
+    * @param pkgMgrContext
+    * @param deps
+    * @return
+    * @throws DependencyResoultionException
+    */
+   @Override
+   public Set<PackageContext> resolveDepedencies(PackageManagerContext pkgMgrContext, PackageContext pkgCtx,
+         UnProcessedDependencies deps) throws DependencyResoultionException
+   {
+      IvySettings ivySettings = new IvySettings();
+      // set the basedir to the package root
+      ivySettings.setBaseDir(pkgCtx.getPackageRoot());
+      logger.info("Ivy basedir is " + ivySettings.getBaseDir());
+
+      // get hold of the ivy settings xml file
+      URL ivySettingsFile = this.getIvySettingsFile(pkgMgrContext, pkgCtx);
+      if (ivySettingsFile == null)
+      {
+         throw new DependencyResoultionException("Ivy settings file not found for package manager " + pkgMgrContext);
+      }
+      logger.info("Ivy settings file " + ivySettingsFile + " being used for dependency resolution of " + pkgCtx);
+      // create an ivy instance
+      Ivy ivy = Ivy.newInstance(ivySettings);
+      try
+      {
+         // configure Ivy (repos, etc...) through the settings file
+         ivy.configure(ivySettingsFile);
+
+         // file containing the list of dependencies (ex: ivy.xml)
+         File dependencyFile = new File(pkgCtx.getPackageRoot(), deps.getFile());
+         // resolve the dependencies
+         ResolveReport resolveReport = ivy.resolve(dependencyFile);
+         // check for errors (if any) during resolve
+         if (resolveReport.hasError())
+         {
+            List<String> problems = resolveReport.getAllProblemMessages();
+            if (problems != null && !problems.isEmpty())
+            {
+               StringBuffer errorMsgs = new StringBuffer();
+               for (String problem : problems)
+               {
+                  errorMsgs.append(problem);
+                  errorMsgs.append("\n");
+               }
+               logger.error("Errors encountered during dependency resolution for package " + pkgCtx + " :");
+               logger.error(errorMsgs);
+               throw new DependencyResoultionException("Dependencies could not be resolved for package " + pkgCtx);
+            }
+         }
+         // Now that the dependencies have been resolved, let now retrieve them
+         ModuleDescriptor md = resolveReport.getModuleDescriptor();
+         // the dependency packages will be retrieved to a sub folder under the package manager's
+         // tmp folder
+         File pkgTmpDir = new File(pkgMgrContext.getPackageManagerEnvironment().getPackageManagerTmpDir(), pkgCtx
+               .getPackage().getName());
+         pkgTmpDir.mkdir();
+
+         ModuleRevisionId mRID = md.getModuleRevisionId();
+         RetrieveOptions retrieveOptions = new RetrieveOptions();
+
+         String pattern = pkgTmpDir.getAbsolutePath() + "/[organization]/[module]/[type]/[artifact]-[revision].[ext]";
+         retrieveOptions.setDestIvyPattern(pattern);
+         // We only retrieve "jar" type artifacts (i.e. we are *not* interested in "source"
+         // or "javadoc" or any other artifact types
+         Filter jarArtifactFilter = FilterHelper.getArtifactTypeFilter("jar");
+         retrieveOptions.setArtifactFilter(jarArtifactFilter);
+
+         // default logging option
+         retrieveOptions.setLog(LogOptions.LOG_DEFAULT);
+         // retrieve them!
+         int packagesRetrieved = ivy.retrieve(mRID, pattern, retrieveOptions);
+         logger.info("Retrieved " + packagesRetrieved + " dependencies for package " + pkgCtx);
+         Set<PackageContext> depPkgCtxs = new HashSet<PackageContext>();
+         // for each of the retrieved packages, create a package context
+         for (File depPkg : getJarFilesRecursively(pkgTmpDir))
+         {
+            PackageContext depPkgCtx;
+            try
+            {
+               depPkgCtx = new DefaultPackageContext(pkgMgrContext, depPkg.toURI().toURL());
+               depPkgCtxs.add(depPkgCtx);
+            }
+            catch (InvalidPackageException e)
+            {
+               // this is not a package file so skip it and log a WARN message
+               logger.warn("Skipping dependency file " + depPkg
+                     + " since it's not a package. Was listed as a dependency of " + pkgCtx);
+               continue;
+            }
+
+         }
+         return depPkgCtxs;
+      }
+      catch (IOException ioe)
+      {
+         throw new DependencyResoultionException(ioe);
+      }
+      catch (ParseException pe)
+      {
+         throw new DependencyResoultionException(pe);
+      }
+
+   }
+
+   /**
+    * Returns the URL to the Ivy settings file. The Ivy settings file is searched for in the
+    * following order:
+    * <ol>
+    *   <li>
+    *       First the <code>pkgCtx</code> is searched for a file named ivy-settings.xml at the 
+    *       root of the package {@link PackageContext#getPackageRoot()}. If such a file is 
+    *       found, the URL corresponding to it, is returned. 
+    *   </li>
+    *   <li>
+    *       If not found in the package, the JVM system level property {@link #PROPERTY_IVY_SETTINGS_FILE}
+    *       is checked to see if any value is set. If set, then the corresponding value is used as the
+    *       absolute file path to the Ivy settings file. The URL corresponding to this file is returned
+    *   </li>
+    *   <li>
+    *       If neither of the above to steps find the settings file, then the default ivy-default-settings.xml
+    *       packaged within the package manager is used. 
+    *   </li>
+    *   <li>
+    *       If none of the above steps lead to the settings file, then NULL is returned
+    *   </li>
+    * </ol>
+    * 
+    * @param pkgMrgCtx Package manager context
+    * @param pkgCtx The context of the package being processed
+    * @return Returns the URL to the Ivy settings file. If no suitable file is found then this method returns null
+    */
+   private URL getIvySettingsFile(PackageManagerContext pkgMrgCtx, PackageContext pkgCtx)
+   {
+      // first check for ivy-settings.xml at the root of the package 
+      File ivySettingsInPackage = new File(pkgCtx.getPackageRoot(), "ivy-settings.xml");
+      if (ivySettingsInPackage.exists())
+      {
+         try
+         {
+            return ivySettingsInPackage.toURI().toURL();
+         }
+         catch (MalformedURLException mue)
+         {
+            throw new RuntimeException(mue);
+         }
+      }
+      // The ivy-settings.xml wasn't available in the package, so now check
+      // whether the jvm system level property was set to point to the settings file.
+      String ivySettingsLocation = System.getProperty(PROPERTY_IVY_SETTINGS_FILE);
+      if (ivySettingsLocation != null)
+      {
+         File userSpecifiedIvySettings = new File(ivySettingsLocation);
+         try
+         {
+            return userSpecifiedIvySettings.toURI().toURL();
+         }
+         catch (MalformedURLException e)
+         {
+            throw new RuntimeException("Incorrect location " + userSpecifiedIvySettings + " specified for "
+                  + PROPERTY_IVY_SETTINGS_FILE + " property");
+         }
+      }
+      // if the property was *not* set to point to a specific ivy settings file,
+      // then fallback on the ivy-default-settings.xml file which is packaged within the package manager jar
+
+      // TODO: This needs to be more fool proof to ensure that we 
+      // pick up the ivy-default-settings.xml file from within the package manager
+      // jar and not some other file in the classpath. Probably use the CodeSource?
+      return pkgMrgCtx.getClass().getClassLoader().getResource("ivy-default-settings.xml");
+
+   }
+
+   /**
+    * 
+    * @param parent
+    * @return
+    */
+   private List<File> getJarFilesRecursively(File parent)
+   {
+      List<File> result = new ArrayList<File>();
+      File[] filesAndDirs = parent.listFiles();
+      List<File> filesDirs = Arrays.asList(filesAndDirs);
+      for (File file : filesDirs)
+      {
+         if (file.isFile() && file.getName().endsWith(".jar"))
+         {
+            result.add(file);
+         }
+         else if (file.isDirectory())
+         {
+            //recursive call!
+            List<File> deeperList = getJarFilesRecursively(file);
+            result.addAll(deeperList);
+         }
+      }
+      return result;
+
+   }
+}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/DependencyResoultionException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/DependencyResoultionException.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/DependencyResoultionException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.exception;
+
+/**
+ * DependencyResoultionException
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DependencyResoultionException extends PackageManagerException
+{
+
+   public DependencyResoultionException(String msg)
+   {
+      super(msg);
+   }
+
+   public DependencyResoultionException(Exception e)
+   {
+      super(e);
+   }
+
+   public DependencyResoultionException(String msg, Exception e)
+   {
+      super(msg, e);
+   }
+}

Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InstallerException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InstallerException.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InstallerException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.packagemanager.exception;
-
-/**
- * InstallerException
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class InstallerException extends Exception
-{
-
-   public InstallerException(String msg)
-   {
-      super(msg);
-   }
-   
-   public InstallerException(Exception e)
-   {
-      super(e);
-   }
-   
-   public InstallerException(String msg, Exception e)
-   {
-      super(msg,e);
-   }
-}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InvalidPackageException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InvalidPackageException.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/InvalidPackageException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.exception;
+
+/**
+ * InvalidPackageException
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class InvalidPackageException extends PackageManagerException
+{
+
+   public InvalidPackageException(String msg)
+   {
+      super(msg);
+   }
+}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageManagerException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageManagerException.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageManagerException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.packagemanager.exception;
+
+/**
+ * InstallerException
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class PackageManagerException extends Exception
+{
+
+   public PackageManagerException(String msg)
+   {
+      super(msg);
+   }
+   
+   public PackageManagerException(Exception e)
+   {
+      super(e);
+   }
+   
+   public PackageManagerException(String msg, Exception e)
+   {
+      super(msg,e);
+   }
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageRetrievalException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageRetrievalException.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageRetrievalException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -27,7 +27,7 @@
  * @author Jaikiran Pai
  * @version $Revision: $
  */
-public class PackageRetrievalException extends Exception
+public class PackageRetrievalException extends PackageManagerException
 {
    public PackageRetrievalException(String msg)
    {

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/ScriptProcessingException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/ScriptProcessingException.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/ScriptProcessingException.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -27,7 +27,7 @@
  * @author Jaikiran Pai
  * @version $Revision: $
  */
-public class ScriptProcessingException extends Exception
+public class ScriptProcessingException extends PackageManagerException
 {
    public ScriptProcessingException(String msg)
    {

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageContext.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageContext.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageContext.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,186 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.exception.InvalidPackageException;
+import org.jboss.ejb3.packagemanager.exception.PackageRetrievalException;
+import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.retriever.PackageRetriever;
+import org.jboss.ejb3.packagemanager.retriever.impl.PackageRetrievalFactory;
+import org.jboss.ejb3.packagemanager.util.IOUtil;
+import org.jboss.ejb3.packagemanager.xml.PackageUnmarshaller;
+
+/**
+ * DefaultPackageContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DefaultPackageContext implements PackageContext
+{
+
+   /**
+    * Source of the of the package
+    */
+   private URL packageSource;
+
+   /**
+    * The root folder where the package is extracted during
+    * package manager operation(s)
+    */
+   private File packageRoot;
+
+   /**
+    * The package manager context
+    */
+   private PackageManagerContext pkgMgrCtx;
+
+   /**
+    * The package metadata
+    */
+   private org.jboss.ejb3.packagemanager.metadata.Package pkg;
+
+   /**
+    * Constructs a package context out of a package source, for 
+    * a package manager context
+    * 
+    * @param pkgMgrCtx Package manager context
+    * @param packageSrc Source of the package
+    */
+   public DefaultPackageContext(PackageManagerContext pkgMgrCtx, URL packageSrc) throws InvalidPackageException
+   {
+      this.packageSource = packageSrc;
+      this.pkgMgrCtx = pkgMgrCtx;
+      initPackageContext();
+   }
+
+   /**
+    * @see PackageContext#getPackageSource()
+    */
+   @Override
+   public URL getPackageSource()
+   {
+      return this.packageSource;
+   }
+
+   /**
+    * @see PackageContext#getPackageRoot()
+    */
+   @Override
+   public File getPackageRoot()
+   {
+      return this.packageRoot;
+   }
+
+   /**
+    * @see PackageContext#getPackage()
+    */
+   @Override
+   public Package getPackage()
+   {
+      return this.pkg;
+   }
+
+   /**
+    * Retrieves the package from the package source and 
+    * extracts it the package manager's build folder. It also parses the package.xml 
+    * file in the package and creates metadata out of it.
+    * 
+    */
+   private void initPackageContext() throws InvalidPackageException
+   {
+      // retrieve the package and extract it to our build folder
+      PackageRetriever pkgRetriever = PackageRetrievalFactory.getPackageRetriever(this.packageSource);
+      try
+      {
+         File pkg = pkgRetriever.retrievePackage(this.pkgMgrCtx, this.packageSource);
+         // the directory to which the package will be extracted
+         this.packageRoot = new File(pkgMgrCtx.getPackageManagerEnvironment().getPackageManagerBuildDir(), pkg
+               .getName());
+         if (!this.packageRoot.exists())
+         {
+            this.packageRoot.mkdirs();
+         }
+         JarFile jar = new JarFile(pkg);
+         IOUtil.extractJarFile(this.packageRoot, jar);
+         // validate that it contains a package.xml
+         File packageXml = new File(this.packageRoot, "package.xml");
+         if (!packageXml.exists())
+         {
+            throw new InvalidPackageException(pkg + " is not a valid package - it does not contain a package.xml");
+         }
+      }
+      catch (PackageRetrievalException pre)
+      {
+         throw new RuntimeException(pre);
+      }
+      catch (IOException ioe)
+      {
+         throw new RuntimeException("Exception while creating context for " + this.packageSource, ioe);
+      }
+
+      // now that package has been retrieved and extracted, lets parse the package.xml
+      this.initPackageMetadata();
+   }
+
+   /**
+    * Parses the package.xml file and creates metadata out of it
+    */
+   private void initPackageMetadata()
+   {
+      File packageXmlFile = new File(this.packageRoot, "package.xml");
+      try
+      {
+         this.pkg = new PackageUnmarshaller().unmarshal(packageXmlFile.toURI().toURL());
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Could not create metadata from package.xml file " + packageXmlFile, e);
+      }
+   }
+
+   @Override
+   public String toString()
+   {
+      StringBuffer sb = new StringBuffer();
+      sb.append("Package [name=");
+      String pkgName = this.pkg == null ? null : this.pkg.getName();
+      sb.append(pkgName);
+      sb.append(" ,version=");
+      String pkgVersion = this.pkg == null ? null : this.pkg.getVersion();
+      sb.append(pkgVersion);
+      //      sb.append(" ,source=");
+      //      sb.append(this.packageSource);
+      //      sb.append(" ,root=");
+      //      sb.append(this.packageRoot);
+      sb.append("]");
+      return sb.toString();
+
+   }
+}

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerContext.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerContext.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerContext.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.impl;
+
+import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
+
+/**
+ * DefaultPackageManagerContext
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DefaultPackageManagerContext implements PackageManagerContext
+{
+
+   /**
+    * The package manager to which this context corresponds
+    */
+   private PackageManager pkgMgr;
+
+   /**
+    * Constructs a context for the {@code pkgMgr}
+    *  
+    * @param pkgMgr The package manager to which this context corresponds
+    */
+   public DefaultPackageManagerContext(PackageManager pkgMgr)
+   {
+      this.pkgMgr = pkgMgr;
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.PackageManagerContext#getJBossServerHome()
+    */
+   @Override
+   public String getJBossServerHome()
+   {
+      return this.pkgMgr.getServerHome();
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.PackageManagerContext#getPackageManagerEnvironment()
+    */
+   @Override
+   public PackageManagerEnvironment getPackageManagerEnvironment()
+   {
+      return this.pkgMgr.getPackageManagerEnvironment();
+   }
+
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerImpl.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerImpl.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -26,13 +26,16 @@
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.List;
+import java.util.Set;
 
+import org.jboss.ejb3.packagemanager.PackageContext;
 import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
-import org.jboss.ejb3.packagemanager.PackageSource;
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
-import org.jboss.ejb3.packagemanager.exception.PackageRetrievalException;
-import org.jboss.ejb3.packagemanager.exception.ScriptProcessingException;
+import org.jboss.ejb3.packagemanager.dependency.DependencyManager;
+import org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.installer.DefaultInstaller;
 import org.jboss.ejb3.packagemanager.installer.Installer;
 import org.jboss.ejb3.packagemanager.installer.MergingInstaller;
@@ -40,11 +43,11 @@
 import org.jboss.ejb3.packagemanager.metadata.FileType;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
 import org.jboss.ejb3.packagemanager.metadata.PostInstall;
 import org.jboss.ejb3.packagemanager.metadata.PreInstall;
 import org.jboss.ejb3.packagemanager.metadata.Script;
-import org.jboss.ejb3.packagemanager.retriever.PackageRetriever;
-import org.jboss.ejb3.packagemanager.retriever.impl.PackageRetrievalFactory;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
 import org.jboss.ejb3.packagemanager.script.ScriptProcessor;
 import org.jboss.ejb3.packagemanager.script.impl.AntScriptProcessor;
 import org.jboss.logging.Logger;
@@ -75,6 +78,11 @@
    private PackageManagerEnvironment environment;
 
    /**
+    * Package manager context
+    */
+   private PackageManagerContext pkgMgrCtx;
+
+   /**
     * Creates the default package manager for a server 
     * 
     * @param environment The package manager environment
@@ -84,6 +92,7 @@
    {
       this.environment = environment;
       this.installationServerHome = jbossHome;
+      this.pkgMgrCtx = new DefaultPackageManagerContext(this);
    }
 
    /**
@@ -106,15 +115,15 @@
     * Installs a package
     * 
     * @param pkgPath The URL to the package that is to be installed
-    * @throws InstallerException If any exceptions occur during installation of the package
+    * @throws PackageManagerException If any exceptions occur during installation of the package
     * @see org.jboss.ejb3.packagemanager.PackageManager#installPackage(java.lang.String)
     */
    @Override
-   public void installPackage(String pkgPath) throws InstallerException
+   public void installPackage(String pkgPath) throws PackageManagerException
    {
       if (pkgPath == null)
       {
-         throw new InstallerException("Package path is null");
+         throw new PackageManagerException("Package path is null");
       }
       URL packageURL = null;
       try
@@ -123,7 +132,7 @@
       }
       catch (MalformedURLException mue)
       {
-         throw new InstallerException("Cannot parse path " + pkgPath, mue);
+         throw new PackageManagerException("Cannot parse path " + pkgPath, mue);
       }
       this.installPackage(packageURL);
    }
@@ -132,50 +141,58 @@
     * Installs the package from the {@code packageURL}
     * 
     * @param packageURL The URL to the package that is to be installed
-    * @throws InstallerException If any exceptions occur during installation of the package
+    * @throws PackageManagerException If any exceptions occur during installation of the package
     * @see org.jboss.ejb3.packagemanager.PackageManager#installPackage(URL)
     * 
     */
    @Override
-   public void installPackage(URL packageURL) throws InstallerException
+   public void installPackage(URL packageURL) throws PackageManagerException
    {
       if (packageURL == null)
       {
-         throw new InstallerException("Package URL is null");
+         throw new PackageManagerException("Package URL is null");
       }
-      // get the appropriate retriever
-      PackageRetriever pkgRetriever = PackageRetrievalFactory.getPackageRetriever(packageURL);
-      // retrieve the package source
-      PackageSource pkgSource = null;
-      try
+
+      // create a package context
+      PackageContext pkgCtx = new DefaultPackageContext(this.pkgMgrCtx, packageURL);
+      this.installPackage(pkgCtx);
+
+   }
+
+   /**
+    * 
+    * @param pkgContext
+    * @throws PackageManagerException
+    */
+   public void installPackage(PackageContext pkgContext) throws PackageManagerException
+   {
+      if (pkgContext == null)
       {
-         logger.debug("Retrieving package from " + packageURL + " using retriever " + pkgRetriever);
-         pkgSource = pkgRetriever.retrievePackage(this, packageURL);
+         throw new PackageManagerException("Package context is null");
       }
-      catch (PackageRetrievalException pre)
-      {
-         throw new InstallerException("Could not retrieve package: " + packageURL, pre);
-      }
       // proceed with installation of the package
-      Package pkgToInstall = pkgSource.getPackageMetadata();
+      Package pkgToInstall = pkgContext.getPackage();
       if (pkgToInstall.getFiles() == null)
       {
-         throw new InstallerException("There are no files to install for package: " + pkgToInstall.getName()
+         throw new PackageManagerException("There are no files to install for package: " + pkgToInstall.getName()
                + " version: " + pkgToInstall.getVersion());
       }
-      // work on dependencies first
-      this.processDependencies(pkgSource);
+      // work on dependencies first (because if deps are not satisfied then no point
+      // running the pre-install step.
+      // BUT, think about this (should we first run pre-install and then deps?). 
+      // What would be a ideal behaviour? 
+      this.installDependencies(pkgContext);
       // pre-installation step
-      this.preInstallPackage(pkgSource);
+      this.preInstallPackage(pkgContext);
       // install files in this package
       for (InstallFile fileToInstall : pkgToInstall.getFiles())
       {
          Installer installer = getInstaller(fileToInstall);
-         installer.install(this, pkgSource, fileToInstall);
+         installer.install(this.pkgMgrCtx, pkgContext, fileToInstall);
       }
       // post-installation step
-      this.postInstallPackage(pkgSource);
-
+      this.postInstallPackage(pkgContext);
+      logger.info("Installed " + pkgContext);
    }
 
    /**
@@ -254,36 +271,70 @@
       return new DefaultInstaller();
    }
 
+   private DependencyManager getDependencyManager(UnProcessedDependencies dependencies)
+   {
+      if (dependencies == null)
+      {
+         return null;
+      }
+      String depManagerClassName = dependencies.getManager();
+      if (depManagerClassName == null)
+      {
+         // our default is ivy dependency manager
+         return new IvyDependencyManager();
+      }
+      Class<?> dependencyManager = null;
+      // load the script processor
+      try
+      {
+         dependencyManager = Class.forName(depManagerClassName, true, Thread.currentThread().getContextClassLoader());
+      }
+      catch (ClassNotFoundException cnfe)
+      {
+         throw new RuntimeException("Could not load dependency manager: " + depManagerClassName, cnfe);
+      }
+      // make sure the dependency manager specified in the metadata
+      // does indeed implement the DependencyManager interface
+      if (!DependencyManager.class.isAssignableFrom(dependencyManager))
+      {
+         throw new RuntimeException("Dependency manager " + depManagerClassName + " does not implement "
+               + DependencyManager.class);
+      }
+      try
+      {
+         return (DependencyManager) dependencyManager.newInstance();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Could not instantiate dependency manager " + depManagerClassName, e);
+      }
+
+   }
+
    /**
     * The pre-installation step for packages. Each package can have multiple 
     * pre-install scripts to be run. This method runs those pre-install scripts
     * 
-    * @param pkgSource The package source
-    * @throws InstallerException If any exception occurs during pre-installation of the 
+    * @param pkgCtx The package source
+    * @throws PackageManagerException If any exception occurs during pre-installation of the 
     * package
     */
-   protected void preInstallPackage(PackageSource pkgSource) throws InstallerException
+   protected void preInstallPackage(PackageContext pkgCtx) throws PackageManagerException
    {
-      Package pkgMetadata = pkgSource.getPackageMetadata();
+      Package pkgMetadata = pkgCtx.getPackage();
       // find any pre-install scripts
       PreInstall preInstall = pkgMetadata.getPreInstall();
       if (preInstall == null || preInstall.getScripts() == null || preInstall.getScripts().isEmpty())
       {
-         logger.debug("There are no pre-install scripts for " + pkgSource);
+         logger.debug("There are no pre-install scripts for " + pkgCtx);
          return;
       }
       for (Script script : preInstall.getScripts())
       {
-         ScriptProcessor scriptProcessor = this.getScriptProcessor(script);
-         try
-         {
-            scriptProcessor.processScript(this, pkgSource, script);
-         }
-         catch (ScriptProcessingException spe)
-         {
-            throw new InstallerException("Error while processing script: " + script.getFile() + " for " + pkgSource,
-                  spe);
-         }
+         // TODO: Can we just have one instance of the script processor to process
+         // all scripts? Stateful/stateless?
+         ScriptProcessor scriptProcessor = new AntScriptProcessor();
+         scriptProcessor.processScript(this.pkgMgrCtx, pkgCtx, script);
       }
 
    }
@@ -292,170 +343,130 @@
     * The post-installation step for packages. Each package can have multiple 
     * post-install scripts to be run. This method runs those post-install scripts
     * 
-    * @param pkgSource The package source
-    * @throws InstallerException If any exception occurs during post-installation of the 
+    * @param pkgCtx The package source
+    * @throws PackageManagerException If any exception occurs during post-installation of the 
     * package
     */
-   protected void postInstallPackage(PackageSource pkgSource) throws InstallerException
+   protected void postInstallPackage(PackageContext pkgCtx) throws PackageManagerException
    {
-      Package pkgMetadata = pkgSource.getPackageMetadata();
+      Package pkgMetadata = pkgCtx.getPackage();
       // find any post-install scripts
       PostInstall postInstall = pkgMetadata.getPostInstall();
       if (postInstall == null || postInstall.getScripts() == null || postInstall.getScripts().isEmpty())
       {
-         logger.debug("There are no post-install scripts for " + pkgSource);
+         logger.debug("There are no post-install scripts for " + pkgCtx);
          return;
       }
       for (Script script : postInstall.getScripts())
       {
-         ScriptProcessor scriptProcessor = this.getScriptProcessor(script);
-         try
-         {
-            scriptProcessor.processScript(this, pkgSource, script);
-         }
-         catch (ScriptProcessingException spe)
-         {
-            throw new InstallerException("Error while processing script: " + script.getFile() + " for " + pkgSource,
-                  spe);
-         }
+         ScriptProcessor scriptProcessor = new AntScriptProcessor();
+         // TODO: Can we just have one instance of the script processor to process
+         // all scripts? Stateful/stateless?
+         scriptProcessor.processScript(this.pkgMgrCtx, pkgCtx, script);
+
       }
    }
 
    /**
     * Process any dependencies listed for the package. Dependency processing
     * will include resolving and retrieving the appropriate dependency packages
-    * and install (/un-installing?) those packages.
+    * and install those packages. Dependency packages, either in the form of {@link PackagedDependency}
+    * or {@link UnProcessedDependencies} will be installed during this process.
     * 
-    * TODO: Work-in-progress
-    * @param pkgSource
-    * @throws InstallerException
+    * First the packaged dependencies are installed and then the unprocessed dependencies
+    * 
+    * @param pkgContext
+    * @throws PackageManagerException
     */
-   protected void processDependencies(PackageSource pkgSource) throws InstallerException
+   protected void installDependencies(PackageContext pkgContext) throws PackageManagerException
    {
-      Package pkgMeta = pkgSource.getPackageMetadata();
-      Dependencies dependencies = pkgMeta.getDependencies();
-      if (dependencies == null)
-      {
-         logger.debug(pkgSource + " does not have any dependencies");
-         return;
-      }
-      File dependencyFile = new File(pkgSource.getSource(), dependencies.getFile());
-      if (!dependencyFile.exists())
-      {
-         throw new InstallerException("Dependency file " + dependencyFile + " not found for " + pkgSource);
-      }
-
+      // first process packaged dependencies
+      installPackagedDependencies(pkgContext);
+      // now now process the dependencies, that have been listed in a dependency file, through
+      // a dependency manager
+      installUnProcessedPackages(pkgContext);
    }
 
    /**
-    * One of the entry points to the package manager.
-    * Accepts the command line arguments and carries out appropriate operations
-    * through the package-manager.
+    * Processes {@link UnProcessedDependencies} by using the dependency manager specified
+    * through {@link UnProcessedDependencies#getManager()}
     * 
-    *  TODO: The command line arguments, haven't yet been finalized
-    * 
-    * @param args
+    * @param pkgContext The package context for which the dependencies are being resolved
+    * @throws PackageManagerException If any exceptions occur while processing the dependencies for the package
     */
-   public static void main(String[] args)
+   protected void installUnProcessedPackages(PackageContext pkgContext) throws PackageManagerException
    {
-      logger.debug("comm line length = " + args.length);
-      StringBuffer sb = new StringBuffer();
-      for (String arg : args)
+      Package pkgMeta = pkgContext.getPackage();
+      Dependencies dependencies = pkgMeta.getDependencies();
+      if (dependencies == null || dependencies.getUnProcessedDependencies() == null)
       {
-         sb.append(arg);
-         sb.append(" ");
+         logger.debug("No unprocessed dependencies for " + pkgContext);
+         return;
       }
-      logger.debug(DefaultPackageManagerImpl.class + " invoked with args: " + sb.toString());
-
-      Getopt getOpt = new Getopt("packagemanager", args, "i:u:e:s:p:");
-      int opt;
-      String packageFilePath = null;
-      String jbossHome = null;
-      String packageNameToUninstall = null;
-      String pmHome = System.getProperty("java.io.tmpdir");
-      while ((opt = getOpt.getopt()) != -1)
+      UnProcessedDependencies unProcessedDeps = dependencies.getUnProcessedDependencies();
+      File dependencyFile = new File(pkgContext.getPackageRoot(), unProcessedDeps.getFile());
+      if (!dependencyFile.exists())
       {
-         switch (opt)
-         {
-            case 'i' :
-               packageFilePath = getOpt.getOptarg();
-               break;
-            case 'u' :
-               packageFilePath = getOpt.getOptarg();
-               break;
-            case 'e' :
-               packageNameToUninstall = getOpt.getOptarg();
-               break;
-            case 's' :
-               jbossHome = getOpt.getOptarg();
-               break;
-            case 'p' :
-               pmHome = getOpt.getOptarg();
-               break;
-            default :
-               throw new Error("Unhandled code " + opt);
-         }
+         throw new PackageManagerException("Dependency file " + dependencyFile + " not found for " + pkgContext);
       }
-      if (jbossHome == null || packageFilePath == null)
+      DependencyManager depManager = this.getDependencyManager(unProcessedDeps);
+      if (depManager == null)
       {
-         throw new Error("JBoss home or package file not specified");
+         return;
       }
-      PackageManagerEnvironment env = new PackageManagerEnvironment(pmHome);
-      PackageManager pm = new DefaultPackageManagerImpl(env, jbossHome);
-
-      // install the package
-      try
+      Set<PackageContext> dependencyPackages = depManager.resolveDepedencies(this.pkgMgrCtx, pkgContext,
+            unProcessedDeps);
+      if (dependencyPackages == null || dependencyPackages.isEmpty())
       {
-         pm.installPackage(packageFilePath);
+         logger.debug("Dependency manager did not find any dependency packages to be installed for " + pkgContext);
+         return;
       }
-      catch (InstallerException ie)
+      for (PackageContext dependencyPkg : dependencyPackages)
       {
-         throw new RuntimeException(ie);
+         logger.info("Installing dependency package: " + dependencyPkg + " for dependent package: " + pkgContext);
+         this.installPackage(dependencyPkg);
       }
-
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.PackageManager#getScriptProcessor(org.jboss.ejb3.packagemanager.metadata.Script)
+    * Processes packaged dependencies {@link PackagedDependency} of a package. These
+    * dependency packages are installed during this process.
+    *  
+    * @param pkgContext
+    * @throws PackageManagerException
     */
-   public ScriptProcessor getScriptProcessor(Script script)
+   protected void installPackagedDependencies(PackageContext pkgContext) throws PackageManagerException
    {
-      if (script == null)
+      Package pkgMeta = pkgContext.getPackage();
+      Dependencies dependencies = pkgMeta.getDependencies();
+      if (dependencies == null || dependencies.getPackagedDependencies() == null
+            || dependencies.getPackagedDependencies().isEmpty())
       {
-         return null;
+         logger.debug("No packaged dependency for " + pkgContext);
+         return;
       }
-      String scriptProcessorClassName = script.getProcessor();
-      if (scriptProcessorClassName == null)
+      List<PackagedDependency> packagedDeps = dependencies.getPackagedDependencies();
+      for (PackagedDependency packagedDep : packagedDeps)
       {
-         // our default is ant script processor
-         return new AntScriptProcessor();
+         String relativePathToDependencyPackage = packagedDep.getFile();
+         File dependencyPackage = new File(pkgContext.getPackageRoot(), relativePathToDependencyPackage);
+         if (!dependencyPackage.exists())
+         {
+            throw new PackageManagerException("packaged-dependency file " + dependencyPackage + " does not exist");
+         }
+         PackageContext dependencyPkgCtx;
+         try
+         {
+            dependencyPkgCtx = new DefaultPackageContext(this.pkgMgrCtx, dependencyPackage.toURI().toURL());
+         }
+         catch (MalformedURLException mue)
+         {
+            throw new RuntimeException(mue);
+         }
+
+         logger.info("Installing packaged dependency: " + dependencyPkgCtx + " for dependent package: " + pkgContext);
+         this.installPackage(dependencyPkgCtx);
       }
-      Class<?> scriptProcessor = null;
-      // load the script processor
-      try
-      {
-         scriptProcessor = Class
-               .forName(scriptProcessorClassName, true, Thread.currentThread().getContextClassLoader());
-      }
-      catch (ClassNotFoundException cnfe)
-      {
-         throw new RuntimeException("Could not load script processor: " + scriptProcessorClassName, cnfe);
-      }
-      // make sure the script processor specified in the metadata
-      // does indeed implement the ScriptProcessor interface
-      if (!ScriptProcessor.class.isAssignableFrom(scriptProcessor))
-      {
-         throw new RuntimeException("Script processor " + scriptProcessorClassName + " does not implement "
-               + ScriptProcessor.class);
-      }
-      try
-      {
-         return (ScriptProcessor) scriptProcessor.newInstance();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Could not instantiate script processor " + scriptProcessorClassName, e);
-      }
+   }
 
-   }
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/AbstractInstaller.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/AbstractInstaller.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/AbstractInstaller.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -23,9 +23,9 @@
 
 import java.io.File;
 
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 import org.jboss.ejb3.packagemanager.metadata.Package;
 import org.jboss.logging.Logger;
@@ -42,39 +42,40 @@
    private static Logger logger = Logger.getLogger(AbstractInstaller.class);
 
    /**
-    * @see org.jboss.ejb3.packagemanager.installer.Installer#install(org.jboss.ejb3.packagemanager.PackageSource, org.jboss.ejb3.packagemanager.metadata.InstallFile)
+    * @see org.jboss.ejb3.packagemanager.installer.Installer#install(org.jboss.ejb3.packagemanager.PackageManagerContext, org.jboss.ejb3.packagemanager.PackageContext, InstallFile)
     */
-   public final void install(PackageManager pkgManager, PackageSource pkgSource, InstallFile fileMeta)
-         throws InstallerException
+   @Override
+   public final void install(PackageManagerContext pkgMgrCtx, PackageContext pkgCtx, InstallFile fileMeta)
+         throws PackageManagerException
    {
       // do templating
-      File pkgRoot = pkgSource.getSource();
+      File pkgRoot = pkgCtx.getPackageRoot();
       File srcPathOfFileToInstall = pkgRoot;
       if (fileMeta.getSrcPath() != null)
       {
          srcPathOfFileToInstall = new File(pkgRoot, fileMeta.getSrcPath());
       }
       File fileToInstall = new File(srcPathOfFileToInstall, fileMeta.getName());
-      Package pkg = pkgSource.getPackageMetadata();
+      Package pkg = pkgCtx.getPackage();
       if (!fileToInstall.exists())
       {
-         throw new InstallerException(fileToInstall.getAbsolutePath() + " does not exist, package: " + pkg.getName()
-               + " version: " + pkg.getVersion() + " being installed from " + pkgSource.getSource()
+         throw new PackageManagerException(fileToInstall.getAbsolutePath() + " does not exist, package: " + pkg.getName()
+               + " version: " + pkg.getVersion() + " being installed from " + pkgCtx.getPackageRoot()
                + " is probably corrupt!");
       }
 
       if (fileMeta.getDestPath() == null)
       {
-         throw new InstallerException("File " + fileMeta.getName() + " in package: " + pkg.getName() + " version: "
+         throw new PackageManagerException("File " + fileMeta.getName() + " in package: " + pkg.getName() + " version: "
                + pkg.getVersion() + " does not specify a destination");
       }
-      String destServerHome = pkgManager.getServerHome();
+      String destServerHome = pkgMgrCtx.getJBossServerHome();
       File locationToInstall = new File(destServerHome, fileMeta.getDestPath());
       // TODO: Provide an option on <file> to allow for creating missing destination folders
       // Till then just throw an exception if dest-path is not actually available
       if (!locationToInstall.exists() || !locationToInstall.isDirectory())
       {
-         throw new InstallerException("dest-path " + locationToInstall.getAbsolutePath() + " for file: "
+         throw new PackageManagerException("dest-path " + locationToInstall.getAbsolutePath() + " for file: "
                + fileMeta.getName() + " in package: " + pkg.getName() + " version: " + pkg.getVersion()
                + " is either not present or is not a directory");
       }
@@ -95,7 +96,7 @@
    }
 
    protected abstract void doInstall(InstallFile fileMetadata, File fileToInstall, File dest)
-         throws InstallerException;
+         throws PackageManagerException;
 
 
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/DefaultInstaller.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/DefaultInstaller.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/DefaultInstaller.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -24,7 +24,7 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 import org.jboss.ejb3.packagemanager.metadata.Package;
 import org.jboss.ejb3.packagemanager.util.IOUtil;
@@ -45,7 +45,7 @@
     * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFile, java.io.File, java.io.File)
     */
    @Override
-   protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws InstallerException
+   protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws PackageManagerException
    {
       // just copy from source to dest
       File destFile = new File(dest, fileMetadata.getName());
@@ -62,7 +62,7 @@
       catch (IOException e)
       {
 
-         throw new InstallerException("Could not install file: " + fileMetadata.getName() + " from package: "
+         throw new PackageManagerException("Could not install file: " + fileMetadata.getName() + " from package: "
                + pkgMeta.getName() + " version: " + pkgMeta.getVersion() + " into " + dest.getAbsolutePath());
       }
 

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/Installer.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/Installer.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/Installer.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,9 +21,9 @@
 */
 package org.jboss.ejb3.packagemanager.installer;
 
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 
 /**
@@ -35,5 +35,5 @@
 public interface Installer
 {
 
-   void install(PackageManager pkgMgr, PackageSource pkgSource, InstallFile file) throws InstallerException;
+   void install(PackageManagerContext pkgMgrCtx, PackageContext pkgCtx, InstallFile file) throws PackageManagerException;
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/MergingInstaller.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/MergingInstaller.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/MergingInstaller.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -23,7 +23,7 @@
 
 import java.io.File;
 
-import org.jboss.ejb3.packagemanager.exception.InstallerException;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 
 /**
@@ -32,17 +32,17 @@
  * @author Jaikiran Pai
  * @version $Revision: $
  */
-public class MergingInstaller extends AbstractInstaller
+public class MergingInstaller extends DefaultInstaller//AbstractInstaller
 {
 
    /**
     * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFile, java.io.File, java.io.File)
     */
    @Override
-   protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws InstallerException
+   protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws PackageManagerException
    {
-      // TODO Auto-generated method stub
-
+      
+      super.doInstall(fileMetadata, fileToInstall, dest);
    }
 
 }

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/main/Main.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/main/Main.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/main/Main.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,99 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.main;
+
+import gnu.getopt.Getopt;
+
+import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
+import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
+import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
+
+/**
+ * Main
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class Main
+{
+
+   /**
+    * One of the entry points to the package manager.
+    * Accepts the command line arguments and carries out appropriate operations
+    * through the package-manager.
+    * 
+    *  TODO: The command line arguments, haven't yet been finalized
+    * 
+    * @param args
+    */
+   public static void main(String[] args)
+   {
+      Getopt getOpt = new Getopt("packagemanager", args, "i:u:e:s:p:");
+      int opt;
+      String packageFilePath = null;
+      String jbossHome = null;
+      String packageNameToUninstall = null;
+      String pmHome = System.getProperty("java.io.tmpdir");
+      while ((opt = getOpt.getopt()) != -1)
+      {
+         switch (opt)
+         {
+            case 'i' :
+               packageFilePath = getOpt.getOptarg();
+               break;
+            case 'u' :
+               packageFilePath = getOpt.getOptarg();
+               break;
+            case 'e' :
+               packageNameToUninstall = getOpt.getOptarg();
+               break;
+            case 's' :
+               jbossHome = getOpt.getOptarg();
+               break;
+            case 'p' :
+               pmHome = getOpt.getOptarg();
+               break;
+            default :
+               throw new Error("Unhandled code " + opt);
+         }
+      }
+      if (jbossHome == null || packageFilePath == null)
+      {
+         throw new Error("JBoss home or package file not specified");
+      }
+      PackageManagerEnvironment env = new PackageManagerEnvironment(pmHome);
+      PackageManager pm = new DefaultPackageManagerImpl(env, jbossHome);
+
+      // install the package
+      try
+      {
+         pm.installPackage(packageFilePath);
+      }
+      catch (PackageManagerException ie)
+      {
+         throw new RuntimeException(ie);
+      }
+
+   }
+
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Dependencies.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Dependencies.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Dependencies.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,59 +21,63 @@
  */
 package org.jboss.ejb3.packagemanager.metadata;
 
+import java.util.List;
+
 /**
  * Represents the metadata for dependencies within a package.
  * 
- * A package can have dependencies on other packages. Dependencies are configured in
- * separate files. The dependencies element just points to that file. The file path is
- * relative to the location of the package.xml within a package.
- * Optionally a dependency manager can be specified through the
- * "manager" attribute. The manager attribute should contain the fully qualified class name
- * of the dependency manager which is responsible for parsing the dependencies file and
- * managing the dependencies listed in that file. The class should implement the
- * org.jboss.ejb3.packagemanager.dependency.DependencyManager interface.
- * By default, org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager will be
- * used as the dependency manager.
+ * A package can have dependencies on other packages. Dependencies can be specified
+ *               and provided in 2 ways.
+ *                   1) A package which depends on other packages can package those dependencies
+ *               within it package jar/zip file. It can then use the "package-dependency"
+ *               element to list such dependencies. 
+ *                   2) Dependencies can be listed separately in a file. The "unprocessed-dependencies" element points
+ *               to that file.
+ *               Irrespective of how the dependencies are specified, the dependencies must always be packages.
  *             
  * @see Package
+ * @author Jaikiran Pai
  * 
- * 
  */
 public interface Dependencies
 {
 
    /**
-    * @return Returns the file path (including the filename) of the dependencies file,
-    *  relative  to the location of package.xml file in the package
+    * Returns the list of packaged dependencies of a package
+    * @return
     */
-   String getFile();
-
+   List<PackagedDependency> getPackagedDependencies();
+   
    /**
-    * Sets the file path (including hte filename) of the dependencies file.
+    * Sets the list of packaged dependencies of a package
+    * @param packagedDependencies
+    */
+   void setPackagedDependencies(List<PackagedDependency> packagedDependencies);
+   
+   /**
+    * Adds a packaged dependency to the list of packaged dependencies
     * 
-    * @param depFile Relative file path of the dependencies file of this package
-    *     
+    * @param packagedDep
     */
-   void setFile(String depFile);
+   void addPackagedDependency(PackagedDependency packagedDep);
    
    /**
-    * Returns the fully qualified class name of the dependencies manager.
-    * 
+    * Returns the unprocessed dependencies of a package
     * @return
     */
-   String getManager();
+   UnProcessedDependencies getUnProcessedDependencies();
    
    /**
-    * Sets the fully qualified class name of the dependencies manager.
-    * 
-    * @param depManager Fully qualified class name of the dependencies manager
+    * Sets the unprocessed dependencies of a package
+    *  
+    * @param unProcessedDependencies
     */
-   void setManager(String depManager);
+   void setUnProcessedDependencies(UnProcessedDependencies unProcessedDependencies);
    
    /**
-    * Returns the package for which this is an dependency
+    * Returns the package to which this dependencies correspond to
+    * 
     * @return
     */
    Package getPackage();
-
 }

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackagedDependency.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackagedDependency.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackagedDependency.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.metadata;
+
+/**
+ * PackagedDependency
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PackagedDependency
+{
+   String getFile();
+   
+   void setFile(String file);
+   
+   /**
+    * Returns the package for which this is an dependency
+    * @return
+    */
+   Package getPackage();
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Script.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Script.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Script.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,7 +21,6 @@
 */
 package org.jboss.ejb3.packagemanager.metadata;
 
-import org.jboss.ejb3.packagemanager.script.ScriptProcessor;
 
 /**
  * ScriptMetadata
@@ -49,24 +48,24 @@
     */
    void setFile(String scriptFile);
    
-   /**
-    * Returns the fully qualified name of the class which implements
-    * {@link ScriptProcessor} and is responsible for processing the 
-    * {@link #getFile()} script file
-    * @return
-    */
-   String getProcessor();
+//   /**
+//    * Returns the fully qualified name of the class which implements
+//    * {@link ScriptProcessor} and is responsible for processing the 
+//    * {@link #getFile()} script file
+//    * @return
+//    */
+//   String getProcessor();
+//   
+//   /**
+//    * Sets the script processor which is responsible for processing the
+//    * {@link #getFile()} script file
+//    * 
+//    * @param scriptProcessor Fully qualified name of the class which implements
+//    *   {@link ScriptProcessor} 
+//    */
+//   void setProcessor(String scriptProcessor);
    
    /**
-    * Sets the script processor which is responsible for processing the
-    * {@link #getFile()} script file
-    * 
-    * @param scriptProcessor Fully qualified name of the class which implements
-    *   {@link ScriptProcessor} 
-    */
-   void setProcessor(String scriptProcessor);
-   
-   /**
     * Returns the package installation phase, during which this script
     * is expected to be executed
     *  

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.metadata;
+
+/**
+ * UnProcessedDependencies
+ * 
+ *
+ * The "unprocessed-dependencies"  element is used to point to the file containing a list of dependencies
+ * of the package. The "file" attribute is relative to the location of the package.xml within the package.
+ * Optionally a dependency manager can be specified through the "manager" attribute. The manager attribute should
+ * contain the fully qualified class name of the dependency manager which is responsible for parsing the
+ * dependencies file and managing the dependencies listed in that file. The class should implement the
+ * org.jboss.ejb3.packagemanager.dependency.DependencyManager interface.
+ * By default, org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager will be
+ * used as the dependency manager. 
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface UnProcessedDependencies
+{
+
+   /**
+    * @return Returns the file path (including the filename) of the dependencies file,
+    *  relative  to the location of package.xml file in the package
+    */
+   String getFile();
+
+   /**
+    * Sets the file path (including hte filename) of the dependencies file.
+    * 
+    * @param depFile Relative file path of the dependencies file of this package
+    *     
+    */
+   void setFile(String depFile);
+   
+   /**
+    * Returns the fully qualified class name of the dependencies manager.
+    * 
+    * @return
+    */
+   String getManager();
+   
+   /**
+    * Sets the fully qualified class name of the dependencies manager.
+    * 
+    * @param depManager Fully qualified class name of the dependencies manager
+    */
+   void setManager(String depManager);
+   
+   /**
+    * Returns the package for which this is an dependency
+    * @return
+    */
+   Package getPackage();
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/DependenciesImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/DependenciesImpl.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/DependenciesImpl.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,9 +21,22 @@
  */
 package org.jboss.ejb3.packagemanager.metadata.impl;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.jboss.ejb3.packagemanager.metadata.Dependencies;
 import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
 
+/**
+ * 
+ * DependenciesImpl
+ *
+ * @see Dependencies
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
 public class DependenciesImpl implements Dependencies
 {
 
@@ -33,14 +46,14 @@
    private Package pkg;
 
    /**
-    * Fully qualified class name of the dependencies manager
+    * Unprocessed dependencies
     */
-   private String depManager;
+   private UnProcessedDependencies unProcessedDeps;
 
    /**
-    * The file containing the dependencies 
+    * A list of packaged dependencies 
     */
-   private String file;
+   private List<PackagedDependency> packagedDeps;
 
    /**
     * Constructor
@@ -52,46 +65,69 @@
    }
 
    /**
-    * Returns the file path, which contains the dependency listing.
-    * The file path is relative to the location of package.xml in the package
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackagedDependencies()
     */
-   public String getFile()
+   @Override
+   public List<PackagedDependency> getPackagedDependencies()
    {
-      return file;
+      return this.packagedDeps;
    }
 
    /**
-    * Sets the file path containing the dependency listing.
-    * The file path is relative to the location of package.xml in the package
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getUnProcessedDependencies()
     */
-   public void setFile(String value)
+   @Override
+   public UnProcessedDependencies getUnProcessedDependencies()
    {
-      this.file = value;
+      return this.unProcessedDeps;
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackage()
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setPackagedDependencies(java.util.List)
     */
-   public Package getPackage()
+   @Override
+   public void setPackagedDependencies(List<PackagedDependency> packagedDependencies)
    {
-      return this.pkg;
+      this.packagedDeps = packagedDependencies;
+
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getManager()
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setUnProcessedDependencies(org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies)
     */
-   public String getManager()
+   @Override
+   public void setUnProcessedDependencies(UnProcessedDependencies unProcessedDependencies)
    {
-      return this.depManager;
+      this.unProcessedDeps = unProcessedDependencies;
+
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setManager(java.lang.String)
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackage()
     */
-   public void setManager(String depManager)
+   @Override
+   public Package getPackage()
    {
-      this.depManager = depManager;
+      return this.pkg;
 
    }
 
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#addPackagedDependency(org.jboss.ejb3.packagemanager.metadata.PackagedDependency)
+    */
+   @Override
+   public void addPackagedDependency(PackagedDependency packagedDep)
+   {
+      if (packagedDep == null)
+      {
+         return;
+      }
+      if (this.packagedDeps == null)
+      {
+         this.packagedDeps = new ArrayList<PackagedDependency>();
+      }
+      this.packagedDeps.add(packagedDep);
+
+   }
+
 }

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackagedDependencyImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackagedDependencyImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackagedDependencyImpl.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,79 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.metadata.impl;
+
+import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
+
+/**
+ * PackagedDependencyImpl
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class PackagedDependencyImpl implements PackagedDependency
+{
+
+   private Package pkg;
+   
+   private String file;
+   
+   public PackagedDependencyImpl(Package pkg)
+   {
+      this.pkg = pkg;
+       
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.PackagedDependency#getFile()
+    */
+   @Override
+   public String getFile()
+   {
+      return this.file;
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.PackagedDependency#getPackage()
+    */
+   @Override
+   public Package getPackage()
+   {
+      return this.pkg;
+      
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.PackagedDependency#setFile(java.lang.String)
+    */
+   @Override
+   public void setFile(String file)
+   {
+      if (file == null)
+      {
+         throw new IllegalArgumentException("A non-null file is mandatory for a packaged-dependency");
+      }
+      this.file = file;
+      
+   }
+   
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/ScriptImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/ScriptImpl.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/ScriptImpl.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -25,7 +25,7 @@
 import org.jboss.ejb3.packagemanager.metadata.Script;
 
 /**
- * ScriptMetadataImpl
+ * ScriptImpl
  *
  * @author Jaikiran Pai
  * @version $Revision: $
@@ -34,16 +34,11 @@
 {
 
    /**
-    * The script processor
+    * The script file (default is package-script.xml)
     */
-   private String scriptProcessor;
+   private String scriptFile = "package-script.xml";
 
    /**
-    * The script file
-    */
-   private String scriptFile;
-
-   /**
     * @see org.jboss.ejb3.packagemanager.metadata.Script#getFile()
     */
    public String getFile()
@@ -52,14 +47,6 @@
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.metadata.Script#getProcessor()
-    */
-   public String getProcessor()
-   {
-      return this.scriptProcessor;
-   }
-
-   /**
     * @see org.jboss.ejb3.packagemanager.metadata.Script#setFile(java.lang.String)
     */
    public void setFile(String scriptFile)
@@ -72,15 +59,6 @@
    }
 
    /**
-    * @see org.jboss.ejb3.packagemanager.metadata.Script#setProcessor(java.lang.String)
-    */
-   public void setProcessor(String scriptProcessor)
-   {
-      this.scriptProcessor = scriptProcessor;
-
-   }
-
-   /**
     * @see org.jboss.ejb3.packagemanager.metadata.Script#getScriptExecutionPhase()
     */
    public abstract PackageInstallationPhase getScriptExecutionPhase();

Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/UnProcessedDependenciesImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/UnProcessedDependenciesImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/UnProcessedDependenciesImpl.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,106 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.metadata.impl;
+
+import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+
+/**
+ * UnProcessedDependenciesImpl
+ * 
+ * Represents the metadata for unprocessed-dependencies element.
+ * 
+ * @see UnProcessedDependencies 
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class UnProcessedDependenciesImpl implements UnProcessedDependencies
+{
+
+   /**
+    * The package to which this dependency metadata corresponds
+    */
+   private Package pkg;
+
+   /**
+    * Fully qualified class name of the dependencies manager
+    */
+   private String depManager;
+
+   /**
+    * The file containing the dependencies 
+    */
+   private String file;
+
+   /**
+    * Constructor
+    * @param pkgMetadata The package to which this dependencies correspond
+    */
+   public UnProcessedDependenciesImpl(Package pkgMetadata)
+   {
+      this.pkg = pkgMetadata;
+   }
+
+   /**
+    * Returns the file path, which contains the dependency listing.
+    * The file path is relative to the location of package.xml in the package
+    */
+   public String getFile()
+   {
+      return file;
+   }
+
+   /**
+    * Sets the file path containing the dependency listing.
+    * The file path is relative to the location of package.xml in the package
+    */
+   public void setFile(String value)
+   {
+      this.file = value;
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackage()
+    */
+   public Package getPackage()
+   {
+      return this.pkg;
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getManager()
+    */
+   public String getManager()
+   {
+      return this.depManager;
+   }
+
+   /**
+    * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setManager(java.lang.String)
+    */
+   public void setManager(String depManager)
+   {
+      this.depManager = depManager;
+
+   }
+}

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/PackageRetriever.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/PackageRetriever.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/PackageRetriever.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,10 +21,10 @@
 */
 package org.jboss.ejb3.packagemanager.retriever;
 
+import java.io.File;
 import java.net.URL;
 
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.exception.PackageRetrievalException;
 
 /**
@@ -35,5 +35,5 @@
  */
 public interface PackageRetriever
 {
-   PackageSource retrievePackage(PackageManager pkgMgr, URL packagePath) throws PackageRetrievalException;
+   File retrievePackage(PackageManagerContext pkgMgrCtx, URL packagePath) throws PackageRetrievalException;
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/FileSystemPackageRetriever.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/FileSystemPackageRetriever.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/FileSystemPackageRetriever.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -22,15 +22,11 @@
 package org.jboss.ejb3.packagemanager.retriever.impl;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.URL;
-import java.util.jar.JarFile;
 
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.exception.PackageRetrievalException;
 import org.jboss.ejb3.packagemanager.retriever.PackageRetriever;
-import org.jboss.ejb3.packagemanager.util.IOUtil;
 
 /**
  * FileSystemPackageRetriever
@@ -42,9 +38,10 @@
 {
 
    /**
-    * @see org.jboss.ejb3.packagemanager.retriever.PackageRetriever#retrievePackage(org.jboss.ejb3.packagemanager.PackageManager, java.net.URL)
+    * @see org.jboss.ejb3.packagemanager.retriever.PackageRetriever#retrievePackage(PackageManagerContext, URL)
     */
-   public PackageSource retrievePackage(PackageManager pkgMgr, URL packagePathURL) throws PackageRetrievalException
+   @Override
+   public File retrievePackage(PackageManagerContext pkgMgrCtx, URL packagePathURL) throws PackageRetrievalException
    {
       if (packagePathURL == null)
       {
@@ -56,38 +53,8 @@
                + " can only retrieve package from a file: URL. It can't handle " + packagePathURL);
       }
       File pkg = new File(packagePathURL.getFile());
-      // TODO: There should be a better way to check for a jar file
-      if (!pkg.getName().endsWith(".jar"))
-      {
-         throw new PackageRetrievalException("File system package retriever can handle only .jar package files. " + pkg
-               + " is not a .jar file");
-      }
-      if (!pkg.exists())
-      {
-         throw new PackageRetrievalException("Package file " + pkg + " does not exist");
-      }
-      try
-      {
-         // the directory to which the package will be extracted
-         File extractedPkgDir = new File(pkgMgr.getPackageManagerEnvironment().getPackageManagerBuildDir(), pkg.getName());
-         if (!extractedPkgDir.exists())
-         {
-            extractedPkgDir.mkdirs();
-         }
-         JarFile jar = new JarFile(pkg);
-         IOUtil.extractJarFile(extractedPkgDir, jar);
-         // validate that it contains a package.xml
-         File packageXml = new File(extractedPkgDir, "package.xml");
-         if (!packageXml.exists())
-         {
-            throw new PackageRetrievalException(pkg + " is not a valid package - it does not contain a package.xml");
-         }
-         return new PackageSource(extractedPkgDir);
-      }
-      catch (IOException ioe)
-      {
-         throw new PackageRetrievalException("Error while processing package file " + pkg, ioe);
-      }
+      return pkg;
+
    }
 
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/HttpPackageRetriever.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/HttpPackageRetriever.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/retriever/impl/HttpPackageRetriever.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
-import java.util.jar.JarFile;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -36,11 +35,9 @@
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.exception.PackageRetrievalException;
 import org.jboss.ejb3.packagemanager.retriever.PackageRetriever;
-import org.jboss.ejb3.packagemanager.util.IOUtil;
 
 /**
  * HttpPackageRetriever
@@ -52,9 +49,10 @@
 {
 
    /**
-    * @see org.jboss.ejb3.packagemanager.retriever.PackageRetriever#retrievePackage(PackageManager, URL)
+    * @see org.jboss.ejb3.packagemanager.retriever.PackageRetriever#retrievePackage(PackageManagerContext, URL)
     */
-   public PackageSource retrievePackage(PackageManager pkgMgr, URL packagePath) throws PackageRetrievalException
+   @Override
+   public File retrievePackage(PackageManagerContext pkgMgrCtx, URL packagePath) throws PackageRetrievalException
    {
       if (!packagePath.getProtocol().equals("http"))
       {
@@ -71,16 +69,18 @@
       {
          throw new PackageRetrievalException("Exception while retrieving package " + packagePath, e);
       }
-      if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) 
+      if (httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK)
       {
-         throw new PackageRetrievalException("Http retrieval wasn't successful, returned status code  " + httpResponse.getStatusLine().getStatusCode());
+         throw new PackageRetrievalException("Http retrieval wasn't successful, returned status code  "
+               + httpResponse.getStatusLine().getStatusCode());
       }
       HttpEntity httpEntity = httpResponse.getEntity();
-      
+
       try
       {
          // TODO: should this tmp be deleted on exit?
-         File tmpPkgFile = File.createTempFile("tmp", ".jar", pkgMgr.getPackageManagerEnvironment().getPackageManagerTmpDir());
+         File tmpPkgFile = File.createTempFile("tmp", ".jar", pkgMgrCtx.getPackageManagerEnvironment()
+               .getPackageManagerTmpDir());
          FileOutputStream fos = new FileOutputStream(tmpPkgFile);
          BufferedOutputStream bos = null;
          BufferedInputStream bis = null;
@@ -91,7 +91,7 @@
             bis = new BufferedInputStream(is);
             byte[] content = new byte[4096];
             int length;
-            while ((length = bis.read(content)) != -1) 
+            while ((length = bis.read(content)) != -1)
             {
                bos.write(content, 0, length);
             }
@@ -108,24 +108,8 @@
                bis.close();
             }
          }
-   
-         // package has been retrieved to tmp location, now unpack it to a subfolder in package-manager build folder
-         File extractedPackageDir = new File(pkgMgr.getPackageManagerEnvironment().getPackageManagerBuildDir(), tmpPkgFile
-               .getName());
-         if (!extractedPackageDir.exists())
-         {
-            extractedPackageDir.mkdirs();
-         }
-         
-            IOUtil.extractJarFile(extractedPackageDir, new JarFile(tmpPkgFile));
-            // validate that it contains a package.xml
-            File packageXml = new File(extractedPackageDir, "package.xml");
-            if (!packageXml.exists())
-            {
-               throw new PackageRetrievalException(packagePath + " is not a valid package - it does not contain a package.xml");
-            }
-            // create a package source out of this
-            return new PackageSource(extractedPackageDir);
+         return tmpPkgFile;
+
       }
       catch (IOException ioe)
       {

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/ScriptProcessor.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/ScriptProcessor.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/ScriptProcessor.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -21,8 +21,8 @@
 */
 package org.jboss.ejb3.packagemanager.script;
 
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.exception.ScriptProcessingException;
 import org.jboss.ejb3.packagemanager.metadata.Script;
 
@@ -35,5 +35,5 @@
 public interface ScriptProcessor
 {
 
-   void processScript(PackageManager pkgManager, PackageSource pkgSource, Script script) throws ScriptProcessingException;
+   void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, Script script) throws ScriptProcessingException;
 }

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/impl/AntScriptProcessor.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/impl/AntScriptProcessor.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/impl/AntScriptProcessor.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -27,8 +27,8 @@
 import org.apache.tools.ant.BuildListener;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
-import org.jboss.ejb3.packagemanager.PackageManager;
-import org.jboss.ejb3.packagemanager.PackageSource;
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
 import org.jboss.ejb3.packagemanager.exception.ScriptProcessingException;
 import org.jboss.ejb3.packagemanager.metadata.PackageInstallationPhase;
 import org.jboss.ejb3.packagemanager.metadata.Script;
@@ -50,27 +50,29 @@
    private static Logger logger = Logger.getLogger(AntScriptProcessor.class);
 
    /**
-    * @see org.jboss.ejb3.packagemanager.script.ScriptProcessor#processScript(org.jboss.ejb3.packagemanager.PackageSource, org.jboss.ejb3.packagemanager.metadata.Script)
+    * @see org.jboss.ejb3.packagemanager.script.ScriptProcessor#processScript(PackageManagerContext, PackageContext, Script)
     */
-   public void processScript(PackageManager pkgManager, PackageSource pkgSource, Script script)
+   @Override
+   public void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, Script script)
          throws ScriptProcessingException
    {
-      File root = pkgSource.getSource();
+      File root = pkgCtx.getPackageRoot();
       File antBuildFile = new File(root, script.getFile());
       if (!antBuildFile.exists())
       {
-         throw new ScriptProcessingException("Ant script " + script.getFile() + " does not exist in " + pkgSource);
+         throw new ScriptProcessingException("Ant script " + script.getFile() + " does not exist in " + pkgCtx);
       }
       Project antProject = new Project();
       // add our build listener to capture ant logging and other stuff
       antProject.addBuildListener(new AntBuildListener());
       // Set the basedir for the ant project to point to the 
       // root of the package.xml file of the package being installed 
-      antProject.setBaseDir(pkgSource.getSource());
+      antProject.setBaseDir(pkgCtx.getPackageRoot());
       // Also set the properties JBOSS_HOME and PM_HOME for the 
       // build scripts to use (if they find it necessary)
-      antProject.setProperty("JBOSS_HOME", pkgManager.getServerHome());
-      antProject.setProperty("PM_HOME",pkgManager.getPackageManagerEnvironment().getPackageManagerHome().getAbsolutePath());
+      antProject.setProperty("JBOSS_HOME", pkgManagerCtx.getJBossServerHome());
+      antProject.setProperty("PM_HOME", pkgManagerCtx.getPackageManagerEnvironment().getPackageManagerHome()
+            .getAbsolutePath());
       // init the project
       antProject.init();
 
@@ -99,9 +101,9 @@
       if (!antProject.getTargets().containsKey(targetName))
       {
          throw new ScriptProcessingException("Target " + targetName + " not present in Ant script " + antBuildFile
-               + " for " + pkgSource);
+               + " for " + pkgCtx);
       }
-      logger.info("Running pre-install script " + antBuildFile + " ,target= " + targetName + " for " + pkgSource);
+      logger.info("Running pre-install script " + antBuildFile + " ,target= " + targetName + " for " + pkgCtx);
       try
       {
          antProject.executeTarget(targetName);
@@ -109,7 +111,7 @@
       catch (Exception e)
       {
          throw new ScriptProcessingException("Exception while running target " + targetName + " in script "
-               + antBuildFile + " for " + pkgSource);
+               + antBuildFile + " for " + pkgCtx);
       }
 
    }
@@ -145,7 +147,7 @@
        */
       public void messageLogged(BuildEvent buildEvent)
       {
-         
+
          int logLevel = buildEvent.getPriority();
          switch (logLevel)
          {
@@ -185,7 +187,7 @@
          {
             logger.info(buildEvent.getTarget() + " completed successfully");
          }
-         
+
       }
 
       /**

Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/xml/PackageUnmarshaller.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/xml/PackageUnmarshaller.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/xml/PackageUnmarshaller.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -33,16 +33,21 @@
 import org.jboss.ejb3.packagemanager.metadata.Dependencies;
 import org.jboss.ejb3.packagemanager.metadata.InstallFile;
 import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
 import org.jboss.ejb3.packagemanager.metadata.PostInstall;
 import org.jboss.ejb3.packagemanager.metadata.PreInstall;
 import org.jboss.ejb3.packagemanager.metadata.Script;
 import org.jboss.ejb3.packagemanager.metadata.SystemRequirements;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+import org.jboss.ejb3.packagemanager.metadata.impl.DependenciesImpl;
 import org.jboss.ejb3.packagemanager.metadata.impl.InstallFileImpl;
 import org.jboss.ejb3.packagemanager.metadata.impl.PackageImpl;
+import org.jboss.ejb3.packagemanager.metadata.impl.PackagedDependencyImpl;
 import org.jboss.ejb3.packagemanager.metadata.impl.PostInstallImpl;
 import org.jboss.ejb3.packagemanager.metadata.impl.PostInstallScript;
 import org.jboss.ejb3.packagemanager.metadata.impl.PreInstallImpl;
 import org.jboss.ejb3.packagemanager.metadata.impl.PreInstallScript;
+import org.jboss.ejb3.packagemanager.metadata.impl.UnProcessedDependenciesImpl;
 
 /**
  * PackageXMLParser
@@ -134,7 +139,9 @@
                }
                else if (childElement.equals("dependencies"))
                {
-                  this.processDependencies(pkgMeta, xmlStreamReader);
+                  Dependencies dependencies = this.processDependencies(pkgMeta, xmlStreamReader);
+                  pkgMeta.setDependencies(dependencies);
+                  
                }
                break;
 
@@ -312,10 +319,6 @@
          {
             script.setFile(xmlStreamReader.getAttributeValue(i));
          }
-         else if ("processor".equals(name))
-         {
-            script.setProcessor(xmlStreamReader.getAttributeValue(i));
-         }
 
       }
       // consume the end event of file
@@ -331,20 +334,48 @@
    
    private Dependencies processDependencies(Package pkgMetadata, XMLStreamReader2 xmlStreamReader) throws Exception
    {
-      Dependencies depMetadata = null;
-//      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
-//      {
-//         String name = xmlStreamReader.getAttributeLocalName(i);
-//         if ("file".equals(name))
-//         {
-//            script.setFile(xmlStreamReader.getAttributeValue(i));
-//         }
-//         else if ("processor".equals(name))
-//         {
-//            script.setProcessor(xmlStreamReader.getAttributeValue(i));
-//         }
-//
-//      }
+      Dependencies depMetadata = new DependenciesImpl(pkgMetadata);
+      int event = xmlStreamReader.next();
+      while (event != XMLEvent.END_ELEMENT)
+      {
+         switch (event)
+         {
+            case XMLEvent.START_ELEMENT :
+               String childElement = xmlStreamReader.getLocalName();
+               if (childElement.equals("unprocessed-dependencies"))
+               {
+                  UnProcessedDependencies unProcessedDeps = processUnProcessedDependencies(pkgMetadata, xmlStreamReader);
+                  depMetadata.setUnProcessedDependencies(unProcessedDeps);
+               }
+               else if (childElement.equals("packaged-dependency"))
+               {
+                  PackagedDependency packagedDep = processPackagedDependency(pkgMetadata, xmlStreamReader);
+                  depMetadata.addPackagedDependency(packagedDep);
+               }
+               break;
+               
+         }
+         event = xmlStreamReader.next();
+      }
+      return depMetadata;
+   }
+   
+   private UnProcessedDependencies processUnProcessedDependencies(Package pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
+   {
+      UnProcessedDependencies unProcessedDep = new UnProcessedDependenciesImpl(pkgMeta);
+      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
+      {
+         String name = xmlStreamReader.getAttributeLocalName(i);
+         if ("file".equals(name))
+         {
+            unProcessedDep.setFile(xmlStreamReader.getAttributeValue(i));
+         }
+         else if ("manager".equals(name))
+         {
+            unProcessedDep.setManager(xmlStreamReader.getAttributeValue(i));
+         }
+
+      }
       // consume the end event of file
       int event = xmlStreamReader.next();
       while (event != XMLEvent.END_ELEMENT)
@@ -352,6 +383,27 @@
          event = xmlStreamReader.next();
 
       }
-      return depMetadata;
+      return unProcessedDep;
    }
+   
+   private PackagedDependency processPackagedDependency(Package pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
+   {
+      PackagedDependency packagedDep = new PackagedDependencyImpl(pkgMeta);
+      for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
+      {
+         String name = xmlStreamReader.getAttributeLocalName(i);
+         if ("file".equals(name))
+         {
+            packagedDep.setFile(xmlStreamReader.getAttributeValue(i));
+         }
+      }
+      // consume the end event of file
+      int event = xmlStreamReader.next();
+      while (event != XMLEvent.END_ELEMENT)
+      {
+         event = xmlStreamReader.next();
+
+      }
+      return packagedDep;
+   }
 }

Added: projects/ejb3/trunk/package-manager/src/main/resources/ivy-default-settings.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/resources/ivy-default-settings.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/resources/ivy-default-settings.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,10 @@
+<ivysettings>
+  <settings defaultResolver="defaultRepoChain"/>
+  <resolvers>
+    <chain name="defaultRepoChain">
+        <ibiblio name="jboss-snap-m2-repo" root="http://snapshots.jboss.org/maven2/" m2compatible="true" />
+        <ibiblio name="jboss-m2-repo" root="http://repository.jboss.org/maven2/" m2compatible="true" />
+        <ibiblio name="ibiblio" m2compatible="true" />
+    </chain>
+  </resolvers>
+</ivysettings>

Modified: projects/ejb3/trunk/package-manager/src/main/resources/package.xsd
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/resources/package.xsd	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/main/resources/package.xsd	2009-10-21 18:14:55 UTC (rev 95327)
@@ -43,10 +43,12 @@
 
             <xs:sequence>
                 <xs:element name="system-requirements" minOccurs="0" maxOccurs="1" type="jboss:system-requirementsType"/>
-                <xs:element name="file" minOccurs="1" maxOccurs="unbounded" type="jboss:fileType"/>
+                <xs:element name="file" minOccurs="0" maxOccurs="unbounded" type="jboss:fileType"/>
                 <xs:element name="dependencies" minOccurs="0" maxOccurs="1" type="jboss:dependenciesType"/>
                 <xs:element name="pre-install" minOccurs="0" maxOccurs="1" type="jboss:pre-installType"/>
                 <xs:element name="post-install" minOccurs="0" maxOccurs="1" type="jboss:post-installType"/>
+                <xs:element name="pre-uninstall" minOccurs="0" maxOccurs="1" type="jboss:pre-uninstallType"/>
+                <xs:element name="post-uninstall" minOccurs="0" maxOccurs="1" type="jboss:post-uninstallType"/>
             </xs:sequence>
             <xs:attribute name="name" use="required" type="xs:string"/>
             <xs:attribute name="version" use="required" type="xs:string"/>
@@ -82,24 +84,26 @@
     <xs:complexType name="dependenciesType">
         <xs:annotation>
             <xs:documentation>
-                A package can have dependencies on other packages. Dependencies are configured in
-                separate files. The dependencies element just points to that file. The file path is
-                relative to the location of the package.xml within a package.
-                Optionally a dependency manager can be specified through the
-                "manager" attribute. The manager attribute should contain the fully qualified class name
-                of the dependency manager which is responsible for parsing the dependencies file and
-                managing the dependencies listed in that file. The class should implement the
-                org.jboss.ejb3.packagemanager.dependency.DependencyManager interface.
-                By default, org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager will be
-                used as the dependency manager.
+                A package can have dependencies on other packages. Dependencies can be specified
+                and provided in 2 ways.
+                    1) A package which depends on other packages can package those dependencies
+                within it package jar/zip file. It can then use the "package-dependency"
+                element to list such dependencies. 
+                    2) Dependencies can be listed separately in a file. The "unprocessed-dependencies" element points
+                to that file.
+                Irrespective of how the dependencies are specified, the dependencies must always be packages.
             </xs:documentation>
         </xs:annotation>
-        <xs:attribute name="file" type="xs:string" use="required"/>
-        <xs:attribute name="manager" type="xs:string" use="optional"
-                      default="org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager"/>
+        <xs:sequence>
+            <xs:element name="packaged-dependency" minOccurs="0" maxOccurs="unbounded" type="jboss:packaged-dependencyType"/>
+            <xs:element name="unprocessed-dependencies" minOccurs="0" maxOccurs="1" type="jboss:unprocessed-dependenciesType"/>
+        </xs:sequence>
+        
+
     </xs:complexType>
 
 
+
     <xs:complexType name="pre-installType">
         <xs:annotation>
             <xs:documentation>
@@ -131,23 +135,83 @@
         </xs:sequence>
     </xs:complexType>
 
+    <xs:complexType name="pre-uninstallType">
+        <xs:annotation>
+            <xs:documentation>
+                A pre-uninstall element is used to point to pre-uninstall scripts that
+                are to be run before un-installing the package. There can be any number
+                of pre-uninstall scripts and they will be run in the same order as
+                they appear in the xml
+            </xs:documentation>
+
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="script" minOccurs="1" maxOccurs="unbounded" type="jboss:scriptType"/>
+        </xs:sequence>
+
+    </xs:complexType>
+
+    <xs:complexType name="post-uninstallType">
+        <xs:annotation>
+            <xs:documentation>
+                A post-uninstall element is used to point to post-uninstall scripts that
+                are to be run after installing the package. There can be any number
+                of post-uninstall scripts and they will be run in the same order as
+                they appear in the xml
+            </xs:documentation>
+
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="script" minOccurs="1" maxOccurs="unbounded" type="jboss:scriptType"/>
+        </xs:sequence>
+    </xs:complexType>
+
     <xs:complexType name="scriptType">
         <xs:annotation>
             <xs:documentation>
-                A script element points to a file containing a script.
-                The file attribute of this element should contain the path of the script, relative to the location of
+                A script element points to a Ant build script file.
+                The file attribute of this element contains the path of the script, relative to the location of
                 package.xml in the package.
-                The processor attribute of a script can be used to specify the fully qualified name of the
-                class which implements the org.jboss.ejb3.packagemanager.script.ScriptProcessor interface.
-                By default the processor of a script is the Ant processor
-                (org.jboss.ejb3.packagemanager.script.impl.AntScriptProcessor) which processes Ant build script
+                By default the file attribute value is "package-script.xml"
 
             </xs:documentation>
 
         </xs:annotation>
+        <xs:attribute name="file" type="xs:string" use="optional" default="package-script.xml"/>
+        <!--<xs:attribute name="processor" type="xs:string" use="optional"
+                      default="org.jboss.ejb3.packagemanager.script.impl.AntScriptProcessor"/> -->
+    </xs:complexType>
+
+    <xs:complexType name="packaged-dependencyType">
+        <xs:annotation>
+            <xs:documentation>
+                A "packaged-dependency" element points to a dependency package. The "file" attribute is relative to the
+                location of the package.xml within the package.
+            </xs:documentation>
+
+        </xs:annotation>
         <xs:attribute name="file" type="xs:string" use="required"/>
-        <xs:attribute name="processor" type="xs:string" use="optional"
-                      default="org.jboss.ejb3.packagemanager.script.impl.AntScriptProcessor"/>
+
     </xs:complexType>
 
+    <xs:complexType name="unprocessed-dependenciesType">
+        <xs:annotation>
+            <xs:documentation>
+                The "unprocessed-dependencies"  element is used to point to the file containing a list of dependencies
+                of the package. The "file" attribute is relative to the location of the package.xml within the package.
+                Optionally a dependency manager can be specified through the "manager" attribute. The manager attribute should
+                contain the fully qualified class name of the dependency manager which is responsible for parsing the
+                dependencies file and managing the dependencies listed in that file. The class should implement the
+                org.jboss.ejb3.packagemanager.dependency.DependencyManager interface.
+                By default, org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager will be
+                used as the dependency manager.
+            </xs:documentation>
+
+        </xs:annotation>
+        <xs:attribute name="file" type="xs:string" use="required"/>
+        <xs:attribute name="manager" type="xs:string" use="optional"
+                      default="org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager"/>
+
+    </xs:complexType>
+
 </xs:schema>
\ No newline at end of file

Modified: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -29,10 +29,14 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
+import org.jboss.logging.Logger;
 import org.jboss.shrinkwrap.api.export.ZipExporter;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchiveFactory;
+import org.junit.Assert;
 
 /**
  * PackageManagerTestCase
@@ -46,6 +50,11 @@
 {
 
    /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(PackageManagerTestCase.class);
+
+   /**
     * Base dir
     */
    protected static File baseDir = new File(System.getProperty("basedir"));
@@ -143,9 +152,9 @@
     * 
     * @param jar The jar file which is to be written to the file system
     * @param destFile The file to which the jar is to be written
-    * @throws Exception
+    * @throws IOException
     */
-   protected void exportZip(JavaArchive jar, File destFile) throws Exception
+   protected void exportZip(JavaArchive jar, File destFile) throws IOException
    {
       InputStream is = ZipExporter.exportZip(jar);
       FileOutputStream fos = new FileOutputStream(destFile);
@@ -177,6 +186,176 @@
    }
 
    /**
+    * Creates a dummy jar file containing a dummy .class file
+    * The dummy.jar file is created in the project's "target" directory. If target/dummy.jar
+    * already exists, then the existing File is returned.
+    * 
+    * @return Returns target/dummy.jar File
+    * @throws IOException
+    */
+   protected File createDummyJar() throws IOException
+   {
+      // Create a jar using ShrinkWrap API.
+      // The jar will look like:
+      // dummy.jar
+      //    |
+      //    |--- org/jboss/ejb3/packagemanager/test/common/Dummy.class
+      //           |--- jboss
+      //                    |--- ejb3
+      //                            |--- packagemanager
+      //                                    |--- test
+      //                                            |--- common
+      //                                                    |--- Dummy.class
+
+      File dummyJar = new File(targetDir, "dummy.jar");
+      // if it already exists then no need to recreate it
+      if (dummyJar.exists())
+      {
+         return dummyJar;
+      }
+      JavaArchive jar = JavaArchiveFactory.create(dummyJar.getName());
+      jar.addClass(Dummy.class);
+      // write out to file system at target/dummy.jar
+      logger.debug("Writing out the created jar " + jar.toString(true));
+      this.exportZip(jar, dummyJar);
+      return dummyJar;
+
+   }
+
+   /**
+    * Creates a simple package with the following contents:
+    * 
+    *  <package-name>
+    *   |
+    *   |--- dummy.jar
+    *   |
+    *   |--- package.xml
+    *   
+    * The package.xml is configured to install the dummy.jar to JBOSS_HOME/common/lib. Nothing 
+    * else is configured in the package.xml
+    *   
+    * @param packageFileName The name of the package to be created. Ex: simple-package.jar
+    *   Note: It is mandatory to specify the extension (.jar) which passing the packageFileName
+    * @return Returns the {@link File} corresponding the to the created package
+    * @throws IOException If any IO exceptions occur during the package creation
+    */
+   protected File createSimplePackage(String packageFileName) throws IOException
+   {
+      File dummyJar = this.createDummyJar();
+
+      // Now let's package the dummy.jar, package.xml into a package
+      File simplePackage = new File(targetDir, packageFileName);
+      JavaArchive pkg = JavaArchiveFactory.create(simplePackage.getName());
+      pkg.addResource("dummy.jar", dummyJar);
+      URL packageXmlURL = this.getResource(PackageManagerTestCase.class, "package-with-just-install-file.xml");
+      File file = new File(packageXmlURL.getFile());
+      pkg.addResource("package.xml", file);
+      // now write out the package to disk
+      logger.debug("Writing out the created package " + pkg.toString(true));
+      this.exportZip(pkg, simplePackage);
+
+      return simplePackage;
+   }
+
+   /**
+    * Creates a package containing a file to install and a pre-install script. The package
+    * will look as follows:
+    * 
+    *  <package-name>
+    *   |
+    *   |--- dummy.jar
+    *   |
+    *   |--- package.xml
+    *   |
+    *   |--- build.xml
+    *   
+    * The package.xml is configured to install the dummy.jar to JBOSS_HOME/server/default/deploy. 
+    * Additionally, the package.xml is also configured for the pre-install script named build.xml,
+    * which is available at the root of the package. The build.xml script is implemented
+    * to place a file named "test.txt" under JBOSS_HOME/bin folder, when the script is run.
+    *   
+    * @param packageFileName The name of the package to be created. Ex: simple-package.jar
+    *   Note: It is mandatory to specify the extension (.jar) which passing the packageFileName
+    * @return Returns the {@link File} corresponding the to the created package
+    * @throws IOException If any IO exceptions occur during the package creation
+    */
+   protected File createPackageWithPreInstallScript(String packageFileName) throws IOException
+   {
+      File dummyJar = this.createDummyJar();
+
+      // Now let's package the dummy.jar, package.xml and build.xml into a package
+      File packageWithPreInstallScript = new File(targetDir, packageFileName);
+      JavaArchive pkg = JavaArchiveFactory.create(packageWithPreInstallScript.getName());
+      pkg.addResource("dummy.jar", dummyJar);
+      URL packageXmlURL = this.getResource(PackageManagerTestCase.class, "package-with-pre-install-script.xml");
+      File packageXmlFile = new File(packageXmlURL.getFile());
+      pkg.addResource("package.xml", packageXmlFile);
+      URL buildXmlURL = this.getResource(PackageManagerTestCase.class, "build.xml");
+      File buildFile = new File(buildXmlURL.getFile());
+      pkg.addResource("build.xml", buildFile);
+
+      // now write out the package to disk
+      logger.debug("Writing out the created package " + pkg.toString(true));
+      this.exportZip(pkg, packageWithPreInstallScript);
+      return packageWithPreInstallScript;
+   }
+
+   /**
+    * Creates a package  containing a file to install and a packaged-dependency. The package
+    * will look as follows:
+    * 
+    *  <package-name>
+    *   |
+    *   |--- dependee-package.jar (this is the packaged dependency)
+    *   |
+    *   |--- package.xml
+    *   |
+    *   |--- dummy.jar
+    *   
+    * The package.xml is configured to install the dummy.jar to JBOSS_HOME/server/default/lib. Also
+    * the package.xml is configured to mark dependee-package.jar as a packaged-dependency.
+    *  
+    * The "dependee" package contains the following:
+    * 
+    * <package-name>
+    *   |
+    *   |--- dummy.jar
+    *   |
+    *   |--- package.xml
+    * 
+    * The package.xml of the dependee package is configured to install the dummy.jar to JBOSS_HOME/common/lib.
+    * Nothing else is configured in the package.xml of the dependee package
+    *   
+    * @param packageFileName The name of the package to be created. Ex: simple-package.jar
+    *   Note: It is mandatory to specify the extension (.jar) which passing the packageFileName
+    * @return Returns the {@link File} corresponding the to the created package
+    * @throws IOException If any IO exceptions occur during the package creation
+    */
+   protected File createPackageWithSimplePackagedDependency(String packageFileName) throws IOException
+   {
+      // let's create a simple "dependee" package
+      File dependeePackage = this.createSimplePackage("dependee-package.jar");
+
+      // Now package this dependee package and also any other files in the dependent package
+      File packageWithPackagedDependency = new File(targetDir, packageFileName);
+      JavaArchive pkg = JavaArchiveFactory.create(packageWithPackagedDependency.getName());
+      pkg.addResource("dependee-package.jar", dependeePackage);
+      // package the other files
+      File dummyJar = this.createDummyJar();
+      pkg.addResource("dummy.jar", dummyJar);
+      URL packageXmlURL = this.getResource(PackageManagerTestCase.class, "package-with-packaged-dependency.xml");
+      File packageXmlFile = new File(packageXmlURL.getFile());
+      pkg.addResource("package.xml", packageXmlFile);
+
+      // now write out the package to disk
+      logger.debug("Writing out the created package " + pkg.toString(true));
+      this.exportZip(pkg, packageWithPackagedDependency);
+
+      return packageWithPackagedDependency;
+
+   }
+
+   /**
     * Creates a JBoss AS-5 directory structure for the given {@code jbossHome}
     * 
     * @param jbossHome The server home
@@ -223,4 +402,98 @@
       File serverDeployers = new File(serverProf, "deployers");
       serverDeployers.mkdirs();
    }
+
+   /**
+    * (Recursively) removes any files from the JBoss installation represented by
+    * {@code jbossHome}
+    * 
+    * NOTE: Use with extreme caution and 
+    * 
+    * @param jbossHome
+    * @throws IOException
+    */
+   protected void cleanupJBossInstance(File jbossHome) throws IOException
+   {
+      // Deleting is extremely dangerous, since we never know if the user 
+      // unintentionally (or maliciously) passed a directory which is not JBOSS_HOME.
+      // So let's atleast make sure that the jbossHome is within this project's 
+      // "target" directory. If not, we won't delete anything (outside our scope)
+      // and just throw an IOException
+
+      if (this.isChildOfTargetFolder(jbossHome))
+      {
+         this.recursivelyDeleteFiles(jbossHome);
+         return;
+      }
+      else
+      {
+         throw new IOException(
+               jbossHome
+                     + " is not under the project \"target\" folder -" +
+                     		" Deleting the contents of that folder is not in the scope of this method");
+      }
+
+   }
+
+   protected void assertFileExistenceUnderJBossHome(File jbossHome, String file)
+   {
+      File fileToBeChecked = new File(jbossHome, file);
+      Assert.assertTrue("Expected to find file " + fileToBeChecked + " but not found", fileToBeChecked.exists());
+   }
+   
+   /**
+    * 
+    * @param file
+    * @return
+    */
+   private boolean isChildOfTargetFolder(File file)
+   {
+      if (file == null)
+      {
+         return false;
+      }
+      if (file.equals(this.targetDir))
+      {
+         return false;
+      }
+      file = file.getParentFile();
+      while (file != null)
+      {
+         if (this.targetDir.equals(file))
+         {
+            return true;
+         }
+      }
+      return false;
+   }
+
+   /**
+    * 
+    * @param parent
+    * @throws IOException
+    */
+   private void recursivelyDeleteFiles(File parent) throws IOException
+   {
+      File[] filesAndDirs = parent.listFiles();
+      List<File> filesDirs = Arrays.asList(filesAndDirs);
+      for (File file : filesDirs)
+      {
+         if (file.isFile())
+         {
+            file.delete();
+         }
+         else if (file.isDirectory())
+         {
+            // recurse
+            this.recursivelyDeleteFiles(file);
+         }
+      }
+   }
+
+   protected File getPerTestTargetDir(Class<?> testClass)
+   {
+      File testCaseTargetDir = new File(targetDir, testClass.getName().replace('.', '/'));
+      testCaseTargetDir.mkdirs();
+      return testCaseTargetDir;
+   }
 }

Added: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/DependencyInstallTestCase.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/DependencyInstallTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/DependencyInstallTestCase.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,253 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.packagemanager.test.dependency.unit;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
+import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
+import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
+import org.jboss.logging.Logger;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchiveFactory;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * DependencyInstallTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DependencyInstallTestCase extends PackageManagerTestCase
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(DependencyInstallTestCase.class);
+
+   /**
+    * Package manager
+    */
+   private static PackageManager pkgMgr;
+
+   /**
+    * The JBoss Home used in this test
+    */
+   private static File jbossHome;
+
+   /**
+    * Package manager home used in this test
+    */
+   private static File pkgMgrHome;
+
+   private File perTestTargetDir = this.getPerTestTargetDir(this.getClass());
+
+   /**
+    * Do the necessary setup
+    * @throws Exception
+    */
+   @BeforeClass
+   public static void setup() throws Exception
+   {
+      pkgMgrHome = setupPackageManagerHome();
+      jbossHome = setupDummyJBoss();
+      PackageManagerEnvironment env = new PackageManagerEnvironment(pkgMgrHome.getAbsolutePath());
+      pkgMgr = new DefaultPackageManagerImpl(env, jbossHome.getAbsolutePath());
+   }
+
+   @Before
+   public void beforeTest() throws Exception
+   {
+      this.cleanupJBossInstance(jbossHome);
+   }
+
+   /**
+    * Tests that a package containing packaged-dependency is installed correctly.
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testPackageWithPackagedDependency() throws Exception
+   {
+      File packageWithPackagedDependency = this
+            .createPackageWithSimplePackagedDependency("package-with-packaged-dependency.jar");
+
+      // now install
+      this.pkgMgr.installPackage(packageWithPackagedDependency.getAbsolutePath());
+
+      // and now check that the files have been installed
+      // this package was expected to install dummy.jar to JBOSS_HOME/common/lib and JBOSS_HOME/server/default/lib folders
+      this.assertFileExistenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/lib/dummy.jar");
+   }
+
+   /**
+    * Tests that a package containing multiple packaged dependencies is installed correctly
+    *  
+    * @throws Exception
+    */
+   @Test
+   public void testPackageWithMultiplePackagedDependencies() throws Exception
+   {
+      File packageToInstall = this
+            .createPackageWithMultiplePackagedDependencies("package-with-multiple-packaged-dependencies.jar");
+
+      this.pkgMgr.installPackage(packageToInstall.toURI().toURL());
+
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/dummy-main.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/some-deployer-jboss-beans.xml");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/dummy1.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/dummy2.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/dummy3.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "bin/where-is-kilroy.txt");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "bin/who-was-here.txt");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "bin/kilroy-was-here.txt");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "bin/kilroy-was-here-again.txt");
+
+   }
+
+   /**
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testPackageWithUnProcessedDependencies() throws Exception
+   {
+      File dummyJar = this.createDummyJar();
+      // create the package
+      File packageWithUnprocessedDeps = new File(this.perTestTargetDir, "package-with-unprocessed-dependencies.jar");
+      JavaArchive archive = JavaArchiveFactory.create(packageWithUnprocessedDeps.getName());
+      archive.addResource("dummy.jar", dummyJar);
+      List<URL> resources = this.getResources(this.getClass(), "some-deployer-jboss-beans.xml", "ivy.xml");
+      for (URL resource : resources)
+      {
+         File resourceFile = new File(resource.getFile());
+         archive.addResource(resourceFile.getName(), resourceFile);
+      }
+
+      URL packageXmlURL = this.getResource(this.getClass(), "package-with-unprocessed-dependencies.xml");
+      File file = new File(packageXmlURL.getFile());
+      archive.addResource("package.xml", file);
+
+      // now write out the package to disk
+      logger.debug("Writing out the package " + archive.toString(true));
+      this.exportZip(archive, packageWithUnprocessedDeps);
+
+      // install
+      this.pkgMgr.installPackage(packageWithUnprocessedDeps.getAbsolutePath());
+
+      // test the files have been installed
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/dummy.jar");
+      this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deployers/some-deployer-jboss-beans.xml");
+
+   }
+
+   /**
+    * 
+    * @param packageFileName
+    * @return
+    * @throws IOException
+    */
+   protected File createPackageWithMultiplePackagedDependencies(String packageFileName) throws IOException
+   {
+
+      File dummyJar = this.createDummyJar();
+      // create dependee package#1
+      File dependeePackageOne = new File(this.perTestTargetDir, "dependee-package-one.jar");
+      JavaArchive archiveOne = JavaArchiveFactory.create(dependeePackageOne.getName());
+      archiveOne.addResource("dummy1.jar", dummyJar);
+      URL packageXmlURL = this.getResource(this.getClass(), "dependee-package1.xml");
+      File file = new File(packageXmlURL.getFile());
+      archiveOne.addResource("package.xml", file);
+      // pre-install script
+      URL preInstallScriptXml = this.getResource(this.getClass(), "pre-install-build.xml");
+      File preInstallScriptFile = new File(preInstallScriptXml.getFile());
+      archiveOne.addResource("scripts/pre-install-build.xml", preInstallScriptFile);
+
+      // now write out the package to disk
+      logger.debug("Writing out the first dependee package " + archiveOne.toString(true));
+      this.exportZip(archiveOne, dependeePackageOne);
+
+      // create dependee package#2
+      File dependeePackageTwo = new File(this.perTestTargetDir, "dependee-package-two.jar");
+      JavaArchive archiveTwo = JavaArchiveFactory.create(dependeePackageTwo.getName());
+      archiveTwo.addResource("dummy2.jar", dummyJar);
+      URL packageXmlTwo = this.getResource(this.getClass(), "dependee-package2.xml");
+      File packageXmlTwoFile = new File(packageXmlTwo.getFile());
+      archiveTwo.addResource("package.xml", packageXmlTwoFile);
+      // post-install script
+      URL postInstallXml = this.getResource(this.getClass(), "post-install-build.xml");
+      File postInstallScriptFile = new File(postInstallXml.getFile());
+      archiveTwo.addResource("scripts/post-install-build.xml", postInstallScriptFile);
+
+      // now write out the package to disk
+      logger.debug("Writing out the second dependee package " + archiveTwo.toString(true));
+      this.exportZip(archiveTwo, dependeePackageTwo);
+
+      // create dependee package#3
+      File dependeePackageThree = new File(this.perTestTargetDir, "dependee-package-three.jar");
+      JavaArchive archiveThree = JavaArchiveFactory.create(dependeePackageThree.getName());
+      archiveThree.addResource("dummy3.jar", dummyJar);
+      URL packageXmlThree = this.getResource(this.getClass(), "dependee-package3.xml");
+      File packageXmlThreeFile = new File(packageXmlThree.getFile());
+      archiveThree.addResource("package.xml", packageXmlThreeFile);
+      // pre-install and post-install script
+      URL scriptXml = this.getResource(this.getClass(), "build.xml");
+      File scriptFile = new File(scriptXml.getFile());
+      archiveThree.addResource("build.xml", scriptFile);
+
+      // now write out the package to disk
+      logger.debug("Writing out the third dependee package " + archiveThree.toString(true));
+      this.exportZip(archiveThree, dependeePackageThree);
+
+      // Create the final package with all these 3 packages as the package-dependencies
+      File aggregatedPacakge = new File(this.perTestTargetDir, packageFileName);
+      JavaArchive aggregatedArchive = JavaArchiveFactory.create(aggregatedPacakge.getName());
+      aggregatedArchive.addResource("dummy-main.jar", dummyJar);
+      URL aggPackageXml = this.getResource(this.getClass(), "package-with-multiple-packaged-dependencies.xml");
+      File aggPackageXmlFile = new File(aggPackageXml.getFile());
+      aggregatedArchive.addResource("package.xml", aggPackageXmlFile);
+      URL someDeployerConfigXml = this.getResource(this.getClass(), "some-deployer-jboss-beans.xml");
+      File deployerConfigFile = new File(someDeployerConfigXml.getFile());
+      aggregatedArchive.addResource("some-config-folder/some-deployer-jboss-beans.xml", deployerConfigFile);
+
+      // add all the created packages at appropriate locations
+      aggregatedArchive.addResource("dependee-package1.jar", dependeePackageOne);
+      aggregatedArchive.addResource("subfolder/dependee-package2.jar", dependeePackageTwo);
+      aggregatedArchive.addResource("subfolder/deep-nested-folder/dependee-package3.jar", dependeePackageThree);
+
+      // now write out the package to disk
+      logger.debug("Writing out the (main aggregated) package containing the packaged dependencies"
+            + aggregatedArchive.toString(true));
+      this.exportZip(aggregatedArchive, aggregatedPacakge);
+
+      return aggregatedPacakge;
+
+   }
+}

Modified: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/install/unit/BasicInstallTestCase.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/install/unit/BasicInstallTestCase.java	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/install/unit/BasicInstallTestCase.java	2009-10-21 18:14:55 UTC (rev 95327)
@@ -23,17 +23,14 @@
 package org.jboss.ejb3.packagemanager.test.install.unit;
 
 import java.io.File;
-import java.net.URL;
 
 import org.jboss.ejb3.packagemanager.PackageManager;
 import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
 import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
-import org.jboss.ejb3.packagemanager.test.common.Dummy;
+import org.jboss.ejb3.packagemanager.main.Main;
 import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
 import org.jboss.logging.Logger;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.JavaArchiveFactory;
-import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -77,6 +74,12 @@
       PackageManagerEnvironment env = new PackageManagerEnvironment(pkgMgrHome.getAbsolutePath());
       pkgMgr = new DefaultPackageManagerImpl(env, jbossHome.getAbsolutePath());
    }
+   
+   @Before
+   public void beforeTest() throws Exception
+   {
+      this.cleanupJBossInstance(jbossHome);
+   }
 
    /**
     * Tests that a simple install feature works. The package to be installed
@@ -91,38 +94,13 @@
    @Test
    public void testSimpleInstall() throws Exception
    {
-      File dummyJar = this.createDummyJar();
+      File simplePackage = this.createSimplePackage("simple-package.jar");
 
-      // Now let's package the dummy.jar, package.xml into a package
-      File simplePackage = new File(targetDir, "simple-package.jar");
-      JavaArchive pkg = JavaArchiveFactory.create(simplePackage.getName());
-      pkg.addResource("dummy.jar", dummyJar);
-      URL packageXmlURL = this.getResource(this.getClass(), "package-with-just-install-file.xml");
-      File file = new File(packageXmlURL.getFile());
-      pkg.addResource("package.xml", file);
-      // now write out the package to disk
-      logger.debug("Writing out the created package " + pkg.toString(true));
-      this.exportZip(pkg, simplePackage);
-
-      // We are done with the package creation, now let's install it
-      // using the package manager
-      // But let's first make sure that the jar file to be installed 
-      // through this package is not already in the JBoss AS (this check
-      // is just for the sanity of this test case). If it exists, just
-      // clean it up before running the package manager
-      File dummyJarInJBoss = new File(jbossHome, "common/lib/dummy.jar");
-      if (dummyJarInJBoss.exists())
-      {
-         logger
-               .debug("JBOSS_HOME/common/lib/dummy.jar already exists - cleaning it up before running the package manager test");
-         dummyJarInJBoss.delete();
-      }
       // run the package manager
-      pkgMgr.installPackage(simplePackage.toURL());
+      pkgMgr.installPackage(simplePackage.toURI().toURL());
 
       // now check that the file was installed in that location
-      Assert.assertTrue("Package manager did NOT install dummy.jar into JBOSS_HOME/common/lib", dummyJarInJBoss
-            .exists());
+      this.assertFileExistenceUnderJBossHome(this.jbossHome, "common/lib/dummy.jar");
    }
 
    /**
@@ -135,52 +113,21 @@
    @Test
    public void testPreInstallScriptExecution() throws Exception
    {
-      File dummyJar = this.createDummyJar();
+      File packageWithPreInstallScript = this.createPackageWithPreInstallScript("package-with-pre-install-script.jar");
 
-      // Now let's package the dummy.jar, package.xml and build.xml into a package
-      File packageWithPreInstallScript = new File(targetDir, "package-with-preinstall-script.jar");
-      JavaArchive pkg = JavaArchiveFactory.create(packageWithPreInstallScript.getName());
-      pkg.addResource("dummy.jar", dummyJar);
-      URL packageXmlURL = this.getResource(this.getClass(), "package-with-pre-install-script.xml");
-      File packageXmlFile = new File(packageXmlURL.getFile());
-      pkg.addResource("package.xml", packageXmlFile);
-      URL buildXmlURL = this.getResource(this.getClass(), "build.xml");
-      File buildFile = new File(buildXmlURL.getFile());
-      pkg.addResource("build.xml", buildFile);
-
-      // now write out the package to disk
-      logger.debug("Writing out the created package " + pkg.toString(true));
-      this.exportZip(pkg, packageWithPreInstallScript);
-
-      // The pre-install build script is written such that it creates a test.txt file in the JBOSS_HOME/bin
-      // folder. So before running the package manager, just cleanup the JBOSS_HOME/bin folder of any such existing
-      // files
-      File testFileInJBossBin = new File(this.jbossHome, "bin/test.txt");
-      if (testFileInJBossBin.exists())
-      {
-         logger
-               .debug("JBOSS_HOME/bin/test.txt already exists - cleaning it up before running the package manager test");
-         testFileInJBossBin.delete();
-      }
       // now run the package manager
       this.pkgMgr.installPackage(packageWithPreInstallScript.getAbsolutePath());
       // now assert that the JBOSS_HOME/bin/test.txt was created
       // If that file was created then it's enough to guarantee that the pre-install script was run
-      Assert.assertTrue(
-            testFileInJBossBin.getAbsolutePath() + " was NOT created. The pre-install script in the package "
-                  + packageWithPreInstallScript + " did not run", testFileInJBossBin.exists());
+      this.assertFileExistenceUnderJBossHome(this.jbossHome, "bin/test.txt");
 
       // As a further test, also check that the dummy.jar packaged in this package was
       // also installed (at JBOSS_HOME/server/default/deploy folder)
-      File dummyJarInServerDefaultDeploy = new File(this.jbossHome, "server/default/deploy/dummy.jar");
-      Assert.assertTrue(dummyJarInServerDefaultDeploy + " was not installed by the package manager",
-            dummyJarInServerDefaultDeploy.exists());
+      this.assertFileExistenceUnderJBossHome(this.jbossHome, "server/default/deploy/dummy.jar");
    }
 
    /**
-    * The {@link DefaultPackageManagerImpl}'s {@link DefaultPackageManagerImpl#main(String[])}
-    * method acts as a valid entry point for package manager clients. Test that it parses the
-    * command line arguments corrects and functionalities of the package manager work as expected
+    * Test that the command line variant of the package manager works as expected. 
     * 
     *  TODO: Note that the params passed through the command line are still work-in-progress
     *  and they might change in future. This test case then needs to change appropriately. 
@@ -190,37 +137,17 @@
    @Test
    public void testMainMethodOfDefaultPackageManager() throws Exception
    {
-      File dummyJar = this.createDummyJar();
-      // Now let's package the dummy.jar, package.xml into a package
-      File commandLineTestPackage = new File(targetDir, "commandline-test-package.jar");
-      JavaArchive pkg = JavaArchiveFactory.create(commandLineTestPackage.getName());
-      pkg.addResource("dummy.jar", dummyJar);
-      URL packageXmlURL = this.getResource(this.getClass(), "package-with-just-install-file.xml");
-      File packageXmlFile = new File(packageXmlURL.getFile());
-      pkg.addResource("package.xml", packageXmlFile);
-      // now write out the package to disk
-      logger.debug("Writing out the created package " + pkg.toString(true));
-      this.exportZip(pkg, commandLineTestPackage);
+      File commandLineTestPackage = this.createSimplePackage("command-line-test-package.jar");
 
       String commandLineArgs[] = new String[]
       {"-i", commandLineTestPackage.getAbsolutePath(), "-p", this.pkgMgrHome.getAbsolutePath(), "-s",
             this.jbossHome.getAbsolutePath()};
 
-      // cleanup any appropriate existing files in JBoss server
-      File dummyJarInJBoss = new File(jbossHome, "common/lib/dummy.jar");
-      if (dummyJarInJBoss.exists())
-      {
-         logger
-               .debug("JBOSS_HOME/common/lib/dummy.jar already exists - cleaning it up before running the package manager test");
-         dummyJarInJBoss.delete();
-      }
-
       // run the package manager
-      DefaultPackageManagerImpl.main(commandLineArgs);
+      Main.main(commandLineArgs);
 
       // now check that the file was installed in that location
-      Assert.assertTrue("Package manager did NOT install dummy.jar into JBOSS_HOME/common/lib", dummyJarInJBoss
-            .exists());
+      this.assertFileExistenceUnderJBossHome(this.jbossHome, "common/lib/dummy.jar");
 
    }
 
@@ -242,58 +169,13 @@
    @Test
    public void testHttpPackageInstall() throws Exception
    {
-      // cleanup any appropriate existing files in JBoss server
-      File dummyJarInJBoss = new File(jbossHome, "common/lib/dummy.jar");
-      if (dummyJarInJBoss.exists())
-      {
-         logger
-               .debug("JBOSS_HOME/common/lib/dummy.jar already exists - cleaning it up before running the package manager test");
-         dummyJarInJBoss.delete();
-      }
       // TODO: See javadocs of this test. This URL will change in near future
       String httpPackageURL = "http://snapshots.jboss.org/maven2/org/jboss/ejb3/tmp/simple-package.jar";
       // install the package
       this.pkgMgr.installPackage(httpPackageURL);
 
       // now check that the file was installed in that location
-      Assert.assertTrue("Package manager did NOT install dummy.jar into JBOSS_HOME/common/lib", dummyJarInJBoss
-            .exists());
+      this.assertFileExistenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
    }
 
-   /**
-    * Creates a dummy jar file containing a dummy .class file
-    * The dummy.jar file is created in the project's "target" directory. If target/dummy.jar
-    * already exists, then the existing File is returned.
-    * 
-    * @return Returns target/dummy.jar File
-    * @throws Exception
-    */
-   private File createDummyJar() throws Exception
-   {
-      // Create a jar using ShrinkWrap API.
-      // The jar will look like:
-      // dummy.jar
-      //    |
-      //    |--- org/jboss/ejb3/packagemanager/test/common/Dummy.class
-      //           |--- jboss
-      //                    |--- ejb3
-      //                            |--- packagemanager
-      //                                    |--- test
-      //                                            |--- common
-      //                                                    |--- Dummy.class
-
-      File dummyJar = new File(targetDir, "dummy.jar");
-      // if it already exists then no need to recreate it
-      if (dummyJar.exists())
-      {
-         return dummyJar;
-      }
-      JavaArchive jar = JavaArchiveFactory.create(dummyJar.getName());
-      jar.addClass(Dummy.class);
-      // write out to file system at target/dummy.jar
-      logger.debug("Writing out the created jar " + jar.toString(true));
-      this.exportZip(jar, dummyJar);
-      return dummyJar;
-
-   }
 }

Modified: projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -49,7 +49,7 @@
 
   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
     <param name="Target" value="System.out"/>
-    <param name="Threshold" value="INFO"/>
+     <!--  <param name="Threshold" value="INFO"/> -->
     <layout class="org.apache.log4j.PatternLayout">
       <!-- The default pattern: Date Priority [Category] Message\n -->
       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>

Copied: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/build.xml (from rev 95263, projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/build.xml)
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/build.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,37 @@
+<!--
+  ~ JBoss, Home of Professional Open Source
+  ~ Copyright 2005, JBoss Inc., and individual contributors as indicated
+  ~ by the @authors tag. See the copyright.txt in the distribution for a
+  ~ full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<project name="Package Install Script">
+
+	<property name="test" value="testvalue"/>
+
+	
+	<target name="pre-install">
+		<echo level="info">***************************************************************</echo>
+		<echo level="info">This is the pre-install target in the dummy package!</echo>
+		<echo level="info">Package manager home is = ${PM_HOME}</echo>
+		<echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
+		<echo level="info">***************************************************************</echo>
+		<echo file="${JBOSS_HOME}/bin/test.txt" message="This proves that the pre-install script was run"/>
+		<echo level="debug" message="Test property value is = ${test}"/>
+	</target>
+</project>
\ No newline at end of file

Copied: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-just-install-file.xml (from rev 95263, projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-just-install-file.xml)
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-just-install-file.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-just-install-file.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,8 @@
+<sh:package name="common-package-with-just-install-file" version="1.0.0-Alpha1"
+xmlns:sh="http://www.jboss.org/schema">
+
+    <!--  Package to install a dummy jar into JBOSS_AS/common/lib -->  
+  <file name="dummy.jar" dest-path="common/lib" type="library"/>
+  
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-packaged-dependency.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-packaged-dependency.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-packaged-dependency.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,11 @@
+<sh:package name="common-package-with-packaged-dependency" version="1.0.0-Alpha1"
+xmlns:sh="http://www.jboss.org/schema">
+
+    <!--  Package to install a dummy jar into JBOSS_AS/server/default/lib -->  
+  <file name="dummy.jar" dest-path="server/default/lib" type="library"/>
+  
+  <dependencies>
+    <packaged-dependency file="dependee-package.jar"/>
+  </dependencies>
+  
+</sh:package>
\ No newline at end of file

Copied: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-pre-install-script.xml (from rev 95263, projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-pre-install-script.xml)
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-pre-install-script.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/common/package-with-pre-install-script.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,11 @@
+<sh:package name="common-package-with-pre-install" version="1.0.0-Alpha1"
+xmlns:sh="http://www.jboss.org/schema">
+
+    <!--  Package to install a dummy jar into JBOSS_AS/server/default/deploy -->  
+  <file name="dummy.jar" dest-path="server/default/deploy" type="library"/>
+  
+  <pre-install>
+    <script file="build.xml"/>
+  </pre-install>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/build.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/build.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,45 @@
+<!--
+  ~ JBoss, Home of Professional Open Source
+  ~ Copyright 2005, JBoss Inc., and individual contributors as indicated
+  ~ by the @authors tag. See the copyright.txt in the distribution for a
+  ~ full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<project name="Package Install Script">
+
+		
+	<target name="pre-install">
+		<echo level="info">***************************************************************</echo>
+		<echo level="info">This is the pre-install target!</echo>
+		<echo level="info">Package manager home is = ${PM_HOME}</echo>
+		<echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
+		<echo level="info">***************************************************************</echo>
+		<echo file="${JBOSS_HOME}/bin/kilroy-was-here.txt" message="http://en.wikipedia.org/wiki/Kilroy_was_here"/>
+	</target>
+	
+	<target name="post-install">
+			<echo level="info">***************************************************************</echo>
+			<echo level="info">This is the post-install target!</echo>
+			<echo level="info">Package manager home is = ${PM_HOME}</echo>
+			<echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
+			<echo level="info">***************************************************************</echo>
+			<echo file="${JBOSS_HOME}/bin/kilroy-was-here-again.txt" 
+				message="http://en.wikipedia.org/wiki/Kilroy_was_here - Keeps coming for no reason"/>
+			
+		</target>
+</project>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package1.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package1.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package1.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,11 @@
+<sh:package name="DependencyInstallTestCase-dependeee-package1" version="1.0.0"
+xmlns:sh="http://www.jboss.org/schema">
+
+      
+  <file name="dummy1.jar" dest-path="server/default/deployers" type="library"/>
+  
+  <pre-install>
+    <script file="scripts/pre-install-build.xml"/>
+  </pre-install>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package2.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package2.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package2.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,11 @@
+<sh:package name="DependencyInstallTestCase-dependeee-package2" version="1.0.1"
+xmlns:sh="http://www.jboss.org/schema">
+
+      
+  <file name="dummy2.jar" dest-path="server/default/deployers" type="library"/>
+  
+  <post-install>
+    <script file="scripts/post-install-build.xml"/>
+  </post-install>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package3.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package3.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/dependee-package3.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,15 @@
+<sh:package name="DependencyInstallTestCase-dependeee-package3" version="0.0.1"
+xmlns:sh="http://www.jboss.org/schema">
+
+      
+  <file name="dummy3.jar" dest-path="server/default/deployers" type="library"/>
+  
+  <pre-install>
+    <script file="build.xml"/>
+  </pre-install>
+
+  <post-install>
+    <script file="build.xml"/>
+  </post-install>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/ivy.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/ivy.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/ivy.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,6 @@
+<ivy-module version="2.0">
+    <info organisation="org.jboss.ejb3.packagemanager" module="simple-dependency-test"/>
+    <dependencies>
+        <dependency org="org.jboss.ejb3.tmp" name="simple-package" rev="1.0.0.Alpha1"/>
+    </dependencies>
+</ivy-module>

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-multiple-packaged-dependencies.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-multiple-packaged-dependencies.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-multiple-packaged-dependencies.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,14 @@
+<sh:package name="DependencyInstallTestCase-package-with-multiple-packaged-deps" version="1.0.0-Alpha1"
+xmlns:sh="http://www.jboss.org/schema">
+
+      
+  <file name="dummy-main.jar" dest-path="server/default/deployers" type="library"/>
+  <file name="some-deployer-jboss-beans.xml" src-path="some-config-folder" dest-path="server/default/deployers" type="config"/>
+  
+  <dependencies>
+    <packaged-dependency file="dependee-package1.jar"/>
+    <packaged-dependency file="subfolder/dependee-package2.jar"/>
+    <packaged-dependency file="/subfolder/deep-nested-folder/dependee-package3.jar"/>
+  </dependencies>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-unprocessed-dependencies.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-unprocessed-dependencies.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/package-with-unprocessed-dependencies.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,12 @@
+<sh:package name="DependencyInstallTestCase-package-with-unprocessed-deps" version="1.0.0"
+xmlns:sh="http://www.jboss.org/schema">
+
+      
+  <file name="dummy.jar" dest-path="server/default/deployers" type="library"/>
+  <file name="some-deployer-jboss-beans.xml" dest-path="server/default/deployers" type="config"/>
+  
+  <dependencies>
+    <unprocessed-dependencies file="ivy.xml"/>
+  </dependencies>
+  
+</sh:package>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/post-install-build.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/post-install-build.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/post-install-build.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,32 @@
+<!--
+  ~ JBoss, Home of Professional Open Source
+  ~ Copyright 2005, JBoss Inc., and individual contributors as indicated
+  ~ by the @authors tag. See the copyright.txt in the distribution for a
+  ~ full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+<project name="Package Install Script">
+
+    <target name="post-install">
+        <echo level="info">***************************************************************</echo>
+        <echo level="info">This is the post-install target!</echo>
+        <echo level="info">Package manager home is = ${PM_HOME}</echo>
+        <echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
+        <echo level="info">***************************************************************</echo>
+        <echo file="${JBOSS_HOME}/bin/where-is-kilroy.txt" message="Here http://en.wikipedia.org/wiki/Kilroy_was_here"/>
+    </target>
+</project>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/pre-install-build.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/pre-install-build.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/pre-install-build.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,33 @@
+<!--
+  ~ JBoss, Home of Professional Open Source
+  ~ Copyright 2005, JBoss Inc., and individual contributors as indicated
+  ~ by the @authors tag. See the copyright.txt in the distribution for a
+  ~ full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<project name="Package Install Script">
+
+    <target name="pre-install">
+        <echo level="info">***************************************************************</echo>
+        <echo level="info">This is the pre-install target!</echo>
+        <echo level="info">Package manager home is = ${PM_HOME}</echo>
+        <echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
+        <echo level="info">***************************************************************</echo>
+        <echo file="${JBOSS_HOME}/bin/who-was-here.txt" message="Kilroy http://en.wikipedia.org/wiki/Kilroy_was_here"/>
+    </target>
+</project>
\ No newline at end of file

Added: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/some-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/some-deployer-jboss-beans.xml	                        (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/dependency/unit/some-deployer-jboss-beans.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+<!--  just a dummy file -->
+</deployment>
\ No newline at end of file

Deleted: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/build.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/build.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/build.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -1,37 +0,0 @@
-<!--
-  ~ JBoss, Home of Professional Open Source
-  ~ Copyright 2005, JBoss Inc., and individual contributors as indicated
-  ~ by the @authors tag. See the copyright.txt in the distribution for a
-  ~ full listing of individual contributors.
-  ~
-  ~ This is free software; you can redistribute it and/or modify it
-  ~ under the terms of the GNU Lesser General Public License as
-  ~ published by the Free Software Foundation; either version 2.1 of
-  ~ the License, or (at your option) any later version.
-  ~
-  ~ This software is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
-  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  ~ Lesser General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU Lesser General Public
-  ~ License along with this software; if not, write to the Free
-  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  -->
-
-<project name="Package Install Script">
-
-	<property name="test" value="testvalue"/>
-
-	
-	<target name="pre-install">
-		<echo level="info">***************************************************************</echo>
-		<echo level="info">This is the pre-install target in the dummy package!</echo>
-		<echo level="info">Package manager home is = ${PM_HOME}</echo>
-		<echo level="info">JBoss AS home is = ${JBOSS_HOME}</echo>
-		<echo level="info">***************************************************************</echo>
-		<echo file="${JBOSS_HOME}/bin/test.txt" message="This proves that the pre-install script was run"/>
-		<echo level="debug" message="Test property value is = ${test}"/>
-	</target>
-</project>
\ No newline at end of file

Deleted: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-just-install-file.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-just-install-file.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-just-install-file.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -1,8 +0,0 @@
-<sh:package name="jboss-ejb3-nointerface" version="1.0.0-Alpha1"
-xmlns:sh="http://www.jboss.org/schema">
-
-    <!--  Package to install a dummy jar into JBOSS_AS/common/lib -->  
-  <file name="dummy.jar" dest-path="common/lib" type="library"/>
-  
-  
-</sh:package>
\ No newline at end of file

Deleted: projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-pre-install-script.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-pre-install-script.xml	2009-10-21 18:07:21 UTC (rev 95326)
+++ projects/ejb3/trunk/package-manager/src/test/resources/org/jboss/ejb3/packagemanager/test/install/unit/package-with-pre-install-script.xml	2009-10-21 18:14:55 UTC (rev 95327)
@@ -1,11 +0,0 @@
-<sh:package name="jboss-ejb3-nointerface" version="1.0.0-Alpha1"
-xmlns:sh="http://www.jboss.org/schema">
-
-    <!--  Package to install a dummy jar into JBOSS_AS/server/default/deploy -->  
-  <file name="dummy.jar" dest-path="server/default/deploy" type="library"/>
-  
-  <pre-install>
-    <script file="build.xml"/>
-  </pre-install>
-  
-</sh:package>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list