Package org.apache.cxf.tools.common.model

Examples of org.apache.cxf.tools.common.model.JavaModel


        return true;
    }

    public void generate(ToolContext penv) throws ToolException {      
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);
       
        if (passthrough()) {
            return;
        }
       
        if (javaModel.getServiceClasses().size() == 0) {
            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
            String wsdl = serviceInfo.getDescription().getBaseURI();
            Message msg = new Message("CAN_NOT_GEN_ANT", LOG, wsdl);
            if (penv.isVerbose()) {
                System.out.println(msg.toString());
            }
            return;
        }
       
        Map<String, String> clientClassNamesMap = new HashMap<String, String>();
        Map<String, String> serverClassNamesMap = new HashMap<String, String>();
       
        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
        int index = 1;
        Iterator it = javaModel.getServiceClasses().values().iterator();
        while (it.hasNext()) {
            JavaServiceClass js = (JavaServiceClass)it.next();
            Iterator i = js.getPorts().iterator();
            while (i.hasNext()) {
                JavaPort jp = (JavaPort)i.next();
                String interfaceName = jp.getInterfaceClass();
                JavaInterface intf = interfaces.get(interfaceName);
                if (intf == null) {
                    interfaceName = jp.getPortType();
                    intf = interfaces.get(interfaceName);
                }
               
                String clientClassName = intf.getPackageName() + "." + interfaceName + "_"
                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Client";

                String serverClassName = intf.getPackageName() + "." + interfaceName + "_"
                                         + NameUtil.mangleNameToClassName(jp.getPortName()) + "_Server";
                String clientTargetName = interfaceName + "Client";
                boolean collison = false;
                if (clientClassNamesMap.keySet().contains(clientTargetName)) {
                    clientTargetName = clientTargetName + index;
                    collison = true;
                }
                String serverTargetName = interfaceName + "Server";
                if (serverClassNamesMap.keySet().contains(serverTargetName)) {
                    serverTargetName = serverTargetName + index;
                    collison = true;
                }
               
                if (collison) {
                    index++;
                }
                clientClassNamesMap.put(clientTargetName, clientClassName);
                serverClassNamesMap.put(serverTargetName, serverClassName);
               
            }
        }

        clearAttributes();
        setAttributes("clientClassNamesMap", clientClassNamesMap);
        setAttributes("serverClassNamesMap", serverClassNamesMap);
        setAttributes("wsdlLocation", javaModel.getLocation());
        setCommonAttributes();

        doWrite(ANT_TEMPLATE, parseOutputName(null, "build", ".xml"));
    }
