Package org.apache.ws.jaxme.js

Examples of org.apache.ws.jaxme.js.JavaSource


        int num = 0;
        for (Iterator iter = methods.entrySet().iterator();  iter.hasNext()) {
            Map.Entry entry = (Map.Entry) iter.next();
            String name = (String) entry.getKey();
            JavaMethod method = (JavaMethod) entry.getValue();
            JavaSource innerClass = getInvoker(pSource, method, pInvoker, num++);
            con.addLine(pMap, ".put(", JavaSource.getQuoted(name), ", new ", innerClass.getQName(), "());");
        }
        return con;
    }
View Full Code Here


    /** Creates the dispatcher class. Make sure, that this method
     * is invoked <em>after</em> {@link #addClass(JavaSource, JavaSourceResolver)}!
     * @param pQName Fully qualified class name of the dispatcher class.
     */
    public JavaSource getDispatcher(JavaQName pQName) {
      JavaSource js = getFactory().newJavaSource(pQName, JavaSource.PUBLIC);
        if (isDispatcherImplementsXmlRpcHandler()) {
          js.addImport(JavaQNameImpl.getInstance("org.apache.xmlrpc.XmlRpcHandler", true));
        }
      JavaComment comment = js.newComment();
        comment.addLine("The dispatcher is being used by the XmlRpcServer.");
        comment.addLine("It delegates incoming XML-RPC calls to the classes");
        comment.addLine("and methods, for which client classes have been");
        comment.addLine("created by the " +
                        XmlRpcClientGenerator.class.getName() + ".");
        JavaSource invoker = getInvokerClass(js);
        JavaField map = getInvokerMap(js);
        getDispatcherConstructor(js, map, invoker.getQName());
        getGetInvokerMethod(js, invoker.getQName(), map);
        getDispatcherInvokeMethod(js, invoker.getQName());
        return js;
    }
View Full Code Here

            throws RecognitionException, TokenStreamException, IOException {
        if (pNames.contains(pQName)) {
          return;
        }
        pNames.add(pQName);
        JavaSource js = loadSource(Thread.currentThread().getContextClassLoader(),
                               pQName.toString(), pFactory);
        if (js == null) {
          return;
        }
        pSources.add(js);
        JavaQName[] superInterfaces = js.getExtends();
        for (int i = 0;  i < superInterfaces.length;  i++) {
          loadSources(pClassLoader, superInterfaces[i],
                        pFactory, pSources, pNames);
        }
    }
View Full Code Here

         controllerDescription.setMandatory(true);
         interfaces[i] = controllerDescription;
      }

      ProxyGenerator proxyInterfaceGenerator = new ProxyInterfaceGenerator();
      JavaSource proxyInterface = proxyInterfaceGenerator.generate(pFactory, getChainInterface(), interfaces);
      proxyInterface.setType(JavaSource.INTERFACE);

      ProxyGenerator proxyImpGenerator = new ProxyImplementationGenerator();
      JavaSource proxyImplementation = proxyImpGenerator.generate(pFactory, getProxyClass(), interfaces);

      ProxyGenerator controllerImplementationGenerator = new ControllerImplementationGenerator();
      JavaSource controllerImplementation = controllerImplementationGenerator.generate(pFactory, getImplementationClass(), interfaces);

      return new JavaSource[]{controllerImplementation, proxyInterface, proxyImplementation};
   }
View Full Code Here

      SchemaSG schemaSG = generator.generate(schemaFiles[i]);
          if (producesFilesSet != null) {
            JavaSourceFactory jsf = schemaSG.getJavaSourceFactory();
            File targetDirectory = getTarget();
            for (Iterator iter = jsf.getJavaSources();  iter.hasNext()) {
              JavaSource js = (JavaSource) iter.next();
              File f = jsf.getLocation(targetDirectory, js).getAbsoluteFile();
              producesFilesSet.remove(f);
            }
            for (Iterator iter = jsf.getTextFiles();  iter.hasNext()) {
              TextFile tf = (TextFile) iter.next();
View Full Code Here

      return;
    }
    CustomTableData customTableData = (CustomTableData) pController.getProperty(jdbcSG.getKey());
    if (customTableData != null) {
      JavaQName qName = pController.getComplexTypeSG().getClassContext().getPMName();
      JavaSource js = pController.getSchema().getJavaSourceFactory().newJavaSource(qName, JavaSource.PUBLIC);
      getPMClass(pController, js, customTableData);
    }
  }
