//
if (epr == null)
throw new NullPointerException(_MESSAGES.get("NullMemberServiceEPR"));
WsResource sg = getWsResource();
//
// make sure this is a valid member of the group
//
if (!isMatch(epr))
throw new AddRefusedFault(_MESSAGES.get("ContentCreationFailed"));
ResourceManager manager = sg.getResourceManager();
String endpoint = getEntryContextPath();
WsResource resource = null;
try
{
resource = (WsResource)manager.createResource(endpoint);
}
catch (SoapFault error)
{
throw new ResourceInitializationFault(error);
}
//
// set the sg entry fields before initializing the entry resource
//
Entry entry = (Entry)resource.getCapability(WssgConstants.ENTRY_URI);
entry.setServiceGroup(sg);
entry.setMemberEPR(epr);
try
{
resource.initialize();
manager.addResource(resource.getEndpointReference(), resource);
}
catch (SoapFault error)
{
throw new ResourceInitializationFault(error);
}
//
// set termination time AFTER we initialize so that we can rely
// on the base Resource class' implementation of WS-RL (which
// tries to apply the change immediately, rather than storing it
// in a field and setting it during initialization)
//
if (resource.hasCapability(WsrlConstants.SCHEDULED_TERMINATION_URI))
{
ScheduledTermination wsrl =
(ScheduledTermination)resource.getCapability(WsrlConstants.SCHEDULED_TERMINATION_URI);
wsrl.setTerminationTime(termination);
}
return resource;
}