private static Class<?> findInterface(Endpoint endpoint, DomainRegistry domainRegistry) throws MalformedURLException, ClassNotFoundException { Interface iface = endpoint.getService().getInterfaceContract().getInterface(); if (iface instanceof JavaInterface) { String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName()); if (curi != null) { ContributionDescription ic = domainRegistry.getInstalledContribution(curi); ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())}, Remotable.class.getClassLoader()); return cl.loadClass(((JavaInterface)iface).getName()); } } return null; } }
private static Class<?> findInterface(Endpoint endpoint, DomainRegistry domainRegistry) throws MalformedURLException, ClassNotFoundException { Interface iface = endpoint.getService().getInterfaceContract().getInterface(); if (iface instanceof JavaInterface) { String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName()); if (curi != null) { ContributionDescription ic = domainRegistry.getInstalledContribution(curi); ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())}, Remotable.class.getClassLoader()); return cl.loadClass(((JavaInterface)iface).getName()); } } return null; } }
private void findInterface(Endpoint endpoint) throws MalformedURLException, ClassNotFoundException { Interface iface = endpoint.getService().getInterfaceContract().getInterface(); if (iface instanceof JavaInterface) { String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName()); if (curi != null) { ContributionDescription ic = domainRegistry.getInstalledContribution(curi); ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())}); serviceInterface = cl.loadClass(((JavaInterface)iface).getName()); } } }
private void findInterface(Endpoint endpoint) throws MalformedURLException, ClassNotFoundException { Interface iface = endpoint.getService().getInterfaceContract().getInterface(); if (iface instanceof JavaInterface) { String curi = domainRegistry.getContainingCompositesContributionURI(endpoint.getComponent().getName()); if (curi != null) { ContributionDescription ic = domainRegistry.getInstalledContribution(curi); ClassLoader cl = new URLClassLoader(new URL[]{new URL(ic.getURL())}); serviceInterface = cl.loadClass(((JavaInterface)iface).getName()); } } }
public String getServiceName() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext != null && msgContext.getTo() != null){ return msgContext.getTo().getService().getName(); } else { // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } }
boolean services() throws IOException { if (getNode() == null) { return true; } DomainRegistry reg = ((NodeImpl)getNode()).getEndpointRegistry(); for (Endpoint endpoint : reg.getEndpoints()) { out.println(endpoint.getComponent().getURI() + "/" + endpoint.getService().getName()); for (Binding b : endpoint.getService().getBindings()) { if (!SCABinding.TYPE.equals(b.getType())) { out.println(" " + b.getType().getLocalPart() + " " + b.getURI()); } } } return true; }
boolean services() throws IOException { if (getNode() == null) { return true; } DomainRegistry reg = ((NodeImpl)getNode()).getEndpointRegistry(); for (Endpoint endpoint : reg.getEndpoints()) { out.println(endpoint.getComponent().getURI() + "/" + endpoint.getService().getName()); for (Binding b : endpoint.getService().getBindings()) { if (!SCABinding.TYPE.equals(b.getType())) { out.println(" " + b.getType().getLocalPart() + " " + b.getURI()); } } } return true; }
@Override public int complete(final String buffer, final int cursor, final List clist) { if (shell.getNode() != null) { List<String> services = new ArrayList<String>(); DomainRegistry reg = ((NodeImpl)shell.getNode()).getEndpointRegistry(); for (Endpoint endpoint : reg.getEndpoints()) { services.add(endpoint.getComponent().getURI() + "/" + endpoint.getService().getName()); } setCandidateStrings(services.toArray(new String[services.size()])); } return super.complete(buffer, cursor, clist); }
@Override public int complete(final String buffer, final int cursor, final List clist) { if (shell.getNode() != null) { List<String> services = new ArrayList<String>(); DomainRegistry reg = ((NodeImpl)shell.getNode()).getEndpointRegistry(); for (Endpoint endpoint : reg.getEndpoints()) { services.add(endpoint.getComponent().getURI() + "/" + endpoint.getService().getName()); } setCandidateStrings(services.toArray(new String[services.size()])); } return super.complete(buffer, cursor, clist); }
public synchronized Endpoint getEndpoint(String uri) { for (Endpoint ep : endpoints) { String epURI = ep.getComponent().getURI() + "#" + ep.getService().getName() + "/" + ep.getBinding().getName(); if (epURI.equals(uri)) { return ep; } if (ep.getBinding().getName() == null || ep.getBinding().getName().equals(ep.getService().getName())) { epURI = ep.getComponent().getURI() + "#" + ep.getService().getName(); if (epURI.equals(uri)) { return ep; } } } return null; }
private void build(Endpoint endpoint) { BindingBuilder builder = builders.getBindingBuilder(endpoint.getBinding().getType()); if (builder != null) { builder.build(endpoint.getComponent(), endpoint.getService(), endpoint.getBinding(), new BuilderContext(extensionPoints), true); } }
Endpoint ep = endpointFinder.findEndpoint(domainRegistry, serviceURI); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { String serviceName = ep.getService().getName() + '/' + ep.getBinding().getName(); return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
Endpoint ep = endpointFinder.findEndpoint(domainRegistry, serviceURI); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { String serviceName = ep.getService().getName() + '/' + ep.getBinding().getName(); return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
@SuppressWarnings("unchecked") public <CB> ServiceReference<CB> getCallbackReference() { Message msgContext = ThreadMessageContext.getMessageContext(); if (msgContext == null || msgContext.getTo() == null){ // message in thread context could be null (or the default message where to == null) // if the user has spun up a new thread inside their component implementation return null; } Endpoint to = msgContext.getTo(); RuntimeComponentService service = (RuntimeComponentService) to.getService(); RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference(); if (callbackReference == null) { return null; } JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface(); Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass(); List<EndpointReference> wires = callbackReference.getEndpointReferences(); ServiceReferenceImpl ref = new CallbackServiceReferenceImpl(javaClass, wires); return ref; } }
private RuntimeEndpointReference createEndpointReference(JavaInterfaceFactory javaInterfaceFactory, CompositeContext compositeContext, AssemblyFactory assemblyFactory, Endpoint endpoint, Class<?> businessInterface) throws CloneNotSupportedException, InvalidInterfaceException { Component component = endpoint.getComponent(); ComponentService service = endpoint.getService(); ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setName("$sca.client$." + service.getName());
private RuntimeEndpointReference createEndpointReference(JavaInterfaceFactory javaInterfaceFactory, CompositeContext compositeContext, AssemblyFactory assemblyFactory, Endpoint endpoint, Class<?> businessInterface) throws CloneNotSupportedException, InvalidInterfaceException { Component component = endpoint.getComponent(); ComponentService service = endpoint.getService(); ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setName("$sca.client$." + service.getName());
public void process(RuntimeEndpointReference endpointReference) { if(!(endpointReference instanceof RuntimeEndpointReference)) { return; } RuntimeEndpointReference epr = (RuntimeEndpointReference) endpointReference; Contract contract = epr.getReference(); if (!(contract instanceof RuntimeComponentReference)) { return; } RuntimeComponent component = (RuntimeComponent) epr.getComponent(); if (component == null) { return; } Implementation implementation = component.getImplementation(); if (!(implementation instanceof JavaImplementation)) { return; } JavaImplementation javaImpl = (JavaImplementation)implementation; Endpoint callbackEndpoint = epr.getCallbackEndpoint(); if (callbackEndpoint != null) { Interface iface = callbackEndpoint.getService().getInterfaceContract().getInterface(); if (!supportsCallbackInterface(iface, javaImpl)) { // callback to this impl is not possible, so ensure a callback object is set for (InvocationChain chain : epr.getInvocationChains()) { chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor()); } } } } }
throws CloneNotSupportedException, InvalidInterfaceException { Component component = endpoint.getComponent(); ComponentService service = endpoint.getService(); ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setName("sca.client." + service.getName());
private EndpointReference createEndpointReference(Endpoint endpoint, Class<?> businessInterface) throws CloneNotSupportedException, InvalidInterfaceException { Component component = endpoint.getComponent(); ComponentService service = endpoint.getService(); ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setName("$self$." + service.getName());
RuntimeComponentService service = (RuntimeComponentService) target.getService(); if (service != null) { // not a callback wire