Example #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);
        }
      }
    }
  }
Example #2
0
  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("serviceName")) {
        serviceName = DocumentSerializableUtilities.getString(childElement);
      } else if (tagName.equals("serviceParam")) {
        serviceParameter = DocumentSerializableUtilities.getString(childElement);
      } else if (tagName.equals("numInboundQueued")) {
        numInboundQueued = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("numInboundDropped")) {
        numInboundDropped = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("timeToDropInbound")) {
        timeToDropInbound = DocumentSerializableUtilities.getLong(childElement);
      } else if (tagName.equals("numInboundDeQueued")) {
        numInboundDeQueued = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("timeInInboundQueue")) {
        timeInInboundQueue = DocumentSerializableUtilities.getLong(childElement);
      } else if (tagName.equals("numInboundProcessed")) {
        numInboundProcessed = DocumentSerializableUtilities.getInt(childElement);
      } else if (tagName.equals("timeToProcessInbound")) {
        timeToProcessInbound = DocumentSerializableUtilities.getLong(childElement);
      }
    }

    serviceIdString = serviceName + serviceParameter;
  }
Example #3
0
  public void serializeTo(Element element) throws DocumentSerializationException {

    DocumentSerializableUtilities.addString(element, "serviceName", serviceName);
    DocumentSerializableUtilities.addString(element, "serviceParam", serviceParameter);

    if (numInboundQueued != 0) {
      DocumentSerializableUtilities.addInt(element, "numInboundQueued", numInboundQueued);
    }

    if (numInboundDropped != 0) {
      DocumentSerializableUtilities.addInt(element, "numInboundDropped", numInboundDropped);
    }

    if (timeToDropInbound != 0) {
      DocumentSerializableUtilities.addLong(element, "timeToDropInbound", timeToDropInbound);
    }

    if (numInboundDeQueued != 0) {
      DocumentSerializableUtilities.addInt(element, "numInboundDeQueued", numInboundDeQueued);
    }

    if (timeInInboundQueue != 0) {
      DocumentSerializableUtilities.addLong(element, "timeInInboundQueue", timeInInboundQueue);
    }

    if (numInboundProcessed != 0) {
      DocumentSerializableUtilities.addInt(element, "numInboundProcessed", numInboundProcessed);
    }

    if (timeToProcessInbound != 0) {
      DocumentSerializableUtilities.addLong(element, "timeToProcessInbound", timeToProcessInbound);
    }
  }
  /** {@inheritDoc} */
  public void serializeTo(Element element) throws DocumentSerializationException {
    for (Iterator i = transportMetrics.iterator(); i.hasNext(); ) {
      TransportMetric transportMetric = (TransportMetric) i.next();

      DocumentSerializableUtilities.addDocumentSerializable(
          element, "transportMetric", transportMetric);
    }
    if (moduleClassID != null) {
      DocumentSerializableUtilities.addString(element, "moduleClassID", moduleClassID.toString());
    }
  }
Example #5
0
  /** {@inheritDoc} */
  public void serializeTo(Element element) throws DocumentSerializationException {
    DocumentSerializableUtilities.addString(element, "description", description);

    for (Iterator i = serviceMonitorFilters.values().iterator(); i.hasNext(); ) {
      ServiceMonitorFilter serviceMonitorFilter = (ServiceMonitorFilter) i.next();

      Element serviceElement = DocumentSerializableUtilities.createChildElement(element, "service");

      DocumentSerializableUtilities.addString(
          serviceElement, "moduleClassID", serviceMonitorFilter.getModuleClassID().toString());
      DocumentSerializableUtilities.addDocumentSerializable(
          serviceElement, "serviceFilter", serviceMonitorFilter);
    }
  }
  /** {@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);
        }
      }
    }
  }
  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);
      }
    }
  }
 public void serializeTo(Element element) throws DocumentSerializationException {
   if (peerID != null) {
     DocumentSerializableUtilities.addString(element, "peerID", peerID.toString());
   }
   if (state != null) {
     DocumentSerializableUtilities.addString(element, "state", state);
   }
   if (transitionTime != 0) {
     DocumentSerializableUtilities.addLong(element, "transitionTime", transitionTime);
   }
   if (lastLeaseRenewalTime != 0) {
     DocumentSerializableUtilities.addLong(element, "lastLeaseRenewalTime", lastLeaseRenewalTime);
   }
   if (lease != 0) {
     DocumentSerializableUtilities.addLong(element, "lease", lease);
   }
   if (numConnects != 0) {
     DocumentSerializableUtilities.addInt(element, "numConnects", numConnects);
   }
   if (numLeaseRenewals != 0) {
     DocumentSerializableUtilities.addInt(element, "numLeaseRenewals", numLeaseRenewals);
   }
   if (numDisconnects != 0) {
     DocumentSerializableUtilities.addInt(element, "numDisconnects", numDisconnects);
   }
   if (numConnectionsRefused != 0) {
     DocumentSerializableUtilities.addInt(element, "numConnectionsRefused", numConnectionsRefused);
   }
   if (numErrorsAddingClient != 0) {
     DocumentSerializableUtilities.addInt(element, "numErrorsAddingClient", numErrorsAddingClient);
   }
   if (numUnableToRespondToConnectRequest != 0) {
     DocumentSerializableUtilities.addInt(
         element, "numUnableToRespondToConnectRequest", numUnableToRespondToConnectRequest);
   }
   if (totalTimeConnected != 0) {
     DocumentSerializableUtilities.addLong(element, "totalTimeConnected", totalTimeConnected);
   }
 }