コード例 #1
0
  @Override
  public GetWorkflowGraphResponseDocument getWorkflowGraph(
      GetWorkflowGraphRequestDocument getWorkflowGraphRequest) {

    log.info(getWorkflowGraphRequest);
    GetWorkflowGraphResponseDocument getWorkflowGraphResponseDocument = null;

    try {
      getWorkflowGraphResponseDocument = querier.getWorkflowGraph(getWorkflowGraphRequest);
    } catch (QueryException qe) {
      log.error("Failed to query getWorkflowGraph");
    }

    return getWorkflowGraphResponseDocument;
  }
コード例 #2
0
  public static String queryProvenance(QueryImplementer querier, XmlObject query) {
    try {
      QueryTypeEnum QueryType = QueryTypeEnum.determineQueryTypeFromXmlBeansDocument(query);
      switch (QueryType) {
        case COMPARE_WORKFLOW_GRAPHS:
          CompareWorkflowGraphsResponseDocument compareWorkflowGraphsResponseDocument = null;

          try {
            compareWorkflowGraphsResponseDocument =
                querier.compareWorkflowGraphs((CompareWorkflowGraphsRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in compareWorkflowGraphs().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return compareWorkflowGraphsResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case FIND_ABSTRACT_DATA_PRODUCT:
          FindAbstractDataProductResponseDocument findAbstractDataProductResponseDocument = null;

          try {
            findAbstractDataProductResponseDocument =
                querier.findAbstractDataProduct((FindAbstractDataProductRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findAbstractDataProduct().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findAbstractDataProductResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case FIND_ABSTRACT_METHOD:
          FindAbstractMethodResponseDocument findAbstractMethodResponseDocument = null;

          try {
            findAbstractMethodResponseDocument =
                querier.findAbstractMethod((FindAbstractMethodRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findAbstractMethod().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findAbstractMethodResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case FIND_ABSTRACT_SERVICE:
          FindAbstractServiceResponseDocument findAbstractServiceResponseDocument = null;

          try {
            findAbstractServiceResponseDocument =
                querier.findAbstractService((FindAbstractServiceRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findAbstractService().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findAbstractServiceResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case FIND_DATA_PRODUCT:
          FindDataProductResponseDocument findDataProductResponseDocument = null;

          try {
            findDataProductResponseDocument =
                querier.findDataProduct((FindDataProductRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findDataProduct().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findDataProductResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case FIND_METHOD_INVOCATION:
          FindMethodInvocationResponseDocument findMethodInvocationResponseDocument = null;

          try {
            findMethodInvocationResponseDocument =
                querier.findMethodInvocation((FindMethodInvocationRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findMethodInvocation().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findMethodInvocationResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case FIND_SERVICE:
          FindServiceResponseDocument findServiceResponseDocument = null;

          try {
            findServiceResponseDocument = querier.findService((FindServiceRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in findService().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return findServiceResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case GET_ABSTRACT_DATA_PRODUCT_DETAIL:
          GetAbstractDataProductDetailResponseDocument
              getAbstractDataProductDetailResponseDocument = null;

          try {
            getAbstractDataProductDetailResponseDocument =
                querier.getAbstractDataProductDetail(
                    (GetAbstractDataProductDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getAbstractDataProductDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getAbstractDataProductDetailResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_ABSTRACT_METHOD_DETAIL:
          GetAbstractMethodDetailResponseDocument getAbstractMethodDetailResponseDocument = null;

          try {
            getAbstractMethodDetailResponseDocument =
                querier.getAbstractMethodDetail((GetAbstractMethodDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getAbstractMethodDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getAbstractMethodDetailResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_ABSTRACT_SERVICE_DETAIL:
          GetAbstractServiceDetailResponseDocument getAbstractServiceDetailResponseDocument = null;

          try {
            getAbstractServiceDetailResponseDocument =
                querier.getAbstractServiceDetail((GetAbstractServiceDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getAbstractServiceDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getAbstractServiceDetailResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_ANNOTATION_DETAIL:
          GetAnnotationDetailResponseDocument getAnnotationDetailResponseDocument = null;

          try {
            getAnnotationDetailResponseDocument =
                querier.getAnnotationDetail((GetAnnotationDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getAnnotationDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getAnnotationDetailResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case GET_CLIENT_DETAIL:
          GetClientDetailResponseDocument getClientDetailResponseDocument = null;

          try {
            getClientDetailResponseDocument =
                querier.getClientDetail((GetClientDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getClientDetail()");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getClientDetailResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case GET_DATA_PRODUCT_DETAIL:
          GetDataProductDetailResponseDocument getDataProductDetailResponseDocument = null;

          try {
            getDataProductDetailResponseDocument =
                querier.getDataProductDetail((GetDataProductDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getDataProductDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getDataProductDetailResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_SERVICE_DETAIL:
          GetServiceDetailResponseDocument getServiceDetailResponseDocument = null;

          try {
            getServiceDetailResponseDocument =
                querier.getServiceDetail((GetServiceDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getServiceDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getServiceDetailResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case GET_METHOD_INVOCATION_DETAIL:
          GetMethodInvocationDetailResponseDocument getMethodInvocationDetailResponseDocument =
              null;

          try {
            getMethodInvocationDetailResponseDocument =
                querier.getMethodInvocationDetail((GetMethodInvocationDetailRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getMethodInvocationDetail().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }

          return getMethodInvocationDetailResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_WORKFLOW_GRAPH:
          /*
          String instanceID = ((GetOPMDocument)query).getGetOPM().getIn();
          Connection connection = null;
          OpmGraphDocument opmGraphDoc = null;
          try {
              connection = DBConnectionPool.getInstance().getEntry();
              opmGraphDoc = QueryByWorkflowURIUtil.getOPMGraphDocument(connection, instanceID);
          } finally {
              if (connection != null) {
                  DBConnectionPool.getInstance().releaseEntry(connection);
              }
          }
          return opmGraphDoc.xmlText(new XmlOptions().setSavePrettyPrint());
          */

          GetWorkflowGraphResponseDocument getWorkflowGraphResponseDocument = null;

          try {
            getWorkflowGraphResponseDocument =
                querier.getWorkflowGraph((GetWorkflowGraphRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getWorkflowGraph().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }
          return getWorkflowGraphResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case GET_PROVENANCE_HISTORY:
          GetProvenanceHistoryResponseDocument getProvenanceHistoryResponseDocument = null;
          try {
            getProvenanceHistoryResponseDocument =
                querier.getProvenanceHistory((GetProvenanceHistoryRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getProvenanceHistory().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }
          return getProvenanceHistoryResponseDocument.xmlText(
              new XmlOptions().setSavePrettyPrint());

        case GET_NODE_COUNT_OF_GRAPH:
          GetNodeCountOfGraphResponseDocument getNodeCountOfGraphResponseDocument = null;
          try {
            getNodeCountOfGraphResponseDocument =
                querier.getNodeCountOfGraph((GetNodeCountOfGraphRequestDocument) query);
          } catch (QueryException qe) {
            l.error("Error in getNodeCountOfGraph().");
            l.error(qe.getMessage());
            return ERROR_STRING + ": " + qe.getMessage();
          }
          return getNodeCountOfGraphResponseDocument.xmlText(new XmlOptions().setSavePrettyPrint());

        case UNKNOWN_TYPES:
          l.error("Unknown query type.");
          return "Unknown Query";
        default:
          l.error("Unknown query type.");
          return "Unknown Query";
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return "[Exception in queryProvenance]" + e.getMessage();
    }
  }