public static <T> T getService(Class<T> interfaze, String serviceURI, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, Deployer deployer) throws NoSuchServiceException { List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI); if (endpoints.size() < 1) { throw new NoSuchServiceException(serviceURI); } String serviceName = null; if (serviceURI.contains("/")) { int i = serviceURI.indexOf("/"); if (i < serviceURI.length() - 1) { serviceName = serviceURI.substring(i + 1); } } Endpoint ep = endpoints.get(0); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { return ((RuntimeComponent)ep.getComponent()).getServiceReference(interfaze, serviceName).getService(); } else { return getRemoteProxy(interfaze, ep, domainRegistry, extensionPointRegistry, deployer); } }
public static <T> T getService(Class<T> interfaze, String serviceURI, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, Deployer deployer) throws NoSuchServiceException { List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI); if (endpoints.size() < 1) { throw new NoSuchServiceException(serviceURI); } String serviceName = null; if (serviceURI.contains("/")) { int i = serviceURI.indexOf("/"); if (i < serviceURI.length() - 1) { serviceName = serviceURI.substring(i + 1); } } Endpoint ep = endpoints.get(0); if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { return ((RuntimeComponent)ep.getComponent()).getServiceReference(interfaze, serviceName).getService(); } else { return getRemoteProxy(interfaze, ep, domainRegistry, extensionPointRegistry, deployer); } }
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()); } } }
/** * @return */ public static RuntimeComponent getCurrentComponent() { Message message = ThreadMessageContext.getMessageContext(); if (message != null) { Endpoint to = message.getTo(); if (to == null) { return null; } RuntimeComponent component = (RuntimeComponent)message.getTo().getComponent(); return component; } return null; }
/** * @return */ public static RuntimeComponent getCurrentComponent() { Message message = ThreadMessageContext.getMessageContext(); if (message != null) { Endpoint to = message.getTo(); if (to == null) { return null; } RuntimeComponent component = (RuntimeComponent)message.getTo().getComponent(); return component; } return null; }
@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); }
protected List<T> findPolicies(Operation operation) { // collect together all the candidate policy sets List<PolicySet> policySets = new ArrayList<PolicySet>(); // add endpoint or endpoint reference policy sets policySets.addAll(subject.getPolicySets()); // add interface operation policy sets policySets.addAll(operation.getPolicySets()); // add implementation operation policy sets if (subject instanceof Endpoint){ for(Operation op :((Endpoint)subject).getComponent().getImplementation().getOperations()){ if (op.getName().equals(operation.getName())){ policySets.addAll(op.getPolicySets()); break; } } } return findPolicies(policySets); }
@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); }
protected List<T> findPolicies(Operation operation) { // collect together all the candidate policy sets List<PolicySet> policySets = new ArrayList<PolicySet>(); // add endpoint or endpoint reference policy sets policySets.addAll(subject.getPolicySets()); // add interface operation policy sets policySets.addAll(operation.getPolicySets()); // add implementation operation policy sets if (subject instanceof Endpoint){ for(Operation op :((Endpoint)subject).getComponent().getImplementation().getOperations()){ if (op.getName().equals(operation.getName())){ policySets.addAll(op.getPolicySets()); break; } } } return findPolicies(policySets); }
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; }
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; }
if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { String serviceName = ep.getService().getName() + '/' + ep.getBinding().getName(); return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) { String serviceName = ep.getService().getName() + '/' + ep.getBinding().getName(); return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
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); } }
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();
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();