//
// instantiate the resource object itself
//
Class resourceClass = getResourceClass();
Resource resource = (Resource)ReflectUtils.newInstance(resourceClass);
//
// give the resource access to all the standard Muse components
//
resource.setEnvironment(env);
resource.setLog(log);
resource.setContextPath(getContextPath());
resource.setInitializationParameters(getInitializationParameters());
WsdlConfig wsdl = getWsdlConfig();
resource.setWsdlPath(wsdl.getWsdlPath());
resource.setWsdlPortType(wsdl.getWsdlPortType());
//
// create the unique EPR for the resource using the
// ID factory specified
//
EndpointReference uniqueEPR = env.getDeploymentEPR();
ResourceIdFactory idFactory = getResourceIdFactory();
if (idFactory != null)
{
QName id = idFactory.getIdentifierName();
String value = idFactory.getNextIdentifier();
uniqueEPR.addParameter(id, value);
}
resource.setEndpointReference(uniqueEPR);
//
// add all of the capabilities to the resource
//
Iterator i = getCapabilityDefinitions().iterator();
while (i.hasNext())
{
CapabilityDefinition next = (CapabilityDefinition)i.next();
Capability capability = next.newInstance();
resource.addCapability(capability);
}
return resource;
}