org.apache.tuscany.sca.interfacedef.Interface.isRemotable()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(15.3k)|赞(0)|评价(0)|浏览(261)

本文整理了Java中org.apache.tuscany.sca.interfacedef.Interface.isRemotable()方法的一些代码示例,展示了Interface.isRemotable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Interface.isRemotable()方法的具体详情如下:
包路径:org.apache.tuscany.sca.interfacedef.Interface
类名称:Interface
方法名:isRemotable

Interface.isRemotable介绍

[英]Returns true if the interface is a remotable interface..
[中]如果接口是远程接口,则返回true。。

代码示例

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

  1. protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {
  2. InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();
  3. if (!bindingInterfaceContract.getInterface().isRemotable()) {
  4. throw new IllegalStateException("This method should only have been called for a remotable interface.");
  5. }
  6. Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);
  7. return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);
  8. }
  9. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {
  2. InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();
  3. if (!bindingInterfaceContract.getInterface().isRemotable()) {
  4. throw new IllegalStateException("This method should only have been called for a remotable interface.");
  5. }
  6. Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);
  7. return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);
  8. }
  9. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. private boolean supportsCallbackInterface(Interface iface, JavaImplementation impl) {
  2. if (iface instanceof JavaInterface) {
  3. Class<?> ifaceClass = ((JavaInterface)iface).getJavaClass();
  4. if (ifaceClass.isAssignableFrom(impl.getJavaClass())) {
  5. return true;
  6. }
  7. }
  8. try {
  9. Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass());
  10. // Ignore the remotable/conversational testing
  11. implType.setRemotable(iface.isRemotable());
  12. return interfaceContractMapper.isCompatibleSubset(iface, implType);
  13. } catch (InvalidInterfaceException e) {
  14. logger.log(Level.WARNING, e.getMessage(), e);
  15. return false;
  16. }
  17. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. public boolean isCompatibleSubset(Interface source, Interface target) {
  2. if (source == target) {
  3. // Shortcut for performance
  4. return true;
  5. }
  6. if (source == null || target == null) {
  7. return false;
  8. }
  9. if (source.isDynamic() || target.isDynamic()) {
  10. return true;
  11. }
  12. if (source.isRemotable() != target.isRemotable()) {
  13. return false;
  14. }
  15. for (Operation operation : source.getOperations()) {
  16. Operation targetOperation = getOperation(target.getOperations(), operation.getName());
  17. if (targetOperation == null) {
  18. return false;
  19. }
  20. if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) {
  21. return false;
  22. }
  23. }
  24. return true;
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly

  1. public boolean isCompatibleSubset(Interface source, Interface target) {
  2. if (source == target) {
  3. // Shortcut for performance
  4. return true;
  5. }
  6. if (source == null || target == null) {
  7. return false;
  8. }
  9. if (source.isDynamic() || target.isDynamic()) {
  10. return true;
  11. }
  12. if (source.isRemotable() != target.isRemotable()) {
  13. return false;
  14. }
  15. for (Operation operation : source.getOperations()) {
  16. Operation targetOperation = getOperation(target.getOperations(), operation.getName());
  17. if (targetOperation == null) {
  18. return false;
  19. }
  20. if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) {
  21. return false;
  22. }
  23. }
  24. return true;
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. private String getWsdlCallback() {
  2. InterfaceContract ic = getComponentServiceInterfaceContract();
  3. if (ic == null || ic.getCallbackInterface() == null || !ic.getCallbackInterface().isRemotable()) {
  4. return "";

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

  1. protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {
  2. boolean differentDataBindings = OperationDataBindingHelper.isTransformationRequired(sourceOperation, targetOperation);
  3. if (differentDataBindings) {
  4. InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();
  5. if (!bindingInterfaceContract.getInterface().isRemotable()) {
  6. throw new IllegalStateException("This method should only have been called for a remotable interface.");
  7. }
  8. Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);
  9. return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);
  10. } else {
  11. return new SameDBCopyTransformer(mediator, sourceOperation, targetOperation);
  12. }
  13. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {
  2. boolean differentDataBindings = OperationDataBindingHelper.isTransformationRequired(sourceOperation, targetOperation);
  3. if (differentDataBindings) {
  4. InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();
  5. if (!bindingInterfaceContract.getInterface().isRemotable()) {
  6. throw new IllegalStateException("This method should only have been called for a remotable interface.");
  7. }
  8. Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);
  9. return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);
  10. } else {
  11. return new SameDBCopyTransformer(mediator, sourceOperation, targetOperation);
  12. }
  13. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding

  1. /**
  2. * Lookup a fault data type from the source operation which matches the target fault data type
  3. * @param sourceOperation The source operation
  4. * @param targetExceptionType The target fault data type
  5. * @return The matching source target fault type
  6. */
  7. private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) {
  8. boolean remotable = sourceOperation.getInterface().isRemotable();
  9. DataType targetFaultType = getFaultType(targetExceptionType);
  10. for (DataType dt : sourceOperation.getFaultTypes()) {
  11. DataType sourceFaultType = getFaultType(dt);
  12. if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) {
  13. return dt;
  14. }
  15. }
  16. return null;
  17. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-assembly

  1. /**
  2. * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
  3. * org.apache.tuscany.sca.interfacedef.Operation)
  4. */
  5. public Operation map(Interface target, Operation source) {
  6. // TODO: How to handle the case that source operation is dynamic?
  7. if (target == null || target.isDynamic()) {
  8. return source;
  9. } else if (target.isRemotable()) {
  10. for (Operation op : target.getOperations()) {
  11. if (op.getName().equals(source.getName())) {
  12. return op;
  13. }
  14. }
  15. return null;
  16. } else {
  17. for (Operation op : target.getOperations()) {
  18. if (isCompatible(source, op, Compatibility.SUBSET)) {
  19. return op;
  20. }
  21. }
  22. return null;
  23. }
  24. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. /**
  2. * Lookup a fault data type from the source operation which matches the target fault data type
  3. * @param sourceOperation The source operation
  4. * @param targetExceptionType The target fault data type
  5. * @return The matching source target fault type
  6. */
  7. private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) {
  8. boolean remotable = sourceOperation.getInterface().isRemotable();
  9. DataType targetFaultType = getFaultType(targetExceptionType);
  10. for (DataType dt : sourceOperation.getFaultTypes()) {
  11. DataType sourceFaultType = getFaultType(dt);
  12. if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) {
  13. return dt;
  14. }
  15. }
  16. return null;
  17. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. /**
  2. * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
  3. * org.apache.tuscany.sca.interfacedef.Operation)
  4. */
  5. public Operation map(Interface target, Operation source) {
  6. // TODO: How to handle the case that source operation is dynamic?
  7. if (target == null || target.isDynamic()) {
  8. return source;
  9. } else if (target.isRemotable()) {
  10. for (Operation op : target.getOperations()) {
  11. if (op.getName().equals(source.getName())) {
  12. return op;
  13. }
  14. }
  15. return null;
  16. } else {
  17. for (Operation op : target.getOperations()) {
  18. if (isCompatible(source, op, Compatibility.SUBSET)) {
  19. return op;
  20. }
  21. }
  22. return null;
  23. }
  24. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

  1. /**
  2. * Choose the physical binding for service-side remotable binding.sca
  3. * @param endpoint
  4. * @return
  5. */
  6. protected QName chooseBinding(RuntimeEndpoint endpoint) {
  7. DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry();
  8. boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  9. InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract();
  10. if(interfaceContract != null
  11. && interfaceContract.getInterface() != null
  12. && interfaceContract.getInterface().isRemotable()
  13. && distributed
  14. && isBindingSupported(defaultMappedBinding)) {
  15. return defaultMappedBinding;
  16. }
  17. return defaultLocalBinding;
  18. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. /**
  2. * Choose the physical binding for service-side remotable binding.sca
  3. * @param endpoint
  4. * @return
  5. */
  6. protected QName chooseBinding(RuntimeEndpoint endpoint) {
  7. DomainRegistry domainRegistry = endpoint.getCompositeContext().getEndpointRegistry();
  8. boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  9. InterfaceContract interfaceContract = endpoint.getService().getInterfaceContract();
  10. if(interfaceContract != null
  11. && interfaceContract.getInterface() != null
  12. && interfaceContract.getInterface().isRemotable()
  13. && distributed
  14. && isBindingSupported(defaultMappedBinding)) {
  15. return defaultMappedBinding;
  16. }
  17. return defaultLocalBinding;
  18. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. public void process(RuntimeEndpoint endpoint) {
  2. InterfaceContract sourceContract = endpoint.getBindingInterfaceContract();
  3. InterfaceContract targetContract = endpoint.getComponentTypeServiceInterfaceContract();
  4. if (targetContract == null) {
  5. targetContract = sourceContract;
  6. }
  7. if (!sourceContract.getInterface().isRemotable()) {
  8. return;
  9. }
  10. List<InvocationChain> chains = endpoint.getInvocationChains();
  11. for (InvocationChain chain : chains) {
  12. Operation sourceOperation = chain.getSourceOperation();
  13. Operation targetOperation = chain.getTargetOperation();
  14. Interceptor interceptor = null;
  15. if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
  16. // Add the interceptor to the source side because multiple
  17. // references can be wired to the same service
  18. interceptor = new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
  19. }
  20. if (interceptor != null) {
  21. String phase = Phase.SERVICE_INTERFACE;
  22. chain.addInterceptor(phase, interceptor);
  23. }
  24. }
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. public void process(RuntimeEndpointReference endpointReference) {
  2. InterfaceContract sourceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
  3. InterfaceContract targetContract = endpointReference.getBindingInterfaceContract();
  4. if (targetContract == null) {
  5. targetContract = sourceContract;
  6. }
  7. if (sourceContract == null || !sourceContract.getInterface().isRemotable()) {
  8. return;
  9. }
  10. List<InvocationChain> chains = endpointReference.getInvocationChains();
  11. for (InvocationChain chain : chains) {
  12. Operation sourceOperation = chain.getSourceOperation();
  13. Operation targetOperation = chain.getTargetOperation();
  14. Interceptor interceptor = null;
  15. if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
  16. // Add the interceptor to the source side because multiple
  17. // references can be wired to the same service
  18. interceptor = new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
  19. }
  20. if (interceptor != null) {
  21. String phase = Phase.REFERENCE_INTERFACE;
  22. chain.addInterceptor(phase, interceptor);
  23. }
  24. }
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-core-databinding

  1. public void process(RuntimeEndpointReference endpointReference) {
  2. InterfaceContract sourceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
  3. InterfaceContract targetContract = endpointReference.getBindingInterfaceContract();
  4. if (targetContract == null) {
  5. targetContract = sourceContract;
  6. }
  7. if (sourceContract == null || !sourceContract.getInterface().isRemotable()) {
  8. return;
  9. }
  10. List<InvocationChain> chains = endpointReference.getInvocationChains();
  11. for (InvocationChain chain : chains) {
  12. Operation sourceOperation = chain.getSourceOperation();
  13. Operation targetOperation = chain.getTargetOperation();
  14. Interceptor interceptor = null;
  15. if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
  16. // Add the interceptor to the source side because multiple
  17. // references can be wired to the same service
  18. interceptor = new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
  19. }
  20. if (interceptor != null) {
  21. String phase = Phase.REFERENCE_INTERFACE;
  22. chain.addInterceptor(phase, interceptor);
  23. }
  24. }
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-core-databinding

  1. public void process(RuntimeEndpoint endpoint) {
  2. InterfaceContract sourceContract = endpoint.getBindingInterfaceContract();
  3. InterfaceContract targetContract = endpoint.getComponentTypeServiceInterfaceContract();
  4. if (targetContract == null) {
  5. targetContract = sourceContract;
  6. }
  7. if (!sourceContract.getInterface().isRemotable()) {
  8. return;
  9. }
  10. List<InvocationChain> chains = endpoint.getInvocationChains();
  11. for (InvocationChain chain : chains) {
  12. Operation sourceOperation = chain.getSourceOperation();
  13. Operation targetOperation = chain.getTargetOperation();
  14. Interceptor interceptor = null;
  15. if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
  16. // Add the interceptor to the source side because multiple
  17. // references can be wired to the same service
  18. interceptor = new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
  19. }
  20. if (interceptor != null) {
  21. String phase = Phase.SERVICE_INTERFACE;
  22. chain.addInterceptor(phase, interceptor);
  23. }
  24. }
  25. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

  1. /**
  2. * Choose the physical binding for reference-side remotable binding.sca
  3. * @param endpointReference
  4. * @return
  5. */
  6. protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
  7. DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
  8. boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  9. if(endpointReference.getTargetEndpoint().isRemote()) {
  10. RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
  11. if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
  12. throw new ServiceRuntimeException("Reference interface not remotable for component: "
  13. + endpointReference.getComponent().getName()
  14. + " and reference: "
  15. + ref.getName());
  16. }
  17. if(distributed && isBindingSupported(defaultMappedBinding)) {
  18. return defaultMappedBinding;
  19. }
  20. }
  21. return defaultLocalBinding;
  22. }

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

  1. /**
  2. * Choose the physical binding for reference-side remotable binding.sca
  3. * @param endpointReference
  4. * @return
  5. */
  6. protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
  7. DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
  8. boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  9. if(endpointReference.getTargetEndpoint().isRemote()) {
  10. RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
  11. if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
  12. throw new ServiceRuntimeException("Reference interface not remotable for component: "
  13. + endpointReference.getComponent().getName()
  14. + " and reference: "
  15. + ref.getName());
  16. }
  17. if(distributed && isBindingSupported(defaultMappedBinding)) {
  18. return defaultMappedBinding;
  19. }
  20. }
  21. return defaultLocalBinding;
  22. }

相关文章