Ejemplo n.º 1
0
  private void parseTLD(XModelObject o, IPath source, LoadedDeclarations ds) {
    TLDLibrary library = new TLDLibrary();
    library.setId(o);
    library.setURI(new XMLValueInfo(o, AbstractTagLib.URI));
    library.setDisplayName(new XMLValueInfo(o, TLDLibrary.DISPLAY_NAME));
    library.setShortName(new XMLValueInfo(o, ATTR_SHORTNAME));
    String version = o.getAttributeValue(TLDLibrary.VERSION);
    if (version == null) {
      if ("FileTLD_1_2".equals(o.getModelEntity().getName())) { // $NON-NLS-1$
        version = "1.2"; // $NON-NLS-1$
      } else {
        version = "1.1"; // $NON-NLS-1$
      }
      library.setVersion(version);
    } else {
      library.setVersion(new XMLValueInfo(o, TLDLibrary.VERSION));
    }

    ds.getLibraries().add(library);

    XModelObject[] ts = o.getChildren();
    for (XModelObject t : ts) {
      if (t.getModelEntity().getName().startsWith("TLDTag")) { // $NON-NLS-1$
        AbstractComponent tag = new TLDTag();
        tag.setId(t);

        tag.setName(new XMLValueInfo(t, XMLStoreConstants.ATTR_NAME));
        tag.setDescription(new XMLValueInfo(t, AbstractComponent.DESCRIPTION));
        tag.setComponentClass(new XMLValueInfo(t, ATTR_TAGCLASS));
        tag.setCanHaveBody(new XMLValueInfo(t, ATTR_BODY_CONTENT));

        XModelObject[] as = t.getChildren();
        for (XModelObject a : as) {
          if (a.getModelEntity().getName().startsWith("TLDAttribute")) { // $NON-NLS-1$
            AbstractAttribute attr = new TLDAttribute();
            attr.setId(a);
            attr.setName(new XMLValueInfo(a, XMLStoreConstants.ATTR_NAME));
            attr.setDescription(new XMLValueInfo(a, AbstractComponent.DESCRIPTION));
            attr.setRequired(new XMLValueInfo(a, AbstractAttribute.REQUIRED));

            tag.addAttribute(attr);
          }
        }

        library.addComponent(tag);
      }
    }
    XModelObject functions = o.getChildByPath("Functions"); // $NON-NLS-1$
    if (functions != null) {
      ts = functions.getChildren();
      for (XModelObject t : ts) {
        ELFunction f = new ELFunction();
        f.setId(t);
        f.setName(new XMLValueInfo(t, XModelObjectConstants.ATTR_NAME));
        f.setSignature(new XMLValueInfo(t, ATTR_FUNC_SIGN));
        f.setFunctionClass(new XMLValueInfo(t, ELFunction.FUNCTION_CLASS));
        library.addFunction(f);
      }
    }
  }
Ejemplo n.º 2
0
  private void parseFaceletTaglib(XModelObject o, IPath source, LoadedDeclarations ds) {
    FaceletTagLibrary library = new FaceletTagLibrary();
    library.setId(o);
    library.setURI(new XMLValueInfo(o, AbstractTagLib.URI));

    ds.getLibraries().add(library);

    XModelObject[] os = o.getChildren();
    for (XModelObject t : os) {
      String entity = t.getModelEntity().getName();
      if (entity.startsWith("FaceletTaglibTag")) { // $NON-NLS-1$
        FaceletTag tag = new FaceletTag();
        tag.setId(t);
        tag.setName(new XMLValueInfo(t, ATTR_TAG_NAME));
        tag.setDescription(new XMLValueInfo(t, AbstractComponent.DESCRIPTION));
        XModelObject d = t.getChildByPath("declaration"); // $NON-NLS-1$
        if (d != null
            && d.getModelEntity().getName().startsWith("FaceletTaglibComponent")) { // $NON-NLS-1$
          String componentType = d.getAttributeValue(ATTR_COMPONENT_TYPE); // $NON-NLS-1$
          if (componentType != null && componentType.length() > 0) {
            tag.setComponentType(new XMLValueInfo(d, ATTR_COMPONENT_TYPE)); // $NON-NLS-1$
          }
        }
        XModelObject[] as = t.getChildren();
        for (XModelObject a : as) {
          String entity2 = a.getModelEntity().getName();
          if (entity2.startsWith("FaceletTaglibAttribute")) { // $NON-NLS-1$
            FaceletAttribute attr = new FaceletAttribute();
            attr.setId(a);
            attr.setName(new XMLValueInfo(a, XMLStoreConstants.ATTR_NAME));
            attr.setDescription(new XMLValueInfo(a, AbstractComponent.DESCRIPTION));
            attr.setRequired(new XMLValueInfo(a, AbstractAttribute.REQUIRED));

            tag.addAttribute(attr);
          }
        }
        library.addComponent(tag);
      } else if (entity.startsWith("FaceletTaglibFunction")) { // $NON-NLS-1$
        ELFunction f = new ELFunction();
        f.setId(t);
        f.setName(new XMLValueInfo(t, ATTR_FUNC_NAME));
        f.setSignature(new XMLValueInfo(t, ATTR_FUNC_SIGN));
        f.setFunctionClass(new XMLValueInfo(t, ELFunction.FUNCTION_CLASS));
        library.addFunction(f);
      }
    }
  }
Ejemplo n.º 3
0
  private void parseFacesConfig(XModelObject o, IPath source, LoadedDeclarations ds) {
    FacesConfigTagLibrary library = new FacesConfigTagLibrary();
    library.setId(o);
    library.setURI("TODO"); // TODO what is the URI? //$NON-NLS-1$

    ds.getLibraries().add(library);

    XModelObject componentFolder = o.getChildByPath("Components"); // $NON-NLS-1$
    if (componentFolder == null) return;
    XModelObject[] os = componentFolder.getChildren();
    for (XModelObject c : os) {
      FacesConfigComponent component = new FacesConfigComponent();
      component.setId(c);
      // what else can we take for the name? only attribute 'component-type' is available
      component.setName(new XMLValueInfo(c, AbstractComponent.COMPONENT_TYPE));

      component.setComponentClass(new XMLValueInfo(c, AbstractComponent.COMPONENT_CLASS));
      component.setComponentType(new XMLValueInfo(c, AbstractComponent.COMPONENT_TYPE));
      component.setDescription(new XMLValueInfo(c, AbstractComponent.DESCRIPTION));

      XModelObject[] as = c.getChildren();
      for (XModelObject child : as) {
        String entity = child.getModelEntity().getName();
        if (entity.startsWith("JSFAttribute")) { // $NON-NLS-1$
          FacesConfigAttribute attr = new FacesConfigAttribute();
          attr.setId(child);
          attr.setName(new XMLValueInfo(child, ATTR_ATTRIBUTE_NAME));
          component.addAttribute(attr);
        } else if (entity.startsWith("JSFFacet")) { // $NON-NLS-1$
          Facet f = new Facet();
          f.setId(child);
          f.setName(new XMLValueInfo(child, ATTR_FACET_NAME));
          f.setDescription(new XMLValueInfo(child, AbstractComponent.DESCRIPTION));
          component.addFacet(f);
        }
      }
      library.addComponent(component);
    }
  }