public InterfaceContract getComponentServiceInterfaceContract() { resolve(); if (interfaceContract == null && service != null) { interfaceContract = service.getInterfaceContract(); } return interfaceContract; }
public InterfaceContract getComponentServiceInterfaceContract() { resolve(); if (interfaceContract == null && service != null) { interfaceContract = service.getInterfaceContract(); } return interfaceContract; }
@Override public InterfaceContract getBindingInterfaceContract() { return endpoint.getService().getInterfaceContract(); }
private ServiceReference getServiceReference(BundleContext bundleContext, ComponentService service) { JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getInterface(); // String filter = getOSGiFilter(provider.getOSGiProperties(service)); // FIXME: What is the filter? String filter = "(!(" + SERVICE_IMPORTED + "=*))"; // "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))"; ServiceReference ref; try { ref = bundleContext.getServiceReferences(javaInterface.getName(), filter)[0]; } catch (InvalidSyntaxException e) { throw new ServiceRuntimeException(e); } return ref; }
protected boolean isAsIs() { InterfaceContract ic = service.getInterfaceContract(); if (ic.getInterface().getOperations().size() != 1) { return false; } List<DataType> inputDataTypes = ic.getInterface().getOperations().get(0).getInputType().getLogical(); if (inputDataTypes.size() != 1) { return false; } Class<?> inputType = inputDataTypes.get(0).getPhysical(); if (javax.jms.Message.class.isAssignableFrom(inputType)) { return true; } return false; }
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; } }
public HTTPRPCServiceOperationSelectorInterceptor(RuntimeEndpoint endpoint) { Interface serviceInterface = endpoint.getService().getInterfaceContract().getInterface(); this.operations = serviceInterface.getOperations(); }
private String handleCallbackAddress( SOAPHeader header, Message msg ) { String callbackAddress = null; Iterator<SOAPElement> it = header.getChildElements(QNAME_WSA_FROM); SOAPElement from = it.hasNext() ? it.next() : null; if( from == null ) { Iterator<SOAPElement> it2 = header.getChildElements(QNAME_WSA_REPLYTO); from = it2.hasNext() ? it2.next() : null; } if (from != null) { Iterator<SOAPElement> it2 = header.getChildElements(QNAME_WSA_ADDRESS); SOAPElement callbackAddrElement = it2.hasNext() ? it2.next() : null; if (callbackAddrElement != null) { if (endpoint.getService().getInterfaceContract().getCallbackInterface() != null) { callbackAddress = callbackAddrElement.getTextContent(); } // OMElement refParms = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS); Iterator<SOAPElement> it3 = header.getChildElements(QNAME_WSA_REFERENCE_PARAMETERS); SOAPElement refParms = it3.hasNext() ? it3.next() : null; if( refParms != null ) msg.getHeaders().put(WS_REF_PARMS, refParms); } } // end if return callbackAddress; } // end method handleCallbackAddress
public HTTPDefaultServiceOperationSelectorInterceptor(RuntimeEndpoint endpoint) { Interface serviceInterface = endpoint.getService().getInterfaceContract().getInterface(); this.operations = serviceInterface.getOperations(); }
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()); } } }
private Operation getOperation( Object args ) { if( isNativeAsync ) { List<Operation> ops = requestEndpoint.getService().getInterfaceContract().getInterface().getOperations(); for (Operation op : ops) { if( operationName.equals(op.getName()) ) return op; } // end for return null; } else { operationName = "setResponse"; if( args instanceof Throwable ) { operationName = "setWrappedFault"; } List<Operation> ops = responseEndpointReference.getReference().getInterfaceContract().getInterface().getOperations(); for (Operation op : ops) { if( operationName.equals(op.getName()) ) return op; } // end for return null; } // end if } // end getOperation
public void start() { ComponentService service = endpoint.getService(); Interface serviceInterface = service.getInterfaceContract().getInterface(); for (Operation op : serviceInterface.getOperations()) { JSONPServlet servlet = new JSONPServlet(endpoint, op); String path = endpoint.getBinding().getURI() + "/" + op.getName(); String mappedURI = servletHost.addServletMapping(path, servlet); String endpointURI = mappedURI.substring(0, mappedURI.lastIndexOf("/" + op.getName())); endpoint.setDeployedURI(endpointURI); endpoint.getBinding().setURI(endpointURI); } }
public void stop() { ComponentService service = endpoint.getService(); Interface serviceInterface = service.getInterfaceContract().getInterface(); for (Operation op : serviceInterface.getOperations()) { String path = endpoint.getBinding().getURI() + "/" + op.getName(); servletHost.removeServletMapping(path); } }
/** * Choose the physical binding for service-side remotable binding.sca * @param endpoint * @return */ protected QName chooseBinding(RuntimeEndpoint endpoint) { DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry(); boolean distributed = alwaysDistributed || domainRegistry.isDistributed(); InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract(); if(interfaceContract != null && interfaceContract.getInterface() != null && interfaceContract.getInterface().isRemotable() && distributed && isBindingSupported(defaultMappedBinding)) { return defaultMappedBinding; } return defaultLocalBinding; }
/** * Choose the physical binding for service-side remotable binding.sca * @param endpoint * @return */ protected QName chooseBinding(RuntimeEndpoint endpoint) { DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry(); boolean distributed = alwaysDistributed || domainRegistry.isDistributed(); InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract(); if(interfaceContract != null && interfaceContract.getInterface() != null && interfaceContract.getInterface().isRemotable() && distributed && isBindingSupported(defaultMappedBinding)) { return defaultMappedBinding; } return defaultLocalBinding; }
/** * Init the comet binding server-side infrastructure. */ @Override public void start() { String deployedURI = ServletFactory.registerServlet(this.servletHost); endpoint.setDeployedURI(deployedURI); final ComponentService service = this.endpoint.getService(); final Interface serviceInterface = service.getInterfaceContract().getInterface(); JavascriptGenerator.generateServiceProxy(service); for (final Operation operation : serviceInterface.getOperations()) { final String url = "/" + endpoint.getService().getName() + "/" + operation.getName(); CometEndpointManager.add(url, endpoint); CometOperationManager.add(url, operation); JavascriptGenerator.generateMethodProxy(service, operation); } }
componentReference.getBindings().add(endpoint.getBinding()); InterfaceContract interfaceContract = service.getInterfaceContract(); Service componentTypeService = service.getService(); if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
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()); } } } } }