コード例 #1
0
ファイル: WRITECopyThread.java プロジェクト: giwa/fiapstorage
  /**
   * write要素の直下にある PointおよびPointSet を解析し、<br>
   * m_PointTreeRoots, m_PointMap, m_ChildToParentMap<br>
   * を構築する
   *
   * @param e
   */
  private void parsePointTree(Element e)
      throws org.apache.axis2.databinding.types.URI.MalformedURIException {

    String parentTagName = e.getTagName();
    Node n0 = e.getFirstChild();
    while (n0 != null) {
      if (n0.getNodeType() == Node.ELEMENT_NODE) {
        Element e0 = (Element) n0;
        String tagName = e0.getTagName();
        String id = e0.getAttribute("id");
        if (tagName.equals("pointSet")) {
          PointSet ps = new PointSet();
          ps.setId(new org.apache.axis2.databinding.types.URI(id));
          m_PointMap.put(id, new PointData(ps));
          if (parentTagName.equals("pointSet")) {
            String parent = e.getAttribute("id");
            m_ChildToParentMap.put(id, parent);
          } else if (parentTagName.equals("write")) {
            m_PointTreeRoots.put(id, new PointData(ps));
          }
          parsePointTree(e0);
        } else if (tagName.equals("point")) {
          Point p = new Point();
          p.setId(new org.apache.axis2.databinding.types.URI(id));
          m_PointMap.put(id, new PointData(p));
          if (parentTagName.equals("pointSet")) {
            String parent = e.getAttribute("id");
            m_ChildToParentMap.put(id, parent);
          } else if (parentTagName.equals("write")) {
            m_PointTreeRoots.put(id, new PointData(p));
          }
        }
      }
      n0 = n0.getNextSibling();
    }
  }
コード例 #2
0
ファイル: WRITECopyThread.java プロジェクト: giwa/fiapstorage
  /** PointSet木を ローカルのStorageに作成する */
  public void init() {

    Storage2Admin admin = Storage2Admin.getInstance();
    admin.log(
        "fiap.client.writecopy.init.begin",
        "fiapURI="
            + m_FIAPURI
            + "; frequency="
            + m_Frequency
            + "; mode="
            + m_Mode
            + "; offset="
            + m_OffSet,
        false);

    java.util.Map<String, PointData> roots = new java.util.Hashtable<String, PointData>();
    java.util.Map<String, PointData> points = new java.util.Hashtable<String, PointData>();
    String[] keys = new String[0];
    keys = m_PointMap.keySet().toArray(keys);
    for (int i = 0; i < keys.length; i++) {
      PointData obj = m_PointMap.get(keys[i]);
      PointData clone = null;
      if (obj.hasPointSet()) {
        PointSet clonePS = new PointSet();
        clonePS.setId(obj.getPointSet().getId());
        clone = new PointData(clonePS);
      } else if (obj.hasPoint()) {
        Point cloneP = new Point();
        cloneP.setId(obj.getPoint().getId());
        clone = new PointData(cloneP);
      }
      if (m_PointTreeRoots.containsKey(keys[i])) {
        roots.put(keys[i], clone);
      }
      points.put(keys[i], clone);
    }
    keys = new String[0];
    keys = m_ChildToParentMap.keySet().toArray(keys);
    for (int i = 0; i < keys.length; i++) {
      String id = keys[i];
      String parent = m_ChildToParentMap.get(id);
      PointData child = points.get(id);
      if (child.hasPointSet()) {
        points.get(parent).getPointSet().addPointSet(child.getPointSet());
      } else if (child.hasPoint()) {
        points.get(parent).getPointSet().addPoint(child.getPoint());
      }
    }

    keys = new String[0];
    keys = roots.keySet().toArray(keys);
    for (int i = 0; i < keys.length; i++) {
      PointData obj = roots.get(keys[i]);
      //	System.out.println(keys[i]);
      m_Parent.sendUpdate(obj);
    }

    admin.log(
        "fiap.client.writecopy.init.end",
        "fiapURI="
            + m_FIAPURI
            + "; frequency="
            + m_Frequency
            + "; mode="
            + m_Mode
            + "; offset="
            + m_OffSet,
        false);
  }