Package org.eclipse.wst.wsi.internal.core.analyzer.config

Examples of org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig


    {
    if (wsiPreferences.getComplianceLevel() != WSITestToolsEclipseProperties.IGNORE_NON_WSI)
    {
        DocumentFactory documentFactory = DocumentFactory.newInstance();
        // Initialize the BasicProfileAnalyzer using an analyzerconfig object
        AnalyzerConfig analyzerconfig = documentFactory.newAnalyzerConfig();
        if(wsdlspecified)
        {
          WSDLReference wsdlref = new WSDLReferenceImpl();
          wsdlref.setWSDLLocation(wsdlfile);
       
          WSDLElement wsdlelem = new WSDLElementImpl();
          wsdlelem.setName(elementname);
          wsdlelem.setNamespace(namespace);
          wsdlelem.setParentElementName(parentname);
          wsdlelem.setType(type);
       
          wsdlref.setWSDLElement(wsdlelem);
       
          analyzerconfig.setWSDLReference(wsdlref);
        }

        AssertionResultsOption aro = new AssertionResultsOptionImpl();
        aro.setAssertionResultType(AssertionResultType.newInstance(NOTPASSED));
        aro.setShowAssertionDescription(false);
        aro.setShowFailureDetail(false);
        aro.setShowFailureMessage(false);
        aro.setShowMessageEntry(false);

        // although we don't use a stylesheet for our application it is required or the
        // WS-I tools will fail
        AddStyleSheet addstylesheet = new AddStyleSheetImpl();

        analyzerconfig.setAssertionResultsOption(aro);
        analyzerconfig.setAddStyleSheet(addstylesheet);
     
        analyzerconfig.setCorrelationType("endpoint");
        try
    {
      analyzerconfig.setLogLocation(URIEncoder.encode(filename, "UTF8"));
      analyzerconfig.setTestAssertionsDocumentLocation(wsiPreferences.getTADFile());
    }
    catch (UnsupportedEncodingException uee)
    {
      analyzerconfig.setLogLocation(URIEncoder.encode(filename, "UTF8"));
        analyzerconfig.setTestAssertionsDocumentLocation(URIEncoder.encode(wsiPreferences.getTADFile(), "UTF8"));
    }
        //analyzerconfig.setLogLocation(filename);
        //analyzerconfig.setTestAssertionsDocumentLocation(getBasicProfileTestAssertionsFile());
        analyzerconfig.setVerboseOption(false);
     

        List analyzerConfigs = new Vector();
        analyzerConfigs.add(analyzerconfig);
        // here's where the validation actually starts happening
View Full Code Here


      wsdlReference.setWSDLElement(wsdlElement);

      wsdlReference.setWSDLLocation(wsdlURI);
      DocumentFactory documentFactory = DocumentFactory.newInstance();
      // Initialize the BasicProfileAnalyzer using an analyzerconfig object
      AnalyzerConfig analyzerconfig = documentFactory.newAnalyzerConfig();

      AssertionResultsOption aro = new AssertionResultsOptionImpl();
      aro.setAssertionResultType(AssertionResultType.newInstance(NOTPASSED));
      aro.setShowAssertionDescription(false);
      aro.setShowFailureDetail(false);
      aro.setShowFailureMessage(false);
      aro.setShowMessageEntry(false);

      // although we don't use a stylesheet for our application it is required or the
      // WS-I tools will fail
      AddStyleSheet addstylesheet = new AddStyleSheetImpl();

      analyzerconfig.setAssertionResultsOption(aro);
      analyzerconfig.setAddStyleSheet(addstylesheet);
      analyzerconfig.setReplaceReport(true);
      //analyzerconfig.setLogLocation(filename);
      analyzerconfig.setTestAssertionsDocumentLocation(wsiPreferences.getTADFile());
      analyzerconfig.setVerboseOption(false);

      // set the wsdlReference
      analyzerconfig.setWSDLReference(wsdlReference);
      analyzerConfigs.add(analyzerconfig);
    }
    catch (Exception e)
    {
      throw new WSIAnalyzerException("Unable to add AnalyzerConfig to list. " + e);
View Full Code Here

    catch (Exception e){}
  }

  public static AnalyzerConfig getAnalyzerConfig(Reporter reporter)
  {
  AnalyzerConfig result = null;
  if (reporter != null)
  {
    try
    {
    result = reporter.getReport().getReportContext().getAnalyzer().getAnalyzerConfig();
View Full Code Here

    // Save log entry to be referenced by other methods
    this.logEntry = entryContext.getMessageEntry();

    // Get reference to the analyzer config object
    AnalyzerConfig analyzerConfig =
      reporter.getReport().getReportContext().getAnalyzer().getAnalyzerConfig();

    /* If Service Description (WSDL/UDDI) NOT supplied in analyzer config OR
     * Service Description IS supplied and the current message correlates to it...
     */
    if ((!analyzerConfig.isWSDLReferenceSet())
      || messageCorrelatesToService(
        entryContext,
        analyzerConfig.getCorrelationType()))
    {
      // now inner classes moved out from the validator
      //String classPrefix = this.getClass().getName() + "$";
      String classPrefix = this.getClass().getPackage().getName()+".";

View Full Code Here

    throws WSIException
  {
    // BaseValidatorImpl
    super.init(analyzerContext, profileArtifact, reportArtifact, reporter);

    AnalyzerConfig analyzerConfig = Utils.getAnalyzerConfig(reporter);
    testable = ((analyzerConfig != null) && (analyzerConfig.isUDDIReferenceSet()))

    // Save input references
    this.uddiReference = uddiReference;
  }
View Full Code Here

    // Get new config reader
    AnalyzerConfigReader analyzerConfigReader = new AnalyzerConfigReaderImpl();
    analyzerConfigReader.init(this.messageList);

    // Analyzer config object which will be merged after all of the input parms are processed
    AnalyzerConfig analyzerConfigFromArgs = null;

    // Assertion results option
    AssertionResultsOption assertionResultsOption = null;

    // If no input arguments, then throw exception
    if (args.length == 0)
    {
      // ADD:
      throw new IllegalArgumentException(
        getMessage("usage01", Analyzer.USAGE_MESSAGE));
    }

    // Parse the command line arguments to locate the config file option (if it was specified)
    for (int argCount = 0; argCount < args.length; argCount++)
    {
      // -config
      if ((args[argCount].equalsIgnoreCase("-config"))
        || (args[argCount].equals("-c")))
      {
        argCount++;
        analyzerConfigFromArgs =
          analyzerConfigReader.readAnalyzerConfig(
            getOptionValue(args, argCount));
      }
    }

    // If config file was not specified, then create analyzer config object
    if (analyzerConfigFromArgs == null)
    {
      analyzerConfigFromArgs = new AnalyzerConfigImpl();
      analyzerConfigFromArgs.init(this.messageList);
    }

    // Get assertion results option
    if ((assertionResultsOption =
      analyzerConfigFromArgs.getAssertionResultsOption())
      == null)
    {
      assertionResultsOption = new AssertionResultsOptionImpl();
      analyzerConfigFromArgs.setAssertionResultsOption(assertionResultsOption);
    }

    // Parse all of the command line arguments
    for (int argCount = 0; argCount < args.length; argCount++)
    {
      // -config
      if ((args[argCount].equalsIgnoreCase("-config"))
        || (args[argCount].equals("-c")))
      {
        // Skip this option since it was already processed
        argCount++;
      }

      // -verbose
      else if (
        (args[argCount].equalsIgnoreCase("-verbose"))
          || (args[argCount].equals("-v")))
      {
        argCount++;
        analyzerConfigFromArgs.setVerboseOption(
          Boolean.valueOf(getOptionValue(args, argCount)).booleanValue());
      }

      // -assertionResults
      else if (
        (args[argCount].equalsIgnoreCase("-assertionResults"))
          || (args[argCount].equals("-a")))
      {
        argCount++;
        assertionResultsOption.setAssertionResultType(
          AssertionResultType.newInstance(getOptionValue(args, argCount)));
      }

      // -messageEntry
      else if (
        (args[argCount].equalsIgnoreCase("-messageEntry"))
          || (args[argCount].equals("-M")))
      {
        argCount++;
        assertionResultsOption.setShowMessageEntry(
          Boolean.valueOf(getOptionValue(args, argCount)).booleanValue());
      }

      // -assertionDescription
      else if (
        (args[argCount].equalsIgnoreCase("-assertionDescription"))
          || (args[argCount].equals("-A")))
      {
        argCount++;
        assertionResultsOption.setShowAssertionDescription(
          Boolean.valueOf(args[argCount]).booleanValue());
      }

      // -failureMessage
      else if (
        (args[argCount].equalsIgnoreCase("-failureMessage"))
          || (args[argCount].equals("-F")))
      {
        argCount++;
        assertionResultsOption.setShowFailureMessage(
          Boolean.valueOf(getOptionValue(args, argCount)).booleanValue());
      }

      // -failureDetail
      else if (
        (args[argCount].equalsIgnoreCase("-failureDetail"))
          || (args[argCount].equals("-D")))
      {
        argCount++;
        assertionResultsOption.setShowFailureDetail(
          Boolean.valueOf(getOptionValue(args, argCount)).booleanValue());
      }

      // -logFile
      else if (
        (args[argCount].equalsIgnoreCase("-logFile"))
          || (args[argCount].equals("-l")))
      {
        argCount++;
        analyzerConfigFromArgs.setLogLocation(getOptionValue(args, argCount));
      }

      // -testAssertionFile
      else if (
        (args[argCount].equalsIgnoreCase("-testAssertionFile"))
          || (args[argCount].equals("-t")))
      {
        argCount++;
        analyzerConfigFromArgs.setTestAssertionsDocumentLocation(
          getOptionValue(args, argCount));
      }

      // -reportFile
      else if (
        (args[argCount].equalsIgnoreCase("-reportFile"))
          || (args[argCount].equals("-r")))
      {
        argCount++;
        analyzerConfigFromArgs.setReportLocation(
          getOptionValue(args, argCount));
      }

      // -replace
      else if (
        (args[argCount].equalsIgnoreCase("-replace"))
          || (args[argCount].equals("-R")))
      {
        argCount++;
        analyzerConfigFromArgs.setReplaceReport(
          Boolean.valueOf(getOptionValue(args, argCount)).booleanValue());
      }

      // -correlationType
      else if (
        (args[argCount].equalsIgnoreCase("-correlationType"))
          || (args[argCount].equals("-C")))
      {
        argCount++;
        analyzerConfigFromArgs.setCorrelationType(
          getOptionValue(args, argCount));
      }

      // -wsdlElement
      else if (
        (args[argCount].equalsIgnoreCase("-wsdlElement"))
          || (args[argCount].equals("-W")))
      {
        String optionName = args[argCount];
        argCount++;

        WSDLElement wsdlElement = new WSDLElementImpl();
        wsdlElement.setName(getOptionValue(args, argCount, optionName));
        argCount++;
        wsdlElement.setType(getOptionValue(args, argCount, optionName));
        argCount++;
        wsdlElement.setNamespace(getOptionValue(args, argCount, optionName));
        if (!args[argCount].startsWith("-"))
        {
          argCount++;
          wsdlElement.setParentElementName(
            getOptionValue(args, argCount, optionName));
        }

        if (wsdlReference != null)
        {
          wsdlReference.setWSDLElement(wsdlElement);
        }
        else if (uddiReference != null)
        {
          uddiReference.setWSDLElement(wsdlElement);
        }
        else
        {
          throw new IllegalArgumentException(
            getMessage(
              "config10",
              "The -wsdlElement option must appear after the -wsdlURI or -uddiKey options."));
        }

        analyzerConfigFromArgs.setWSDLReference(wsdlReference);
      }

      // -serviceLocation
      else if (
        (args[argCount].equalsIgnoreCase("-serviceLocation"))
          || (args[argCount].equals("-S")))
      {
        argCount++;

        if (wsdlReference != null)
        {
          wsdlReference.setServiceLocation(getOptionValue(args, argCount));
        }
        else if (uddiReference != null)
        {
          uddiReference.setServiceLocation(getOptionValue(args, argCount));
        }
        else
        {
          throw new IllegalArgumentException(
            getMessage(
              "config11",
              "The -serviceLocation option must appear after the -wsdlURI or -uddiKey options."));
        }
      }

      // -wsdlURI
      else if (
        (args[argCount].equalsIgnoreCase("-wsdlURI"))
          || (args[argCount].equals("-W")))
      {
        argCount++;
        if (wsdlReference == null)
          wsdlReference = new WSDLReferenceImpl();
        wsdlReference.setWSDLLocation(getOptionValue(args, argCount));
        analyzerConfigFromArgs.setWSDLReference(wsdlReference);
      }

      // -uddiKeyType
      else if (
        (args[argCount].equalsIgnoreCase("-uddiKeyType"))
          || (args[argCount].equals("-K")))
      {
        argCount++;
        if (uddiReference == null)
          uddiReference = new UDDIReferenceImpl();
        uddiReference.setKeyType(getOptionValue(args, argCount));
        analyzerConfigFromArgs.setUDDIReference(uddiReference);
      }

      // -uddiKey
      else if (
        (args[argCount].equalsIgnoreCase("-uddiKey"))
          || (args[argCount].equals("-k")))
      {
        argCount++;
        if (uddiReference == null)
          uddiReference = new UDDIReferenceImpl();
        uddiReference.setKey(getOptionValue(args, argCount));
        analyzerConfigFromArgs.setUDDIReference(uddiReference);
      }

      // -inquiryURL
      else if (
        (args[argCount].equalsIgnoreCase("-inquiryURL"))
          || (args[argCount].equals("-i")))
      {
        argCount++;
        if (uddiReference == null)
          uddiReference = new UDDIReferenceImpl();
        uddiReference.setInquiryURL(getOptionValue(args, argCount));
        analyzerConfigFromArgs.setUDDIReference(uddiReference);
      }

      // ADD: Need to add support for other options (-config, -binding, etc.)
      else
      {
        throw new IllegalArgumentException(
          getMessage(
            "config12",
            args[argCount],
            "The specified option is not supported:"));
      }
    }

    // If addStyleSheet was not specified, then create a comment version of it
    if (analyzerConfigFromArgs.getAddStyleSheet() == null)
    {
      AddStyleSheet addStyleSheet = new AddStyleSheetImpl();
      addStyleSheet.setHref(WSIConstants.DEFAULT_REPORT_XSL);
      addStyleSheet.setType(WSIConstants.DEFAULT_XSL_TYPE);
      addStyleSheet.setComment(true);
      analyzerConfigFromArgs.setAddStyleSheet(addStyleSheet);
    }

    // Merge config info into this object
    setConfig(analyzerConfigFromArgs);
View Full Code Here

  /**
   * @see org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfigReader#readAnalyzerConfig(Reader)
   */
  public AnalyzerConfig readAnalyzerConfig(Reader reader) throws WSIException
  {
    AnalyzerConfig analyzerConfig = new AnalyzerConfigImpl();

    // Parse XML
    Document doc = XMLUtils.parseXML(reader);

    // Parse elements in the config document
View Full Code Here

TOP

Related Classes of org.eclipse.wst.wsi.internal.core.analyzer.config.AnalyzerConfig

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.