SimpleServiceGroup can't handle resources that have TerminationTime
-------------------------------------------------------------------
Key: MUSE-253
URL: https://issues.apache.org/jira/browse/MUSE-253
Project: Muse
Issue Type: Bug
Components: Core Engine - Resource and Capability APIs
Environment: Muse 2.2.0, Eclipse 3.2.1
Reporter: Vinh Nguyen
Assignee: Dan Jemiolo
My SG implementation is similar to the wsrf sample. But when I dynamically
generate a resource with a default termination time, the SG throws this error:
[STDERR] org.apache.muse.ws.resource.sg.faults.AddRefusedFault: [ID = 'NoWSRL']
The WS-SG Entry resources, which have context path 'ServiceGroupEntry', do not
support the WS-RL ScheduledTermination capability. WS-SG Add requests that
specify an initial termination time for WS-SG entries will only work if the
WS-SG resource type defined in muse.xml has the WS-RL ScheduledTermination
capability, defined by capability URI
'http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination'.
[STDERR] at
org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup.createEntry(SimpleServiceGroup.java:150)
[STDERR] at
org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup.addEntry(SimpleServiceGroup.java:92)
[STDERR] at
org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup.resourceAdded(SimpleServiceGroup.java:408)
So, I added the ScheduledTermination capability to my ServiceGroupEntry
resource in muse.xml. But then I get another error:
[STDERR] java.lang.RuntimeException: [ID = 'PropertyNotFound'] The schema has
no property with the name '{http://docs.oasis-open.org/wsrf/rl-2}CurrentTime'.
Use the hasProperty method to determine if a property exists.
[STDERR] at
org.apache.muse.ws.resource.properties.schema.impl.SimpleResourcePropertiesSchema.getProperty(SimpleResourcePropertiesSchema.java:237)
[STDERR] at
org.apache.muse.ws.resource.properties.schema.impl.SimpleResourcePropertiesSchema.setCapability(SimpleResourcePropertiesSchema.java:275)
[STDERR] at
org.apache.muse.ws.resource.properties.impl.SimpleResourcePropertyCollection.addCapability(SimpleResourcePropertyCollection.java:129)
[STDERR] at
org.apache.muse.ws.resource.impl.AbstractWsResourceCapability.initialize(AbstractWsResourceCapability.java:304)
[STDERR] at
org.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination.initialize(SimpleScheduledTermination.java:95)
[STDERR] at
org.apache.muse.core.SimpleResource.initializeCapabilities(SimpleResource.java:303)
[STDERR] at
org.apache.muse.core.SimpleResource.initialize(SimpleResource.java:268)
[STDERR] at
org.apache.muse.ws.resource.impl.SimpleWsResource.initialize(SimpleWsResource.java:217)
[STDERR] at
org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup.createEntry(SimpleServiceGroup.java:164)
[STDERR] at
org.apache.muse.ws.resource.sg.impl.SimpleServiceGroup.addEntry(SimpleServiceGroup.java:92)
The problem is in the Muse code. In SimpleServiceGroup.createEntry(), if the
resource to add has a termination time, then it requires the new
ServiceGroupEntry resource to also have the ScheduledTermination capability.
This way, they both terminate at the same time.
But, ScheduledTermination requires support for the CurrentTime property. Yet,
WS-ServiceGroupEntry-1_2.wsdl and WS-ServiceGroup-1_2.xsd do not list this
property for ServiceGroupEntry. So out of the box, SimpleServiceGroup can't
handle expirable resources, which forces me to:
1) extend the base wsdl/xsd and add the CurrentTime property to the RP.
2) extend SimpleServiceGroup to return an additional CurrentTime property
I think the real bug though is in SimpleServiceGroup.resourceAdded(). It
should only need to create a new ServiceGroupEntry resource WITHOUT a
termination time. This is because in resourceRemoved(), it automatically
removes the Entry when the parent resource is destroyed.
Also, by initially setting a termination time on the Entry to match the
termination time of the parent resource, Muse has to make sure these are kept
in sync. But Muse doens't do this, which is another bug. So a client can
extend the termination time of the parent resource, but the Entry still has the
old time. Hence, the Entry will terminate itself early, and the parent
resource no longer is in the SG.
For now, my "hack" solution is to override SimpleServiceGroup.addEntry() and
immediately call super.addEntry(), but always pass a null termination time.
This way, Muse will never need to set a termination time on the Entry resource
nor require it to have the ScheduledTermination capability.
The real fix should be to update resourceAdded() and createEntry() and remove
logic that checks/requires a termination time.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]