Ejemplo 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);
        }
      }
    }
  }
Ejemplo n.º 2
0
 private static SSLServerSOContainer createServerContainer(
     String id, SSLServerSOContainerGroup group, String path, int keepAlive)
     throws IDCreateException {
   System.out.println(
       "  Creating container with id="
           + id
           + " keepAlive="
           + keepAlive); //$NON-NLS-1$ //$NON-NLS-2$
   final ID newServerID = IDFactory.getDefault().createStringID(id);
   final SOContainerConfig config = new SOContainerConfig(newServerID);
   return new SSLServerSOContainer(config, group, path, keepAlive);
 }
Ejemplo n.º 3
0
  /** {@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);
        }
      }
    }
  }
Ejemplo n.º 4
0
 public static R_OSGiID createR_OSGiID(Namespace namespace, String uriStr) {
   return (R_OSGiID) IDFactory.getDefault().createID(namespace, uriStr);
 }
Ejemplo n.º 5
0
  @Override
  protected void loadData() {
    /*
     * insert tasks
     */
    Task task1 = new Task();
    task1.setTaskid(TASKID1);
    task1.setName("test1");
    task1.setStatus(TaskStatus.RUNNING);
    task1.setAllowmultiinstances(1);
    taskMapper.insertSelective(task1);

    Task task2 = new Task();
    task2.setTaskid(TASKID2);
    task2.setName("test2");
    task2.setStatus(TaskStatus.RUNNING);
    task2.setAllowmultiinstances(2);
    taskMapper.insertSelective(task2);

    Task task3 = new Task();
    task3.setTaskid(TASKID3);
    task3.setName("test3");
    task3.setStatus(TaskStatus.RUNNING);
    task3.setAllowmultiinstances(3);
    taskMapper.insertSelective(task3);

    /*
     * insert attempt
     */
    TaskAttempt attempt1 = new TaskAttempt();
    attempt1.setTaskid(TASKID1);
    String instanceID1 = idFactory.newInstanceID(TASKID1);
    attempt1.setInstanceid(instanceID1);
    attempt1.setAttemptid(idFactory.newAttemptID(instanceID1));
    attempt1.setStatus(AttemptStatus.RUNNING);
    attemptMapper.insertSelective(attempt1);

    TaskAttempt attempt2 = new TaskAttempt();
    attempt2.setTaskid(TASKID2);
    String instanceID2 = idFactory.newInstanceID(TASKID2);
    attempt2.setInstanceid(instanceID2);
    attempt2.setAttemptid(idFactory.newAttemptID(instanceID2));
    attempt2.setStatus(AttemptStatus.RUNNING);
    attemptMapper.insertSelective(attempt2);

    TaskAttempt attempt3 = new TaskAttempt();
    attempt3.setTaskid(TASKID3);
    String instanceID3 = idFactory.newInstanceID(TASKID3);
    attempt3.setInstanceid(instanceID3);
    attempt3.setAttemptid(idFactory.newAttemptID(instanceID3));
    attempt3.setStatus(AttemptStatus.RUNNING);
    attemptMapper.insertSelective(attempt3);

    /*
     * Engine load task
     */
    engine.load();
    engine.setMaxConcurrency(5);

    /*
     * set next to null
     */
    filter1.setNext(null);

    /*
     * load attemptcontext
     */

    TaskAttempt attempt4 = new TaskAttempt();
    attempt4.setTaskid(TASKID3);
    String instanceID4 = idFactory.newInstanceID(TASKID3);
    attempt4.setInstanceid(instanceID4);
    attempt4.setAttemptid(idFactory.newAttemptID(instanceID4));
    attempt4.setStatus(AttemptStatus.DEPENDENCY_PASS);
    contexts.add(new AttemptContext(attempt4, task3));

    TaskAttempt attempt5 = new TaskAttempt();
    attempt5.setTaskid(TASKID3);
    String instanceID5 = idFactory.newInstanceID(TASKID3);
    attempt5.setInstanceid(instanceID5);
    attempt5.setAttemptid(idFactory.newAttemptID(instanceID5));
    attempt5.setStatus(AttemptStatus.DEPENDENCY_PASS);
    contexts.add(new AttemptContext(attempt5, task3));

    TaskAttempt attempt6 = new TaskAttempt();
    attempt6.setTaskid(TASKID3);
    String instanceID6 = idFactory.newInstanceID(TASKID3);
    attempt6.setInstanceid(instanceID6);
    attempt6.setAttemptid(idFactory.newAttemptID(instanceID6));
    attempt6.setStatus(AttemptStatus.DEPENDENCY_PASS);
    contexts.add(new AttemptContext(attempt6, task3));

    TaskAttempt attempt7 = new TaskAttempt();
    attempt7.setTaskid(TASKID1);
    String instanceID7 = idFactory.newInstanceID(TASKID1);
    attempt7.setInstanceid(instanceID7);
    attempt7.setAttemptid(idFactory.newAttemptID(instanceID7));
    attempt7.setStatus(AttemptStatus.DEPENDENCY_PASS);
    contexts.add(new AttemptContext(attempt7, task1));

    TaskAttempt attempt8 = new TaskAttempt();
    attempt8.setTaskid(TASKID2);
    String instanceID8 = idFactory.newInstanceID(TASKID2);
    attempt8.setInstanceid(instanceID8);
    attempt8.setAttemptid(idFactory.newAttemptID(instanceID8));
    attempt8.setStatus(AttemptStatus.DEPENDENCY_PASS);
    contexts.add(new AttemptContext(attempt8, task2));
  }