Examples of EnunciateFreemarkerModel


Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

      //if it's a parametric collection type, we need to provide a choice between all subclasses of the base type.
      TypeMirror typeMirror = getBareAccessorType();
      if (typeMirror instanceof DeclaredType) {
        String fqn = ((DeclaredType) typeMirror).getDeclaration().getQualifiedName();
        EnunciateFreemarkerModel model = ((EnunciateFreemarkerModel) FreemarkerModel.get());
        for (RootElementDeclaration rootElement : model.getRootElementDeclarations()) {
          if (isInstanceOf(rootElement, fqn)) {
            if (qnamesAdded.add(rootElement.getQname())) {
              choices.add(new ElementRef((MemberDeclaration) getDelegate(), getTypeDefinition(), rootElement));
            }
          }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

    if (!(unwrapped instanceof ClassDeclaration)) {
      throw new TemplateModelException("A class declaration must be provided.");
    }

    ClassDeclaration def = (ClassDeclaration) unwrapped;
    EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
    return model.findElementDeclaration(def);
  }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

    webinf.mkdirs();
    File destWebXML = new File(webinf, "web.xml");

    File configDir = getGenerateDir();
    File webXML = new File(configDir, "web.xml");
    EnunciateFreemarkerModel model = getModel();
    model.setFileOutputDirectory(configDir);
    try {
      //delayed to the "build" phase to enable modules to supply their web app fragments.
      model.put("displayName", model.getEnunciateConfig().getLabel());
      model.put("webAppFragments", enunciate.getWebAppFragments());
      List<WebAppResource> envEntries = Collections.<WebAppResource>emptyList();
      List<WebAppResource> resourceEnvRefs = Collections.<WebAppResource>emptyList();
      List<WebAppResource> resourceRefs = Collections.<WebAppResource>emptyList();
      WebAppConfig webAppConfig = getWebAppConfig();
      if (webAppConfig != null) {
        envEntries = webAppConfig.getEnvEntries();
        resourceEnvRefs = webAppConfig.getResourceEnvRefs();
        resourceRefs = webAppConfig.getResourceRefs();
      }
      model.put("envEntries", envEntries);
      model.put("resourceEnvRefs", resourceEnvRefs);
      model.put("resourceRefs", resourceRefs);
      if (webAppConfig != null) {
        model.put("webappAttributes", webAppConfig.getWebXmlAttributes());
      }
      processTemplate(getWebXmlTemplateURL(), model);
    }
    catch (TemplateException e) {
      throw new EnunciateException("Error processing web.xml template file.", e);
    }

    File mergedWebXml = webXML;
    WebAppConfig webAppConfig = getWebAppConfig();
    if ((webAppConfig != null) && (webAppConfig.getMergeWebXMLURL() != null || webAppConfig.getMergeWebXML() != null)) {
      URL webXmlToMerge = webAppConfig.getMergeWebXMLURL();
      if (webXmlToMerge == null) {
        webXmlToMerge = enunciate.resolvePath(webAppConfig.getMergeWebXML()).toURL();
      }

      try {
        Document source1Doc = loadMergeXml(webXmlToMerge.openStream());
        NodeModel.simplify(source1Doc);
        Document source2Doc = loadMergeXml(new FileInputStream(webXML));
        NodeModel.simplify(source2Doc);

        Map<String, String> mergedAttributes = new HashMap<String, String>();
        NamedNodeMap source2Attributes = source2Doc.getDocumentElement().getAttributes();
        for (int i = 0; i < source2Attributes.getLength(); i++) {
          mergedAttributes.put(source2Attributes.item(i).getNodeName(), source2Attributes.item(i).getNodeValue());
        }
        NamedNodeMap source1Attributes = source1Doc.getDocumentElement().getAttributes();
        for (int i = 0; i < source1Attributes.getLength(); i++) {
          mergedAttributes.put(source1Attributes.item(i).getNodeName(), source1Attributes.item(i).getNodeValue());
        }

        model.put("source1", NodeModel.wrap(source1Doc.getDocumentElement()));
        model.put("source2", NodeModel.wrap(source2Doc.getDocumentElement()));
        model.put("mergedAttributes", mergedAttributes);
        processTemplate(getMergeWebXmlTemplateURL(), model);
      }
      catch (TemplateException e) {
        throw new EnunciateException("Error while merging web xml files.", e);
      }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

    return overridesAnother((Accessor) unwrapped);
  }

  public Boolean overridesAnother(Accessor a) {
    String name = a.getSimpleName();
    EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
    TypeDeclaration declaringType = a.getDeclaringType();
    if (declaringType instanceof ClassDeclaration) {
      declaringType = ((ClassDeclaration) declaringType).getSuperclass().getDeclaration();
      while (declaringType instanceof ClassDeclaration && !Object.class.getName().equals(declaringType.getQualifiedName())) {
        TypeDefinition typeDef = model.findTypeDefinition((ClassDeclaration) declaringType);
        if (typeDef != null) {
          ArrayList<Accessor> accessors = new ArrayList<Accessor>();
          accessors.addAll(typeDef.getAttributes());
          accessors.add(typeDef.getValue());
          accessors.addAll(typeDef.getElements());
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

      throw new IllegalArgumentException("A web method must be provided.");
    }

    annotation = delegate.getAnnotation(javax.jws.WebParam.class);
    this.adapterType = AdapterUtil.findAdapterType(this);
    EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
    this.forceSpecCompliance = model != null && model.getEnunciateConfig() != null && model.getEnunciateConfig().isForceJAXWSSpecCompliance();
  }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel


  //Inherited.
  @Override
  public FileStrategy newStrategy() {
    EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
    File outputDir = (model != null) ? model.getFileOutputDirectory() : null;
    return new EnunciateFileStrategy(outputDir);
  }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

      addReferencedNamespaces(typeDef, referencedNamespaces);
    }
    else if (elementDeclaration instanceof LocalElementDeclaration) {
      TypeDeclaration typeDecl = ((LocalElementDeclaration) elementDeclaration).getElementTypeDeclaration();
      if (typeDecl instanceof ClassDeclaration) {
        EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
        TypeDefinition typeDefinition = model.findTypeDefinition((ClassDeclaration) typeDecl);
        if (typeDefinition != null) {
          addReferencedNamespaces(typeDefinition, referencedNamespaces);
        }
      }
    }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

   * Gets the model for processing.
   *
   * @return The model for processing.
   */
  public EnunciateFreemarkerModel getModel() {
    EnunciateFreemarkerModel model = getModelInternal();

    if (model == null) {
      throw new IllegalStateException("A model must be established.");
    }

    model.setObjectWrapper(getObjectWrapper());
    model.setFileOutputDirectory(getGenerateDir());
    return model;
  }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

    if (mapType != null) {
      setMapXmlType(mapType);
    }
    else {
      XmlType xmlType = null;
      EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
      ClassDeclaration declaration = classType.getDeclaration();
      if (declaration != null) {
        XmlType knownType = model.getKnownType(declaration);
        if (knownType != null) {
          xmlType = knownType;
        }
        else {
          //type not known, not specified.  Last chance: look for the type definition.
          TypeDefinition typeDefinition = model.findTypeDefinition(declaration);
          if (typeDefinition != null) {
            xmlType = new XmlClassType(typeDefinition);
          }
        }
      }
View Full Code Here

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

      addReferencedNamespaces(typeDef, referencedNamespaces);
    }
    else if (elementDeclaration instanceof LocalElementDeclaration) {
      TypeDeclaration typeDecl = ((LocalElementDeclaration) elementDeclaration).getElementTypeDeclaration();
      if (typeDecl instanceof ClassDeclaration) {
        EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
        TypeDefinition typeDefinition = model.findTypeDefinition((ClassDeclaration) typeDecl);
        if (typeDefinition != null) {
          addReferencedNamespaces(typeDefinition, referencedNamespaces);
        }
      }
    }
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.