Author: heiko.braun(a)jboss.com
Date: 2007-08-07 15:16:05 -0400 (Tue, 07 Aug 2007)
New Revision: 4240
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectInstaller.java
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointAPIDeploymentAspect.java
framework/trunk/version.properties
Log:
1.0.0.CR2: DeploymentAspectInstaller works with parent/child relationships
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java 2007-08-07
19:13:42 UTC (rev 4239)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DefaultEndpoint.java 2007-08-07
19:16:05 UTC (rev 4240)
@@ -102,8 +102,11 @@
ClassLoader classLoader = service.getDeployment().getRuntimeClassLoader();
if (classLoader == null)
+ {
+ // TODO: IMO this is an exception
classLoader = service.getDeployment().getInitialClassLoader();
-
+ }
+
if (classLoader == null)
throw new IllegalStateException("Deployment classloader not set");
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectInstaller.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectInstaller.java 2007-08-07
19:13:42 UTC (rev 4239)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectInstaller.java 2007-08-07
19:16:05 UTC (rev 4240)
@@ -43,11 +43,23 @@
{
// provide logging
private static final Logger log = Logger.getLogger(DeploymentAspectInstaller.class);
-
+
+ private DeploymentAspectManager parent;
private DeploymentAspectManager manager;
private Set<DeploymentAspect> aspects;
private boolean sortAspectsOnCreate;
+ private Set<String> parentProvidedConditions = new HashSet<String>();
+ public DeploymentAspectManager getParent()
+ {
+ return parent;
+ }
+
+ public void setParent(DeploymentAspectManager parent)
+ {
+ this.parent = parent;
+ }
+
public void setManager(DeploymentAspectManager manager)
{
this.manager = manager;
@@ -66,6 +78,17 @@
public void create()
{
List<DeploymentAspect> unsortedAspects = new
ArrayList<DeploymentAspect>();
+
+ if(parent!=null)
+ {
+ Iterator<DeploymentAspect> it = parent.getDeploymentAspects().iterator();
+ while(it.hasNext())
+ {
+ DeploymentAspect aspect = it.next();
+ parentProvidedConditions.addAll( aspect.getProvidesAsSet());
+ }
+ }
+
unsortedAspects.addAll(manager.getDeploymentAspects());
unsortedAspects.addAll(aspects);
@@ -75,8 +98,9 @@
sortedAspects = new ArrayList<DeploymentAspect>();
List<DeploymentAspect> allAspects = new
ArrayList<DeploymentAspect>(unsortedAspects);
- // Add aspects with no requirements first
+ // Add aspects with no requirements first
Iterator<DeploymentAspect> itAll = allAspects.iterator();
+
while (itAll.hasNext())
{
DeploymentAspect aspect = itAll.next();
@@ -98,7 +122,7 @@
sortedAspects.add(index, aspect);
itAll.remove();
- itAll = allAspects.iterator();
+ itAll = allAspects.iterator(); // Hm,...
}
}
@@ -132,27 +156,38 @@
DeploymentAspect sortedAspect = sortedAspects.get(i);
providedConditions.addAll(sortedAspect.getProvidesAsSet());
}
+
+ String exmsg = "Cannot add deployment aspect(s)";
+ StringBuilder str = new StringBuilder(exmsg);
+
+ if(parent!=null)
+ str.append( "\n"+parent.getName()+ " provides: " +
parentProvidedConditions);
+ str.append( "\n"+manager.getName()+ " provides: " +
providedConditions);
- String exmsg = "Cannot add deployment aspect(s)";
- StringBuilder str = new StringBuilder(exmsg + "\nProvided Conditions are:
" + providedConditions);
for (DeploymentAspect da : allAspects)
{
str.append("\n " + da.getClass().getName() + ", requires:
" + da.getRequires());
}
log.error(str);
- throw new IllegalStateException(exmsg);
+ throw new IllegalStateException(str.toString());
}
private int getAspectIndex(List<DeploymentAspect> sortedAspects,
DeploymentAspect aspect)
{
int index = -1;
- Set<String> providedConditions = new HashSet<String>();
+ Set<String> selfProvidedConditions = new HashSet<String>();
for (int i = 0; i < sortedAspects.size(); i++)
{
DeploymentAspect sortedAspect = sortedAspects.get(i);
- providedConditions.addAll(sortedAspect.getProvidesAsSet());
- if (providedConditions.containsAll(aspect.getRequiresAsSet()))
+ selfProvidedConditions.addAll(sortedAspect.getProvidesAsSet());
+
+ // take both parent and child conditions into consideration
+ HashSet<String> parentAndChildConditions = new HashSet<String>();
+ parentAndChildConditions.addAll(parentProvidedConditions);
+ parentAndChildConditions.addAll(selfProvidedConditions);
+
+ if (parentAndChildConditions.containsAll(aspect.getRequiresAsSet()))
{
index = i + 1;
break;
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java 2007-08-07
19:13:42 UTC (rev 4239)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/DeploymentAspectManagerImpl.java 2007-08-07
19:16:05 UTC (rev 4240)
@@ -90,10 +90,15 @@
DeploymentAspect aspect = getDeploymentAspects().get(i);
// Check that all required aspects are met
+ /*
+ TODO: This should done by adding all provided conditions to the Deployment
+ when being executed. Otherwise we will miss the parent provided conditions here
+
Set<String> requiredSet = aspect.getRequiresAsSet();
requiredSet.remove(DeploymentAspect.LAST_DEPLOYMENT_ASPECT);
if (providedConditions.containsAll(requiredSet) == false)
throw new IllegalStateException("Required conditions '" +
aspect.getRequires() + "' not satisfied by '" + providedConditions +
"' for: " + aspect);
+ */
logInvocation(aspect, "Create");
aspect.create(dep);
Modified:
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointAPIDeploymentAspect.java
===================================================================
---
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointAPIDeploymentAspect.java 2007-08-07
19:13:42 UTC (rev 4239)
+++
framework/trunk/src/main/java/org/jboss/wsf/framework/deployment/EndpointAPIDeploymentAspect.java 2007-08-07
19:16:05 UTC (rev 4240)
@@ -57,7 +57,11 @@
ClassLoader rtcl = dep.getRuntimeClassLoader();
if (rtcl == null)
+ {
+ // TODO: What's this? Look's quiet hacky...
+ log.warn("Using inital class laoder as runtime laoder. Hack?", new
IllegalArgumentException());
dep.setRuntimeClassLoader(dep.getInitialClassLoader());
+ }
for (Endpoint ep : dep.getService().getEndpoints())
{
Modified: framework/trunk/version.properties
===================================================================
--- framework/trunk/version.properties 2007-08-07 19:13:42 UTC (rev 4239)
+++ framework/trunk/version.properties 2007-08-07 19:16:05 UTC (rev 4240)
@@ -5,10 +5,10 @@
specification.vendor=JBoss (
http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=1.0.0.CR1
-repository.id=1.0.0.CR1
+version.id=1.0.0.CR2
+repository.id=1.0.0.CR2
-implementation.title=JBoss Web Services - Common
+implementation.title=JBoss Web Services - Framework
implementation.url=http://www.jboss.org/products/jbossws
implementation.vendor=JBoss Inc.
implementation.vendor.id=http://www.jboss.org