[jboss-cvs] JBossAS SVN: r95676 - in projects/ejb3/trunk/package-manager: src/main/java/org/jboss/ejb3/packagemanager and 23 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 28 06:41:53 EDT 2009
Author: jaikiran
Date: 2009-10-28 06:41:52 -0400 (Wed, 28 Oct 2009)
New Revision: 95676
Added:
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/DefaultDatabaseManager.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/PackageDatabaseManager.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledFile.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledPackage.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageDependency.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageManagerEntity.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageNotInstalledException.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/DependenciesType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFileType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackageType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstallType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstallType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/ScriptType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirementsType.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependenciesType.java
projects/ejb3/trunk/package-manager/src/main/resources/META-INF/
projects/ejb3/trunk/package-manager/src/main/resources/META-INF/persistence.xml
projects/ejb3/trunk/package-manager/src/main/resources/package-manager-sql-scripts.sql
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/unit/
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/unit/CommandLineTestCase.java
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/DBUtil.java
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/unit/
projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/unit/UnInstallTestCase.java
projects/ejb3/trunk/package-manager/src/test/resources/remove-packages-script.sql
Removed:
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/InstallFile.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Package.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstall.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstall.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/SystemRequirements.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java
Modified:
projects/ejb3/trunk/package-manager/pom.xml
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/PackageManager.java
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/IvyDependencyManager.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/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/PackagedDependency.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/InstallFileImpl.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackageImpl.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/PostInstallImpl.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallScript.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallImpl.java
projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallScript.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/metadata/impl/SystemRequirementsImpl.java
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/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/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java
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/install/unit/BasicInstallTestCase.java
projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml
Log:
EJBTHREE-1942 Further implementation to package manager
Modified: projects/ejb3/trunk/package-manager/pom.xml
===================================================================
--- projects/ejb3/trunk/package-manager/pom.xml 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/pom.xml 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,17 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-
- <!-- POM Model Version -->
- <modelVersion>4.0.0</modelVersion>
-
- <!-- Artifact Information -->
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-package-manager</artifactId>
- <packaging>jar</packaging>
- <name>JBoss EJB3 Package Manager</name>
- <version>1.0.0-SNAPSHOT</version>
- <description>Package manager for JBoss EJB3 package installations into JBoss AS</description>
- <repositories>
+
+
+ <!-- POM Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Information -->
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-package-manager</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss EJB3 Package Manager</name>
+ <version>1.0.0-SNAPSHOT</version>
+ <description>Package manager for JBoss EJB3 package installations into JBoss AS</description>
+ <repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
@@ -77,7 +77,7 @@
</build>
- <dependencies>
+ <dependencies>
<!-- Ant for script processors -->
<dependency>
@@ -152,6 +152,41 @@
<version>2.1.0</version>
</dependency>
+ <!-- We use JPA 1.0 for database operations -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <!-- We use Hibernate as our JPA provider -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>3.4.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.5.8</version>
+ </dependency>
+
+ <!-- We use Derby db, for it's embedded support, by default -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.4.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+
<!-- Tests -->
<dependency>
<groupId>junit</groupId>
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageContext.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -23,8 +23,12 @@
import java.io.File;
import java.net.URL;
+import java.util.List;
+import java.util.Set;
-import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
+import org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType;
/**
* PackageContext
@@ -41,21 +45,29 @@
* @return
*/
URL getPackageSource();
-
+
/**
* The root of the package where it has been
* extracted
* @return
*/
File getPackageRoot();
-
+
+ String getPackageName();
+
+ String getPackageVersion();
+
/**
- * Returns the package metadata parsed out of
- * the package.xml file available in the package source.
- *
- * @see #getPackageSource()
- *
- * @return
+ * @return Returns the set of dependency package contexts for this
+ * package context. Returns an empty set if there are no dependencies
*/
- Package getPackage();
+ Set<PackageContext> getDependencyPackages();
+
+ SystemRequirementsType getSystemRequirements();
+
+ List<ScriptType> getPostInstallScripts();
+
+ List<ScriptType> getPreInstallScripts();
+
+ List<InstallFileType> getInstallationFiles();
}
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/PackageManager.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,10 +24,7 @@
import java.net.URL;
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;
-import org.jboss.ejb3.packagemanager.script.ScriptProcessor;
+import org.jboss.ejb3.packagemanager.exception.PackageNotInstalledException;
/**
* PackageManager
@@ -52,14 +49,14 @@
*
* @param packagePath The URL path to the package file
*/
- void updatePackage(String packagePath);
+ void updatePackage(String packagePath) throws PackageManagerException;
/**
* Updates the package
*
* @param packageURL The URL of the package file
*/
- void updatePackage(URL packageURL);
+ void updatePackage(URL packageURL) throws PackageManagerException;
/**
* Installs a package
@@ -81,16 +78,9 @@
* Removes a package using the name of the package
* @param packageName Name of the package to be uninstalled
*/
- void removePackage(String packageName);
+ void removePackage(String packageName) throws PackageNotInstalledException, PackageManagerException;
- /**
- * Returns an appropriate {@link Installer} for the {@link InstallFile}
- * @param fileMeta The file in the package, to be installed
- * @return
- */
- Installer getInstaller(InstallFile fileMeta);
-
/**
* A package manager works against a JBoss AS server. This method returns the
* absolute path of the JBoss AS Home.
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/DefaultDatabaseManager.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/DefaultDatabaseManager.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/DefaultDatabaseManager.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,319 @@
+/*
+* 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.db;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.entity.InstalledFile;
+import org.jboss.ejb3.packagemanager.entity.InstalledPackage;
+import org.jboss.ejb3.packagemanager.entity.PackageDependency;
+import org.jboss.ejb3.packagemanager.entity.PackageManagerEntity;
+import org.jboss.ejb3.packagemanager.exception.PackageNotInstalledException;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.logging.Logger;
+
+/**
+ * DefaultDatabaseManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DefaultDatabaseManager implements PackageDatabaseManager
+{
+ /**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(DefaultDatabaseManager.class);
+
+ /**
+ * Entity manager factory
+ */
+ private EntityManagerFactory entityMgrFactory;
+
+ /**
+ * TODO: Revisit this
+ */
+ private ThreadLocal<EntityManager> currentEntityManager = new ThreadLocal<EntityManager>();
+
+ private PackageManagerContext packageManagerCtx;
+
+ /**
+ * Constructor
+ * @param pkgMgrCtx
+ */
+ public DefaultDatabaseManager(PackageManagerContext pkgMgrCtx)
+ {
+ this.packageManagerCtx = pkgMgrCtx;
+
+ // TODO: Set it in a better way
+ // String jbossServerDataDir = pkgMgrCtx.getJBossServerHome() + "/server/default/data";
+ // System.setProperty("derby.system.home", "/home/jpai/pm");
+ System.out.println("Derby system home is " + System.getProperty("derby.system.home"));
+ this.entityMgrFactory = Persistence.createEntityManagerFactory("default");
+
+ }
+
+ private PackageManagerEntity getOrCreatePackageManagerEntity(PackageManagerContext pkgMgrCtx)
+ {
+ EntityManager em = this.getEntityManager();
+ Query query = em.createQuery("from PackageManagerEntity pm where pm.jbossHome='" + pkgMgrCtx.getJBossServerHome()
+ + "'");
+ List<PackageManagerEntity> packageManagers = query.getResultList();
+ if (packageManagers == null || packageManagers.isEmpty())
+ {
+ PackageManagerEntity pm = new PackageManagerEntity(pkgMgrCtx);
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ em.persist(pm);
+ tx.commit();
+ return pm;
+ }
+ else if (packageManagers.size() > 1)
+ {
+ throw new RuntimeException("More than one package manager found for JBOSS_HOME "
+ + pkgMgrCtx.getJBossServerHome());
+ }
+ else
+ {
+ return packageManagers.get(0);
+ }
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#installPackage(PackageContext)
+ */
+ @Override
+ public InstalledPackage installPackage(PackageContext pkgCtx)
+ {
+ EntityManager em = this.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ PackageManagerEntity packageManager = this.getOrCreatePackageManagerEntity(this.packageManagerCtx);
+
+ InstalledPackage newlyInstalledPackage = this.createPackage(packageManager, pkgCtx);
+
+ try
+ {
+ em.persist(newlyInstalledPackage);
+ tx.commit();
+ logger.info("Recorded installation of package " + pkgCtx + " to database");
+ return newlyInstalledPackage;
+
+ }
+ catch (Exception e)
+ {
+ tx.rollback();
+ this.removeEntityManager(em);
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#getInstalledPackage(java.lang.String)
+ */
+ @Override
+ public InstalledPackage getInstalledPackage(String name)
+ {
+ EntityManager em = this.getEntityManager();
+ PackageManagerEntity packageManager = this.getOrCreatePackageManagerEntity(this.packageManagerCtx);
+ Query query = em.createQuery("from " + InstalledPackage.class.getSimpleName() + " p where p.name='" + name
+ + "' and p.packageManager.id=" + packageManager.getId());
+ return (InstalledPackage) query.getSingleResult();
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#isPackageInstalled(java.lang.String)
+ */
+ @Override
+ public boolean isPackageInstalled(String name)
+ {
+ EntityManager em = this.getEntityManager();
+ PackageManagerEntity packageManager = this.getOrCreatePackageManagerEntity(this.packageManagerCtx);
+ Query query = em.createQuery("from " + InstalledPackage.class.getSimpleName() + " p where p.name='" + name
+ + "' and p.packageManager.id=" + packageManager.getId());
+ List<Object> result = query.getResultList();
+
+ if (result == null || result.isEmpty())
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#getDependentPackages(java.lang.String)
+ */
+ @Override
+ public Set<InstalledPackage> getDependentPackages(String name)
+ {
+ InstalledPackage installedPackage = this.getInstalledPackage(name);
+ EntityManager em = this.getEntityManager();
+ Query query = em.createQuery("select pd.dependentPackage from " + PackageDependency.class.getSimpleName()
+ + " pd " + "join pd.dependeePackage p " + " where p.id=" + installedPackage.getId());
+
+ List<InstalledPackage> result = query.getResultList();
+ if (result == null || result.isEmpty())
+ {
+ return Collections.EMPTY_SET;
+ }
+ Set<InstalledPackage> dependentPackages = new HashSet<InstalledPackage>(result);
+ return dependentPackages;
+ }
+
+ /**
+ *
+ * @param pkgMgrEntity
+ * @param pkgCtx
+ * @return
+ */
+ private InstalledPackage createPackage(PackageManagerEntity pkgMgrEntity, PackageContext pkgCtx)
+ {
+ InstalledPackage newPackage = new InstalledPackage(pkgMgrEntity, pkgCtx.getPackageName(), pkgCtx
+ .getPackageVersion());
+
+ List<InstallFileType> files = pkgCtx.getInstallationFiles();
+ if (files != null)
+ {
+ Set<InstalledFile> installationFilesForNewPackage = new HashSet<InstalledFile>(files.size());
+ newPackage.setInstallationFiles(installationFilesForNewPackage);
+
+ for (InstallFileType file : files)
+ {
+ InstalledFile installationFile = new InstalledFile(file.getName(), file.getDestPath());
+ installationFile.setPkg(newPackage);
+ if (file.getType() != null)
+ {
+ installationFile.setFileType(file.getType().toString());
+ }
+ installationFilesForNewPackage.add(installationFile);
+ }
+ }
+
+ Set<PackageContext> dependencyPackages = pkgCtx.getDependencyPackages();
+ if (dependencyPackages != null)
+ {
+ Set<PackageDependency> dependencyPackagesForNewPackage = new HashSet<PackageDependency>(dependencyPackages
+ .size());
+ newPackage.setDependencies(dependencyPackagesForNewPackage);
+
+ for (PackageContext dependencyPkgCtx : dependencyPackages)
+ {
+ PackageDependency dependency = new PackageDependency();
+ dependency.setDependentPackage(newPackage);
+ InstalledPackage dependencyPackage = this.getInstalledPackage(dependencyPkgCtx.getPackageName());
+ dependency.setDependeePackage(dependencyPackage);
+
+ dependencyPackagesForNewPackage.add(dependency);
+ }
+ }
+ return newPackage;
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#upgradePackage(org.jboss.ejb3.packagemanager.entity.InstalledPackage, org.jboss.ejb3.packagemanager.entity.InstalledPackage)
+ */
+ @Override
+ public InstalledPackage upgradePackage(PackageContext packageToUpgrade)
+ {
+ // get all packages which were dependent on the previous version of the package
+ return null;
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#removePackage(java.lang.String)
+ */
+ @Override
+ public void removePackage(String name) throws PackageNotInstalledException
+ {
+ if (!this.isPackageInstalled(name))
+ {
+ throw new PackageNotInstalledException(name);
+ }
+ InstalledPackage installedPackage = this.getInstalledPackage(name);
+ this.removePackage(installedPackage);
+
+ }
+
+ /**
+ * TODO: Revisit this
+ * @return
+ */
+ private EntityManager getEntityManager()
+ {
+ EntityManager em = currentEntityManager.get();
+ if (em == null)
+ {
+ em = this.entityMgrFactory.createEntityManager();
+ currentEntityManager.set(em);
+ }
+ return em;
+ }
+
+ /**
+ * TODO: Revisit this
+ * @param em
+ */
+ private void removeEntityManager(EntityManager em)
+ {
+ em.close();
+ currentEntityManager.set(null);
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.db.PackageDatabaseManager#removePackage(org.jboss.ejb3.packagemanager.entity.InstalledPackage)
+ */
+ @Override
+ public void removePackage(InstalledPackage installedPackage)
+ {
+ EntityManager em = this.getEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ try
+ {
+ installedPackage = em.merge(installedPackage);
+ logger.info("Deleting installed package = " + installedPackage.getId());
+ em.remove(installedPackage);
+ tx.commit();
+ logger.info("Deleted installed package = " + installedPackage.getId());
+ }
+ catch (Exception e)
+ {
+ // tx.rollback();
+ this.removeEntityManager(em);
+ throw new RuntimeException(e);
+ }
+
+ }
+
+}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/PackageDatabaseManager.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/PackageDatabaseManager.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/db/PackageDatabaseManager.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,52 @@
+/*
+* 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.db;
+
+import java.util.Set;
+
+import org.jboss.ejb3.packagemanager.PackageContext;
+import org.jboss.ejb3.packagemanager.entity.InstalledPackage;
+import org.jboss.ejb3.packagemanager.exception.PackageNotInstalledException;
+
+/**
+ * PackageDatabaseManager
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PackageDatabaseManager
+{
+
+ InstalledPackage installPackage(PackageContext pkgCtx);
+
+ InstalledPackage getInstalledPackage(String name);
+
+ boolean isPackageInstalled(String name);
+
+ Set<InstalledPackage> getDependentPackages(String name);
+
+ InstalledPackage upgradePackage(PackageContext pkgCtx);
+
+ void removePackage(String name) throws PackageNotInstalledException;
+
+ void removePackage(InstalledPackage installedPackage);
+}
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/DependencyManager.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -26,7 +26,7 @@
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;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
/**
* DependencyManager
@@ -37,6 +37,6 @@
public interface DependencyManager
{
- Set<PackageContext> resolveDepedencies(PackageManagerContext pkgMgrContext, PackageContext pkgCtx, UnProcessedDependencies deps)
+ Set<PackageContext> resolveDepedencies(PackageManagerContext pkgMgrContext, PackageContext pkgCtx, UnProcessedDependenciesType deps)
throws DependencyResoultionException;
}
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/dependency/impl/IvyDependencyManager.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -47,7 +47,7 @@
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.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
import org.jboss.logging.Logger;
/**
@@ -75,7 +75,7 @@
*/
@Override
public Set<PackageContext> resolveDepedencies(PackageManagerContext pkgMgrContext, PackageContext pkgCtx,
- UnProcessedDependencies deps) throws DependencyResoultionException
+ UnProcessedDependenciesType deps) throws DependencyResoultionException
{
IvySettings ivySettings = new IvySettings();
// set the basedir to the package root
@@ -121,8 +121,8 @@
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());
+ File pkgTmpDir = new File(pkgMgrContext.getPackageManagerEnvironment().getPackageManagerTmpDir(), pkgCtx.getPackageName());
+
pkgTmpDir.mkdir();
ModuleRevisionId mRID = md.getModuleRevisionId();
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledFile.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledFile.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledFile.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,126 @@
+/*
+* 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.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * InstallationFile
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Entity
+ at Table(name="installation_file")
+public class InstalledFile
+{
+
+ @Id
+ @GeneratedValue (strategy = GenerationType.IDENTITY)
+ private long id;
+
+ private String fileName;
+
+ private String installedPath;
+
+ private String fileType;
+
+ @ManyToOne
+ @JoinColumn(name="package_id")
+ private InstalledPackage pkg;
+
+ private InstalledFile()
+ {
+ // for jpa
+ }
+
+ /**
+ * Constructor
+ *
+ * @param fileName The name of the file
+ * @param pathWhereInstalled The path, relative to JBOSS_HOME where this file is installed
+ */
+ public InstalledFile(String fileName, String pathWhereInstalled)
+ {
+ this.fileName = fileName;
+ this.installedPath = pathWhereInstalled;
+ }
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ public String getFileName()
+ {
+ return fileName;
+ }
+
+ public void setFileName(String fileName)
+ {
+ this.fileName = fileName;
+ }
+
+ public String getInstalledPath()
+ {
+ return installedPath;
+ }
+
+ public void setInstalledPath(String installedPath)
+ {
+ this.installedPath = installedPath;
+ }
+
+ public String getFileType()
+ {
+ return fileType;
+ }
+
+ public void setFileType(String fileType)
+ {
+ this.fileType = fileType;
+ }
+
+ public InstalledPackage getPkg()
+ {
+ return pkg;
+ }
+
+ public void setPkg(InstalledPackage pkg)
+ {
+ this.pkg = pkg;
+ }
+
+
+
+}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledPackage.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledPackage.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/InstalledPackage.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,160 @@
+/*
+* 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.entity;
+
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ * Package
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Entity
+ at Table(name = "package")
+public class InstalledPackage
+{
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private long id;
+
+ private String name;
+
+ private String version;
+
+ @OneToMany(mappedBy = "dependeePackage", cascade=CascadeType.ALL)
+ private Set<PackageDependency> dependencies;
+
+ @OneToMany(mappedBy = "pkg", cascade = CascadeType.ALL)
+ private Set<InstalledFile> installationFiles;
+
+ @ManyToOne
+ @JoinColumn(name = "package_manager_id")
+ private PackageManagerEntity packageManager;
+
+ private InstalledPackage()
+ {
+ // for JPA
+ }
+
+ public InstalledPackage(PackageManagerEntity pkgMgr, String packageName, String packageVersion)
+ {
+ this.packageManager = pkgMgr;
+ this.name = packageName;
+ this.version = packageVersion;
+ }
+
+ public InstalledPackage(long id)
+ {
+ this.id = id;
+ }
+
+
+ public String getPackageName()
+ {
+ return this.name;
+ }
+
+ public String getPackageVersion()
+ {
+ return this.version;
+ }
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ public Set<InstalledFile> getInstallationFiles()
+ {
+ return installationFiles;
+ }
+
+ public void setInstallationFiles(Set<InstalledFile> installationFiles)
+ {
+ this.installationFiles = installationFiles;
+ }
+
+ public PackageManagerEntity getPackageManager()
+ {
+ return packageManager;
+ }
+
+ public void setPackageManager(PackageManagerEntity packageManager)
+ {
+ this.packageManager = packageManager;
+ }
+
+ public Set<PackageDependency> getDependencies()
+ {
+ return dependencies;
+ }
+
+ public void setDependencies(Set<PackageDependency> dependencies)
+ {
+ this.dependencies = dependencies;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (!(obj instanceof InstalledPackage))
+ {
+ return false;
+ }
+ InstalledPackage otherPackge = (InstalledPackage) obj;
+ return this.getId() == otherPackge.getId();
+
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ return Long.valueOf(this.id).hashCode();
+ }
+}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageDependency.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageDependency.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageDependency.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,86 @@
+/*
+* 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.entity;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * PackageDependency
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Entity
+ at Table(name = "package_dependency")
+public class PackageDependency
+{
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private long id;
+
+ @ManyToOne (cascade=CascadeType.REFRESH)
+ @JoinColumn(name = "dependent_package_id")
+ private InstalledPackage dependentPackage;
+
+ @ManyToOne(cascade=CascadeType.REFRESH)
+ @JoinColumn(name = "dependee_package_id")
+ private InstalledPackage dependeePackage;
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ public InstalledPackage getDependentPackage()
+ {
+ return dependentPackage;
+ }
+
+ public void setDependentPackage(InstalledPackage dependentPackage)
+ {
+ this.dependentPackage = dependentPackage;
+ }
+
+ public InstalledPackage getDependeePackage()
+ {
+ return dependeePackage;
+ }
+
+ public void setDependeePackage(InstalledPackage dependeePackage)
+ {
+ this.dependeePackage = dependeePackage;
+ }
+
+}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageManagerEntity.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageManagerEntity.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/entity/PackageManagerEntity.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,84 @@
+/*
+* 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.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.jboss.ejb3.packagemanager.PackageManagerContext;
+
+/**
+ * PackageManagerEntity
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Entity
+ at Table(name = "package_manager")
+public class PackageManagerEntity
+{
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private long id;
+
+ private String jbossHome;
+
+ private PackageManagerEntity()
+ {
+ // for jpa
+ }
+
+ public PackageManagerEntity(String jbossHome)
+ {
+ this.jbossHome = jbossHome;
+ }
+
+ public PackageManagerEntity(PackageManagerContext pkgMgrCtx)
+ {
+ this.jbossHome = pkgMgrCtx.getJBossServerHome();
+ }
+
+ public long getId()
+ {
+ return id;
+ }
+
+ public void setId(long id)
+ {
+ this.id = id;
+ }
+
+ public String getJbossHome()
+ {
+ return jbossHome;
+ }
+
+ public void setJbossHome(String jbossHome)
+ {
+ this.jbossHome = jbossHome;
+ }
+
+}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageNotInstalledException.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageNotInstalledException.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/exception/PackageNotInstalledException.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -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;
+
+/**
+ * PackageNotInstalledException
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class PackageNotInstalledException extends PackageManagerException
+{
+
+ public PackageNotInstalledException(String packageName)
+ {
+ super("Package: " + packageName + " is not installed");
+ }
+}
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageContext.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -23,18 +23,35 @@
import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import java.util.jar.JarFile;
import org.jboss.ejb3.packagemanager.PackageContext;
import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.dependency.DependencyManager;
+import org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager;
+import org.jboss.ejb3.packagemanager.exception.DependencyResoultionException;
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.metadata.DependenciesType;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
+import org.jboss.ejb3.packagemanager.metadata.PostInstallType;
+import org.jboss.ejb3.packagemanager.metadata.PreInstallType;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
+import org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
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;
+import org.jboss.logging.Logger;
/**
* DefaultPackageContext
@@ -46,6 +63,11 @@
{
/**
+ * Logger
+ */
+ private static Logger logger = Logger.getLogger(DefaultPackageContext.class);
+
+ /**
* Source of the of the package
*/
private URL packageSource;
@@ -64,20 +86,27 @@
/**
* The package metadata
*/
- private org.jboss.ejb3.packagemanager.metadata.Package pkg;
+ private org.jboss.ejb3.packagemanager.metadata.PackageType pkg;
/**
+ * Set of dependency packages for this package context
+ */
+ private Set<PackageContext> dependencyPackages = new HashSet<PackageContext>();
+
+ /**
* 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
+ public DefaultPackageContext(PackageManagerContext pkgMgrCtx, URL packageSrc) throws InvalidPackageException,
+ DependencyResoultionException
{
this.packageSource = packageSrc;
this.pkgMgrCtx = pkgMgrCtx;
initPackageContext();
+ initPackageDependencies();
}
/**
@@ -98,16 +127,166 @@
return this.packageRoot;
}
+
+ public PackageType getPackage()
+ {
+ return this.pkg;
+ }
+
/**
- * @see PackageContext#getPackage()
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getDependencyPackages()
*/
@Override
- public Package getPackage()
+ public Set<PackageContext> getDependencyPackages()
{
- return this.pkg;
+ return this.dependencyPackages;
+
}
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getInstallationFiles()
+ */
+ @Override
+ public List<InstallFileType> getInstallationFiles()
+ {
+ return Collections.unmodifiableList(this.pkg.getFiles());
+ }
/**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getPackageName()
+ */
+ @Override
+ public String getPackageName()
+ {
+ return this.pkg.getName();
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getPackageVersion()
+ */
+ @Override
+ public String getPackageVersion()
+ {
+ return this.pkg.getVersion();
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getPostInstallScripts()
+ */
+ @Override
+ public List<ScriptType> getPostInstallScripts()
+ {
+ PostInstallType postInstall = this.pkg.getPostInstall();
+ if (postInstall == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ List<ScriptType> postInstallScripts = postInstall.getScripts();
+ if (postInstallScripts == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ return Collections.unmodifiableList(postInstallScripts);
+
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getPreInstallScripts()
+ */
+ @Override
+ public List<ScriptType> getPreInstallScripts()
+ {
+ PreInstallType preInstall = this.pkg.getPreInstall();
+ if (preInstall == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ List<ScriptType> preInstallScripts = preInstall.getScripts();
+ if (preInstallScripts == null)
+ {
+ return Collections.EMPTY_LIST;
+ }
+ return Collections.unmodifiableList(preInstallScripts);
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.PackageContext#getSystemRequirements()
+ */
+ @Override
+ public SystemRequirementsType getSystemRequirements()
+ {
+ return this.pkg.getSystemRequirements();
+ }
+
+ private void initPackageDependencies() throws DependencyResoultionException, InvalidPackageException
+ {
+ // packaged dependencies
+ this.dependencyPackages.addAll(this.getPackagedDependencyPackages());
+ // unprocessed dependencies
+ this.dependencyPackages.addAll(this.getUnprocessedDependencyPackages());
+ }
+
+ private Set<PackageContext> getUnprocessedDependencyPackages() throws DependencyResoultionException
+ {
+ DependenciesType dependencies = this.pkg.getDependencies();
+ if (dependencies == null || dependencies.getUnProcessedDependencies() == null)
+ {
+ logger.debug("No unprocessed dependencies for " + this);
+ return Collections.EMPTY_SET;
+ }
+ UnProcessedDependenciesType unProcessedDeps = dependencies.getUnProcessedDependencies();
+ File dependencyFile = new File(this.getPackageRoot(), unProcessedDeps.getFile());
+ if (!dependencyFile.exists())
+ {
+ throw new DependencyResoultionException("Dependency file " + dependencyFile + " not found for " + this);
+ }
+ DependencyManager depManager = this.getDependencyManager(unProcessedDeps);
+ if (depManager == null)
+ {
+ // TODO: Revisit this
+ return Collections.EMPTY_SET;
+ }
+ Set<PackageContext> dependencyPackages = depManager.resolveDepedencies(this.pkgMgrCtx, this, unProcessedDeps);
+ return dependencyPackages;
+ }
+
+ private Set<PackageContext> getPackagedDependencyPackages() throws InvalidPackageException,
+ DependencyResoultionException
+ {
+
+ DependenciesType dependencies = this.pkg.getDependencies();
+ if (dependencies == null || dependencies.getPackagedDependencies() == null
+ || dependencies.getPackagedDependencies().isEmpty())
+ {
+ logger.debug("No packaged dependency for " + this);
+ return Collections.EMPTY_SET;
+ }
+ List<PackagedDependency> packagedDeps = dependencies.getPackagedDependencies();
+ Set<PackageContext> depPackageCtxs = new HashSet<PackageContext>();
+ for (PackagedDependency packagedDep : packagedDeps)
+ {
+ String relativePathToDependencyPackage = packagedDep.getFile();
+ File dependencyPackage = new File(this.getPackageRoot(), relativePathToDependencyPackage);
+ if (!dependencyPackage.exists())
+ {
+ throw new DependencyResoultionException("packaged-dependency file " + dependencyPackage + " does not exist");
+ }
+ PackageContext dependencyPkgCtx;
+ try
+ {
+ dependencyPkgCtx = new DefaultPackageContext(this.pkgMgrCtx, dependencyPackage.toURI().toURL());
+ depPackageCtxs.add(dependencyPkgCtx);
+
+ }
+ catch (MalformedURLException mue)
+ {
+ throw new RuntimeException(mue);
+ }
+ }
+ return depPackageCtxs;
+ }
+
+ /**
* 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.
@@ -165,6 +344,46 @@
}
}
+ private DependencyManager getDependencyManager(UnProcessedDependenciesType 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);
+ }
+
+ }
+
@Override
public String toString()
{
@@ -183,4 +402,6 @@
return sb.toString();
}
+
+
}
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/impl/DefaultPackageManagerImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -21,8 +21,6 @@
*/
package org.jboss.ejb3.packagemanager.impl;
-import gnu.getopt.Getopt;
-
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
@@ -33,21 +31,20 @@
import org.jboss.ejb3.packagemanager.PackageManager;
import org.jboss.ejb3.packagemanager.PackageManagerContext;
import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
-import org.jboss.ejb3.packagemanager.dependency.DependencyManager;
-import org.jboss.ejb3.packagemanager.dependency.impl.IvyDependencyManager;
+import org.jboss.ejb3.packagemanager.db.DefaultDatabaseManager;
+import org.jboss.ejb3.packagemanager.db.PackageDatabaseManager;
+import org.jboss.ejb3.packagemanager.entity.InstalledFile;
+import org.jboss.ejb3.packagemanager.entity.InstalledPackage;
import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
+import org.jboss.ejb3.packagemanager.exception.PackageNotInstalledException;
import org.jboss.ejb3.packagemanager.installer.DefaultInstaller;
import org.jboss.ejb3.packagemanager.installer.Installer;
import org.jboss.ejb3.packagemanager.installer.MergingInstaller;
-import org.jboss.ejb3.packagemanager.metadata.Dependencies;
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.InstallFileType;
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.UnProcessedDependencies;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
import org.jboss.ejb3.packagemanager.script.ScriptProcessor;
import org.jboss.ejb3.packagemanager.script.impl.AntScriptProcessor;
import org.jboss.logging.Logger;
@@ -83,6 +80,11 @@
private PackageManagerContext pkgMgrCtx;
/**
+ * Package database manager
+ */
+ private PackageDatabaseManager pkgDatabaseManager;
+
+ /**
* Creates the default package manager for a server
*
* @param environment The package manager environment
@@ -93,6 +95,7 @@
this.environment = environment;
this.installationServerHome = jbossHome;
this.pkgMgrCtx = new DefaultPackageManagerContext(this);
+ this.pkgDatabaseManager = new DefaultDatabaseManager(this.pkgMgrCtx);
}
/**
@@ -170,12 +173,18 @@
{
throw new PackageManagerException("Package context is null");
}
+ // check if package is already installed
+ boolean packageAlreadyInstalled = this.pkgDatabaseManager.isPackageInstalled(pkgContext.getPackageName());
+ if (packageAlreadyInstalled)
+ {
+ throw new PackageManagerException("Package " + pkgContext + " is already installed");
+ }
+ logger.debug("New package " + pkgContext + " being installed");
// proceed with installation of the package
- Package pkgToInstall = pkgContext.getPackage();
- if (pkgToInstall.getFiles() == null)
+
+ if (pkgContext.getInstallationFiles() == null)
{
- throw new PackageManagerException("There are no files to install for package: " + pkgToInstall.getName()
- + " version: " + pkgToInstall.getVersion());
+ throw new PackageManagerException("There are no files to install for package: " + pkgContext);
}
// work on dependencies first (because if deps are not satisfied then no point
// running the pre-install step.
@@ -185,50 +194,113 @@
// pre-installation step
this.preInstallPackage(pkgContext);
// install files in this package
- for (InstallFile fileToInstall : pkgToInstall.getFiles())
+ for (InstallFileType fileToInstall : pkgContext.getInstallationFiles())
{
Installer installer = getInstaller(fileToInstall);
- installer.install(this.pkgMgrCtx, pkgContext, fileToInstall);
+ installer.install(pkgContext, fileToInstall);
}
// post-installation step
this.postInstallPackage(pkgContext);
logger.info("Installed " + pkgContext);
+ this.pkgDatabaseManager.installPackage(pkgContext);
}
/**
* @see org.jboss.ejb3.packagemanager.PackageManager#removePackage(java.lang.String)
*/
- public void removePackage(String packageName)
+ @Override
+ public void removePackage(String packageName) throws PackageNotInstalledException, PackageManagerException
{
- // TODO Auto-generated method stub
-
+ this.removePackage(packageName, false);
}
+
+ protected void removePackage(String packageName, boolean forceRemove) throws PackageNotInstalledException, PackageManagerException
+ {
+ // get the installed package
+ boolean isPackageInstalled = this.pkgDatabaseManager.isPackageInstalled(packageName);
+ if (!isPackageInstalled)
+ {
+ throw new PackageNotInstalledException("Package " + packageName + " is not installed - so cannot be removed!");
+ }
+ if (!forceRemove)
+ {
+ // check if other packages are dependent on this package
+ // If yes, then do NOT remove this package. Else remove this package
+ Set<InstalledPackage> dependentPackages = this.pkgDatabaseManager.getDependentPackages(packageName);
+ if (dependentPackages != null && !dependentPackages.isEmpty())
+ {
+ throw new PackageManagerException("Other packages are dependent on package " + packageName
+ + " - cannot remove this package!");
+ }
+ }
+ InstalledPackage installedPackage = this.pkgDatabaseManager.getInstalledPackage(packageName);
+ // TODO : Revisit this installer creation
+ Installer installer = new DefaultInstaller(this.pkgMgrCtx);
+ // install files in this package
+ for (InstalledFile fileToUninstall : installedPackage.getInstallationFiles())
+ {
+ installer.uninstall(installedPackage, fileToUninstall);
+ }
+ this.pkgDatabaseManager.removePackage(installedPackage);
+ }
+
/**
* @see org.jboss.ejb3.packagemanager.PackageManager#updatePackage(java.lang.String)
*/
@Override
- public void updatePackage(String packageFilePath)
+ public void updatePackage(String packageFilePath) throws PackageManagerException
{
- // WIP
- // URL packageUrl = null;
- // try
- // {
- // packageUrl = this.getPackageURL(packageFilePath);
- // }
- // catch (MalformedURLException mue)
- // {
- // throw new InstallerException("Cannot parse path " + packageFilePath, mue);
- // }
- // this.updatePackage(packageUrl);
+ if (packageFilePath == null)
+ {
+ throw new PackageManagerException("Package path is null");
+ }
+ URL packageURL = null;
+ try
+ {
+ packageURL = this.getPackageURL(packageFilePath);
+ }
+ catch (MalformedURLException mue)
+ {
+ throw new PackageManagerException("Cannot parse path " + packageFilePath, mue);
+ }
+ this.updatePackage(packageURL);
}
@Override
- public void updatePackage(URL packageURL)
+ public void updatePackage(URL packageURL) throws PackageManagerException
{
+ if (packageURL == null)
+ {
+ throw new PackageManagerException("Package URL is null");
+ }
+ // create a package context
+ PackageContext pkgCtx = new DefaultPackageContext(this.pkgMgrCtx, packageURL);
+ this.updatePackage(pkgCtx);
}
+ public void updatePackage(PackageContext pkgContext) throws PackageManagerException
+ {
+ // TODO: Revisit
+// // first remove
+// this.removeIfExists(pkgContext.getPackageName());
+//
+ // now install new version
+ this.installPackage(pkgContext);
+
+ }
+
+ private void removeIfExists(String packageName) throws PackageManagerException
+ {
+ // get the installed package
+ boolean isPackageInstalled = this.pkgDatabaseManager.isPackageInstalled(packageName);
+ if (!isPackageInstalled)
+ {
+ return;
+ }
+ this.removePackage(packageName);
+ }
/**
* Parses the {@code pkgPath} string and returns an appropriate URL.
*
@@ -255,9 +327,9 @@
}
/**
- * Returns the appropriate {@link Installer} for the {@link InstallFile}
+ * Returns the appropriate {@link Installer} for the {@link InstallFileType}
*/
- public Installer getInstaller(InstallFile file)
+ private Installer getInstaller(InstallFileType file)
{
if (file == null)
{
@@ -266,51 +338,11 @@
FileType fileType = file.getType();
if (fileType == FileType.CONFIG)
{
- return new MergingInstaller();
+ return new MergingInstaller(this.pkgMgrCtx);
}
- return new DefaultInstaller();
+ return new DefaultInstaller(this.pkgMgrCtx);
}
- 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
@@ -321,15 +353,14 @@
*/
protected void preInstallPackage(PackageContext pkgCtx) throws PackageManagerException
{
- Package pkgMetadata = pkgCtx.getPackage();
// find any pre-install scripts
- PreInstall preInstall = pkgMetadata.getPreInstall();
- if (preInstall == null || preInstall.getScripts() == null || preInstall.getScripts().isEmpty())
+ List<ScriptType> preInstallScripts = pkgCtx.getPreInstallScripts();
+ if (preInstallScripts == null || preInstallScripts.isEmpty())
{
logger.debug("There are no pre-install scripts for " + pkgCtx);
return;
}
- for (Script script : preInstall.getScripts())
+ for (ScriptType script : preInstallScripts)
{
// TODO: Can we just have one instance of the script processor to process
// all scripts? Stateful/stateless?
@@ -349,15 +380,14 @@
*/
protected void postInstallPackage(PackageContext pkgCtx) throws PackageManagerException
{
- Package pkgMetadata = pkgCtx.getPackage();
// find any post-install scripts
- PostInstall postInstall = pkgMetadata.getPostInstall();
- if (postInstall == null || postInstall.getScripts() == null || postInstall.getScripts().isEmpty())
+ List<ScriptType> postInstallScripts = pkgCtx.getPostInstallScripts();
+ if (postInstallScripts == null || postInstallScripts.isEmpty())
{
logger.debug("There are no post-install scripts for " + pkgCtx);
return;
}
- for (Script script : postInstall.getScripts())
+ for (ScriptType script : postInstallScripts)
{
ScriptProcessor scriptProcessor = new AntScriptProcessor();
// TODO: Can we just have one instance of the script processor to process
@@ -371,7 +401,7 @@
* Process any dependencies listed for the package. Dependency processing
* will include resolving and retrieving the appropriate dependency packages
* and install those packages. Dependency packages, either in the form of {@link PackagedDependency}
- * or {@link UnProcessedDependencies} will be installed during this process.
+ * or {@link UnProcessedDependenciesType} will be installed during this process.
*
* First the packaged dependencies are installed and then the unprocessed dependencies
*
@@ -380,93 +410,12 @@
*/
protected void installDependencies(PackageContext pkgContext) throws PackageManagerException
{
- // 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);
- }
-
- /**
- * Processes {@link UnProcessedDependencies} by using the dependency manager specified
- * through {@link UnProcessedDependencies#getManager()}
- *
- * @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
- */
- protected void installUnProcessedPackages(PackageContext pkgContext) throws PackageManagerException
- {
- Package pkgMeta = pkgContext.getPackage();
- Dependencies dependencies = pkgMeta.getDependencies();
- if (dependencies == null || dependencies.getUnProcessedDependencies() == null)
+ Set<PackageContext> dependencies = pkgContext.getDependencyPackages();
+ for (PackageContext dependencyPackage : dependencies)
{
- logger.debug("No unprocessed dependencies for " + pkgContext);
- return;
+ logger.info("Installing dependency package : " + dependencyPackage + " for dependent package: " + pkgContext);
+ this.updatePackage(dependencyPackage);
}
- UnProcessedDependencies unProcessedDeps = dependencies.getUnProcessedDependencies();
- File dependencyFile = new File(pkgContext.getPackageRoot(), unProcessedDeps.getFile());
- if (!dependencyFile.exists())
- {
- throw new PackageManagerException("Dependency file " + dependencyFile + " not found for " + pkgContext);
- }
- DependencyManager depManager = this.getDependencyManager(unProcessedDeps);
- if (depManager == null)
- {
- return;
- }
- Set<PackageContext> dependencyPackages = depManager.resolveDepedencies(this.pkgMgrCtx, pkgContext,
- unProcessedDeps);
- if (dependencyPackages == null || dependencyPackages.isEmpty())
- {
- logger.debug("Dependency manager did not find any dependency packages to be installed for " + pkgContext);
- return;
- }
- for (PackageContext dependencyPkg : dependencyPackages)
- {
- logger.info("Installing dependency package: " + dependencyPkg + " for dependent package: " + pkgContext);
- this.installPackage(dependencyPkg);
- }
}
- /**
- * Processes packaged dependencies {@link PackagedDependency} of a package. These
- * dependency packages are installed during this process.
- *
- * @param pkgContext
- * @throws PackageManagerException
- */
- protected void installPackagedDependencies(PackageContext pkgContext) throws PackageManagerException
- {
- Package pkgMeta = pkgContext.getPackage();
- Dependencies dependencies = pkgMeta.getDependencies();
- if (dependencies == null || dependencies.getPackagedDependencies() == null
- || dependencies.getPackagedDependencies().isEmpty())
- {
- logger.debug("No packaged dependency for " + pkgContext);
- return;
- }
- List<PackagedDependency> packagedDeps = dependencies.getPackagedDependencies();
- for (PackagedDependency packagedDep : packagedDeps)
- {
- 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);
- }
- }
-
}
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/AbstractInstaller.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -25,9 +25,10 @@
import org.jboss.ejb3.packagemanager.PackageContext;
import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.entity.InstalledFile;
+import org.jboss.ejb3.packagemanager.entity.InstalledPackage;
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.metadata.InstallFileType;
import org.jboss.logging.Logger;
/**
@@ -41,13 +42,44 @@
private static Logger logger = Logger.getLogger(AbstractInstaller.class);
+ protected PackageManagerContext packageMgrContext;
+
+ public AbstractInstaller(PackageManagerContext packageMgrCtx)
+ {
+ this.packageMgrContext = packageMgrCtx;
+ }
+
/**
- * @see org.jboss.ejb3.packagemanager.installer.Installer#install(org.jboss.ejb3.packagemanager.PackageManagerContext, org.jboss.ejb3.packagemanager.PackageContext, InstallFile)
+ * @see org.jboss.ejb3.packagemanager.installer.Installer#uninstall(org.jboss.ejb3.packagemanager.PackageManagerContext, org.jboss.ejb3.packagemanager.PackageContext)
*/
@Override
- public final void install(PackageManagerContext pkgMgrCtx, PackageContext pkgCtx, InstallFile fileMeta)
- throws PackageManagerException
+ public void uninstall(InstalledPackage pkg, InstalledFile installedFile) throws PackageManagerException
{
+ String jbossHome = pkg.getPackageManager().getJbossHome();
+ File relativePathToFile = new File(jbossHome, installedFile.getInstalledPath());
+ File fileToUninstall = new File(relativePathToFile, installedFile.getFileName());
+ if (!fileToUninstall.exists())
+ {
+ throw new PackageManagerException("Installed file missing: " + fileToUninstall.getAbsolutePath()
+ + " - cannot uninstall!");
+ }
+ if (fileToUninstall.isDirectory())
+ {
+ throw new PackageManagerException("Installed file is a directory : " + fileToUninstall.getAbsolutePath()
+ + " - cannot uninstall!");
+ }
+ fileToUninstall.delete();
+ logger.info("Uninstalled file " + fileToUninstall + " from package " + pkg.getPackageName());
+
+ }
+
+
+ /**
+ *
+ */
+ @Override
+ public final void install(PackageContext pkgCtx, InstallFileType fileMeta) throws PackageManagerException
+ {
// do templating
File pkgRoot = pkgCtx.getPackageRoot();
File srcPathOfFileToInstall = pkgRoot;
@@ -56,34 +88,33 @@
srcPathOfFileToInstall = new File(pkgRoot, fileMeta.getSrcPath());
}
File fileToInstall = new File(srcPathOfFileToInstall, fileMeta.getName());
- Package pkg = pkgCtx.getPackage();
+
if (!fileToInstall.exists())
{
- throw new PackageManagerException(fileToInstall.getAbsolutePath() + " does not exist, package: " + pkg.getName()
- + " version: " + pkg.getVersion() + " being installed from " + pkgCtx.getPackageRoot()
+ throw new PackageManagerException(fileToInstall.getAbsolutePath() + " does not exist, package: " + pkgCtx
+ + " being installed from " + pkgCtx.getPackageRoot()
+ " is probably corrupt!");
}
if (fileMeta.getDestPath() == null)
{
- throw new PackageManagerException("File " + fileMeta.getName() + " in package: " + pkg.getName() + " version: "
- + pkg.getVersion() + " does not specify a destination");
+ throw new PackageManagerException("File " + fileMeta.getName() + " in package: " + pkgCtx
+ + " does not specify a destination");
}
- String destServerHome = pkgMgrCtx.getJBossServerHome();
+ String destServerHome = this.packageMgrContext.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 PackageManagerException("dest-path " + locationToInstall.getAbsolutePath() + " for file: "
- + fileMeta.getName() + " in package: " + pkg.getName() + " version: " + pkg.getVersion()
+ + fileMeta.getName() + " in package: " + pkgCtx
+ " is either not present or is not a directory");
}
try
{
doInstall(fileMeta, fileToInstall, locationToInstall);
- logger.info("Installed file " + fileMeta.getName() + " from package: " + pkg.getName() + " version: "
- + pkg.getVersion() + " to " + locationToInstall.getAbsolutePath());
+ logger.info("Installed file " + fileMeta.getName() + " from package: " + pkgCtx + " to " + locationToInstall.getAbsolutePath());
// TODO: Write to DB about file install completion
}
@@ -95,8 +126,7 @@
}
}
- protected abstract void doInstall(InstallFile fileMetadata, File fileToInstall, File dest)
+ protected abstract void doInstall(InstallFileType fileMetadata, File fileToInstall, File dest)
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/DefaultInstaller.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,9 +24,10 @@
import java.io.File;
import java.io.IOException;
+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.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
import org.jboss.ejb3.packagemanager.util.IOUtil;
import org.jboss.logging.Logger;
@@ -41,15 +42,20 @@
private static Logger logger = Logger.getLogger(DefaultInstaller.class);
+ public DefaultInstaller(PackageManagerContext packageMgrCtx)
+ {
+ super(packageMgrCtx);
+ }
+
/**
- * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFile, java.io.File, java.io.File)
+ * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFileType, java.io.File, java.io.File)
*/
@Override
- protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws PackageManagerException
+ protected void doInstall(InstallFileType fileMetadata, File fileToInstall, File dest) throws PackageManagerException
{
// just copy from source to dest
File destFile = new File(dest, fileMetadata.getName());
- Package pkgMeta = fileMetadata.getPackage();
+ PackageType pkgMeta = fileMetadata.getPackage();
if (destFile.exists())
{
logger.info("File " + fileMetadata.getName() + " from package: " + pkgMeta.getName() + " version: "
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/Installer.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -22,9 +22,10 @@
package org.jboss.ejb3.packagemanager.installer;
import org.jboss.ejb3.packagemanager.PackageContext;
-import org.jboss.ejb3.packagemanager.PackageManagerContext;
+import org.jboss.ejb3.packagemanager.entity.InstalledFile;
+import org.jboss.ejb3.packagemanager.entity.InstalledPackage;
import org.jboss.ejb3.packagemanager.exception.PackageManagerException;
-import org.jboss.ejb3.packagemanager.metadata.InstallFile;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
/**
* Installer
@@ -35,5 +36,7 @@
public interface Installer
{
- void install(PackageManagerContext pkgMgrCtx, PackageContext pkgCtx, InstallFile file) throws PackageManagerException;
+ void install(PackageContext pkgCtx, InstallFileType fileToInstall) throws PackageManagerException;
+
+ void uninstall(InstalledPackage installedPackage, InstalledFile fileToUnInstall) 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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/installer/MergingInstaller.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -23,8 +23,9 @@
import java.io.File;
+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.InstallFileType;
/**
* MergingInstaller
@@ -36,10 +37,19 @@
{
/**
- * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFile, java.io.File, java.io.File)
+ * @param packageMgrCtx
*/
+ public MergingInstaller(PackageManagerContext packageMgrCtx)
+ {
+ super(packageMgrCtx);
+
+ }
+
+ /**
+ * @see org.jboss.ejb3.packagemanager.installer.AbstractInstaller#doInstall(org.jboss.ejb3.packagemanager.metadata.InstallFileType, java.io.File, java.io.File)
+ */
@Override
- protected void doInstall(InstallFile fileMetadata, File fileToInstall, File dest) throws PackageManagerException
+ protected void doInstall(InstallFileType fileMetadata, File fileToInstall, File dest) throws PackageManagerException
{
super.doInstall(fileMetadata, fileToInstall, dest);
Deleted: 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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Dependencies.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,83 +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.metadata;
-
-import java.util.List;
-
-/**
- * Represents the metadata for dependencies within a package.
- *
- * 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
-{
-
- /**
- * Returns the list of packaged dependencies of a package
- * @return
- */
- List<PackagedDependency> getPackagedDependencies();
-
- /**
- * 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 packagedDep
- */
- void addPackagedDependency(PackagedDependency packagedDep);
-
- /**
- * Returns the unprocessed dependencies of a package
- * @return
- */
- UnProcessedDependencies getUnProcessedDependencies();
-
- /**
- * Sets the unprocessed dependencies of a package
- *
- * @param unProcessedDependencies
- */
- void setUnProcessedDependencies(UnProcessedDependencies unProcessedDependencies);
-
- /**
- * 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/DependenciesType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/DependenciesType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/DependenciesType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+import java.util.List;
+
+/**
+ * Represents the metadata for dependencies within a package.
+ *
+ * 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 PackageType
+ * @author Jaikiran Pai
+ *
+ */
+public interface DependenciesType
+{
+
+ /**
+ * Returns the list of packaged dependencies of a package
+ * @return
+ */
+ List<PackagedDependency> getPackagedDependencies();
+
+ /**
+ * 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 packagedDep
+ */
+ void addPackagedDependency(PackagedDependency packagedDep);
+
+ /**
+ * Returns the unprocessed dependencies of a package
+ * @return
+ */
+ UnProcessedDependenciesType getUnProcessedDependencies();
+
+ /**
+ * Sets the unprocessed dependencies of a package
+ *
+ * @param unProcessedDependencies
+ */
+ void setUnProcessedDependencies(UnProcessedDependenciesType unProcessedDependencies);
+
+ /**
+ * Returns the package to which this dependencies correspond to
+ *
+ * @return
+ */
+ PackageType getPackage();
+}
Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFile.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFile.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFile.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,112 +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.metadata;
-
-/**
- *
- * A file element contains the information of the source and destination of the file to be installed.
- * The src-path of the file is always relative to the location of the package.xml within a package.
- * The dest-path of the file is always relative to the JBoss AS server home (JBOSS_HOME).
- * A file can be of type library or config or script file.
- *
- * @author Jaikiran Pai
- *
- */
-public interface InstallFile
-{
-
- /**
- * @return Returns the name of the file
- *
- */
- String getName();
-
- /**
- * Sets the file name
- *
- * @param name The name of the file
- *
- */
- void setName(String name);
-
- /**
- * @return Returns the src-path of the file. The src-path
- * is relative to the location of the package.xml file in the package
- *
- */
- String getSrcPath();
-
- /**
- * Sets the src-path of the file. The path is expected to be
- * relative to the location of package.xml file in the package
- *
- * @param path Relative source path
- *
- */
- void setSrcPath(String path);
-
- /**
- * @return Returns the dest-path of the file. The dest-path
- * is relative to the location of the package.xml file in the package
- *
- */
- String getDestPath();
-
- /**
- * Sets the dest-path of the file. The path is expected to be
- * relative to the location of package.xml file in the package
- *
- * @param path Relative destination path
- *
- */
- void setDestPath(String path);
-
- /**
- * @return Returns the type of this file
- *
- */
- FileType getType();
-
- /**
- * Sets the type of the file
- *
- * @param ftype File type
- *
- */
- void setFileType(FileType ftype);
-
- /**
- * Sets the file type
- *
- * @param type The type of file
- * @see #setFileType(FileType)
- */
- void setType(String type);
-
- /**
- * Returns the package through which this file was installed
- *
- * @return
- */
- Package getPackage();
-
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFileType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFileType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/InstallFileType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,112 @@
+/*
+ * 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;
+
+/**
+ *
+ * A file element contains the information of the source and destination of the file to be installed.
+ * The src-path of the file is always relative to the location of the package.xml within a package.
+ * The dest-path of the file is always relative to the JBoss AS server home (JBOSS_HOME).
+ * A file can be of type library or config or script file.
+ *
+ * @author Jaikiran Pai
+ *
+ */
+public interface InstallFileType
+{
+
+ /**
+ * @return Returns the name of the file
+ *
+ */
+ String getName();
+
+ /**
+ * Sets the file name
+ *
+ * @param name The name of the file
+ *
+ */
+ void setName(String name);
+
+ /**
+ * @return Returns the src-path of the file. The src-path
+ * is relative to the location of the package.xml file in the package
+ *
+ */
+ String getSrcPath();
+
+ /**
+ * Sets the src-path of the file. The path is expected to be
+ * relative to the location of package.xml file in the package
+ *
+ * @param path Relative source path
+ *
+ */
+ void setSrcPath(String path);
+
+ /**
+ * @return Returns the dest-path of the file. The dest-path
+ * is relative to the location of the package.xml file in the package
+ *
+ */
+ String getDestPath();
+
+ /**
+ * Sets the dest-path of the file. The path is expected to be
+ * relative to the location of package.xml file in the package
+ *
+ * @param path Relative destination path
+ *
+ */
+ void setDestPath(String path);
+
+ /**
+ * @return Returns the type of this file
+ *
+ */
+ FileType getType();
+
+ /**
+ * Sets the type of the file
+ *
+ * @param ftype File type
+ *
+ */
+ void setFileType(FileType ftype);
+
+ /**
+ * Sets the file type
+ *
+ * @param type The type of file
+ * @see #setFileType(FileType)
+ */
+ void setType(String type);
+
+ /**
+ * Returns the package through which this file was installed
+ *
+ * @return
+ */
+ PackageType getPackage();
+
+}
Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Package.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Package.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Package.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,147 +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.metadata;
-
-import java.util.List;
-
-/**
- * Represents the metadata for a package.
- *
- * A package represents a collection of files that are to be installed into
- * the JBoss AS.
- * A package can optionally have dependencies on other packages.
- * A package can also optionally specify system requirements (example: A package might require a JBoss AS
- * 5.1.0 version of the server)
- * A package also has optional pre-install, post-install, pre-uninstall, post-uninstall scripts
- *
- * @author Jaikiran Pai
- *
- */
-public interface Package
-{
-
- /**
- * @return Returns the system requirements of this package
- *
- */
- SystemRequirements getSystemRequirements();
-
- /**
- * Sets the system requirements of this package
- *
- * @param sysRequirements The system requirements for this package
- *
- */
- void setSystemRequirements(SystemRequirements sysRequirements);
-
- /**
- * @return Returns the files that are to be installed for this package
- *
- */
- List<InstallFile> getFiles();
-
- /**
- * Sets the files to be installed by the package
- *
- * @param files The files to be installed by the package
- *
- */
- void setFiles(List<InstallFile> files);
-
- /**
- * Add a file to be installed, into the list of files to install
- * through this package.
- *
- * @param file File to install
- */
- void addFile(InstallFile file);
-
- /**
- *
- * @return Returns the dependencies of this package
- */
- Dependencies getDependencies();
-
- /**
- * Sets the dependencies of this package
- *
- * @param dependencies Dependencies of this package
- *
- */
- void setDependencies(Dependencies deps);
-
- /**
- * @return Returns the name of this package
- *
- */
- String getName();
-
- /**
- * Sets the name of this package
- *
- * @param name Package name
- *
- */
- void setName(String name);
-
- /**
- * @return Returns the version of this package
- *
- */
- String getVersion();
-
- /**
- * Sets the version of this package
- *
- * @param version Package version
- *
- */
- void setVersion(String version);
-
- /**
- * Returns any pre-install metadata related to this package
- *
- * @return
- */
- PreInstall getPreInstall();
-
- /**
- * Sets the pre-install related metadata for this package
- *
- * @param preInstall Pre-install
- */
- void setPreInstall(PreInstall preInstall);
-
- /**
- * Returns any post-install metadata related to this package
- *
- * @return
- */
- PostInstall getPostInstall();
-
- /**
- * Sets the post-install related metadata for this package
- *
- * @param postInstall Post-install
- */
- void setPostInstall(PostInstall postInstall);
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackageType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackageType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackageType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,147 @@
+/*
+ * 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;
+
+import java.util.List;
+
+/**
+ * Represents the metadata for a package.
+ *
+ * A package represents a collection of files that are to be installed into
+ * the JBoss AS.
+ * A package can optionally have dependencies on other packages.
+ * A package can also optionally specify system requirements (example: A package might require a JBoss AS
+ * 5.1.0 version of the server)
+ * A package also has optional pre-install, post-install, pre-uninstall, post-uninstall scripts
+ *
+ * @author Jaikiran Pai
+ *
+ */
+public interface PackageType
+{
+
+ /**
+ * @return Returns the system requirements of this package
+ *
+ */
+ SystemRequirementsType getSystemRequirements();
+
+ /**
+ * Sets the system requirements of this package
+ *
+ * @param sysRequirements The system requirements for this package
+ *
+ */
+ void setSystemRequirements(SystemRequirementsType sysRequirements);
+
+ /**
+ * @return Returns the files that are to be installed for this package
+ *
+ */
+ List<InstallFileType> getFiles();
+
+ /**
+ * Sets the files to be installed by the package
+ *
+ * @param files The files to be installed by the package
+ *
+ */
+ void setFiles(List<InstallFileType> files);
+
+ /**
+ * Add a file to be installed, into the list of files to install
+ * through this package.
+ *
+ * @param file File to install
+ */
+ void addFile(InstallFileType file);
+
+ /**
+ *
+ * @return Returns the dependencies of this package
+ */
+ DependenciesType getDependencies();
+
+ /**
+ * Sets the dependencies of this package
+ *
+ * @param dependencies Dependencies of this package
+ *
+ */
+ void setDependencies(DependenciesType deps);
+
+ /**
+ * @return Returns the name of this package
+ *
+ */
+ String getName();
+
+ /**
+ * Sets the name of this package
+ *
+ * @param name Package name
+ *
+ */
+ void setName(String name);
+
+ /**
+ * @return Returns the version of this package
+ *
+ */
+ String getVersion();
+
+ /**
+ * Sets the version of this package
+ *
+ * @param version Package version
+ *
+ */
+ void setVersion(String version);
+
+ /**
+ * Returns any pre-install metadata related to this package
+ *
+ * @return
+ */
+ PreInstallType getPreInstall();
+
+ /**
+ * Sets the pre-install related metadata for this package
+ *
+ * @param preInstall Pre-install
+ */
+ void setPreInstall(PreInstallType preInstall);
+
+ /**
+ * Returns any post-install metadata related to this package
+ *
+ * @return
+ */
+ PostInstallType getPostInstall();
+
+ /**
+ * Sets the post-install related metadata for this package
+ *
+ * @param postInstall Post-install
+ */
+ void setPostInstall(PostInstallType postInstall);
+}
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PackagedDependency.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -37,5 +37,5 @@
* Returns the package for which this is an dependency
* @return
*/
- Package getPackage();
+ PackageType getPackage();
}
Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstall.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstall.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstall.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,66 +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.metadata;
-
-import java.util.List;
-
-/**
- * PostInstallMetadata
- *
- * Represents the metadata for the post-install element
- * in a package.xml file
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public interface PostInstall
-{
-
- /**
- * Returns the list of post-install scripts for a package
- *
- * @return
- */
- List<Script> getScripts();
-
- /**
- * Sets the list of post-install scripts for a package
- *
- * @param scripts The post-install scripts
- */
- void setScripts(List<Script> scripts);
-
- /**
- * Adds a pre-install script to the list of post-install scripts
- * for this package
- * @param script
- */
- void addScript(Script script);
-
- /**
- * Returns the package to which this post-install step
- * belongs to
- * @return
- */
- Package getPackage();
-
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstallType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstallType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PostInstallType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,66 @@
+/*
+* 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;
+
+import java.util.List;
+
+/**
+ * PostInstallMetadata
+ *
+ * Represents the metadata for the post-install element
+ * in a package.xml file
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PostInstallType
+{
+
+ /**
+ * Returns the list of post-install scripts for a package
+ *
+ * @return
+ */
+ List<ScriptType> getScripts();
+
+ /**
+ * Sets the list of post-install scripts for a package
+ *
+ * @param scripts The post-install scripts
+ */
+ void setScripts(List<ScriptType> scripts);
+
+ /**
+ * Adds a pre-install script to the list of post-install scripts
+ * for this package
+ * @param script
+ */
+ void addScript(ScriptType script);
+
+ /**
+ * Returns the package to which this post-install step
+ * belongs to
+ * @return
+ */
+ PackageType getPackage();
+
+}
Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstall.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstall.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstall.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,68 +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.metadata;
-
-import java.util.List;
-
-/**
- * PreInstallMetadata
- *
- * Represents the metadata for the pre-install element
- * in a package.xml file
- *
- *
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public interface PreInstall
-{
-
- /**
- * Returns the list of pre-install scripts for a package
- *
- * @return
- */
- List<Script> getScripts();
-
- /**
- * Sets the list of pre-install scripts for a package
- *
- * @param scripts The pre-install scripts
- */
- void setScripts(List<Script> scripts);
-
- /**
- * Adds a pre-install script to the list of pre-install scripts
- * for this package
- * @param script
- */
- void addScript(Script script);
-
- /**
- * Returns the package to which this pre-install step
- * belongs to
- * @return
- */
- Package getPackage();
-
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstallType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstallType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/PreInstallType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,68 @@
+/*
+* 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;
+
+import java.util.List;
+
+/**
+ * PreInstallMetadata
+ *
+ * Represents the metadata for the pre-install element
+ * in a package.xml file
+ *
+ *
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PreInstallType
+{
+
+ /**
+ * Returns the list of pre-install scripts for a package
+ *
+ * @return
+ */
+ List<ScriptType> getScripts();
+
+ /**
+ * Sets the list of pre-install scripts for a package
+ *
+ * @param scripts The pre-install scripts
+ */
+ void setScripts(List<ScriptType> scripts);
+
+ /**
+ * Adds a pre-install script to the list of pre-install scripts
+ * for this package
+ * @param script
+ */
+ void addScript(ScriptType script);
+
+ /**
+ * Returns the package to which this pre-install step
+ * belongs to
+ * @return
+ */
+ PackageType getPackage();
+
+}
Deleted: 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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/Script.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,75 +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.metadata;
-
-
-/**
- * ScriptMetadata
- *
- * Represents the metadata for a script element used in pre-install
- * or post-install of a package.
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public interface Script
-{
-
- /**
- * Returns the file path (including the file name) relative to
- * the location of the package.xml in the package
- * @return
- */
- String getFile();
-
- /**
- * Sets the file path (including the name of the file)
- *
- * @param scriptFile Path relative to the location of package.xml in the package
- */
- 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();
-//
-// /**
-// * 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
- *
- * @return
- */
- PackageInstallationPhase getScriptExecutionPhase();
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/ScriptType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/ScriptType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/ScriptType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,75 @@
+/*
+* 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;
+
+
+/**
+ * ScriptMetadata
+ *
+ * Represents the metadata for a script element used in pre-install
+ * or post-install of a package.
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface ScriptType
+{
+
+ /**
+ * Returns the file path (including the file name) relative to
+ * the location of the package.xml in the package
+ * @return
+ */
+ String getFile();
+
+ /**
+ * Sets the file path (including the name of the file)
+ *
+ * @param scriptFile Path relative to the location of package.xml in the package
+ */
+ 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();
+//
+// /**
+// * 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
+ *
+ * @return
+ */
+ PackageInstallationPhase getScriptExecutionPhase();
+}
Deleted: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirements.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirements.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirements.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,33 +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.metadata;
-
-/**
- * Represents the system requirements of a package being installed
- * by package manager
- *
- *
- */
-public interface SystemRequirements
-{
- Package getPackage();
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirementsType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirementsType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/SystemRequirementsType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -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.
+ */
+package org.jboss.ejb3.packagemanager.metadata;
+
+/**
+ * Represents the system requirements of a package being installed
+ * by package manager
+ *
+ *
+ */
+public interface SystemRequirementsType
+{
+ PackageType getPackage();
+}
Deleted: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependencies.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -1,76 +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.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();
-}
Added: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependenciesType.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependenciesType.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/UnProcessedDependenciesType.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -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 UnProcessedDependenciesType
+{
+
+ /**
+ * @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
+ */
+ PackageType 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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/DependenciesImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,31 +24,31 @@
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.DependenciesType;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
-import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
/**
*
* DependenciesImpl
*
- * @see Dependencies
+ * @see DependenciesType
* @author Jaikiran Pai
* @version $Revision: $
*/
-public class DependenciesImpl implements Dependencies
+public class DependenciesImpl implements DependenciesType
{
/**
* The package to which this dependency metadata corresponds
*/
- private Package pkg;
+ private PackageType pkg;
/**
* Unprocessed dependencies
*/
- private UnProcessedDependencies unProcessedDeps;
+ private UnProcessedDependenciesType unProcessedDeps;
/**
* A list of packaged dependencies
@@ -59,13 +59,13 @@
* Constructor
* @param pkgMetadata The package to which this dependencies correspond
*/
- public DependenciesImpl(Package pkgMetadata)
+ public DependenciesImpl(PackageType pkgMetadata)
{
this.pkg = pkgMetadata;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackagedDependencies()
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#getPackagedDependencies()
*/
@Override
public List<PackagedDependency> getPackagedDependencies()
@@ -74,16 +74,16 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getUnProcessedDependencies()
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#getUnProcessedDependencies()
*/
@Override
- public UnProcessedDependencies getUnProcessedDependencies()
+ public UnProcessedDependenciesType getUnProcessedDependencies()
{
return this.unProcessedDeps;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setPackagedDependencies(java.util.List)
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#setPackagedDependencies(java.util.List)
*/
@Override
public void setPackagedDependencies(List<PackagedDependency> packagedDependencies)
@@ -93,27 +93,27 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setUnProcessedDependencies(org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies)
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#setUnProcessedDependencies(org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType)
*/
@Override
- public void setUnProcessedDependencies(UnProcessedDependencies unProcessedDependencies)
+ public void setUnProcessedDependencies(UnProcessedDependenciesType unProcessedDependencies)
{
this.unProcessedDeps = unProcessedDependencies;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#getPackage()
*/
@Override
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkg;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#addPackagedDependency(org.jboss.ejb3.packagemanager.metadata.PackagedDependency)
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#addPackagedDependency(org.jboss.ejb3.packagemanager.metadata.PackagedDependency)
*/
@Override
public void addPackagedDependency(PackagedDependency packagedDep)
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/InstallFileImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/InstallFileImpl.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/InstallFileImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -21,16 +21,16 @@
*/
package org.jboss.ejb3.packagemanager.metadata.impl;
-import org.jboss.ejb3.packagemanager.metadata.InstallFile;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
import org.jboss.ejb3.packagemanager.metadata.FileType;
-import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
-public class InstallFileImpl implements InstallFile
+public class InstallFileImpl implements InstallFileType
{
- private Package pkg;
+ private PackageType pkg;
- public InstallFileImpl(Package pkgMetadata)
+ public InstallFileImpl(PackageType pkgMetadata)
{
if (pkgMetadata == null)
{
@@ -113,7 +113,7 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.InstallFile#setType(org.jboss.ejb3.packagemanager.metadata.FileType)
+ * @see org.jboss.ejb3.packagemanager.metadata.InstallFileType#setType(org.jboss.ejb3.packagemanager.metadata.FileType)
*/
public void setFileType(FileType ftype)
{
@@ -121,9 +121,9 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.InstallFile#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.InstallFileType#getPackage()
*/
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkg;
}
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackageImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackageImpl.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackageImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,21 +24,21 @@
import java.util.ArrayList;
import java.util.List;
-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.PostInstall;
-import org.jboss.ejb3.packagemanager.metadata.PreInstall;
-import org.jboss.ejb3.packagemanager.metadata.SystemRequirements;
+import org.jboss.ejb3.packagemanager.metadata.DependenciesType;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.PostInstallType;
+import org.jboss.ejb3.packagemanager.metadata.PreInstallType;
+import org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType;
-public class PackageImpl implements Package
+public class PackageImpl implements PackageType
{
- protected SystemRequirements systemRequirements;
+ protected SystemRequirementsType systemRequirements;
- protected List<InstallFile> files;
+ protected List<InstallFileType> files;
- protected Dependencies dependencies;
+ protected DependenciesType dependencies;
protected String name;
@@ -47,34 +47,34 @@
/**
* Post-install for this package
*/
- protected PostInstall postInstall;
+ protected PostInstallType postInstall;
/**
* Pre-install for this package
*/
- protected PreInstall preInstall;
+ protected PreInstallType preInstall;
public PackageImpl()
{
}
- public SystemRequirements getSystemRequirements()
+ public SystemRequirementsType getSystemRequirements()
{
return systemRequirements;
}
- public void setSystemRequirements(SystemRequirements value)
+ public void setSystemRequirements(SystemRequirementsType value)
{
this.systemRequirements = ((SystemRequirementsImpl) value);
}
- public List<InstallFile> getFiles()
+ public List<InstallFileType> getFiles()
{
return this.files;
}
- public void setFiles(List<InstallFile> files)
+ public void setFiles(List<InstallFileType> files)
{
if (files == null || files.isEmpty())
{
@@ -83,12 +83,12 @@
this.files = files;
}
- public Dependencies getDependencies()
+ public DependenciesType getDependencies()
{
return dependencies;
}
- public void setDependencies(Dependencies value)
+ public void setDependencies(DependenciesType value)
{
this.dependencies = value;
}
@@ -114,9 +114,9 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Package#addFile(org.jboss.ejb3.packagemanager.metadata.InstallFile)
+ * @see org.jboss.ejb3.packagemanager.metadata.PackageType#addFile(org.jboss.ejb3.packagemanager.metadata.InstallFileType)
*/
- public void addFile(InstallFile file)
+ public void addFile(InstallFileType file)
{
if (file == null)
{
@@ -124,41 +124,41 @@
}
if (this.files == null)
{
- this.files = new ArrayList<InstallFile>();
+ this.files = new ArrayList<InstallFileType>();
}
this.files.add(file);
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Package#getPostInstall()
+ * @see org.jboss.ejb3.packagemanager.metadata.PackageType#getPostInstall()
*/
- public PostInstall getPostInstall()
+ public PostInstallType getPostInstall()
{
return this.postInstall;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Package#getPreInstall()
+ * @see org.jboss.ejb3.packagemanager.metadata.PackageType#getPreInstall()
*/
- public PreInstall getPreInstall()
+ public PreInstallType getPreInstall()
{
return this.preInstall;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Package#setPostInstall(org.jboss.ejb3.packagemanager.metadata.PostInstall)
+ * @see org.jboss.ejb3.packagemanager.metadata.PackageType#setPostInstall(org.jboss.ejb3.packagemanager.metadata.PostInstallType)
*/
- public void setPostInstall(PostInstall postInstall)
+ public void setPostInstall(PostInstallType postInstall)
{
this.postInstall = postInstall;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Package#setPreInstall(org.jboss.ejb3.packagemanager.metadata.PreInstall)
+ * @see org.jboss.ejb3.packagemanager.metadata.PackageType#setPreInstall(org.jboss.ejb3.packagemanager.metadata.PreInstallType)
*/
- public void setPreInstall(PreInstall preInstall)
+ public void setPreInstall(PreInstallType preInstall)
{
this.preInstall = preInstall;
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PackagedDependencyImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -21,7 +21,7 @@
*/
package org.jboss.ejb3.packagemanager.metadata.impl;
-import org.jboss.ejb3.packagemanager.metadata.Package;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
import org.jboss.ejb3.packagemanager.metadata.PackagedDependency;
/**
@@ -33,11 +33,11 @@
public class PackagedDependencyImpl implements PackagedDependency
{
- private Package pkg;
+ private PackageType pkg;
private String file;
- public PackagedDependencyImpl(Package pkg)
+ public PackagedDependencyImpl(PackageType pkg)
{
this.pkg = pkg;
@@ -56,7 +56,7 @@
* @see org.jboss.ejb3.packagemanager.metadata.PackagedDependency#getPackage()
*/
@Override
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkg;
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallImpl.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,9 +24,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.ejb3.packagemanager.metadata.Package;
-import org.jboss.ejb3.packagemanager.metadata.PostInstall;
-import org.jboss.ejb3.packagemanager.metadata.Script;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.PostInstallType;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
/**
* PostInstallMetadataImpl
@@ -34,32 +34,32 @@
* @author Jaikiran Pai
* @version $Revision: $
*/
-public class PostInstallImpl implements PostInstall
+public class PostInstallImpl implements PostInstallType
{
/**
* The package to which this post-install belongs
*/
- private Package pkgMetadata;
+ private PackageType pkgMetadata;
/**
* post-install scripts
*/
- private List<Script> scripts;
+ private List<ScriptType> scripts;
/**
* Constructor
- * @param pkgMeta The {@link Package} to which this post-install belongs
+ * @param pkgMeta The {@link PackageType} to which this post-install belongs
*/
- public PostInstallImpl(Package pkgMeta)
+ public PostInstallImpl(PackageType pkgMeta)
{
this.pkgMetadata = pkgMeta;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PostInstall#addScript(org.jboss.ejb3.packagemanager.metadata.Script)
+ * @see org.jboss.ejb3.packagemanager.metadata.PostInstallType#addScript(org.jboss.ejb3.packagemanager.metadata.ScriptType)
*/
- public void addScript(Script script)
+ public void addScript(ScriptType script)
{
if (script == null)
{
@@ -67,32 +67,32 @@
}
if (this.scripts == null)
{
- this.scripts = new ArrayList<Script>();
+ this.scripts = new ArrayList<ScriptType>();
}
this.scripts.add(script);
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PostInstall#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.PostInstallType#getPackage()
*/
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkgMetadata;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PostInstall#getScripts()
+ * @see org.jboss.ejb3.packagemanager.metadata.PostInstallType#getScripts()
*/
- public List<Script> getScripts()
+ public List<ScriptType> getScripts()
{
return this.scripts;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PostInstall#setScripts(java.util.List)
+ * @see org.jboss.ejb3.packagemanager.metadata.PostInstallType#setScripts(java.util.List)
*/
- public void setScripts(List<Script> scripts)
+ public void setScripts(List<ScriptType> scripts)
{
if (scripts == null)
{
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallScript.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallScript.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PostInstallScript.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -22,7 +22,7 @@
package org.jboss.ejb3.packagemanager.metadata.impl;
import org.jboss.ejb3.packagemanager.metadata.PackageInstallationPhase;
-import org.jboss.ejb3.packagemanager.metadata.PostInstall;
+import org.jboss.ejb3.packagemanager.metadata.PostInstallType;
/**
* PostInstallScript
@@ -37,15 +37,15 @@
* The post-install step to which this script
* belongs
*/
- private PostInstall postInstallMeta;
+ private PostInstallType postInstallMeta;
/**
* Constructor
*
- * @param postInstallMeta The {@link PostInstall} to which this
+ * @param postInstallMeta The {@link PostInstallType} to which this
* post-install script belongs to
*/
- public PostInstallScript(PostInstall postInstallMeta)
+ public PostInstallScript(PostInstallType postInstallMeta)
{
this.postInstallMeta = postInstallMeta;
}
@@ -60,12 +60,12 @@
}
/**
- * Returns the {@link PostInstall} to which this post-install script
+ * Returns the {@link PostInstallType} to which this post-install script
* belongs to
*
* @return
*/
- public PostInstall getPostInstallMetadata()
+ public PostInstallType getPostInstallMetadata()
{
return this.postInstallMeta;
}
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallImpl.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,9 +24,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.ejb3.packagemanager.metadata.Package;
-import org.jboss.ejb3.packagemanager.metadata.PreInstall;
-import org.jboss.ejb3.packagemanager.metadata.Script;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.PreInstallType;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
/**
* PreInstallMetadataImpl
@@ -34,32 +34,32 @@
* @author Jaikiran Pai
* @version $Revision: $
*/
-public class PreInstallImpl implements PreInstall
+public class PreInstallImpl implements PreInstallType
{
/**
* The package to which this pre-install belongs
*/
- private Package pkgMetadata;
+ private PackageType pkgMetadata;
/**
* pre-install scripts
*/
- private List<Script> scripts;
+ private List<ScriptType> scripts;
/**
* Constructor
- * @param pkgMeta The {@link Package} to which this pre-install belongs
+ * @param pkgMeta The {@link PackageType} to which this pre-install belongs
*/
- public PreInstallImpl(Package pkgMeta)
+ public PreInstallImpl(PackageType pkgMeta)
{
this.pkgMetadata = pkgMeta;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PreInstall#addScript(org.jboss.ejb3.packagemanager.metadata.Script)
+ * @see org.jboss.ejb3.packagemanager.metadata.PreInstallType#addScript(org.jboss.ejb3.packagemanager.metadata.ScriptType)
*/
- public void addScript(Script script)
+ public void addScript(ScriptType script)
{
if (script == null)
{
@@ -67,31 +67,31 @@
}
if (this.scripts == null)
{
- this.scripts = new ArrayList<Script>();
+ this.scripts = new ArrayList<ScriptType>();
}
this.scripts.add(script);
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PreInstall#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.PreInstallType#getPackage()
*/
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkgMetadata;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PreInstall#getScripts()
+ * @see org.jboss.ejb3.packagemanager.metadata.PreInstallType#getScripts()
*/
- public List<Script> getScripts()
+ public List<ScriptType> getScripts()
{
return this.scripts;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.PreInstall#setScripts(java.util.List)
+ * @see org.jboss.ejb3.packagemanager.metadata.PreInstallType#setScripts(java.util.List)
*/
- public void setScripts(List<Script> scripts)
+ public void setScripts(List<ScriptType> scripts)
{
if (scripts == null)
{
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallScript.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallScript.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/PreInstallScript.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -22,7 +22,7 @@
package org.jboss.ejb3.packagemanager.metadata.impl;
import org.jboss.ejb3.packagemanager.metadata.PackageInstallationPhase;
-import org.jboss.ejb3.packagemanager.metadata.PreInstall;
+import org.jboss.ejb3.packagemanager.metadata.PreInstallType;
/**
* PreInstallScript
@@ -36,15 +36,15 @@
* The pre-install step to which this script
* belongs
*/
- private PreInstall preInstallMeta;
+ private PreInstallType preInstallMeta;
/**
* Constructor
*
- * @param preInstallMeta The {@link PreInstall} to which this
+ * @param preInstallMeta The {@link PreInstallType} to which this
* pre-install script belongs to
*/
- public PreInstallScript(PreInstall preInstallMeta)
+ public PreInstallScript(PreInstallType preInstallMeta)
{
this.preInstallMeta = preInstallMeta;
}
@@ -59,12 +59,12 @@
}
/**
- * Returns the {@link PreInstall} to which this pre-install script
+ * Returns the {@link PreInstallType} to which this pre-install script
* belongs to
*
* @return
*/
- public PreInstall getPreInstallMetadata()
+ public PreInstallType getPreInstallMetadata()
{
return this.preInstallMeta;
}
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/ScriptImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -22,7 +22,7 @@
package org.jboss.ejb3.packagemanager.metadata.impl;
import org.jboss.ejb3.packagemanager.metadata.PackageInstallationPhase;
-import org.jboss.ejb3.packagemanager.metadata.Script;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
/**
* ScriptImpl
@@ -30,7 +30,7 @@
* @author Jaikiran Pai
* @version $Revision: $
*/
-public abstract class ScriptImpl implements Script
+public abstract class ScriptImpl implements ScriptType
{
/**
@@ -39,7 +39,7 @@
private String scriptFile = "package-script.xml";
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Script#getFile()
+ * @see org.jboss.ejb3.packagemanager.metadata.ScriptType#getFile()
*/
public String getFile()
{
@@ -47,7 +47,7 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Script#setFile(java.lang.String)
+ * @see org.jboss.ejb3.packagemanager.metadata.ScriptType#setFile(java.lang.String)
*/
public void setFile(String scriptFile)
{
@@ -59,7 +59,7 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Script#getScriptExecutionPhase()
+ * @see org.jboss.ejb3.packagemanager.metadata.ScriptType#getScriptExecutionPhase()
*/
public abstract PackageInstallationPhase getScriptExecutionPhase();
Modified: projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/SystemRequirementsImpl.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/SystemRequirementsImpl.java 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/SystemRequirementsImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -21,22 +21,22 @@
*/
package org.jboss.ejb3.packagemanager.metadata.impl;
-import org.jboss.ejb3.packagemanager.metadata.Package;
-import org.jboss.ejb3.packagemanager.metadata.SystemRequirements;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType;
-public class SystemRequirementsImpl implements SystemRequirements
+public class SystemRequirementsImpl implements SystemRequirementsType
{
- private Package pkg;
+ private PackageType pkg;
- public SystemRequirementsImpl(Package pkgMetadata)
+ public SystemRequirementsImpl(PackageType pkgMetadata)
{
this.pkg = pkgMetadata;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.SystemRequirements#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType#getPackage()
*/
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkg;
}
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/metadata/impl/UnProcessedDependenciesImpl.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -21,26 +21,26 @@
*/
package org.jboss.ejb3.packagemanager.metadata.impl;
-import org.jboss.ejb3.packagemanager.metadata.Package;
-import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependencies;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
/**
* UnProcessedDependenciesImpl
*
* Represents the metadata for unprocessed-dependencies element.
*
- * @see UnProcessedDependencies
+ * @see UnProcessedDependenciesType
*
* @author Jaikiran Pai
* @version $Revision: $
*/
-public class UnProcessedDependenciesImpl implements UnProcessedDependencies
+public class UnProcessedDependenciesImpl implements UnProcessedDependenciesType
{
/**
* The package to which this dependency metadata corresponds
*/
- private Package pkg;
+ private PackageType pkg;
/**
* Fully qualified class name of the dependencies manager
@@ -56,7 +56,7 @@
* Constructor
* @param pkgMetadata The package to which this dependencies correspond
*/
- public UnProcessedDependenciesImpl(Package pkgMetadata)
+ public UnProcessedDependenciesImpl(PackageType pkgMetadata)
{
this.pkg = pkgMetadata;
}
@@ -80,15 +80,15 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getPackage()
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#getPackage()
*/
- public Package getPackage()
+ public PackageType getPackage()
{
return this.pkg;
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#getManager()
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#getManager()
*/
public String getManager()
{
@@ -96,7 +96,7 @@
}
/**
- * @see org.jboss.ejb3.packagemanager.metadata.Dependencies#setManager(java.lang.String)
+ * @see org.jboss.ejb3.packagemanager.metadata.DependenciesType#setManager(java.lang.String)
*/
public void setManager(String depManager)
{
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/ScriptProcessor.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -24,7 +24,7 @@
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;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
/**
* ScriptProcessor
@@ -35,5 +35,5 @@
public interface ScriptProcessor
{
- void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, Script script) throws ScriptProcessingException;
+ void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, ScriptType 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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/script/impl/AntScriptProcessor.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -31,7 +31,7 @@
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;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
import org.jboss.ejb3.packagemanager.script.ScriptProcessor;
import org.jboss.logging.Logger;
@@ -50,10 +50,10 @@
private static Logger logger = Logger.getLogger(AntScriptProcessor.class);
/**
- * @see org.jboss.ejb3.packagemanager.script.ScriptProcessor#processScript(PackageManagerContext, PackageContext, Script)
+ * @see org.jboss.ejb3.packagemanager.script.ScriptProcessor#processScript(PackageManagerContext, PackageContext, ScriptType)
*/
@Override
- public void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, Script script)
+ public void processScript(PackageManagerContext pkgManagerCtx, PackageContext pkgCtx, ScriptType script)
throws ScriptProcessingException
{
File root = pkgCtx.getPackageRoot();
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/main/java/org/jboss/ejb3/packagemanager/xml/PackageUnmarshaller.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -30,15 +30,15 @@
import org.codehaus.stax2.XMLStreamReader2;
import org.codehaus.stax2.validation.XMLValidationSchema;
import org.codehaus.stax2.validation.XMLValidationSchemaFactory;
-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.DependenciesType;
+import org.jboss.ejb3.packagemanager.metadata.InstallFileType;
+import org.jboss.ejb3.packagemanager.metadata.PackageType;
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.PostInstallType;
+import org.jboss.ejb3.packagemanager.metadata.PreInstallType;
+import org.jboss.ejb3.packagemanager.metadata.ScriptType;
+import org.jboss.ejb3.packagemanager.metadata.SystemRequirementsType;
+import org.jboss.ejb3.packagemanager.metadata.UnProcessedDependenciesType;
import org.jboss.ejb3.packagemanager.metadata.impl.DependenciesImpl;
import org.jboss.ejb3.packagemanager.metadata.impl.InstallFileImpl;
import org.jboss.ejb3.packagemanager.metadata.impl.PackageImpl;
@@ -59,13 +59,13 @@
{
/**
- * Creates {@link Package} out of the URL pointing to a package.xml file
+ * Creates {@link PackageType} out of the URL pointing to a package.xml file
*
* @param packageXml package.xml URL
- * @return Returns the {@link Package} corresponding to the package.xml
+ * @return Returns the {@link PackageType} corresponding to the package.xml
* @throws Exception If any exceptions occur during processing the package.xml
*/
- public Package unmarshal(URL packageXml) throws Exception
+ public PackageType unmarshal(URL packageXml) throws Exception
{
@@ -82,7 +82,7 @@
xmlStreamReader.validateAgainst(schema);
// parse the xml
- Package pkgMetadata = null;
+ PackageType pkgMetadata = null;
while (xmlStreamReader.hasNext())
{
int event = xmlStreamReader.next();
@@ -94,9 +94,9 @@
return pkgMetadata;
}
- private Package processPackage(XMLStreamReader2 xmlStreamReader) throws Exception
+ private PackageType processPackage(XMLStreamReader2 xmlStreamReader) throws Exception
{
- Package pkgMeta = new PackageImpl();
+ PackageType pkgMeta = new PackageImpl();
for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
{
String name = xmlStreamReader.getAttributeLocalName(i);
@@ -119,27 +119,27 @@
String childElement = xmlStreamReader.getLocalName();
if (childElement.equals("system-requirements"))
{
- SystemRequirements sysReqs = processSystemRequirements(pkgMeta, xmlStreamReader);
+ SystemRequirementsType sysReqs = processSystemRequirements(pkgMeta, xmlStreamReader);
pkgMeta.setSystemRequirements(sysReqs);
}
else if (childElement.equals("file"))
{
- InstallFile file = processFiles(pkgMeta, xmlStreamReader);
+ InstallFileType file = processFiles(pkgMeta, xmlStreamReader);
pkgMeta.addFile(file);
}
else if (childElement.equals("pre-install"))
{
- PreInstall preInstall = processPreInstall(pkgMeta, xmlStreamReader);
+ PreInstallType preInstall = processPreInstall(pkgMeta, xmlStreamReader);
pkgMeta.setPreInstall(preInstall);
}
else if (childElement.equals("post-install"))
{
- PostInstall postInstall = processPostInstall(pkgMeta, xmlStreamReader);
+ PostInstallType postInstall = processPostInstall(pkgMeta, xmlStreamReader);
pkgMeta.setPostInstall(postInstall);
}
else if (childElement.equals("dependencies"))
{
- Dependencies dependencies = this.processDependencies(pkgMeta, xmlStreamReader);
+ DependenciesType dependencies = this.processDependencies(pkgMeta, xmlStreamReader);
pkgMeta.setDependencies(dependencies);
}
@@ -159,7 +159,7 @@
* @return
* @throws Exception
*/
- private SystemRequirements processSystemRequirements(Package pkgMeta,
+ private SystemRequirementsType processSystemRequirements(PackageType pkgMeta,
XMLStreamReader2 xmlStreamReader) throws Exception
{
// TODO Implement
@@ -179,9 +179,9 @@
* @return
* @throws Exception
*/
- private InstallFile processFiles(Package pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
+ private InstallFileType processFiles(PackageType pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
{
- InstallFile fileMeta = new InstallFileImpl(pkgMeta);
+ InstallFileType fileMeta = new InstallFileImpl(pkgMeta);
for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
{
String name = xmlStreamReader.getAttributeLocalName(i);
@@ -221,10 +221,10 @@
* @return
* @throws Exception
*/
- private PreInstall processPreInstall(Package pkgMeta, XMLStreamReader2 xmlStreamReader)
+ private PreInstallType processPreInstall(PackageType pkgMeta, XMLStreamReader2 xmlStreamReader)
throws Exception
{
- PreInstall preInstall = new PreInstallImpl(pkgMeta);
+ PreInstallType preInstall = new PreInstallImpl(pkgMeta);
int event = xmlStreamReader.next();
while (event != XMLEvent.END_ELEMENT)
{
@@ -234,7 +234,7 @@
String childElement = xmlStreamReader.getLocalName();
if (childElement.equals("script"))
{
- Script script = processPreInstallScript(preInstall, xmlStreamReader);
+ ScriptType script = processPreInstallScript(preInstall, xmlStreamReader);
preInstall.addScript(script);
}
break;
@@ -251,10 +251,10 @@
* @return
* @throws Exception
*/
- private PostInstall processPostInstall(Package pkgMeta, XMLStreamReader2 xmlStreamReader)
+ private PostInstallType processPostInstall(PackageType pkgMeta, XMLStreamReader2 xmlStreamReader)
throws Exception
{
- PostInstall postInstall = new PostInstallImpl(pkgMeta);
+ PostInstallType postInstall = new PostInstallImpl(pkgMeta);
int event = xmlStreamReader.next();
while (event != XMLEvent.END_ELEMENT)
{
@@ -264,7 +264,7 @@
String childElement = xmlStreamReader.getLocalName();
if (childElement.equals("script"))
{
- Script script = processPostInstallScript(postInstall, xmlStreamReader);
+ ScriptType script = processPostInstallScript(postInstall, xmlStreamReader);
postInstall.addScript(script);
}
break;
@@ -281,7 +281,7 @@
* @return
* @throws Exception
*/
- private PreInstallScript processPreInstallScript(PreInstall preInstallMeta, XMLStreamReader2 xmlStreamReader)
+ private PreInstallScript processPreInstallScript(PreInstallType preInstallMeta, XMLStreamReader2 xmlStreamReader)
throws Exception
{
PreInstallScript preInstallScript = new PreInstallScript(preInstallMeta);
@@ -296,7 +296,7 @@
* @return
* @throws Exception
*/
- private PostInstallScript processPostInstallScript(PostInstall postInstallMeta,
+ private PostInstallScript processPostInstallScript(PostInstallType postInstallMeta,
XMLStreamReader2 xmlStreamReader) throws Exception
{
PostInstallScript postInstallScript = new PostInstallScript(postInstallMeta);
@@ -309,7 +309,7 @@
* @param xmlStreamReader
* @return
*/
- private Script processScript(Script script, XMLStreamReader2 xmlStreamReader) throws Exception
+ private ScriptType processScript(ScriptType script, XMLStreamReader2 xmlStreamReader) throws Exception
{
for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
@@ -332,9 +332,9 @@
return script;
}
- private Dependencies processDependencies(Package pkgMetadata, XMLStreamReader2 xmlStreamReader) throws Exception
+ private DependenciesType processDependencies(PackageType pkgMetadata, XMLStreamReader2 xmlStreamReader) throws Exception
{
- Dependencies depMetadata = new DependenciesImpl(pkgMetadata);
+ DependenciesType depMetadata = new DependenciesImpl(pkgMetadata);
int event = xmlStreamReader.next();
while (event != XMLEvent.END_ELEMENT)
{
@@ -344,7 +344,7 @@
String childElement = xmlStreamReader.getLocalName();
if (childElement.equals("unprocessed-dependencies"))
{
- UnProcessedDependencies unProcessedDeps = processUnProcessedDependencies(pkgMetadata, xmlStreamReader);
+ UnProcessedDependenciesType unProcessedDeps = processUnProcessedDependencies(pkgMetadata, xmlStreamReader);
depMetadata.setUnProcessedDependencies(unProcessedDeps);
}
else if (childElement.equals("packaged-dependency"))
@@ -360,9 +360,9 @@
return depMetadata;
}
- private UnProcessedDependencies processUnProcessedDependencies(Package pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
+ private UnProcessedDependenciesType processUnProcessedDependencies(PackageType pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
{
- UnProcessedDependencies unProcessedDep = new UnProcessedDependenciesImpl(pkgMeta);
+ UnProcessedDependenciesType unProcessedDep = new UnProcessedDependenciesImpl(pkgMeta);
for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
{
String name = xmlStreamReader.getAttributeLocalName(i);
@@ -386,7 +386,7 @@
return unProcessedDep;
}
- private PackagedDependency processPackagedDependency(Package pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
+ private PackagedDependency processPackagedDependency(PackageType pkgMeta, XMLStreamReader2 xmlStreamReader) throws Exception
{
PackagedDependency packagedDep = new PackagedDependencyImpl(pkgMeta);
for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++)
Added: projects/ejb3/trunk/package-manager/src/main/resources/META-INF/persistence.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/resources/META-INF/persistence.xml (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/resources/META-INF/persistence.xml 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,25 @@
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
+ <persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <!-- <class>org.jboss.ejb3.packagemanager.metadata.impl.PackageImpl</class> -->
+ <properties>
+
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect"/>
+ <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <!-- <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/> -->
+ <property name="hibernate.connection.url" value="jdbc:derby:pmdb"/>
+ <property name="hibernate.max_fetch_depth" value="3"/>
+ <!-- <property name="hibernate.hbm2ddl.auto" value="create-drop"/> -->
+ <property name="hibernate.connection.autocommit" value="false"/>
+ <!--
+ <property name="hibernate.connection.isolation" value="2"/> -->
+
+
+
+ </properties>
+ </persistence-unit>
+</persistence>
+
Added: projects/ejb3/trunk/package-manager/src/main/resources/package-manager-sql-scripts.sql
===================================================================
--- projects/ejb3/trunk/package-manager/src/main/resources/package-manager-sql-scripts.sql (rev 0)
+++ projects/ejb3/trunk/package-manager/src/main/resources/package-manager-sql-scripts.sql 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,49 @@
+-- Package Manager table
+-- DROP TABLE package_manager;
+CREATE TABLE package_manager (
+ id bigint not null GENERATED ALWAYS AS IDENTITY CONSTRAINT PACKAGE_MANAGER_PK PRIMARY KEY,
+ jbossHome varchar(255) not null
+);
+-- add a unique constraint to server home
+ALTER TABLE package_manager
+ADD CONSTRAINT jboss_server_home_uniqueness UNIQUE (jbossHome);
+
+-- Package table
+-- DROP TABLE package;
+CREATE TABLE package (
+ id bigint not null GENERATED ALWAYS AS IDENTITY CONSTRAINT PACKAGE_PK PRIMARY KEY,
+ package_manager_id bigint not null,
+ name varchar(255) not null,
+ version varchar(255) not null,
+ foreign key (package_manager_id) references package_manager (id)
+
+);
+
+-- add a unique constraint to package name,version
+ALTER TABLE package
+ADD CONSTRAINT package_name_version UNIQUE (name, version);
+
+
+-- Installation file
+-- DROP TABLE installation_file;
+CREATE TABLE installation_file (
+ id bigint not null GENERATED ALWAYS AS IDENTITY CONSTRAINT INSTALLATION_FILE_PK PRIMARY KEY,
+ package_id bigint not null,
+ fileName varchar(255) not null,
+ installedPath varchar(255) not null,
+ fileType varchar(255),
+ foreign key (package_id) references package (id)
+
+);
+
+-- Package dependencies
+-- DROP TABLE package_dependency;
+CREATE TABLE package_dependency (
+ id bigint not null GENERATED ALWAYS AS IDENTITY CONSTRAINT PACKAGE_DEPENDENCY_PK PRIMARY KEY,
+ dependent_package_id bigint not null,
+ dependee_package_id bigint not null,
+ --primary key (dependent_package_id, dependee_package_id),
+ foreign key (dependee_package_id) references package (id),
+ foreign key (dependent_package_id) references package(id)
+
+);
\ No newline at end of file
Added: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/unit/CommandLineTestCase.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/unit/CommandLineTestCase.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/commandline/unit/CommandLineTestCase.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,98 @@
+/*
+* 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.commandline.unit;
+
+import java.io.File;
+
+import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
+import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
+import org.jboss.ejb3.packagemanager.main.Main;
+import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
+import org.jboss.logging.Logger;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * CommandLineTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class CommandLineTestCase extends PackageManagerTestCase
+{
+
+ private static Logger logger = Logger.getLogger(CommandLineTestCase.class);
+
+ /**
+ * Package manager
+ */
+ private static PackageManager pkgMgr;
+
+ /**
+ * The JBoss Home used in each test
+ */
+ private static File jbossHome;
+
+ /**
+ * Package manager home used in each test
+ */
+ private static File pkgMgrHome;
+
+ /**
+ * Do the necessary setup
+ * @throws Exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ pkgMgrHome = setupPackageManagerHome(CommandLineTestCase.class);
+ jbossHome = setupDummyJBoss(CommandLineTestCase.class);
+ PackageManagerEnvironment env = new PackageManagerEnvironment(pkgMgrHome.getAbsolutePath());
+ pkgMgr = new DefaultPackageManagerImpl(env, jbossHome.getAbsolutePath());
+ }
+
+ /**
+ * 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.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testMainMethodOfDefaultPackageManager() throws Exception
+ {
+ File commandLineTestPackage = this.createSimplePackage("command-line-test-package.jar");
+
+ String commandLineArgs[] = new String[]
+ {"-i", commandLineTestPackage.getAbsolutePath(), "-p", this.pkgMgrHome.getAbsolutePath(), "-s",
+ this.jbossHome.getAbsolutePath()};
+
+ // run the package manager
+ Main.main(commandLineArgs);
+
+ // now check that the file was installed in that location
+ this.assertFileExistenceUnderJBossHome(this.jbossHome, "common/lib/dummy.jar");
+
+ }
+}
Added: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/DBUtil.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/DBUtil.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/DBUtil.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,108 @@
+/*
+* 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.common;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.jboss.logging.Logger;
+
+/**
+ * DBUtil
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class DBUtil
+{
+
+ private static Logger logger = Logger.getLogger(DBUtil.class);
+
+ public static void runSql(Connection conn, File sqlFile) throws IOException, SQLException
+ {
+ logger.info("SQL being run from file " + sqlFile);
+ InputStream sql = new FileInputStream(sqlFile);
+
+ runSql(conn, sql);
+
+ }
+
+ public static void runSql(Connection conn, InputStream sql) throws IOException, SQLException
+ {
+
+ Reader reader = new InputStreamReader(sql);
+ BufferedReader bufferedReader = new BufferedReader(reader);
+ long lineNo = 0;
+ Statement statement = conn.createStatement();
+ try
+ {
+ StringBuffer trimmedSql = new StringBuffer();
+ for (String line = bufferedReader.readLine(); line != null; line = bufferedReader.readLine())
+ {
+ try
+ {
+ lineNo++;
+ line = line.trim();
+ //String trimmedSql = line.trim();
+ if (line.length() == 0 || line.startsWith("--") || line.startsWith("//")
+ || line.startsWith("/*"))
+ {
+ continue;
+ }
+ else
+ {
+ trimmedSql.append(" ");
+ trimmedSql.append(line);
+ if (trimmedSql.toString().endsWith(";"))
+ {
+ String sqlToRun = trimmedSql.substring(0, trimmedSql.length() - 1);
+ logger.info(sqlToRun);
+ statement.execute(sqlToRun);
+ trimmedSql = new StringBuffer();
+ }
+
+ }
+ }
+ catch (SQLException sqle)
+ {
+ logger.error("SQLException at line number " + lineNo, sqle);
+ throw sqle;
+ }
+ }
+ }
+ finally
+ {
+ if (statement != null)
+ {
+ statement.close();
+ }
+ }
+ }
+}
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/common/PackageManagerTestCase.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -28,6 +28,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -75,15 +78,46 @@
* @throws IOException If there are any IO exceptions during creation of the
* JBoss AS directory structure
*/
- protected static File setupDummyJBoss() throws IOException
+ protected static File setupDummyJBoss(Class<?> testClass) throws IOException
{
- File dummyJBossHome = new File(targetDir, "jboss-as");
+ File dummyJBossHome = new File(getPerTestTargetDir(testClass), "jboss-as");
dummyJBossHome.mkdirs();
createJBossDirectoryStructure(dummyJBossHome);
+
return dummyJBossHome;
}
+ private static void setupDatabase(File dbHome) throws IOException, SQLException
+ {
+ System.setProperty("derby.system.home", dbHome.getAbsolutePath());
+ InputStream sql = Thread.currentThread().getContextClassLoader().getResourceAsStream(
+ "package-manager-sql-scripts.sql");
+ if (sql == null)
+ {
+ throw new RuntimeException(
+ "Could not find package-manager-sql-scripts.sql in classpath - Cannot setup database");
+ }
+ Connection conn = DriverManager.getConnection("jdbc:derby:pmdb;create=true");
+ DBUtil.runSql(conn, sql);
+ logger.info("Successfully setup package manager database at " + dbHome);
+
+ }
+
+ protected static void removeInstalledPackages() throws IOException, SQLException
+ {
+ InputStream sql = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream("remove-packages-script.sql");
+ if (sql == null)
+ {
+ throw new RuntimeException("Could not find remove-packages-script.sql in classpath - Cannot cleanup database");
+ }
+
+ Connection conn = DriverManager.getConnection("jdbc:derby:pmdb");
+ DBUtil.runSql(conn, sql);
+
+ }
+
/**
* Sets up a "home" for the package manager within the project's
* "target" folder. Returns the File corresponding to this
@@ -93,10 +127,25 @@
* @return Returns the File corresponding to the package manager home
* @throws IOException
*/
- protected static File setupPackageManagerHome() throws IOException
+ protected static File setupPackageManagerHome(Class<?> testClass) throws IOException
{
- File pkgMgrHome = new File(targetDir, "pm-home");
+ File pkgMgrHome = new File(getPerTestTargetDir(testClass), "pm-home");
+ if (pkgMgrHome.exists())
+ {
+ recursivelyDeleteFiles(pkgMgrHome, true);
+ }
+
pkgMgrHome.mkdirs();
+ File packageManagerDBHome = new File(pkgMgrHome, "package-manager-db-home");
+ packageManagerDBHome.mkdirs();
+ try
+ {
+ setupDatabase(packageManagerDBHome);
+ }
+ catch (SQLException sqle)
+ {
+ throw new RuntimeException(sqle);
+ }
return pkgMgrHome;
}
@@ -363,6 +412,7 @@
*/
private static void createJBossDirectoryStructure(File jbossHome) throws IOException
{
+ cleanupJBossInstance(jbossHome, true);
// bin folder
File jbossBin = new File(jbossHome, "bin");
jbossBin.mkdirs();
@@ -395,6 +445,9 @@
// server/<servername>/conf
File serverConf = new File(serverProf, "conf");
serverConf.mkdirs();
+ // server/<servername>/data
+ File serverData = new File(serverProf, "data");
+ serverData.mkdirs();
// server/<servername>/deploy
File serverDeploy = new File(serverProf, "deploy");
serverDeploy.mkdirs();
@@ -412,27 +465,32 @@
* @param jbossHome
* @throws IOException
*/
- protected void cleanupJBossInstance(File jbossHome) throws IOException
+ protected static void cleanupJBossInstance(File jbossHome) throws IOException
{
+ cleanupJBossInstance(jbossHome, false);
+
+ }
+
+ protected static void cleanupJBossInstance(File jbossHome, boolean deleteDir) 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))
+ if (isChildOfTargetFolder(jbossHome))
{
- this.recursivelyDeleteFiles(jbossHome);
- return;
+ recursivelyDeleteFiles(jbossHome, deleteDir);
}
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");
+ 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");
}
+ return;
+
}
protected void assertFileExistenceUnderJBossHome(File jbossHome, String file)
@@ -440,29 +498,36 @@
File fileToBeChecked = new File(jbossHome, file);
Assert.assertTrue("Expected to find file " + fileToBeChecked + " but not found", fileToBeChecked.exists());
}
-
+
+ protected void assertFileAbsenceUnderJBossHome(File jbossHome, String file)
+ {
+ File fileToBeChecked = new File(jbossHome, file);
+ Assert.assertFalse("Did not expect to find file " + fileToBeChecked, fileToBeChecked.exists());
+ }
+
/**
*
* @param file
* @return
*/
- private boolean isChildOfTargetFolder(File file)
+ private static boolean isChildOfTargetFolder(File file)
{
if (file == null)
{
return false;
}
- if (file.equals(this.targetDir))
+ if (file.equals(targetDir))
{
return false;
}
file = file.getParentFile();
while (file != null)
{
- if (this.targetDir.equals(file))
+ if (targetDir.equals(file))
{
return true;
}
+ file = file.getParentFile();
}
return false;
}
@@ -472,7 +537,7 @@
* @param parent
* @throws IOException
*/
- private void recursivelyDeleteFiles(File parent) throws IOException
+ private static void recursivelyDeleteFiles(File parent, boolean deleteDir) throws IOException
{
File[] filesAndDirs = parent.listFiles();
List<File> filesDirs = Arrays.asList(filesAndDirs);
@@ -485,12 +550,17 @@
else if (file.isDirectory())
{
// recurse
- this.recursivelyDeleteFiles(file);
+ recursivelyDeleteFiles(file, deleteDir);
}
}
+ if (deleteDir)
+ {
+ parent.delete();
+ }
+
}
- protected File getPerTestTargetDir(Class<?> testClass)
+ protected static File getPerTestTargetDir(Class<?> testClass)
{
File testCaseTargetDir = new File(targetDir, testClass.getName().replace('.', '/'));
testCaseTargetDir.mkdirs();
Modified: 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 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/dependency/unit/DependencyInstallTestCase.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -30,10 +30,10 @@
import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
+import org.jboss.ejb3.packagemanager.test.uninstall.unit.UnInstallTestCase;
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;
@@ -57,36 +57,30 @@
private static PackageManager pkgMgr;
/**
- * The JBoss Home used in this test
+ * The JBoss Home used in each test
*/
private static File jbossHome;
/**
- * Package manager home used in this test
+ * Package manager home used in each test
*/
private static File pkgMgrHome;
- private File perTestTargetDir = this.getPerTestTargetDir(this.getClass());
+ private static File perTestTargetDir = getPerTestTargetDir(DependencyInstallTestCase.class);
/**
* Do the necessary setup
* @throws Exception
*/
@BeforeClass
- public static void setup() throws Exception
+ public static void beforeClass() throws Exception
{
- pkgMgrHome = setupPackageManagerHome();
- jbossHome = setupDummyJBoss();
+ pkgMgrHome = setupPackageManagerHome(DependencyInstallTestCase.class);
+ jbossHome = setupDummyJBoss(DependencyInstallTestCase.class);
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.
*
@@ -105,6 +99,7 @@
// 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");
+
}
/**
@@ -141,7 +136,7 @@
{
File dummyJar = this.createDummyJar();
// create the package
- File packageWithUnprocessedDeps = new File(this.perTestTargetDir, "package-with-unprocessed-dependencies.jar");
+ File packageWithUnprocessedDeps = new File(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");
@@ -179,7 +174,7 @@
File dummyJar = this.createDummyJar();
// create dependee package#1
- File dependeePackageOne = new File(this.perTestTargetDir, "dependee-package-one.jar");
+ File dependeePackageOne = new File(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");
@@ -195,7 +190,7 @@
this.exportZip(archiveOne, dependeePackageOne);
// create dependee package#2
- File dependeePackageTwo = new File(this.perTestTargetDir, "dependee-package-two.jar");
+ File dependeePackageTwo = new File(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");
@@ -227,7 +222,7 @@
this.exportZip(archiveThree, dependeePackageThree);
// Create the final package with all these 3 packages as the package-dependencies
- File aggregatedPacakge = new File(this.perTestTargetDir, packageFileName);
+ File aggregatedPacakge = new File(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");
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-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/install/unit/BasicInstallTestCase.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -29,6 +29,7 @@
import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
import org.jboss.ejb3.packagemanager.main.Main;
import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
+import org.jboss.ejb3.packagemanager.test.uninstall.unit.UnInstallTestCase;
import org.jboss.logging.Logger;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -53,12 +54,12 @@
private static PackageManager pkgMgr;
/**
- * The JBoss Home used in this test
+ * The JBoss Home used in each test
*/
private static File jbossHome;
/**
- * Package manager home used in this test
+ * Package manager home used in each test
*/
private static File pkgMgrHome;
@@ -67,19 +68,13 @@
* @throws Exception
*/
@BeforeClass
- public static void setup() throws Exception
+ public static void beforeClass() throws Exception
{
- pkgMgrHome = setupPackageManagerHome();
- jbossHome = setupDummyJBoss();
+ pkgMgrHome = setupPackageManagerHome(BasicInstallTestCase.class);
+ jbossHome = setupDummyJBoss(BasicInstallTestCase.class);
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
@@ -124,31 +119,7 @@
// As a further test, also check that the dummy.jar packaged in this package was
// also installed (at JBOSS_HOME/server/default/deploy folder)
this.assertFileExistenceUnderJBossHome(this.jbossHome, "server/default/deploy/dummy.jar");
- }
- /**
- * 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.
- *
- * @throws Exception
- */
- @Test
- public void testMainMethodOfDefaultPackageManager() throws Exception
- {
- File commandLineTestPackage = this.createSimplePackage("command-line-test-package.jar");
-
- String commandLineArgs[] = new String[]
- {"-i", commandLineTestPackage.getAbsolutePath(), "-p", this.pkgMgrHome.getAbsolutePath(), "-s",
- this.jbossHome.getAbsolutePath()};
-
- // run the package manager
- Main.main(commandLineArgs);
-
- // now check that the file was installed in that location
- this.assertFileExistenceUnderJBossHome(this.jbossHome, "common/lib/dummy.jar");
-
}
/**
Added: projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/unit/UnInstallTestCase.java
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/unit/UnInstallTestCase.java (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/java/org/jboss/ejb3/packagemanager/test/uninstall/unit/UnInstallTestCase.java 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,164 @@
+/*
+* 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.uninstall.unit;
+
+import java.io.File;
+
+import org.jboss.ejb3.packagemanager.PackageManager;
+import org.jboss.ejb3.packagemanager.PackageManagerEnvironment;
+import org.jboss.ejb3.packagemanager.exception.PackageNotInstalledException;
+import org.jboss.ejb3.packagemanager.impl.DefaultPackageManagerImpl;
+import org.jboss.ejb3.packagemanager.test.common.PackageManagerTestCase;
+import org.jboss.logging.Logger;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * UnInstallTestCase
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class UnInstallTestCase extends PackageManagerTestCase
+{
+
+ private static Logger logger = Logger.getLogger(UnInstallTestCase.class);
+
+ /**
+ * Package manager
+ */
+ private static PackageManager pkgMgr;
+
+ /**
+ * The JBoss Home used in each test
+ */
+ private static File jbossHome;
+
+ /**
+ * Package manager home used in each test
+ */
+ private static File pkgMgrHome;
+
+ /**
+ * Do the necessary setup
+ * @throws Exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ pkgMgrHome = setupPackageManagerHome(UnInstallTestCase.class);
+ jbossHome = setupDummyJBoss(UnInstallTestCase.class);
+ PackageManagerEnvironment env = new PackageManagerEnvironment(pkgMgrHome.getAbsolutePath());
+ pkgMgr = new DefaultPackageManagerImpl(env, jbossHome.getAbsolutePath());
+ }
+
+
+
+ @Test
+ public void testUnInstallNonExistentPackge() throws Exception
+ {
+ try
+ {
+ this.pkgMgr.removePackage("test-package");
+ Assert.fail("Uninstalling non-existent package did not raise error");
+ }
+ catch (PackageNotInstalledException pnie)
+ {
+ // expected
+ }
+ }
+
+ @Test
+ public void testSimpleUninstall() throws Exception
+ {
+ File simplePackage = this.createSimplePackage("simple-uninstall-test-package.jar");
+
+ // first install
+ this.pkgMgr.installPackage(simplePackage.getAbsolutePath());
+
+ // do a simple check that the package was installed (no need
+ // to do a lot of testing around installation, because that's covered by
+ // other tests. This test is mainly for uninstall)
+ this.assertFileExistenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
+
+ // now uninstall
+ this.pkgMgr.removePackage("common-package-with-just-install-file");
+
+ this.assertFileAbsenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
+ }
+
+ @Test
+ public void testUninstallationOfPackageContainingScripts() throws Exception
+ {
+ File packageWithScripts = this.createPackageWithPreInstallScript("package-with-script-uninstall-test.jar");
+ // first install
+ this.pkgMgr.installPackage(packageWithScripts.getAbsolutePath());
+
+ // do a simple check that the package was installed (no need
+ // to do a lot of testing around installation, because that's covered by
+ // other tests. This test is mainly for uninstall)
+ this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/deploy/dummy.jar");
+
+ // now uninstall
+ this.pkgMgr.removePackage("common-package-with-pre-install");
+
+ this.assertFileAbsenceUnderJBossHome(jbossHome, "server/default/deploy/dummy.jar");
+
+ // Remember that the JBOSS_HOME/bin/test.txt file was created
+ // by an script and was NOT included as an installation file (i.e. through
+ // "file" element in the package.xml). Such files are NOT tracked/controlled
+ // by the package manager and hence will not be touched on uninstallation
+ // (unless ofcourse, the post/pre uninstall scripts take care of these files)
+ this.assertFileExistenceUnderJBossHome(jbossHome, "bin/test.txt");
+ }
+
+ @Test
+ public void testUnInstallationOfPackageWithDependencies() throws Exception
+ {
+ File packageWithDependencies = this
+ .createPackageWithSimplePackagedDependency("uninstall-package-with-packaged-dependency.jar");
+ // first install
+ this.pkgMgr.installPackage(packageWithDependencies.getAbsolutePath());
+
+ // do a simple check that the package was installed (no need
+ // to do a lot of testing around installation, because that's covered by
+ // other tests. This test is mainly for uninstall)
+ this.assertFileExistenceUnderJBossHome(jbossHome, "server/default/lib/dummy.jar");
+ this.assertFileExistenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
+
+ // uninstall
+ this.pkgMgr.removePackage("common-package-with-packaged-dependency");
+
+ // the file installed by the main package (the package which was uninstalled)
+ // should no longer be present
+ this.assertFileAbsenceUnderJBossHome(jbossHome, "server/default/lib/dummy.jar");
+ // The file installed by the dependency package SHOULD BE PRESENT,
+ // because removing the dependent package should not remove dependency packages
+ this.assertFileExistenceUnderJBossHome(jbossHome, "common/lib/dummy.jar");
+
+ }
+
+}
Modified: projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml 2009-10-28 10:08:18 UTC (rev 95675)
+++ projects/ejb3/trunk/package-manager/src/test/resources/log4j.xml 2009-10-28 10:41:52 UTC (rev 95676)
@@ -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"/>
Added: projects/ejb3/trunk/package-manager/src/test/resources/remove-packages-script.sql
===================================================================
--- projects/ejb3/trunk/package-manager/src/test/resources/remove-packages-script.sql (rev 0)
+++ projects/ejb3/trunk/package-manager/src/test/resources/remove-packages-script.sql 2009-10-28 10:41:52 UTC (rev 95676)
@@ -0,0 +1,3 @@
+delete from installation_file;
+delete from package_dependency;
+delete from package;
More information about the jboss-cvs-commits
mailing list