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

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


    }


    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();

        for (JavaInterface intf : interfaces.values()) {
            clearAttributes();
            setAttributes("intf", intf);
            setAttributes("seiClass", env.get(ToolConstants.SEI_CLASS));
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();

        for (JavaInterface intf : interfaces.values()) {
            clearAttributes();
            setAttributes("intf", intf);
            setAttributes("implClass", env.get(ToolConstants.IMPL_CLASS));
View Full Code Here

        getInterface(context, serviceInfo, interfaceInfo);
    }

    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 = getInterface(context, serviceInfo, interfaceInfo);
        intf.setJavaModel(jmodel);

        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

   
    public void process() throws ToolException {
        super.process();

        JavaModel jmodel = wsdlDefinitionToJavaModel(context.get(ServiceInfo.class));

        if (jmodel == null) {
            Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
            throw new ToolException(msg);
        }
View Full Code Here

        }
        context.setJavaModel(jmodel);
    }

    private JavaModel wsdlDefinitionToJavaModel(ServiceInfo serviceInfo) throws ToolException {
        JavaModel javaModel = null;
        Map<QName, JavaModel> map = CastUtils.cast((Map)context.get(MODEL_MAP));
        if (map == null) {
            map = new LinkedHashMap<QName, JavaModel>();
            context.put(MODEL_MAP, map);
        }
        if (map.containsKey(serviceInfo.getName())) {
            javaModel = map.get(serviceInfo.getName());
        } else {
            javaModel = new JavaModel();
            map.put(serviceInfo.getName(), javaModel);
        }
        context.put(JavaModel.class, javaModel);
       
        List<JavaInterface> interfaces = new ArrayList<JavaInterface>();
        interfaces.addAll(javaModel.getInterfaces().values());
       
        PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
        portTypeProcessor.process(serviceInfo);

        ServiceProcessor serviceProcessor = new ServiceProcessor(context);
        serviceProcessor.process(serviceInfo);
       
        for (JavaInterface intf : javaModel.getInterfaces().values()) {
            if (!interfaces.contains(intf)) {
                intf.annotate(new WebServiceAnnotator());
                intf.annotate(new XmlSeeAlsoAnnotator(context.get(ClassCollector.class)));
                intf.annotate(new BindingAnnotator());
            }
View Full Code Here

        getInterface(context, serviceInfo, interfaceInfo);
    }

    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 = getInterface(context, serviceInfo, interfaceInfo);
        intf.setJavaModel(jmodel);

        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

            || collector.containSeiClass(packageName, className);
        return collision;
    }

    private void processFault(JavaMethod method, FaultInfo faultMessage) throws ToolException {
        JavaModel model = method.getInterface().getJavaModel();

        String name = NameUtil.mangleNameToClassName(faultMessage.getName().getLocalPart());
        String namespace = faultMessage.getName().getNamespaceURI();
        String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
        if (namespace.equals(method.getInterface().getNamespace())) {
            packageName = method.getInterface().getPackageName();
        }


        JAXWSBinding jaxwsBinding = faultMessage.getExtensor(JAXWSBinding.class);
        if (jaxwsBinding != null) {
            if (jaxwsBinding.getPackage() != null) {
                packageName = jaxwsBinding.getPackage();
            }
            if (jaxwsBinding.getJaxwsClass() != null
                && jaxwsBinding.getJaxwsClass().getClassName() != null) {
                name = jaxwsBinding.getJaxwsClass().getClassName();
                if (name.contains(".")) {
                    packageName = name.substring(0, name.lastIndexOf('.'));
                    name = name.substring(name.lastIndexOf('.') + 1);
                }
            }
        }

        while (isNameCollision(packageName, name)) {
            name = name + "_Exception";
        }

        String fullClassName = packageName + "." + name;
        collector.addExceptionClassName(packageName, name, fullClassName);

        boolean samePackage = method.getInterface().getPackageName().equals(packageName);
        method.addException(new JavaException(faultMessage.getName().getLocalPart(),
                                              samePackage ? name : fullClassName, namespace));

        List<MessagePartInfo> faultParts = faultMessage.getMessageParts();

        JavaExceptionClass expClass = new JavaExceptionClass(model);
        expClass.setName(name);
        expClass.setNamespace(namespace);
        expClass.setPackageName(packageName);

        for (MessagePartInfo part : faultParts) {
            String fName = null;
            String fNamespace = null;

            if (part.getElementQName() != null) {
                fNamespace = part.getElementQName().getNamespaceURI();
                //fNamespace = part.getConcreteName().getNamespaceURI();
                fName = part.getConcreteName().getLocalPart();
            } else {
                fNamespace = part.getTypeQName().getNamespaceURI();
                fName = part.getConcreteName().getLocalPart();
            }

            if (StringUtils.isEmpty(fNamespace)) {
                fNamespace = namespace;
            }

            String fType = ProcessorUtil.getType(part, context, false);

            //REVISIT - custom JAXB package names
            String fPackageName = method.getInterface().getPackageName();


            JavaField fField = new JavaField(fName, fType, fNamespace);
            fField.setQName(ProcessorUtil.getElementName(part));

            if (!method.getInterface().getPackageName().equals(fPackageName)) {
                fField.setClassName(ProcessorUtil.getFullClzName(part, context, false));
            }
            if (!fType.equals(ProcessorUtil.resolvePartType(part))) {
                fField.setClassName(ProcessorUtil.getType(part, context, true));
            }

            expClass.addField(fField);
        }
        model.addExceptionClass(packageName + "." + name, expClass);
    }
View Full Code Here

   
    public void process() throws ToolException {
        super.process();

        JavaModel jmodel = wsdlDefinitionToJavaModel(context.get(ServiceInfo.class));

        if (jmodel == null) {
            Message msg = new Message("FAIL_TO_CREATE_JAVA_MODEL", LOG);
            throw new ToolException(msg);
        }
View Full Code Here

        }
        context.setJavaModel(jmodel);
    }

    private JavaModel wsdlDefinitionToJavaModel(ServiceInfo serviceInfo) throws ToolException {
        JavaModel javaModel = null;
        Map<QName, JavaModel> map = CastUtils.cast((Map)context.get(MODEL_MAP));
        if (map == null) {
            map = new LinkedHashMap<QName, JavaModel>();
            context.put(MODEL_MAP, map);
        }
        if (map.containsKey(serviceInfo.getName())) {
            javaModel = map.get(serviceInfo.getName());
        } else {
            javaModel = new JavaModel();
            map.put(serviceInfo.getName(), javaModel);
        }
        context.put(JavaModel.class, javaModel);
       
        List<JavaInterface> interfaces = new ArrayList<JavaInterface>();
        interfaces.addAll(javaModel.getInterfaces().values());
       
        PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
        portTypeProcessor.process(serviceInfo);

        ServiceProcessor serviceProcessor = new ServiceProcessor(context);
        serviceProcessor.process(serviceInfo);
       
        for (JavaInterface intf : javaModel.getInterfaces().values()) {
            if (!interfaces.contains(intf)) {
                intf.annotate(new WebServiceAnnotator());
                intf.annotate(new XmlSeeAlsoAnnotator(context.get(ClassCollector.class)));
                if (serviceInfo.getBindings().size() > 0) {
                    intf.annotate(new BindingAnnotator());
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 = "";
        if (!services.values().isEmpty()) {
            JavaServiceClass javaservice = services.values().iterator().next();
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.