* @throws JBIException
*/
public InternalEndpoint registerInternalEndpoint(ComponentContextImpl provider, QName serviceName, String endpointName) throws JBIException {
// Create endpoint
String key = getKey(serviceName, endpointName);
InternalEndpoint registered = (InternalEndpoint) internalEndpoints.get(key);
// Check if the endpoint has already been activated by another component
if (registered != null && registered.isLocal()) {
throw new JBIException("An internal endpoint for service " + serviceName + " and endpoint " + endpointName + " is already registered");
}
// Create a new endpoint
InternalEndpoint serviceEndpoint = new InternalEndpoint(provider.getComponentNameSpace(), endpointName, serviceName);
// Get interface from activationSpec
if (provider.getActivationSpec().getInterfaceName() != null) {
serviceEndpoint.addInterface(provider.getActivationSpec().getInterfaceName());
}
// Get interface from SU jbi descriptor
retrieveInterfaceFromSUDescriptor(serviceEndpoint);
// Get interfaces from WSDL
retrieveInterfacesFromDescription(serviceEndpoint);
// Set remote namespaces
if (registered != null) {
InternalEndpoint[] remote = registered.getRemoteEndpoints();
for (int i = 0; i < remote.length; i++) {
serviceEndpoint.addRemoteEndpoint(remote[i]);
}
}
// Register endpoint
internalEndpoints.put(key, serviceEndpoint);
registerEndpoint(serviceEndpoint);