Package org.dtk.resources.dependencies

Examples of org.dtk.resources.dependencies.InputType


   
    // Process form submission, parsing text strings from values.
    MultivaluedMap<String, Object> formFields = HttpUtil.retrieveMultiPartFormValues(multiPartForm, String.class);

    // Check request contains valid input parameters, value and type.
    InputType inputType = retrieveInputType(formFields);
    String inputValue = retrieveInputValue(formFields);
   
    logger.log(Level.INFO, String.format(analyseDependenciesLogMsg, inputType.name(), inputValue));
   
    // Invoke analysis based upon input type (web_page, url or profile).
    switch(inputType) {
    case WEB_PAGE:
      moduleAnalysis = analyseModulesFromWebpage(inputValue);
      break;
    case URL:
      moduleAnalysis = analyseModulesFromUrl(inputValue);
      break;
    }

    // Convert Java Map to Json object and then encode inside HTML.
    // If parsing errors are thrown, return an internal server error
    // HTTP response.
    try {           
      DependenciesResponse response;
      String customPackageIdentifier = null;
     
      if (moduleAnalysis instanceof RecursiveModuleAnalysis) {
        customPackageIdentifier = createTemporaryPackageForRetrievedSource((RecursiveModuleAnalysis) moduleAnalysis);
      }
     
      if (customPackageIdentifier != null) {
        response = new ExplicitModuleFormatAnalysisDependenciesResponse(moduleAnalysis,
          customPackageIdentifier, ModuleFormat.NON_AMD)
      } else {
        response = new ExplicitModuleFormatAnalysisDependenciesResponse(moduleAnalysis, ModuleFormat.NON_AMD);
      }
     
      encodedJson = JsonUtil.writeJavaToHtmlEncodedJson(response);
    } catch (FatalAnalysisError e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);
    } catch (JsonParseException e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);
    } catch (JsonMappingException e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);
    } catch (IOException e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);     
    } catch (UnknownModuleIdentifier e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);   
    } catch (ModuleSourceNotAvailable e) {
      logger.log(Level.SEVERE, String.format(errorGeneratingJsonLogMsg, inputType.name(), inputValue));         
      throw new ConfigurationException(internalServerErrorText);   
    }

    logger.exiting(this.getClass().getName(), "analyseDependencies");
   
View Full Code Here


   * @return
   * @throws IncorrectParameterException
   */
  protected InputType retrieveInputType(MultivaluedMap<String, Object> request)
  throws IncorrectParameterException {
    InputType type;

    try {
      String typeStr = (String) request.getFirst(typeParameter);
      type = InputType.valueOf(typeStr.toUpperCase());
    } catch (NullPointerException npe) {
View Full Code Here

TOP

Related Classes of org.dtk.resources.dependencies.InputType

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.