public edu.uci.isr.xarch.instance.IXMLLink getChangeSet() {
    NodeList nl = DOMUtils.getChildren(elt, ChangesetsConstants.NS_URI, CHANGE_SET_ELT_NAME);
    if (nl.getLength() == 0) {
      return null;
    } else {
      Element el = (Element) nl.item(0);
      IXArch de = getXArch();
      if (de != null) {
        IXArchElement cachedXArchElt = de.getWrapper(el);
        if (cachedXArchElt != null) {
          return (edu.uci.isr.xarch.instance.IXMLLink) cachedXArchElt;
        }
      }

      Object o = makeDerivedWrapper(el, "XMLLink");
      if (o != null) {
        try {
          ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
          if (de != null) {
            de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
          }
          return (edu.uci.isr.xarch.instance.IXMLLink) o;
        } catch (Exception e) {
        }
      }
      edu.uci.isr.xarch.instance.XMLLinkImpl eltImpl =
          new edu.uci.isr.xarch.instance.XMLLinkImpl(el);
      eltImpl.setXArch(getXArch());
      if (de != null) {
        de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
      }
      return eltImpl;
    }
  }
  public IJavaSourceCodeManager getSourceCodeManager() {
    NodeList nl =
        DOMUtils.getChildren(elt, JavasourcecodeConstants.NS_URI, SOURCE_CODE_MANAGER_ELT_NAME);
    if (nl.getLength() == 0) {
      return null;
    } else {
      Element el = (Element) nl.item(0);
      IXArch de = getXArch();
      if (de != null) {
        IXArchElement cachedXArchElt = de.getWrapper(el);
        if (cachedXArchElt != null) {
          return (IJavaSourceCodeManager) cachedXArchElt;
        }
      }

      Object o = makeDerivedWrapper(el, "JavaSourceCodeManager");
      if (o != null) {
        try {
          ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
          if (de != null) {
            de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
          }
          return (IJavaSourceCodeManager) o;
        } catch (Exception e) {
        }
      }
      JavaSourceCodeManagerImpl eltImpl = new JavaSourceCodeManagerImpl(el);
      eltImpl.setXArch(getXArch());
      if (de != null) {
        de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
      }
      return eltImpl;
    }
  }
 public Collection getAllRepositoryLocations() {
   NodeList nl =
       DOMUtils.getChildren(elt, JavasourcecodeConstants.NS_URI, REPOSITORY_LOCATION_ELT_NAME);
   int nlLength = nl.getLength();
   ArrayList v = new ArrayList(nlLength);
   IXArch de = getXArch();
   for (int i = 0; i < nlLength; i++) {
     Element el = (Element) nl.item(i);
     boolean found = false;
     if (de != null) {
       IXArchElement cachedXArchElt = de.getWrapper(el);
       if (cachedXArchElt != null) {
         v.add((IRepositoryLocation) cachedXArchElt);
         found = true;
       }
     }
     if (!found) {
       Object o = makeDerivedWrapper(el, "RepositoryLocation");
       if (o != null) {
         try {
           ((edu.uci.isr.xarch.IXArchElement) o).setXArch(getXArch());
           if (de != null) {
             de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) o));
           }
           v.add((IRepositoryLocation) o);
         } catch (Exception e) {
           RepositoryLocationImpl eltImpl = new RepositoryLocationImpl((Element) nl.item(i));
           eltImpl.setXArch(getXArch());
           if (de != null) {
             de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
           }
           v.add(eltImpl);
         }
       } else {
         RepositoryLocationImpl eltImpl = new RepositoryLocationImpl((Element) nl.item(i));
         eltImpl.setXArch(getXArch());
         if (de != null) {
           de.cacheWrapper(el, ((edu.uci.isr.xarch.IXArchElement) eltImpl));
         }
         v.add(eltImpl);
       }
     }
   }
   return v;
 }
Пример #4
0
  public IXArchElement cloneElement(int depth) {
    synchronized (DOMUtils.getDOMLock(elt)) {
      Document doc = elt.getOwnerDocument();
      if (depth == 0) {
        Element cloneElt = (Element) elt.cloneNode(false);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      } else if (depth == 1) {
        Element cloneElt = (Element) elt.cloneNode(false);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());

        NodeList nl = elt.getChildNodes();
        int size = nl.getLength();
        for (int i = 0; i < size; i++) {
          Node n = nl.item(i);
          Node cloneNode = (Node) n.cloneNode(false);
          cloneNode = doc.importNode(cloneNode, true);
          cloneElt.appendChild(cloneNode);
        }
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      } else /* depth = infinity */ {
        Element cloneElt = (Element) elt.cloneNode(true);
        cloneElt = (Element) doc.importNode(cloneElt, true);
        DirectionImpl cloneImpl = new DirectionImpl(cloneElt);
        cloneImpl.setXArch(getXArch());
        IXArch de = getXArch();
        if (de != null) {
          de.cacheWrapper(cloneElt, cloneImpl);
        }
        return cloneImpl;
      }
    }
  }