Examples of JavaInterface


Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

    public static Reference createReference(AssemblyFactory factory,
                                            JavaInterfaceFactory javaFactory, String name, Class<?> type) {
        org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
        ref.setName(name);
        JavaInterface i = javaFactory.createJavaInterface();
        i.setJavaClass(type);
        JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
        ic.setInterface(i);
        ref.setInterfaceContract(ic);
        return ref;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

    public final void testVisitInterface() throws InvalidInterfaceException {
        DataBindingExtensionPoint registry = new DefaultDataBindingExtensionPoint();
        DataBindingJavaInterfaceProcessor processor = new DataBindingJavaInterfaceProcessor(registry);
        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
       
        JavaInterface contract = javaFactory.createJavaInterface();
        contract.setJavaClass(MockInterface.class);
        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
        interfaceContract.setInterface(contract);
        Operation operation = newOperation("call");
        Operation operation1 = newOperation("call1");
        contract.getOperations().add(operation);
        contract.getOperations().add(operation1);
        contract.setRemotable(true);
        processor.visitInterface(contract);
        // Assert.assertEquals("org.w3c.dom.Node", contract.getDataBinding());
        // Assert.assertEquals("org.w3c.dom.Node",
        // contract.getOperations().get("call").getDataBinding());
        // Assert.assertEquals("xml:string",
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

            }
        }
        if (!compatible) {
            // The interface is not assignable from the interface contract
            interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
            interfaceContract.setInterface(callInterface);
            if (callInterface.getCallbackClass() != null) {
                interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
                    .getCallbackClass()));
            }
        }

        return interfaceContract;
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

        // the Resource interface, and have no references and properties
        widgetService = assemblyFactory.createService();
        widgetService.setName("Widget");
       
        // Create the Java interface contract for the Resource service
        JavaInterface javaInterface;
        try {
            javaInterface = javaFactory.createJavaInterface(Widget.class);
        } catch (InvalidInterfaceException e) {
            throw new IllegalArgumentException(e);
        }
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

         * JavaIntrospectionHelper.getParameterType(genericType); } baseType =
         * JavaIntrospectionHelper.getBusinessInterface(baseType, genericType); }
         */
        try {

            JavaInterface callInterface = javaFactory
                    .createJavaInterface(JavaIntrospectionHelper
                            .getErasure(genericType));
            reference.getInterfaceContract().setInterface(callInterface);
            if (callInterface.getCallbackClass() != null) {
                JavaInterface callbackInterface = javaFactory
                        .createJavaInterface(callInterface.getCallbackClass());
                reference.getInterfaceContract().setCallbackInterface(
                        callbackInterface);
            }
        } catch (InvalidInterfaceException e) {
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

        RuntimeComponentService service = (RuntimeComponentService) to.getContract();
        RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
        if (callbackReference == null) {
            return null;
        }
        JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
        Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
        List<RuntimeWire> wires = callbackReference.getRuntimeWires();
        CallbackReferenceImpl ref = new CallbackReferenceImpl(javaClass, proxyFactory, wires);
        //ref.resolveTarget();
        ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
        ref.attachCallbackID(parameters.getCallbackID());
View Full Code Here

Examples of org.apache.tuscany.sca.interfacedef.java.JavaInterface

                        binding = reference.getBindings().get(0);
                    }
                }
                Interface i = reference.getInterfaceContract().getInterface();
                if (i instanceof JavaInterface) {
                    JavaInterface javaInterface = (JavaInterface)i;
                    if (javaInterface.isUnresolved()) {
                        javaInterface.setJavaClass(Thread.currentThread().getContextClassLoader()
                            .loadClass(javaInterface.getName()));
                        currentActivator.getJavaInterfaceFactory().createJavaInterface(javaInterface,
                                                                                       javaInterface.getJavaClass());
                    }
                    this.businessInterface = (Class<B>)javaInterface.getJavaClass();
                }
                this.proxyFactory = currentActivator.getProxyFactory();
            }
        }
    }
View Full Code Here

