Package ca.carleton.gcrc.couch.export.ExportUtils

Examples of ca.carleton.gcrc.couch.export.ExportUtils.Method


      }
      logger.debug("Export Filter: "+filter.name());
    }
   
    // Parse method
    Method method = null;
    {
      String methodStr = request.getParameter("method");
      if( null != methodStr ) {
        for(Method m : Method.values()){
          if( m.matches(methodStr) ){
            method = m;
          }
        }
      }
     
      if( null == method ) {
        Exception e = new Exception("Unknown method");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Method: "+method.name());
    }
   
    // Parse identifier
    String identifier = null;
    List<String> identifiers = new Vector<String>();
    {
      String[] ids = request.getParameterValues("name");
      if( null != ids ) {
        for(String id : ids){
          identifiers.add(id);
        }
      }
     
      if( identifiers.size() > 0 ) {
        identifier = identifiers.get(0);
      }
     
      if( null == identifier ) {
        Exception e = new Exception("Unknown name");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Name: "+identifier);
    }
   
    // Build doc retrieval based on method
    DocumentRetrieval docRetrieval = null;
    if( Method.LAYER == method ) {
      try {
        docRetrieval = DocumentRetrievalLayer.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from layer: "+identifier,e);
      }
     
    } else if( Method.SCHEMA == method ) {
      try {
        docRetrieval = DocumentRetrievalSchema.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from schema: "+identifier,e);
      }
     
    } else if( Method.DOC_ID == method ) {
      try {
        docRetrieval = DocumentRetrievalId.create(configuration.getCouchDb(), identifiers);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from doc ids: "+identifiers,e);
      }
     
    } else {
      throw new ServletException("Do not know how to handle method: "+method.name());
    }
   
    // Build document filter based on filter type
    DocumentFilter docFilter = null;
    {
View Full Code Here


      }
      logger.debug("Export Filter: "+filter.name());
    }
   
    // Parse method
    Method method = null;
    {
      String methodStr = request.getParameter("method");
      if( null != methodStr ) {
        for(Method m : Method.values()){
          if( m.matches(methodStr) ){
            method = m;
          }
        }
      }
     
      if( null == method ) {
        Exception e = new Exception("Unknown method");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Method: "+method.name());
    }
   
    // Parse identifier
    String identifier = null;
    List<String> identifiers = new Vector<String>();
    {
      String[] ids = request.getParameterValues("name");
      if( null != ids ) {
        for(String id : ids){
          identifiers.add(id);
        }
      }
     
      if( identifiers.size() > 0 ) {
        identifier = identifiers.get(0);
      }
     
      if( null == identifier ) {
        Exception e = new Exception("Unknown name");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Name: "+identifier);
    }
   
    // Parse contentType
    String contentType = null;
    {
      String[] contentTypes = request.getParameterValues("contentType");
      if( null != contentTypes ) {
        for(String t : contentTypes){
          contentType = t;
        }
      }
     
      if( null != contentType ) {
        logger.debug("Content-Type: "+contentType);
      }
    }
   
    // Build doc retrieval based on method
    DocumentRetrieval docRetrieval = null;
    if( Method.LAYER == method ) {
      try {
        docRetrieval = DocumentRetrievalLayer.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from layer: "+identifier,e);
      }
     
    } else if( Method.SCHEMA == method ) {
      try {
        docRetrieval = DocumentRetrievalSchema.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from schema: "+identifier,e);
      }
     
    } else if( Method.DOC_ID == method ) {
      try {
        docRetrieval = DocumentRetrievalId.create(configuration.getCouchDb(), identifiers);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from doc ids: "+identifiers,e);
      }
     
    } else {
      throw new ServletException("Do not know how to handle method: "+method.name());
    }
   
    // Build document filter based on filter type
    DocumentFilter docFilter = null;
    {
View Full Code Here

      }
      logger.debug("Export Filter: "+filter.name());
    }
   
    // Parse method
    Method method = null;
    {
      String methodStr = request.getParameter("method");
      if( null != methodStr ) {
        for(Method m : Method.values()){
          if( m.matches(methodStr) ){
            method = m;
          }
        }
      }
     
      if( null == method ) {
        Exception e = new Exception("Unknown method");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Method: "+method.name());
    }
   
    // Parse identifier
    String identifier = null;
    List<String> identifiers = new Vector<String>();
    {
      String[] ids = request.getParameterValues("name");
      if( null != ids ) {
        for(String id : ids){
          identifiers.add(id);
        }
      }
     
      if( identifiers.size() > 0 ) {
        identifier = identifiers.get(0);
      }
     
      if( null == identifier ) {
        Exception e = new Exception("Unknown name");
        reportError(response,HttpServletResponse.SC_INTERNAL_SERVER_ERROR,e);
        return;
      }
      logger.debug("Export Name: "+identifier);
    }
   
    // Parse contentType
    String contentType = null;
    {
      String[] contentTypes = request.getParameterValues("contentType");
      if( null != contentTypes ) {
        for(String t : contentTypes){
          contentType = t;
        }
      }
     
      if( null != contentType ) {
        logger.debug("Content-Type: "+contentType);
      }
    }
   
    // Build doc retrieval based on method
    DocumentRetrieval docRetrieval = null;
    if( Method.LAYER == method ) {
      try {
        docRetrieval = DocumentRetrievalLayer.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from layer: "+identifier,e);
      }
     
    } else if( Method.SCHEMA == method ) {
      try {
        docRetrieval = DocumentRetrievalSchema.create(configuration.getCouchDb(), identifier);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from schema: "+identifier,e);
      }
     
    } else if( Method.DOC_ID == method ) {
      try {
        docRetrieval = DocumentRetrievalId.create(configuration.getCouchDb(), identifiers);
      } catch (Exception e) {
        throw new ServletException("Problem retrieving documents from doc ids: "+identifiers,e);
      }
     
    } else {
      throw new ServletException("Do not know how to handle method: "+method.name());
    }
   
    // Build document filter based on filter type
    DocumentFilter docFilter = null;
    {
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.export.ExportUtils.Method

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.