[jboss-cvs] JBossAS SVN: r101743 - projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 2 18:15:33 EST 2010
Author: alesj
Date: 2010-03-02 18:15:32 -0500 (Tue, 02 Mar 2010)
New Revision: 101743
Added:
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentMetaData.java
projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentValidationDeployer.java
Log:
[JBDEPLOY-248]; initial Deployment metadata work.
Copied: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentMetaData.java (from rev 101717, projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentLifeCycle.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentMetaData.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentMetaData.java 2010-03-02 23:15:32 UTC (rev 101743)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Inc., 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 javax.xml.bind.annotation.*;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * Deployment meta data.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+ at JBossXmlSchema(namespace="urn:jboss:deployment:1.0", elementFormDefault= XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="deployment")
+ at XmlType(name="deploymentType", propOrder={"filters"})
+public class DeploymentMetaData implements Serializable
+{
+ private static final long serialVersionUID = 1l;
+
+ private DeploymentStage requiredStage = DeploymentStages.DESCRIBE;
+ private boolean lazyResolve;
+ private boolean lazyStart;
+ private Set<String> filters;
+
+ public DeploymentStage getRequiredStage()
+ {
+ return requiredStage;
+ }
+
+ @XmlAttribute(name = "required-stage")
+ public void setRequiredStage(DeploymentStage requiredStage)
+ {
+ if (requiredStage == null)
+ requiredStage = DeploymentStages.DESCRIBE;
+
+ this.requiredStage = requiredStage;
+ }
+
+ public boolean isLazyResolve()
+ {
+ return lazyResolve;
+ }
+
+ @XmlAttribute(name = "lazy-resolve")
+ public void setLazyResolve(boolean lazyResolve)
+ {
+ this.lazyResolve = lazyResolve;
+ }
+
+ public boolean isLazyStart()
+ {
+ return lazyStart || (filters != null && filters.isEmpty() == false);
+ }
+
+ @XmlAttribute(name = "lazy-start")
+ public void setLazyStart(boolean lazyStart)
+ {
+ this.lazyStart = lazyStart;
+ }
+
+ public Set<String> getFilters()
+ {
+ return filters;
+ }
+
+ @XmlElement(name = "lazy-start-filter")
+ public void setFilters(Set<String> filters)
+ {
+ this.filters = filters;
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentValidationDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentValidationDeployer.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/DeploymentValidationDeployer.java 2010-03-02 23:15:32 UTC (rev 101743)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Inc., 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.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.ControllerStateModel;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Deployment meta data validation deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class DeploymentValidationDeployer extends AbstractSimpleRealDeployer<DeploymentMetaData>
+{
+ private static final ControllerState DESCRIBED = ControllerState.getInstance(DeploymentStages.DESCRIBE.getName());
+ private static final ControllerState REAL = ControllerState.getInstance(DeploymentStages.REAL.getName());
+
+ private ControllerStateModel states;
+ private boolean throwException = true;
+
+ public DeploymentValidationDeployer(Controller controller)
+ {
+ super(DeploymentMetaData.class);
+
+ if (controller == null)
+ throw new IllegalArgumentException("Null Controller");
+ this.states = controller.getStates();
+
+ setStage(DeploymentStages.POST_PARSE);
+ setTopLevelOnly(true);
+ }
+
+ @Override
+ public void deploy(DeploymentUnit unit, DeploymentMetaData deployment) throws DeploymentException
+ {
+ DeploymentStage requiredStage = deployment.getRequiredStage();
+ ControllerState state = ControllerState.getInstance(requiredStage.getName());
+
+ if (throwException && deployment.isLazyResolve() && states.isAfterState(state, DESCRIBED))
+ throw new DeploymentException("Required stage is after DESCRIBED with lazy resolve enabled: " + requiredStage);
+ if (throwException && deployment.isLazyStart() && states.isAfterState(state, REAL))
+ throw new DeploymentException("Required stage is after REAL with lazy start enabled: " + requiredStage);
+
+ unit.setRequiredStage(requiredStage);
+ }
+
+ public void setThrowException(boolean throwException)
+ {
+ this.throwException = throwException;
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list