[jboss-cvs] JBossAS SVN: r108557 - in projects/jboss-deployers/trunk: deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 13 13:24:21 EDT 2010
Author: alesj
Date: 2010-10-13 13:24:20 -0400 (Wed, 13 Oct 2010)
New Revision: 108557
Added:
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoadingDomainDeployer.java
Modified:
projects/jboss-deployers/trunk/pom.xml
Log:
[JBDEPLOY-266]; add CL domain configuration deployer.
Copied: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoadingDomainDeployer.java (from rev 104761, projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractLevelClassLoaderSystemDeployer.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoadingDomainDeployer.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractClassLoadingDomainDeployer.java 2010-10-13 17:24:20 UTC (rev 108557)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployers.plugins.classloading;
+
+import org.jboss.classloader.spi.ClassLoaderDomain;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.Loader;
+import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloader.spi.ShutdownPolicy;
+import org.jboss.classloading.spi.metadata.ClassLoadingDomainMetaData;
+import org.jboss.classloading.spi.metadata.LoaderMetaData;
+import org.jboss.classloading.spi.metadata.ParentPolicyMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * AbstractClassLoadingDomainDeployer.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AbstractClassLoadingDomainDeployer extends AbstractSimpleRealDeployer<ClassLoadingDomainMetaData>
+{
+ /** The classloader system */
+ private ClassLoaderSystem system;
+
+ public AbstractClassLoadingDomainDeployer()
+ {
+ super(ClassLoadingDomainMetaData.class);
+ setStage(DeploymentStages.DESCRIBE);
+ }
+
+ /**
+ * Validate the config
+ */
+ public void create()
+ {
+ if (system == null)
+ throw new IllegalStateException("The system has not been set");
+ }
+
+ public void deploy(DeploymentUnit unit, ClassLoadingDomainMetaData deployment) throws DeploymentException
+ {
+ String name = deployment.getName();
+
+ ParentPolicyMetaData ppmd = deployment.getParentPolicy();
+ ParentPolicy pp = (ppmd != null) ? ppmd.createParentPolicy() : ParentPolicy.BEFORE;
+
+ Loader parent = null;
+ String parentDomain = deployment.getParentDomain();
+ LoaderMetaData lmd = deployment.getParent();
+ if (parentDomain != null && lmd != null)
+ throw new DeploymentException("Cannot define both: parent-domain and parent loader: " + deployment);
+
+ if (lmd != null)
+ {
+ parent = lmd.getValue();
+ }
+ else if (parentDomain != null)
+ {
+ parent = system.getDomain(parentDomain);
+ }
+
+ ShutdownPolicy shutdownPolicy = deployment.getShutdownPolicy();
+ Boolean useLoadClassForParent = deployment.getUseLoadClassForParent();
+
+ system.createAndRegisterDomain(name, pp, parent, shutdownPolicy, useLoadClassForParent);
+ }
+
+ public void undeploy(DeploymentUnit unit, ClassLoadingDomainMetaData deployment)
+ {
+ // should be already removed, but let's make sure
+ ClassLoaderDomain domain = system.getDomain(deployment.getName());
+ if (domain != null)
+ system.unregisterDomain(domain);
+ }
+
+ /**
+ * Get the system.
+ *
+ * @return the system.
+ */
+ public ClassLoaderSystem getSystem()
+ {
+ return system;
+ }
+
+ /**
+ * Set the system.
+ *
+ * @param system the system.
+ */
+ public void setSystem(ClassLoaderSystem system)
+ {
+ this.system = system;
+ }
+}
Modified: projects/jboss-deployers/trunk/pom.xml
===================================================================
--- projects/jboss-deployers/trunk/pom.xml 2010-10-13 17:21:06 UTC (rev 108556)
+++ projects/jboss-deployers/trunk/pom.xml 2010-10-13 17:24:20 UTC (rev 108557)
@@ -27,7 +27,7 @@
<version.jboss.man>2.1.1.SP2</version.jboss.man>
<version.jboss.mdr>2.2.0.Alpha3</version.jboss.mdr>
<version.jboss.kernel>2.2.0.Alpha10</version.jboss.kernel>
- <version.jboss.classloader>2.2.0.Alpha8</version.jboss.classloader>
+ <version.jboss.classloader>2.2.0-SNAPSHOT</version.jboss.classloader>
<version.jboss.scanning>1.0.0.Alpha4</version.jboss.scanning>
<version.jboss.classloading.spi>6.0.0-Alpha8</version.jboss.classloading.spi>
<version.jboss.common.core>2.2.17.GA</version.jboss.common.core>
More information about the jboss-cvs-commits
mailing list