Examples of org.jboss.forge.parser.java.JavaInterface

            @Option(required = false, help = "the package in which to build this Interface", description = "source package", type = PromptType.JAVA_PACKAGE, name = "package") final String pckg,
            @Option(required = false, help = "the interface definition: surround with quotes", description = "interface definition") final String... def)
            throws FileNotFoundException
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaInterface jc = null;
      if (def != null)
      {
         String classDef = Strings.join(Arrays.asList(def), " ");
         jc = JavaParser.parse(JavaInterface.class, classDef);
      }
      else if (in != null)
      {
         jc = JavaParser.parse(JavaInterface.class, in);
      }
      else if (interfaceName != null)
      {
         jc = JavaParser.create(JavaInterface.class).setName(interfaceName);
      }
      else
      {
         throw new RuntimeException("arguments required");
      }

      if (pckg != null)
      {
         jc.setPackage(pckg);
      }
      if (!jc.hasSyntaxErrors())
      {
         java.saveJavaSource(jc);
      }
      else
      {
         writer.println(ShellColor.RED, "Syntax Errors:");
         for (SyntaxError error : jc.getSyntaxErrors())
         {
            writer.println(error.toString());
         }
         writer.println();
         if (prompt.promptBoolean(
View Full Code Here

Examples of org.objectweb.celtix.tools.common.model.JavaInterface

    private void processOperation(JavaModel model, BindingOperation bop, Binding binding)
        throws ToolException {
        String portType = ProcessorUtil
            .mangleNameToClassName(binding.getPortType().getQName().getLocalPart());
        JavaInterface jf = model.getInterfaces().get(portType);
        // TODO: extend other bindings
        doCustomizeBinding(model, jf, binding);
        if (isSoapBinding()) {
            SOAPBinding soapBinding = (SOAPBinding)bindingObj;
            if (getSoapStyle(soapBinding.getStyle()) == null) {
                jf.setSOAPStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
            } else {
                jf.setSOAPStyle(getSoapStyle(soapBinding.getStyle()));
            }
        } else {
            // REVISIT: fix for xml binding
            jf.setSOAPStyle(javax.jws.soap.SOAPBinding.Style.DOCUMENT);
        }

        Object[] methods = jf.getMethods().toArray();
        for (int i = 0; i < methods.length; i++) {
            JavaMethod jm = (JavaMethod)methods[i];
            if (jm.getOperationName() != null && jm.getOperationName().equals(bop.getName())) {
                if (isSoapBinding()) {
                    doCustomizeOperation(jf, jm, bop);
                    Map prop = getSoapOperationProp(bop);
                    String soapAction = prop.get(soapOPAction) == null ? "" : (String)prop.get(soapOPAction);
                    String soapStyle = prop.get(soapOPStyle) == null ? "" : (String)prop.get(soapOPStyle);
                    jm.setSoapAction(soapAction);
                    if (getSoapStyle(soapStyle) == null && this.bindingObj == null) {
                        org.objectweb.celtix.common.i18n.Message msg =
                            new org.objectweb.celtix.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
                                                                          LOG);
                        throw new ToolException(msg);
                    }
                    if (getSoapStyle(soapStyle) == null) {
                        jm.setSoapStyle(jf.getSOAPStyle());
                    } else {
                        jm.setSoapStyle(getSoapStyle(soapStyle));
                    }
                } else {
                    // REVISIT: fix for xml binding
                    jm.setSoapStyle(jf.getSOAPStyle());
                }
                OperationProcessor processor = new OperationProcessor(env);

                int headerType = isNonWrappable(bop);
View Full Code Here

Examples of org.objectweb.celtix.tools.common.model.JavaInterface

        super(penv);
    }
   
    public void process(JavaModel jmodel, PortType portType) throws ToolException {
        operationMap.clear();
        JavaInterface intf = new JavaInterface(jmodel);
        intf.setJAXWSBinding(customizing(jmodel, portType));
        intf.setHandlerChains(CustomizationParser.getInstance().getHandlerChains());
       
        String namespace = portType.getQName().getNamespaceURI();
        String packageName = ProcessorUtil.parsePackageName(namespace, env.mapPackageName(namespace));

        String location = (String)env.get(ToolConstants.CFG_WSDLURL);
        try {
            location = ProcessorUtil.getAbsolutePath(location);
        } catch (IOException ioe) {
            Message msg = new Message("CANNOT_FIND_WSDL", LOG, env.get(ToolConstants.CFG_WSDLURL));
            throw new ToolException(msg, ioe);
        }
        String serviceName = portType.getQName().getLocalPart();
        intf.setWebServiceName(serviceName);
        intf.setName(ProcessorUtil.mangleNameToClassName(serviceName));
        intf.setNamespace(namespace);
        intf.setPackageName(packageName);
        intf.setLocation(location);

        List operations = portType.getOperations();
      
        for (Iterator iter = operations.iterator(); iter.hasNext();) {
          
            Operation operation = (Operation)iter.next();
            if (isOverloading(operation.getName())) {
                LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
                continue;
            }
            OperationProcessor operationProcessor = new OperationProcessor(env);
            operationProcessor.process(intf, operation);
        }
        jmodel.setLocation(location);
        jmodel.addInterface(intf.getName() , intf);
      
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.