Exemplo n.º 1
0
  /** {@inheritDoc} */
  public void initializeFrom(Element element) throws DocumentSerializationException {
    for (Enumeration e = element.getChildren(); e.hasMoreElements(); ) {
      Element serviceElement = (TextElement) e.nextElement();
      String tagName = (String) serviceElement.getKey();

      if (tagName.equals("service")) {
        try {
          ModuleClassID moduleClassID =
              (ModuleClassID)
                  IDFactory.fromURI(
                      new URI(
                          DocumentSerializableUtilities.getString(
                              serviceElement, "moduleClassID", "ERROR")));

          try {
            ServiceMonitorFilter serviceMonitorFilter =
                MonitorResources.createServiceMonitorFilter(moduleClassID);
            serviceMonitorFilter.init(moduleClassID);
            Element serviceMonitorFilterElement =
                DocumentSerializableUtilities.getChildElement(serviceElement, "serviceFilter");
            serviceMonitorFilter.initializeFrom(serviceMonitorFilterElement);
            serviceMonitorFilters.put(moduleClassID, serviceMonitorFilter);
          } catch (Exception ex) {
            if (unknownModuleClassIDs == null) unknownModuleClassIDs = new LinkedList();

            unknownModuleClassIDs.add(moduleClassID);
          }
        } catch (URISyntaxException jex) {
          throw new DocumentSerializationException("Can't get ModuleClassID", jex);
        }
      }
    }
  }
  /** {@inheritDoc} */
  public void initializeFrom(Element element) throws DocumentSerializationException {
    for (Enumeration e = element.getChildren(); e.hasMoreElements(); ) {
      Element childElement = (TextElement) e.nextElement();
      String tagName = (String) childElement.getKey();

      if (tagName.equals("transportMetric")) {
        TransportMetric transportMetric =
            (TransportMetric)
                DocumentSerializableUtilities.getDocumentSerializable(
                    childElement, TransportMetric.class);
        transportMetrics.add(transportMetric);
      }
      if (tagName.equals("moduleClassID")) {
        try {
          moduleClassID =
              (ModuleClassID)
                  IDFactory.fromURI(new URI(DocumentSerializableUtilities.getString(childElement)));
        } catch (URISyntaxException jex) {
          throw new DocumentSerializationException("Can't read moduleClassID", jex);
        }
      }
    }
  }
Exemplo n.º 3
0
  public void initializeFrom(Element element) throws DocumentSerializationException {
    state = null;

    for (Enumeration e = element.getChildren(); e.hasMoreElements(); ) {
      Element childElement = (TextElement) e.nextElement();
      String tagName = (String) childElement.getKey();

      if (tagName.equals("peerID")) {
        String peerIDText = DocumentSerializableUtilities.getString(childElement);

        peerID = MetricUtilities.getPeerIdFromString(peerIDText);
      } else if (tagName.equals("state")) {
        state = DocumentSerializableUtilities.getString(childElement);
      } else if (tagName.equals("transitionTime")) {
        transitionTime = DocumentSerializableUtilities.getLong(childElement);
      } else if (tagName.equals("lastLeaseRenewalTime")) {
        lastLeaseRenewalTime = DocumentSerializableUtilities.getLong(childElement);
      } else if (tagName.equals("lease")) {
        lease = DocumentSerializableUtilities.getLong(childElement);
      } else if (tagName.equals("numConnects")) {
        numConnects = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numLeaseRenewals")) {
        numLeaseRenewals = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numDisconnects")) {
        numDisconnects = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numConnectionsRefused")) {
        numConnectionsRefused = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numErrorsAddingClient")) {
        numErrorsAddingClient = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numUnableToRespondToConnectRequest")) {
        numUnableToRespondToConnectRequest = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("totalTimeConnected")) {
        totalTimeConnected = DocumentSerializableUtilities.getLong(childElement);
      }
    }
  }