[jboss-cvs] JBossAS SVN: r100097 - projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 28 20:15:14 EST 2010
Author: flavia.rainone at jboss.com
Date: 2010-01-28 20:15:13 -0500 (Thu, 28 Jan 2010)
New Revision: 100097
Added:
projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/FakeComponentUnit.java
Modified:
projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java
projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java
Log:
[JBAOP-763] Merge change to 742 branch
Modified: projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java 2010-01-29 00:32:56 UTC (rev 100096)
+++ projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AbstractAopMetaDataDeployer.java 2010-01-29 01:15:13 UTC (rev 100097)
@@ -265,17 +265,9 @@
//This has been replaced by a "fake" implementation to avoid the overhead of the real one
//which registers everything in JMX, which is pointless since we throw it away immediately
FakeComponentUnit componentUnit = deployComponentDeploymentContext(unit, bean);
- try
- {
- beanMetaDataDeployer.deploy(componentUnit, bean);
- done.add(bean);
- }
- finally
- {
- //Unregister the component deployment context so that this bean does not get deployed
- //again by the real BeanMetaDataDeployer
- undeployComponentDeploymentContext(componentUnit, bean);
- }
+ output.addComponentUnit(componentUnit);
+ beanMetaDataDeployer.deploy(componentUnit, bean);
+ done.add(bean);
}
}
}
@@ -293,6 +285,14 @@
log.debug("Error undeploying " + done.get(i) + " for " + unit);
}
}
+ List<FakeComponentUnit> components = output.getComponentUnits();
+ if (components != null && components.size() > 0)
+ {
+ for (int i = components.size() - 1 ; i >= 0 ; i--)
+ {
+ components.get(i).cleanup();
+ }
+ }
throw new DeploymentException(t);
}
}
@@ -301,12 +301,12 @@
{
if (output != null)
{
- List<BeanMetaData> aopBeans = output.getBeans();
- if (aopBeans != null && aopBeans.size() > 0)
+ List<FakeComponentUnit> components = output.getComponentUnits();
+ if (components != null && components.size() > 0)
{
- for (int i = aopBeans.size() - 1 ; i >= 0 ; i--)
+ for (int i = components.size() - 1 ; i >= 0 ; i--)
{
- BeanMetaData bean = aopBeans.get(i);
+ BeanMetaData bean = components.get(i).getBeanMetaData();
beanMetaDataDeployer.undeploy(unit, bean);
}
}
@@ -326,14 +326,6 @@
return new FakeComponentUnit(unit, deployment);
}
- /**
- * Undeploy the component deployment unit similar to what the KernelDeploymentDeployer does
- */
- private void undeployComponentDeploymentContext(FakeComponentUnit unit, BeanMetaData bean)
- {
- unit.cleanup();
- }
-
private class MyBeanMetaDataDeployer
{
/**
@@ -365,21 +357,6 @@
mergeScopes(scopeInfo.getMutableScope(), unit.getMutableScope());
}
-// KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
-// ScopeInfo scopeInfo2 = context.getScopeInfo();
-// if (scopeInfo2 != null)
-// {
-// ScopeKey key = unit.getScope().clone();
-// key.removeScopeLevel(CommonLevels.INSTANCE);
-// key.addScope(CommonLevels.INSTANCE, deployment.getName());
-//
-// ScopeKey mutable = new ScopeKey();
-// key.addScope(CommonLevels.INSTANCE, deployment.getName());
-//
-// mergeScopes(scopeInfo2.getScope(), key);
-// mergeScopes(scopeInfo2.getMutableScope(), mutable);
-// }
-
try
{
//System.out.println("==============> Installing " + context.getName());
@@ -465,90 +442,4 @@
return new AbstractValueMetaData(unit.getClassLoader());
}
}
-
- /**
- * BeanMetaDatadeployer uses AbstractComponentUnit per bean, but that has the overhead of
- * registering things in JMX. Create a Fake one here to encapsulate the methods that we use
- * without registering things in JMX
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 82920 $
- */
- private static class FakeComponentUnit
- {
- VFSDeploymentUnit parent;
- BeanMetaData bmd;
- ScopeKey scope;
- ScopeKey mutableScope;
-
- FakeComponentUnit(VFSDeploymentUnit parent, BeanMetaData bmd)
- {
- this.parent = parent;
- this.bmd = bmd;
- }
-
- ScopeKey getScope()
- {
- if (scope == null)
- {
- ScopeKey key = parent.getScope().clone();
- key.removeScopeLevel(CommonLevels.INSTANCE);
- key.addScope(CommonLevels.INSTANCE, bmd.getName());
- }
- return scope;
- }
-
- ScopeKey getMutableScope()
- {
- if (mutableScope == null)
- {
- mutableScope = new ScopeKey();
- mutableScope.addScope(CommonLevels.INSTANCE, bmd.getName());
- }
- return mutableScope;
- }
-
- ClassLoader getClassLoader()
- {
- return parent.getClassLoader();
- }
-
- String getName()
- {
- return bmd.getName();
- }
-
- void cleanup()
- {
- MutableMetaDataRepository repository = null;
- DeploymentUnit unit = parent;
- while (repository == null && unit != null)
- {
- repository = unit.getAttachment(MutableMetaDataRepository.class);
- unit = unit.getParent();
- }
- if (repository == null)
- {
- return;
- }
-
- try
- {
- ScopeKey scope = getScope();
- repository.removeMetaDataRetrieval(scope);
- }
- catch (Throwable ignored)
- {
- }
-
- try
- {
- ScopeKey scope = getMutableScope();
- repository.removeMetaDataRetrieval(scope);
- }
- catch (Throwable ignored)
- {
- }
- }
- }
}
Modified: projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java 2010-01-29 00:32:56 UTC (rev 100096)
+++ projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/AopMetaDataDeployerOutput.java 2010-01-29 01:15:13 UTC (rev 100097)
@@ -37,6 +37,7 @@
{
List<AspectManagerAwareBeanMetaDataFactory> factories;
List<BeanMetaData> beans;
+ List<FakeComponentUnit> componentUnits;
boolean scoped;
String scopedAspectManagerBeanName;
String domainName;
@@ -104,6 +105,20 @@
return beans;
}
+ void addComponentUnit(FakeComponentUnit unit)
+ {
+ if (unit == null)
+ throw new IllegalArgumentException("Null unit");
+ if (componentUnits == null)
+ componentUnits = new ArrayList<FakeComponentUnit>();
+ componentUnits.add(unit);
+ }
+
+ List<FakeComponentUnit> getComponentUnits()
+ {
+ return componentUnits;
+ }
+
private void massageScopedBean(BeanMetaData bean)
{
if (scoped)
Added: projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/FakeComponentUnit.java
===================================================================
--- projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/FakeComponentUnit.java (rev 0)
+++ projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/FakeComponentUnit.java 2010-01-29 01:15:13 UTC (rev 100097)
@@ -0,0 +1,99 @@
+package org.jboss.aop.asintegration.jboss5;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
+/**
+ * BeanMetaDatadeployer uses AbstractComponentUnit per bean, but that has the overhead of
+ * registering things in JMX. Create a Fake one here to encapsulate the methods that we use
+ * without registering things in JMX
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision$
+ */
+class FakeComponentUnit
+{
+ VFSDeploymentUnit parent;
+ BeanMetaData bmd;
+ ScopeKey scope;
+ ScopeKey mutableScope;
+
+ FakeComponentUnit(VFSDeploymentUnit parent, BeanMetaData bmd)
+ {
+ this.parent = parent;
+ this.bmd = bmd;
+ }
+
+ ScopeKey getScope()
+ {
+ if (scope == null)
+ {
+ ScopeKey key = parent.getScope().clone();
+ key.removeScopeLevel(CommonLevels.INSTANCE);
+ key.addScope(CommonLevels.INSTANCE, bmd.getName());
+ }
+ return scope;
+ }
+
+ ScopeKey getMutableScope()
+ {
+ if (mutableScope == null)
+ {
+ mutableScope = new ScopeKey();
+ mutableScope.addScope(CommonLevels.INSTANCE, bmd.getName());
+ }
+ return mutableScope;
+ }
+
+ ClassLoader getClassLoader()
+ {
+ return parent.getClassLoader();
+ }
+
+ String getName()
+ {
+ return bmd.getName();
+ }
+
+ BeanMetaData getBeanMetaData()
+ {
+ return bmd;
+ }
+
+ void cleanup()
+ {
+ MutableMetaDataRepository repository = null;
+ DeploymentUnit unit = parent;
+ while (repository == null && unit != null)
+ {
+ repository = unit.getAttachment(MutableMetaDataRepository.class);
+ unit = unit.getParent();
+ }
+ if (repository == null)
+ {
+ return;
+ }
+
+ try
+ {
+ ScopeKey scope = getScope();
+ repository.removeMetaDataRetrieval(scope);
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ ScopeKey scope = getMutableScope();
+ repository.removeMetaDataRetrieval(scope);
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/aop/branches/classpool_JBAOP-742/deployers/src/main/java/org/jboss/aop/asintegration/jboss5/FakeComponentUnit.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list