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

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

本文整理了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

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

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

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

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

private boolean supportsCallbackInterface(Interface iface, JavaImplementation impl) {
  if (iface instanceof JavaInterface) {
    Class<?> ifaceClass = ((JavaInterface)iface).getJavaClass();
    if (ifaceClass.isAssignableFrom(impl.getJavaClass())) {
      return true;
    }
  }
  try {
    Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass());
    // Ignore the remotable/conversational testing
    implType.setRemotable(iface.isRemotable());
    return interfaceContractMapper.isCompatibleSubset(iface, implType);
  } catch (InvalidInterfaceException e) {
    logger.log(Level.WARNING, e.getMessage(), e);
    return false;
  }
}

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

public boolean isCompatibleSubset(Interface source, Interface target) {
  if (source == target) {
    // Shortcut for performance
    return true;
  }
  if (source == null || target == null) {
    return false;
  }
  if (source.isDynamic() || target.isDynamic()) {
    return true;
  }
  if (source.isRemotable() != target.isRemotable()) {
    return false;
  }
  for (Operation operation : source.getOperations()) {
    Operation targetOperation = getOperation(target.getOperations(), operation.getName());
    if (targetOperation == null) {
      return false;
    }
    if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) {
      return false;
    }
  }
  return true;
}

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

public boolean isCompatibleSubset(Interface source, Interface target) {
  if (source == target) {
    // Shortcut for performance
    return true;
  }
  if (source == null || target == null) {
    return false;
  }
  if (source.isDynamic() || target.isDynamic()) {
    return true;
  }
  if (source.isRemotable() != target.isRemotable()) {
    return false;
  }
  for (Operation operation : source.getOperations()) {
    Operation targetOperation = getOperation(target.getOperations(), operation.getName());
    if (targetOperation == null) {
      return false;
    }
    if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) {
      return false;
    }
  }
  return true;
}

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

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

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

protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {   
  boolean differentDataBindings = OperationDataBindingHelper.isTransformationRequired(sourceOperation, targetOperation);
  if (differentDataBindings) { 
    InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();   
    if (!bindingInterfaceContract.getInterface().isRemotable()) {
      throw new IllegalStateException("This method should only have been called for a remotable interface.");
    }
    Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);                        
    return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);                
  } else {
    return new SameDBCopyTransformer(mediator,  sourceOperation, targetOperation);
  }
}

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

protected BindingSCATransformer getBindingTransformer(Operation sourceOperation, Operation targetOperation) {   
  boolean differentDataBindings = OperationDataBindingHelper.isTransformationRequired(sourceOperation, targetOperation);
  if (differentDataBindings) { 
    InterfaceContract bindingInterfaceContract = getWSDLBindingInterfaceContract();   
    if (!bindingInterfaceContract.getInterface().isRemotable()) {
      throw new IllegalStateException("This method should only have been called for a remotable interface.");
    }
    Operation wsdlBindingOperation = interfaceContractMapper.map(bindingInterfaceContract.getInterface(), sourceOperation);                        
    return new WSDLMediateTransformer(mediator, sourceOperation, wsdlBindingOperation, targetOperation);                
  } else {
    return new SameDBCopyTransformer(mediator,  sourceOperation, targetOperation);
  }
}

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

/**
 * Lookup a fault data type from the source operation which matches the target fault data type
 * @param sourceOperation The source operation
 * @param targetExceptionType The target fault data type
 * @return The matching source target fault type
 */
private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) {
  boolean remotable = sourceOperation.getInterface().isRemotable();
  DataType targetFaultType = getFaultType(targetExceptionType);
  for (DataType dt : sourceOperation.getFaultTypes()) {
    DataType sourceFaultType = getFaultType(dt);
    if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) {
      return dt;
    }
  }
  return null;
}

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

/**
 * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
 *      org.apache.tuscany.sca.interfacedef.Operation)
 */
public Operation map(Interface target, Operation source) {
  // TODO: How to handle the case that source operation is dynamic?
  if (target == null || target.isDynamic()) {
    return source;
  } else if (target.isRemotable()) {
    for (Operation op : target.getOperations()) {
      if (op.getName().equals(source.getName())) {
        return op;
      }
    }
    return null;
  } else {
    for (Operation op : target.getOperations()) {
      if (isCompatible(source, op, Compatibility.SUBSET)) {
        return op;
      }
    }
    return null;
  }
}

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

/**
 * Lookup a fault data type from the source operation which matches the target fault data type
 * @param sourceOperation The source operation
 * @param targetExceptionType The target fault data type
 * @return The matching source target fault type
 */
private DataType findSourceFaultDataType(Operation sourceOperation, DataType targetExceptionType) {
  boolean remotable = sourceOperation.getInterface().isRemotable();
  DataType targetFaultType = getFaultType(targetExceptionType);
  for (DataType dt : sourceOperation.getFaultTypes()) {
    DataType sourceFaultType = getFaultType(dt);
    if (interfaceContractMapper.isCompatible(targetFaultType, sourceFaultType, remotable)) {
      return dt;
    }
  }
  return null;
}

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

/**
 * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
 *      org.apache.tuscany.sca.interfacedef.Operation)
 */
public Operation map(Interface target, Operation source) {
  // TODO: How to handle the case that source operation is dynamic?
  if (target == null || target.isDynamic()) {
    return source;
  } else if (target.isRemotable()) {
    for (Operation op : target.getOperations()) {
      if (op.getName().equals(source.getName())) {
        return op;
      }
    }
    return null;
  } else {
    for (Operation op : target.getOperations()) {
      if (isCompatible(source, op, Compatibility.SUBSET)) {
        return op;
      }
    }
    return null;
  }
}

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

