org.apache.tuscany.sca.interfacedef.Interface类的使用及代码示例

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

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

Interface介绍

[英]Represents a service interface. This interface will typically be extended to support concrete interface type systems, such as Java interfaces, WSDL 1.1 portTypes and WSDL 2.0 interfaces.
[中]表示服务接口。此接口通常会扩展以支持具体的接口类型系统,如Java接口、WSDL 1.1端口类型和WSDL 2.0接口。

代码示例

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

/**
 * @param intf
 * @param useWrapper Use wrapper classes?
 * @return
 */
private static List<DataType> getDataTypes(Interface intf, boolean useWrapper) {
  List<DataType> dataTypes = new ArrayList<DataType>();
  for (Operation op : intf.getOperations()) {
    getDataTypes(dataTypes, op, useWrapper);
  }
  return dataTypes;
}

代码示例来源: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-binding-http-runtime

@Override
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract) {
  interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
  return interfaceContract;
}
@Override

代码示例来源: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

javaInterfaceContract.getInterface().setRemotable(Boolean.parseBoolean(remotable));
javaInterfaceContract.getInterface().setRemotableSetFromSCDL();

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

private void writeInterface(Interface iface, XMLStreamWriter writer, ProcessorContext context) throws XMLStreamException {
  writer.writeAttribute("isRemotable", String.valueOf(iface.isRemotable()));
  for (Operation operation : iface.getOperations()){
    writer.writeStartElement(Constants.SCA11_TUSCANY_NS, OPERATION);
    writer.writeAttribute("name", operation.getName());

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

if (interface1 != null && interface1.isRemotable()) {
  List<Method> matchingMethods = new ArrayList<Method>();
  for (Method m : implClass.getMethods()) {

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

List<Operation> opList = service.getService().getInterfaceContract().getInterface().getOperations();
  BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), service, wsBinding, registry, null);
  interfaceContract = wsBinding.getBindingInterfaceContract();
  interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
  List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();

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

if (topInterfaceContract.getInterface().isRemotableSetFromSCDL() == true){
  if (bottomInterfaceContract.getInterface().isRemotable() == false &&   
    topInterfaceContract.getInterface().isRemotable() == true){
    bottomInterfaceContract.getInterface().setRemotable(true);

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

/**
 * Find the operation from the component service contract
 * @param componentService
 * @param http_method
 * @return
 */
private static List<Operation> filterOperationsByHttpMethod(InterfaceContract interfaceContract, String http_method) {
  List<Operation> operations = null;
  if (http_method.equalsIgnoreCase("get")) {
    operations = (List<Operation>)interfaceContract.getInterface().getAttributes().get(GET.class);
  } else if (http_method.equalsIgnoreCase("put")) {
    operations = (List<Operation>)interfaceContract.getInterface().getAttributes().get(PUT.class);
  } else if (http_method.equalsIgnoreCase("post")) {
    operations = (List<Operation>)interfaceContract.getInterface().getAttributes().get(POST.class);
  } else if (http_method.equalsIgnoreCase("delete")) {
    operations = (List<Operation>)interfaceContract.getInterface().getAttributes().get(DELETE.class);
  }
  return operations;
}

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

private org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
  org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
  service.setName(interfaze.getSimpleName());
  JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
  service.setInterfaceContract(interfaceContract);
  JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(interfaze);
  service.getInterfaceContract().setInterface(callInterface);
  if (callInterface.getCallbackClass() != null) {
    JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
    service.getInterfaceContract().setCallbackInterface(callbackInterface);
  }
  Interface javaInterface = service.getInterfaceContract().getInterface();
  javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
  service.getInterfaceContract().setInterface(javaInterface);
  return service;
}

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

private void writeInterface(Interface iface, XMLStreamWriter writer, ProcessorContext context) throws XMLStreamException {
  writer.writeAttribute("isRemotable", String.valueOf(iface.isRemotable()));
  for (Operation operation : iface.getOperations()){
    writer.writeStartElement(Constants.SCA11_TUSCANY_NS, OPERATION);
    writer.writeAttribute("name", operation.getName());

代码示例来源: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-binding-jms-runtime

List<Operation> opList = reference.getReference().getInterfaceContract().getInterface().getOperations();
  BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), reference, wsBinding, registry, null);
  interfaceContract = wsBinding.getBindingInterfaceContract();
  interfaceContract.getInterface().resetDataBinding(XMLHelperFactory.createXMLHelper(registry).getDataBindingName());
  List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();

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

if (topInterfaceContract.getInterface().isRemotableSetFromSCDL() == true){
  if (bottomInterfaceContract.getInterface().isRemotable() == false &&   
    topInterfaceContract.getInterface().isRemotable() == true){
    bottomInterfaceContract.getInterface().setRemotable(true);

代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-java-jaxrs

jaxrs = true;
operation.getAttributes().put(type, Boolean.TRUE);
Map<Object, Object> attrs = operation.getInterface().getAttributes();
List<Operation> operations = (List<Operation>)attrs.get(type);
if (operations == null) {

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

javaInterfaceContract.getInterface().setRemotable(Boolean.parseBoolean(remotable));
javaInterfaceContract.getInterface().setRemotableSetFromSCDL();

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

service.getInterfaceContract().getInterface().setRemotable(true);

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

/**
 * @param intf
 * @param useWrapper Use wrapper classes?
 * @return
 */
private static List<DataType> getDataTypes(Interface intf, boolean useWrapper) {
  List<DataType> dataTypes = new ArrayList<DataType>();
  for (Operation op : intf.getOperations()) {
    getDataTypes(dataTypes, op, useWrapper);
  }
  return dataTypes;
}

代码示例来源: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;
}

相关文章