View Full Code Here

  public boolean isSequence(GroupSG pController) { return isSequence; }

  public JavaSource getXMLInterface(GroupSG pController) throws SAXException {
    JavaQName qName = pController.getClassContext().getXMLInterfaceName();
    JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(qName, JavaSource.PUBLIC);
    js.setType(JavaSource.INTERFACE);
    pController.generateProperties(js);
    return js;
  }
View Full Code Here


  public JavaSource getXMLImplementation(GroupSG pController) throws SAXException {
    JavaQName qName = pController.getClassContext().getXMLImplementationName();
    JavaSourceFactory jsf = getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(qName, JavaSource.PUBLIC);
    js.addImplements(pController.getClassContext().getXMLInterfaceName());
    pController.generateProperties(js);
    return js;
  }
View Full Code Here

    }
  }

  protected JavaSource getObjectFactory(SchemaSG pController, String pPackageName, List pContextList) {
    JavaQName qName = JavaQNameImpl.getInstance(pPackageName, "ObjectFactory");
    JavaSource js = pController.getJavaSourceFactory().newJavaSource(qName, "public");
    JavaField jf = js.newJavaField("jaxbContext", JAXBContextImpl.class, "private");
    JavaField properties = js.newJavaField("properties", Map.class, "private");

    JavaConstructor jcon = js.newJavaConstructor("public");
    jcon.addThrows(JAXBException.class);
    jcon.addLine(jf, " = (", JAXBContextImpl.class, ") ",
                 JAXBContext.class, ".newInstance(",
                 JavaSource.getQuoted(pPackageName), ");");

    JavaMethod newInstanceMethod = js.newJavaMethod("newInstance", Object.class, "public");
    newInstanceMethod.addThrows(JAXBException.class);
    Parameter pElementInterface = newInstanceMethod.addParam(Class.class, "pElementInterface");
    newInstanceMethod.addLine("return ", jf, ".getElement(", pElementInterface, ");");

    {
      JavaMethod getPropertyMethod = js.newJavaMethod("getProperty", Object.class, "public");
      Parameter pName = getPropertyMethod.addParam(String.class, "pName");
      getPropertyMethod.addIf(properties, " == null");
      getPropertyMethod.addLine("return null;");
      getPropertyMethod.addEndIf();
      getPropertyMethod.addLine("return ", properties, ".get(", pName, ");");
    }

    {
      JavaMethod setPropertyMethod = js.newJavaMethod("setProperty", void.class, "public");
      Parameter pName = setPropertyMethod.addParam(String.class, "pName");
      Parameter pValue = setPropertyMethod.addParam(Object.class, "pValue");
      setPropertyMethod.addIf(properties, " == null");
      setPropertyMethod.addLine(properties, " = new ", HashMap.class, "();");
      setPropertyMethod.addEndIf();
      setPropertyMethod.addLine(properties, ".put(", pName, ", ", pValue, ");");
    }

    for (Iterator iter = pContextList.iterator();  iter.hasNext()) {
      Object o = iter.next();
      if (!(o instanceof ObjectSG)) {
        continue;
      }
      ObjectSG objectSG = (ObjectSG) o;
      TypeSG typeSG = objectSG.getTypeSG();
      if (!typeSG.isComplex()) {
        continue;
      }
      ComplexTypeSG complexTypeSG = typeSG.getComplexTypeSG();

      JavaQName resultName = complexTypeSG.getClassContext().getXMLInterfaceName();
      String className = resultName.getClassName();
      String methodName = "create" + Character.toUpperCase(className.charAt(0)) + className.substring(1);
      JavaMethod createMethod = js.newJavaMethod(methodName, resultName, "public");
      createMethod.addThrows(JAXBException.class);
      createMethod.addLine("return (", resultName, ") newInstance(", resultName, ".class);");
    }
   
    return js;
View Full Code Here

  public JavaSource getXMLInterface(ComplexTypeSG pController) throws SAXException {
    final String mName = "getXMLInterface";
    log.finest(mName, "->");
    JavaQName qName = pController.getClassContext().getXMLInterfaceName();
    JavaSourceFactory jsf = pController.getTypeSG().getSchema().getJavaSourceFactory();
    JavaSource js = jsf.newJavaSource(qName, JavaSource.PUBLIC);
    js.setType(JavaSource.INTERFACE);

    generateProperties(pController, js);
    if (!pController.hasSimpleContent()) {
      GroupSG groupSG = pController.getComplexContentSG().getGroupSG();
      if (groupSG != null) { // Check required, in case the element doesn't have any childs
        groupSG.generateXMLInterfaceSubclasses(js);
      }
    }
    log.finest(mName, "<-", js.getQName());
    return js;
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.js.JavaSource

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.