public ComponentReference getReference(String name){ for (ComponentReference ref : getReferences()){ if (ref.getName().equals(name)){ return ref; } } return null; }
public ComponentReference getReference(String name){ for (ComponentReference ref : getReferences()){ if (ref.getName().equals(name)){ return ref; } } return null; }
/** * Gets a RuntimeComponentReference of a supplied RuntimeComponent by name * @param tuscanyRuntimeComponent - the runtime component * @param name - the name of the reference * @return - the RuntimeComponentReference with the supplied name - null if there is no reference with that name */ private RuntimeComponentReference getReferenceByName( RuntimeComponent tuscanyRuntimeComponent, String name ) { if( name == null ) return null; for( ComponentReference reference : tuscanyRuntimeComponent.getReferences() ) { if( name.equals(reference.getName()) ) return (RuntimeComponentReference)reference; } // end for return null; } // end method getReferenceByName
public String getURI() { if (uri == null) { if (component != null && reference != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = reference.getName(); } uri = component.getURI() + "#reference-binding(" + reference.getName() + "/" + bindingName + ")"; } else if (component != null && reference != null) { uri = component.getURI() + "#reference(" + reference.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
public String getURI() { if (uri == null) { if (component != null && reference != null && binding != null) { String bindingName = binding.getName(); if (bindingName == null) { bindingName = reference.getName(); } uri = component.getURI() + "#reference-binding(" + reference.getName() + "/" + bindingName + ")"; } else if (component != null && reference != null) { uri = component.getURI() + "#reference(" + reference.getName() + ")"; } else if (component != null) { uri = component.getURI(); } } return uri; }
public void stop(Component component, ComponentReference reference) { if (logger.isLoggable(Level.FINE)) { logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName()); } RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference); for ( EndpointReference endpointReference : runtimeRef.getEndpointReferences()){ RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference; stop(epr); } }
/** * Add an SCA service to be added to the DWR runtime */ public void addService(RuntimeEndpointReference epr) { CreatorManager creatorManager = (CreatorManager)getContainer().getBean(CreatorManager.class.getName()); addService(creatorManager, epr); serviceRefs.put(epr.getReference().getName(), epr); }
if (reference != null && reference.getName().endsWith("_asyncCallback")){
if (reference != null && reference.getName().endsWith("_asyncCallback")){
public <B> TuscanyServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) throws IllegalArgumentException { for (ComponentReference ref : component.getReferences()) { if (referenceName.equals(ref.getName())) { Multiplicity multiplicity = ref.getMultiplicity(); if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { throw new IllegalArgumentException("Reference " + referenceName + " has multiplicity " + multiplicity); } if (ref.getEndpointReferences().size() < 1) { return null; } TuscanyServiceReference<B> sr = getServiceReference(businessInterface, (RuntimeEndpointReference)getEndpointReference(ref)); if (sr == null) { throw new IllegalArgumentException("Reference " + referenceName + " is null"); } return sr; } } throw new IllegalArgumentException("[JCA80011] Reference not found: " + referenceName); }
private Object getProxy(String name) { for (ComponentReference reference : component.getReferences()) { if (reference.getName().equals(name)) { Class<?> iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass(); return component.getComponentContext().getService(iface, name); } } throw new IllegalArgumentException("reference " + name + " not found on component: " + component); }
/** * @see ComponentContext#getServiceReferences(Class<B>, String) */ public <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName) { try { for (ComponentReference ref : component.getReferences()) { if (referenceName.equals(ref.getName())) { if (ref.getMultiplicity() == Multiplicity.ONE_ONE) throw new IllegalArgumentException("Reference " + referenceName + " is not a valid argument for getServiceReferences because it has a multiplicity of 1..1"); if (ref.getMultiplicity() == Multiplicity.ZERO_ONE) throw new IllegalArgumentException("Reference " + referenceName + " is not a valid argument for getServiceReferences because it has a multiplicity of 0..1"); ArrayList<ServiceReference<B>> serviceRefs = new ArrayList<ServiceReference<B>>(); for (EndpointReference endpointReference : ref.getEndpointReferences()) { RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference; serviceRefs.add(getServiceReference(businessInterface, epr)); } return serviceRefs; } } throw new IllegalArgumentException("Reference not found: " + referenceName); } catch (IllegalArgumentException iae) { throw iae; } catch (ServiceRuntimeException e) { throw e; } catch (Exception e) { throw new ServiceRuntimeException(e.getMessage(), e); } }
/** * Returns true if the reference has a callback */ private boolean hasCallback(EndpointReference endpointReference){ if (endpointReference.getReference().getInterfaceContract() == null || endpointReference.getReference().getInterfaceContract().getCallbackInterface() == null || endpointReference.getReference().getName().startsWith("$self$.")){ return false; } else { return true; } }
String referenceName = reference.getName(); JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
if (componentReference != component.getReference(componentReference.getName())){ Monitor.error(monitor, this, "DuplicateComponentReferenceName", component.getName(), componentReference.getName()); Reference reference = component.getImplementation().getReference(componentReference.getName()); "ReferenceNotFoundForComponentReference", component.getName(), componentReference.getName());
private void addService(CreatorManager creatorManager, final RuntimeEndpointReference epr) { final Class<?> iface = ((JavaInterface)epr.getComponentTypeReferenceInterfaceContract().getInterface()).getJavaClass(); creatorManager.addCreator(epr.getReference().getName(), new AbstractCreator() { public Class<?> getType() { return iface; } public Object getInstance() throws InstantiationException { ExtensionPointRegistry registry = epr.getCompositeContext().getExtensionPointRegistry(); ExtensibleProxyFactory proxyFactory = ExtensibleProxyFactory.getInstance(registry); return proxyFactory.createProxy(iface, epr); } }); }
String asyncCallbackName = endpointReference.getReference().getName() + "_asyncResponse"; jmsBinding.setResponseDestinationName(asyncCallbackName);
monitor.pushContext("Reference: " + componentReference.getName()); try { configure(componentReference, context);
monitor.pushContext("Reference: " + componentReference.getName()); try { configure(componentReference, context);