/**
 * 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;
}

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

/**
 * 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;
}

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

public void process(RuntimeEndpoint endpoint) {
  InterfaceContract sourceContract = endpoint.getBindingInterfaceContract();
  InterfaceContract targetContract = endpoint.getComponentTypeServiceInterfaceContract();
  if (targetContract == null) {
    targetContract = sourceContract;
  }
  if (!sourceContract.getInterface().isRemotable()) {
    return;
  }
  List<InvocationChain> chains = endpoint.getInvocationChains();
  for (InvocationChain chain : chains) {
    Operation sourceOperation = chain.getSourceOperation();
    Operation targetOperation = chain.getTargetOperation();
    Interceptor interceptor = null;
    if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
      // Add the interceptor to the source side because multiple
      // references can be wired to the same service
      interceptor = new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
    }
    if (interceptor != null) {
      String phase = Phase.SERVICE_INTERFACE;
      chain.addInterceptor(phase, interceptor);
    }
  }
}

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

public void process(RuntimeEndpointReference endpointReference) {
  InterfaceContract sourceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
  InterfaceContract targetContract = endpointReference.getBindingInterfaceContract();
  if (targetContract == null) {
    targetContract = sourceContract;
  }
  if (sourceContract == null || !sourceContract.getInterface().isRemotable()) {
    return;
  }
  List<InvocationChain> chains = endpointReference.getInvocationChains();
  for (InvocationChain chain : chains) {
    Operation sourceOperation = chain.getSourceOperation();
    Operation targetOperation = chain.getTargetOperation();
    Interceptor interceptor = null;
    if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
      // Add the interceptor to the source side because multiple
      // references can be wired to the same service
      interceptor = new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
    }
    if (interceptor != null) {
      String phase = Phase.REFERENCE_INTERFACE;
      chain.addInterceptor(phase, interceptor);
    }
  }
  
}

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

public void process(RuntimeEndpointReference endpointReference) {
  InterfaceContract sourceContract = endpointReference.getComponentTypeReferenceInterfaceContract();
  InterfaceContract targetContract = endpointReference.getBindingInterfaceContract();
  if (targetContract == null) {
    targetContract = sourceContract;
  }
  if (sourceContract == null || !sourceContract.getInterface().isRemotable()) {
    return;
  }
  List<InvocationChain> chains = endpointReference.getInvocationChains();
  for (InvocationChain chain : chains) {
    Operation sourceOperation = chain.getSourceOperation();
    Operation targetOperation = chain.getTargetOperation();
    Interceptor interceptor = null;
    if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
      // Add the interceptor to the source side because multiple
      // references can be wired to the same service
      interceptor = new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
    }
    if (interceptor != null) {
      String phase = Phase.REFERENCE_INTERFACE;
      chain.addInterceptor(phase, interceptor);
    }
  }
  
}

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

public void process(RuntimeEndpoint endpoint) {
  InterfaceContract sourceContract = endpoint.getBindingInterfaceContract();
  InterfaceContract targetContract = endpoint.getComponentTypeServiceInterfaceContract();
  if (targetContract == null) {
    targetContract = sourceContract;
  }
  if (!sourceContract.getInterface().isRemotable()) {
    return;
  }
  List<InvocationChain> chains = endpoint.getInvocationChains();
  for (InvocationChain chain : chains) {
    Operation sourceOperation = chain.getSourceOperation();
    Operation targetOperation = chain.getTargetOperation();
    Interceptor interceptor = null;
    if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
      // Add the interceptor to the source side because multiple
      // references can be wired to the same service
      interceptor = new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
    }
    if (interceptor != null) {
      String phase = Phase.SERVICE_INTERFACE;
      chain.addInterceptor(phase, interceptor);
    }
  }
}

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

/**
 * Choose the physical binding for reference-side remotable binding.sca
 * @param endpointReference
 * @return
 */
protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
  DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
  boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  if(endpointReference.getTargetEndpoint().isRemote()) {
    RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
    if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
      throw new ServiceRuntimeException("Reference interface not remotable for component: "
          + endpointReference.getComponent().getName()
          + " and reference: "
          + ref.getName());
    }
    
    if(distributed && isBindingSupported(defaultMappedBinding)) {
      return defaultMappedBinding;
    }
  }
  
  return defaultLocalBinding;
}

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

/**
 * Choose the physical binding for reference-side remotable binding.sca
 * @param endpointReference
 * @return
 */
protected QName chooseBinding(RuntimeEndpointReference endpointReference) {
  DomainRegistry domainRegistry = endpointReference.getCompositeContext().getEndpointRegistry();
  boolean distributed = alwaysDistributed || domainRegistry.isDistributed();
  if(endpointReference.getTargetEndpoint().isRemote()) {
    RuntimeComponentReference ref = (RuntimeComponentReference)endpointReference.getReference();
    if(ref.getInterfaceContract() != null && !ref.getInterfaceContract().getInterface().isRemotable()) {
      throw new ServiceRuntimeException("Reference interface not remotable for component: "
          + endpointReference.getComponent().getName()
          + " and reference: "
          + ref.getName());
    }
    
    if(distributed && isBindingSupported(defaultMappedBinding)) {
      return defaultMappedBinding;
    }
  }
  
  return defaultLocalBinding;
}

相关文章