/** @see org.apache.axis2.service.Lifecycle#init(org.apache.axis2.context.ServiceContext) */
  public void init(ServiceContext sc) {
    synchronized (initialized) {
      if (!initialized.booleanValue()) {
        AxisService axisService = sc.getAxisService();

        String propertiesPath =
            (String) axisService.getParameterValue("karma.properties.file.path");

        // remove potential whitespace introduced in karma.properties
        if (propertiesPath != null) propertiesPath = propertiesPath.trim();

        ServiceLauncher.start(propertiesPath);

        log = Logger.getLogger(KarmaServiceSkeleton.class);

        if (log.isDebugEnabled()) log.debug("in init");

        ingester = ServiceLauncher.getIngester();
        querier = ServiceLauncher.getQuerier();

        try {
          ingester.resetUnfinishedNotifications();
        } catch (IngestException e) {
          log.error("Error resetting unfinished notifications", e);
        }

        initialized = Boolean.TRUE;
      }
    }
  }
 /**
  * @see
  *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#dataSendStarted(org.dataandsearch.www.karma._2010._08.DataSendStartedDocument)
  */
 public void dataSendStarted(
     org.dataandsearch.www.karma._2010._08.DataSendStartedDocument dataSendStarted14) {
   log.info(dataSendStarted14);
   try {
     ingester.ingestDataSendStarted(dataSendStarted14);
   } catch (IngestException ie) {
     log.error("Failed to ingest DataSendStarted", ie);
   }
 }
 /**
  * @see
  *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#dataReceivedFinished(org.dataandsearch.www.karma._2010._08.DataReceivedFinishedDocument)
  */
 public void dataReceivedFinished(
     org.dataandsearch.www.karma._2010._08.DataReceivedFinishedDocument dataReceivedFinished19) {
   log.info(dataReceivedFinished19);
   try {
     ingester.ingestDataReceivedFinished(dataReceivedFinished19);
   } catch (IngestException ie) {
     log.error("Failed to ingest DataReceivedFinished", ie);
   }
 }
 /**
  * @see
  *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#dataUpdated(org.dataandsearch.www.karma._2010._08.DataUpdatedDocument)
  */
 @Override
 public void dataUpdated(DataUpdatedDocument dataUpdated) {
   log.info(dataUpdated);
   try {
     ingester.ingestDataUpdated(dataUpdated);
   } catch (IngestException ie) {
     log.error("Failed to ingest DataUpdated", ie);
   }
 }
 /**
  * @see
  *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#workflowTerminated(org.dataandsearch.www.karma._2010._08.WorkflowTerminatedDocument)
  */
 public void workflowTerminated(
     org.dataandsearch.www.karma._2010._08.WorkflowTerminatedDocument workflowTerminated8) {
   log.info(workflowTerminated8);
   try {
     ingester.ingestWorkflowTerminated(workflowTerminated8);
   } catch (IngestException ie) {
     log.error("Failed to ingest WorkflowTerminated", ie);
   }
 }
 /**
  * @see
  *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#invokingWorkflowStatus(org.dataandsearch.www.karma._2010._08.InvokingWorkflowStatusDocument)
  */
 public void invokingWorkflowStatus(
     org.dataandsearch.www.karma._2010._08.InvokingWorkflowStatusDocument
         invokingWorkflowStatus7) {
   log.info(invokingWorkflowStatus7);
   try {
     ingester.ingestInvokingWorkflowStatus(invokingWorkflowStatus7);
   } catch (IngestException ie) {
     log.error("Failed to ingest WorkflowFailed", ie);
   }
 }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#serviceTerminated(org.dataandsearch.www.karma._2010._08.ServiceTerminatedDocument)
   */
  public void serviceTerminated(
      org.dataandsearch.www.karma._2010._08.ServiceTerminatedDocument serviceTerminated6) {
    log.info(serviceTerminated6);

    try {
      ingester.ingestServiceTerminated(serviceTerminated6);
    } catch (IngestException ie) {
      log.error("Failed to ingest ServiceTerminated", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#sendingResponseStatus(org.dataandsearch.www.karma._2010._08.SendingResponseStatusDocument)
   */
  public void sendingResponseStatus(
      org.dataandsearch.www.karma._2010._08.SendingResponseStatusDocument sendingResponseStatus2) {
    log.info(sendingResponseStatus2);

    try {
      ingester.ingestSendingResponseStatus(sendingResponseStatus2);
    } catch (IngestException ie) {
      log.error("Failed to ingest SendingResponseStatus", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#invokingServiceStatus(org.dataandsearch.www.karma._2010._08.InvokingServiceStatusDocument)
   */
  public void invokingServiceStatus(
      org.dataandsearch.www.karma._2010._08.InvokingServiceStatusDocument invokingServiceStatus10) {

    log.info(invokingServiceStatus10);
    try {
      ingester.ingestInvokingServiceStatus(invokingServiceStatus10);
    } catch (IngestException ie) {
      log.error("Failed to ingest InvokingServiceStatus", ie);
    }
  }
 @Override
 public void addAnnotationById(AddAnnotationByIdDocument addAnnotationByIdDoc) {
   // TODO Auto-generated method stub
   log.info(addAnnotationByIdDoc);
   try {
     ingester.addAnnotationById(addAnnotationByIdDoc);
   } catch (IngestException ie) {
     log.error("Failed to add annotations by id", ie);
   }
 }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#receivedFault(org.dataandsearch.www.karma._2010._08.ReceivedFaultDocument)
   */
  public void receivedFault(
      org.dataandsearch.www.karma._2010._08.ReceivedFaultDocument receivedFault16) {

    log.info(receivedFault16);
    try {
      ingester.ingestReceivedFault(receivedFault16);
    } catch (IngestException ie) {
      log.error("Failed to ingest ReceivedFault", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#storeUnknown(org.dataandsearch.www.karma._2010._08.UnknownDocument)
   */
  @Override
  public void storeUnknown(UnknownDocument unknown) {
    log.info(unknown);

    try {
      ingester.ingestUnknownNotification(unknown);
    } catch (IngestException ie) {
      log.error("Failed to ingest Unknown", ie);
    }
  }
 @Override
 public void addMultipleObjectAnnotation(
     AddMultipleObjectAnnotationDocument addMultipleObjectAnnotationDoc) {
   // TODO Auto-generated method stub
   log.info(addMultipleObjectAnnotationDoc);
   try {
     ingester.addMultipleObjectAnnotation(addMultipleObjectAnnotationDoc);
   } catch (IngestException ie) {
     log.error("Failed to add annotations for multiple objects", ie);
   }
 }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#receivedResponse(org.dataandsearch.www.karma._2010._08.ReceivedResponseDocument)
   */
  public void receivedResponse(
      org.dataandsearch.www.karma._2010._08.ReceivedResponseDocument receivedResponse1) {
    // print out notification
    log.info(receivedResponse1);

    try {
      ingester.ingestReceivedResponse(receivedResponse1);
    } catch (IngestException ie) {
      log.error("Failed to ingest ReceivedResponse", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#sendingFault(org.dataandsearch.www.karma._2010._08.SendingFaultDocument)
   */
  public void sendingFault(
      org.dataandsearch.www.karma._2010._08.SendingFaultDocument sendingFault23) {
    // print out notification
    log.info(sendingFault23);

    try {
      ingester.ingestSendingFault(sendingFault23);
    } catch (IngestException ie) {
      log.error("Failed to ingest SendingFault", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#dataProduced(org.dataandsearch.www.karma._2010._08.DataProducedDocument)
   */
  public void dataProduced(
      org.dataandsearch.www.karma._2010._08.DataProducedDocument dataProduced21) {

    log.info(dataProduced21.toString());

    try {
      ingester.ingestDataProduced(dataProduced21);
    } catch (IngestException ie) {
      log.error("Failed to ingest DataProduced", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#invokingService(org.dataandsearch.www.karma._2010._08.InvokingServiceDocument)
   */
  public void invokingService(
      org.dataandsearch.www.karma._2010._08.InvokingServiceDocument invokingService17) {

    log.info(invokingService17.toString());

    try {
      ingester.ingestInvokingService(invokingService17);
    } catch (IngestException ie) {
      log.error("Failed to ingest InvokingService", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#serviceInvoked(org.dataandsearch.www.karma._2010._08.ServiceInvokedDocument)
   */
  public void serviceInvoked(
      org.dataandsearch.www.karma._2010._08.ServiceInvokedDocument serviceInvoked15) {

    log.info(serviceInvoked15.toString());

    try {
      ingester.ingestServiceInvoked(serviceInvoked15);
    } catch (IngestException ie) {
      log.error("Failed to ingest ServiceInvoked", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#invokingWorkflow(org.dataandsearch.www.karma._2010._08.InvokingWorkflowDocument)
   */
  public void invokingWorkflow(
      org.dataandsearch.www.karma._2010._08.InvokingWorkflowDocument invokingWorkflow4) {
    // print out notification
    log.info(invokingWorkflow4);

    try {
      ingester.ingestInvokingWorkflow(invokingWorkflow4);
    } catch (IngestException ie) {
      log.error("Failed to ingest InvokingWorkflow", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#sendingResponse(org.dataandsearch.www.karma._2010._08.SendingResponseDocument)
   */
  public void sendingResponse(
      org.dataandsearch.www.karma._2010._08.SendingResponseDocument sendingResponse5) {
    // print out notification
    log.info(sendingResponse5.toString());

    try {
      ingester.ingestSendingResponse(sendingResponse5);
    } catch (IngestException ie) {
      log.error("Failed to ingest SendingResponse", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#dataConsumed(org.dataandsearch.www.karma._2010._08.DataConsumedDocument)
   */
  public void dataConsumed(
      org.dataandsearch.www.karma._2010._08.DataConsumedDocument dataConsumed9) {
    // print out notification
    log.info(dataConsumed9.toString());

    try {
      ingester.ingestDataConsumed(dataConsumed9);
    } catch (IngestException ie) {
      log.error("Failed to ingest DataConsumed", ie);
    }
  }
  /**
   * @see
   *     edu.indiana.dsi.karma.KarmaServiceSkeletonInterface#serviceInitialized(org.dataandsearch.www.karma._2010._08.ServiceInitializedDocument)
   */
  public void serviceInitialized(
      org.dataandsearch.www.karma._2010._08.ServiceInitializedDocument serviceInitialized3) {
    // print out notification
    log.info(serviceInitialized3);

    try {
      ingester.ingestServiceInitialized(serviceInitialized3);

    } catch (IngestException ie) {
      log.error("Failed to ingest ServiceInitialized", ie);
    }
  }
  public static void storeNotification(
      NotificationIngester ingester,
      NotificationSummary.NotificationTypeEnum notificationType,
      String notification) {

    try {
      switch (notificationType) {
        case RECEIVED_RESPONSE:
          ingester.ingestReceivedResponse(ReceivedResponseDocument.Factory.parse(notification));
          return;
        case RECEIVED_FAULT:
          ingester.ingestReceivedFault(ReceivedFaultDocument.Factory.parse(notification));
          return;
        case INVOKING_WORKFLOW:
          ingester.ingestInvokingWorkflow(InvokingWorkflowDocument.Factory.parse(notification));
          return;
        case INVOKING_SERVICE:
          ingester.ingestInvokingService(InvokingServiceDocument.Factory.parse(notification));
          return;
        case INVOKING_WORKFLOW_STATUS:
          ingester.ingestInvokingWorkflowStatus(
              InvokingWorkflowStatusDocument.Factory.parse(notification));
          return;
        case INVOKING_SERVICE_STATUS:
          ingester.ingestInvokingServiceStatus(
              InvokingServiceStatusDocument.Factory.parse(notification));
          return;
        case WORKFLOW_INITIALIZED:
          ingester.ingestWorkflowInitialized(
              WorkflowInitializedDocument.Factory.parse(notification));
          return;
        case SERVICE_INITIALIZED:
          ingester.ingestServiceInitialized(ServiceInitializedDocument.Factory.parse(notification));
          return;
        case WORKFLOW_TERMINATED:
          ingester.ingestWorkflowTerminated(WorkflowTerminatedDocument.Factory.parse(notification));
          return;
        case SERVICE_TERMINATED:
          ingester.ingestServiceTerminated(ServiceTerminatedDocument.Factory.parse(notification));
          return;
        case SERVICE_INVOKED:
          ingester.ingestServiceInvoked(ServiceInvokedDocument.Factory.parse(notification));
          return;
        case WORKFLOW_INVOKED:
          ingester.ingestWorkflowInvoked(WorkflowInvokedDocument.Factory.parse(notification));
          return;
        case DATA_CONSUMED:
          ingester.ingestDataConsumed(DataConsumedDocument.Factory.parse(notification));
          return;
        case DATA_PRODUCED:
          ingester.ingestDataProduced(DataProducedDocument.Factory.parse(notification));
          return;
        case DATA_UPDATED:
          ingester.ingestDataUpdated(DataUpdatedDocument.Factory.parse(notification));
          return;
        case WORKFLOW_FAILED:
          ingester.ingestWorkflowFailed(WorkflowFailedDocument.Factory.parse(notification));
          return;
        case DATA_DELETED:
          ingester.ingestDataDeleted(DataDeletedDocument.Factory.parse(notification));
          return;
        case SENDING_RESPONSE:
          ingester.ingestSendingResponse(SendingResponseDocument.Factory.parse(notification));
          return;
        case SENDING_RESPONSE_STATUS:
          ingester.ingestSendingResponseStatus(
              SendingResponseStatusDocument.Factory.parse(notification));
          return;
        case DATA_SEND_STARTED:
          ingester.ingestDataSendStarted(DataSendStartedDocument.Factory.parse(notification));
          return;
        case DATA_SEND_FINISHED:
          ingester.ingestDataSendFinished(DataSendFinishedDocument.Factory.parse(notification));
          return;
        case DATA_RECEIVED_STARTED:
          ingester.ingestDataReceivedStarted(
              DataReceivedStartedDocument.Factory.parse(notification));
          return;
        case DATA_RECEIVED_FINISHED:
          ingester.ingestDataReceivedFinished(
              DataReceivedFinishedDocument.Factory.parse(notification));
          return;
        case SENDING_FAULT:
          ingester.ingestSendingFault(SendingFaultDocument.Factory.parse(notification));
          return;
        case ADD_ANNOTATION:
          ingester.addAnnotation(AddAnnotationDocument.Factory.parse(notification));
          return;
        case ADD_ANNOTATION_BY_ID:
          ingester.addAnnotationById(AddAnnotationByIdDocument.Factory.parse(notification));
          return;
        case ADD_MULTIPLE_OBJECT_ANNOTATION:
          ingester.addMultipleObjectAnnotation(
              AddMultipleObjectAnnotationDocument.Factory.parse(notification));
          return;
        case ADD_RELATIONSHIP_ANNOTATION_BY_ID:
          ingester.addRelationshipAnnotationById(
              AddRelationshipAnnotationByIdDocument.Factory.parse(notification));
          return;
        case UNKNOWN_TYPES:
          ingester.ingestUnknownNotification(UnknownDocument.Factory.parse(notification));
          return;
        default:
          return;
      }
    } catch (IngestException e1) {
      e1.printStackTrace();
      l.error("Ingest Exception.");
      l.error(e1.getStackTrace());
    } catch (XmlException e) {
      l.error("XML Exception.");
      l.error(e.getStackTrace());
    }
  }