View Full Code Here


        return false;
    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);

        if (passthrough()) {
            return;
        }

        Map<String, JavaExceptionClass> exceptionClasses = javaModel
                .getExceptionClasses();
        for (Iterator iter = exceptionClasses.keySet().iterator(); iter
                .hasNext();) {
            String expClassName = (String)iter.next();
            JavaExceptionClass expClz =
View Full Code Here

    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);

        if (passthrough()) {
            return;
        }

        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();

        if (interfaces.size() == 0) {
            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
            String wsdl = serviceInfo.getDescription().getBaseURI();
            Message msg = new Message("CAN_NOT_GEN_SEI", LOG, wsdl);
View Full Code Here

       
    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);

        if (passthrough()) {
            return;
        }

        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
           
        Map<String, JavaServiceClass> services = javaModel.getServiceClasses();

        JavaServiceClass service = null;
        String port = "";
        Iterator portIterator = null;
        if (!services.values().isEmpty()) {
View Full Code Here

        return false;
    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);

        if (passthrough()) {
            return;
        }
        ClassCollector collector = penv.get(ClassCollector.class);
       
        Map<String, JavaServiceClass> serviceClasses = javaModel.getServiceClasses();
       
        if (serviceClasses.size() == 0) {
            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
            String wsdl = serviceInfo.getDescription().getBaseURI();
            Message msg = new Message("CAN_NOT_GEN_SERVICE", LOG, wsdl);
View Full Code Here

    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);
        if (passthrough()) {
            return;
        }
        if (javaModel.getServiceClasses().size() == 0) {
            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
            String wsdl = serviceInfo.getDescription().getBaseURI();
            Message msg = new Message("CAN_NOT_GEN_CLIENT", LOG, wsdl);
            if (penv.isVerbose()) {
                System.out.println(msg.toString());
            }
            return;
        }

        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
        Iterator it = javaModel.getServiceClasses().values().iterator();
        while (it.hasNext()) {
            JavaServiceClass js = (JavaServiceClass)it.next();
            Iterator i = js.getPorts().iterator();
            while (i.hasNext()) {
                JavaPort jp = (JavaPort)i.next();
View Full Code Here

        return true;
    }

    public void generate(ToolContext penv) throws ToolException {
        this.env = penv;
        JavaModel javaModel = env.get(JavaModel.class);

        if (passthrough()) {
            return;
        }
        String address = "CHANGE_ME";
        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();

        if (javaModel.getServiceClasses().size() == 0) {
            ServiceInfo serviceInfo = (ServiceInfo)env.get(ServiceInfo.class);
            String wsdl = serviceInfo.getDescription().getBaseURI();
            Message msg = new Message("CAN_NOT_GEN_SRV", LOG, wsdl);
            if (penv.isVerbose()) {
                System.out.println(msg.toString());
            }
            return;
        }
        Iterator it = javaModel.getServiceClasses().values().iterator();
        while (it.hasNext()) {
            JavaServiceClass js = (JavaServiceClass)it.next();
            Iterator i = js.getPorts().iterator();
            while (i.hasNext()) {
                JavaPort jp = (JavaPort)i.next();
View Full Code Here

                                  intf.getPackageName() + "." + intf.getName());
    }

    public void process(ServiceInfo serviceInfo) throws ToolException {
        operationMap.clear();
        JavaModel jmodel = context.get(JavaModel.class);


        InterfaceInfo interfaceInfo = serviceInfo.getInterface();

        if (interfaceInfo == null) {
            return;
        }

        JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
        intf.setJavaModel(jmodel);
       
        JAXWSBinding jaxwsBinding = null;
        if (serviceInfo.getDescription() != null) {
            jaxwsBinding = serviceInfo.getDescription().getExtensor(JAXWSBinding.class);
        }
        JAXWSBinding infBinding = interfaceInfo.getExtensor(JAXWSBinding.class);
        if (infBinding != null && infBinding.getPackage() != null) {
            intf.setPackageName(infBinding.getPackage());
        } else if (jaxwsBinding != null && jaxwsBinding.getPackage() != null) {
            intf.setPackageName(jaxwsBinding.getPackage());
        }

        String name = intf.getName();
        if (infBinding != null
            && infBinding.getJaxwsClass() != null
            && infBinding.getJaxwsClass().getClassName() != null) {
            name = infBinding.getJaxwsClass().getClassName();
        }
        intf.setName(name);

        Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
        intf.setHandlerChains(handler);


        Collection<OperationInfo> operations = interfaceInfo.getOperations();

        for (OperationInfo operation : operations) {
            if (isOverloading(operation.getName())) {
                LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
                continue;
            }
            OperationProcessor operationProcessor = new OperationProcessor(context);
            operationProcessor.process(intf, operation);
        }

        jmodel.setLocation(intf.getLocation());
        jmodel.addInterface(intf.getName(), intf);
    }
View Full Code Here

        JavaInterface jinf = JavaFirstUtil.serviceInfo2JavaInf(serviceInfo);
        String className = (String)context.get(ToolConstants.IMPL_CLASS);
        if (className != null && className.equals(jinf.getFullClassName())) {
            jinf.setName(jinf.getName() + SEI_SUFFIX);
        }
        JavaModel jm = new JavaModel();
        jm.addInterface("inf", jinf);
        jinf.setJavaModel(jm);
        context.put(JavaModel.class, jm);
        context.put(ToolConstants.SERVICE_NAME, serviceInfo.getName());
        EndpointInfo endpointInfo = serviceInfo.getEndpoints().iterator().next();       
        context.put(ToolConstants.PORT_NAME, endpointInfo.getName());
View Full Code Here

        this.env = penv;
        if (passthrough()) {
            return;
        }
       
        JavaModel javaModel = env.get(JavaModel.class);
        Map<String, JavaInterface> interfaces = javaModel.getInterfaces();

       
        Map<String, String> serverClassNamesMap = new HashMap<String, String>();
        Map<String, String> clientClassNamesMap = new HashMap<String, String>();
        for (JavaInterface intf : interfaces.values()) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.tools.common.model.JavaModel

Copyright © 2018 www.massapicom. 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.