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

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


    // ---------------------------
    // wsdl:binding
    // ---------------------------
    else if (serviceReference.getWSDLElement().isBinding())
    {
      WSDLElement wsdlElement = serviceReference.getWSDLElement();
      // Find the binding element
      if (wsdlElement.getQName() != null
        && wsdlElement.getQName().getLocalPart() != null
        && wsdlElement.getQName().getLocalPart().length() > 0)
      {
        if (((binding =
          definition.getBinding(serviceReference.getWSDLElement().getQName()))
          == null)
          || (binding.isUndefined()))
View Full Code Here


                  binding == null ? null : binding.getQName().getLocalPart();
                String namespace =
                  binding == null ? null : binding.getQName().getNamespaceURI();

            // Get WSDL binding from the overviewURL and set in analyzerContext
            WSDLElement wsdlElement = new WSDLElementImpl();
            wsdlElement.setName(bindingName);
            wsdlElement.setNamespace(namespace);
            wsdlElement.setType(WSDLValidator.TYPE_DESCRIPTION_BINDING);
            analyzerContext.getServiceReference().setWSDLElement(wsdlElement);
          }
          return wsdlDoc;

      } catch (Exception e) {
View Full Code Here

        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);
        }
View Full Code Here

    throws WSIException
  {

    // ADD: check for null document?

    WSDLElement wsdlElement = serviceReference.getWSDLElement();

    this.wsdlDocument = wsdlDocument;

    /*
     * Generalised fields independent of wsdlElement:
     */
    // ADD: check whether these need to be either expanded or filtered down.
    // Assume WSDL4J pulls int the full tree at the root document for now   
    //this.imports = wsdlDocument.getImports();

    // ... or if only down to first level....
    this.imports =
      (Import[]) getAllImports(
        wsdlDocument.getDefinitions()).toArray(new Import[] {
    });

    /* Definitions.
     * Note that the the first array element is for the root doc
     * which contains all WSDL elements in scope via <import> declarations,
     * as well as the root document itself. Therefore the second definitions
     * array element and above are redundant, but *may* prove useful to the assertion
     * code.
     */

    this.definitions = new Definition[imports.length + 1];
    // allow room for root doc   

    this.definitions[0] = wsdlDocument.getDefinitions(); // root document   

    // Allocate array for types elements
    Types[] tempTypes = new Types[definitions.length];

    int typesCount = 0;

    if (definitions[0].getTypes() != null)
    {
      tempTypes[0] = this.definitions[0].getTypes(); // root document 
      typesCount++;
    }

    // Definitions from other (imported) wsdls correlating to the candidate
    // Only one level down for now
    for (int i = 0; i < imports.length; i++)
    {
      if (((definitions[i + 1] = imports[i].getDefinition()) != null)
        && (definitions[i + 1].getTypes() != null))
      {
        tempTypes[typesCount] = definitions[i + 1].getTypes();
        typesCount++;
      }
    }

    if (typesCount > 0)
    {
      this.types = new Types[typesCount];

      for (int i = 0; i < typesCount; i++)
        this.types[i] = tempTypes[i];
    }
    /*
     * Populate element hierachy:
     * Port
     * Binding
     * PortType
     * operation(s)
     * message(s)
     */

    if (wsdlElement.isPort())
    {

      Port port = null;

      // Use parentElementName to qualify the port within a service.   
      QName serviceName = wsdlElement.getParentElementQName();
      Service[] s = wsdlDocument.getServices();
      String portName = wsdlElement.getName();
      for (int i = 0; i < s.length && port == null; i++)
      {
        if (s[i].getQName().equals(serviceName))
        {
          port = s[i].getPort(portName);
        }
      }

      if (port == null)
      {
        throw new WSIException(
          "WSDL Port \'"
            + portName
            + "\' for Service \'"
            + serviceName
            + "\' not found in service description");
      }
      else
      {
        this.ports = new Port[] { port };
        // ADD: do serviceLocation check for soapbind:address?
        descendents(port);
      }

      // ADD: the following could be instantiated here instead to refine context info
      // definitions
      // imports
      // types

    }

    else if (wsdlElement.isBinding())
    {
      if (wsdlElement.getQName() != null
        && wsdlElement.getQName().getLocalPart() != null
        && wsdlElement.getQName().getLocalPart().length() > 0)
      {
        Binding binding =
          wsdlDocument.getDefinitions().getBinding(wsdlElement.getQName());

        if (binding == null)
        {
          throw new WSIException(
            "WSDL Binding named \'"
              + wsdlElement.getQName()
              + "\' not found in service description");
        }
        else
        {
          this.bindings = new Binding[] { binding };

          // the rest ... below binding: 
          // portTypes from binding
          // operations from portTypes
          // messages from operations
          descendents(binding);

          // above binding:
          // ports
          // definitions, imports, types (future?)       
          // ancestors(bindings);
        }
      }
    }

    else if (wsdlElement.isPortType())
    {

      PortType portType =
        wsdlDocument.getDefinitions().getPortType(wsdlElement.getQName());
      this.portTypes = new PortType[] { portType };

      if (portType == null)
      {
        throw new WSIException(
          "WSDL PortType named \'"
            + wsdlElement.getQName()
            + "\' not found in service description");
      }
      else
      {
        this.portTypes = new PortType[] { portType };
        // the rest ... below portType: 
        descendents(portType);

        // above portType:
        // ports
        // definitions, imports, types (future) ?
        //ancestors(portTypes);   
      }
    }
    else if (wsdlElement.isOperation())
    {

      Operation operation = null;
      String configOpName = wsdlElement.getName();

      // Use parentElementName to qualify the operation within a portType.
      QName portTypeName = wsdlElement.getParentElementQName();
      PortType[] p = wsdlDocument.getPortTypes();
      for (int i = 0; i < p.length && operation == null; i++)
      {
        if (p[i].getQName().equals(portTypeName))
        {
          // wsdl4j available method call below implies that only
          // name+inputname+outputname uniquely defines operation!
          // Since we do not have <input> & <output> name information
          // available in the config, use this instead for now: -
          // Get the first operation we find:
          Iterator opIt = p[i].getOperations().iterator();
          Operation op = null;
          while (opIt.hasNext() && operation == null)
          {
            op = (Operation) opIt.next();
            if (configOpName.equals(op.getName()))
            {
              operation = op;
            }
          }
        }
      }

      if (operation == null)
      {
        throw new WSIException(
          "No WSDL Operation named \'"
            + wsdlElement.getQName()
            + "\' found in service description");
      }
      else
      {
        this.operations = new Operation[] { operation };

        descendents(operation);
        //ancestors(operations);
      }
    }

    else if (wsdlElement.isMessage())
    {

      Message message =
        wsdlDocument.getDefinitions().getMessage(wsdlElement.getQName());
      if (message == null)
      {
        throw new WSIException(
          "No WSDL Message named \'"
            + wsdlElement.getQName()
            + "\' found in service description");
      }
      else
      {
        this.messages = new Message[] { message };

        //ancestors(messages);
      }
    }

    else
    {
      throw new WSIException(
        "Unrecognised <WSDLElement type> in config: " + wsdlElement.getType());
    }

    // get info about the effective service location (s)
    //this.endPoints = deriveEndpoints(analyzerConfig, this.ports, this.definitions);
    this.endPoints =
View Full Code Here

  {
    try
    {
      WSDLReference wsdlReference = new WSDLReferenceImpl();

      WSDLElement wsdlElement = (WSDLElement) new WSDLElementImpl();
      wsdlElement.setType(elementType);
      if (parentName != null)
      {
        wsdlElement.setParentElementName(parentName);
      }
      wsdlElement.setNamespace(namespace);
      wsdlElement.setName(elementName);
      wsdlReference.setWSDLElement(wsdlElement);

      wsdlReference.setWSDLLocation(wsdlURI);
      DocumentFactory documentFactory = DocumentFactory.newInstance();
      // Initialize the BasicProfileAnalyzer using an analyzerconfig object
View Full Code Here

    // Set the WSDL document location in analyzerContext
    ServiceReference serviceReference =
      this.analyzerContext.getServiceReference();

    // If the wsdlElement does not exist, then set it
    WSDLElement wsdlElement;
    if ((wsdlElement = serviceReference.getWSDLElement()) == null)
    {
      // Get the WSDL binding from the overviewURL and set in analyzerContext
      wsdlElement = new WSDLElementImpl();
      wsdlElement.setName(bindingName);
      wsdlElement.setNamespace(namespace);
      wsdlElement.setType(WSDLValidator.TYPE_DESCRIPTION_BINDING);
    }

    // Set the wsdlElement in the service reference
    serviceReference.setWSDLElement(wsdlElement);
View Full Code Here

          || (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)
        {
View Full Code Here

  /**
   * Parse WSDL element.
   */
  private WSDLElement parseWsdlElement(Element element) throws WSIException
  {
    WSDLElement wsdlElement = new WSDLElementImpl();

    // Set type, namespace, parent element name and name
    wsdlElement.setType(
      XMLUtils.getAttributeValue(element, WSIConstants.ATTR_TYPE));
    wsdlElement.setNamespace(
      XMLUtils.getAttributeValue(element, WSIConstants.ATTR_NAMESPACE));
    wsdlElement.setParentElementName(
      XMLUtils.getAttributeValue(
        element,
        WSIConstants.ATTR_PARENT_ELEMENT_NAME));

    String wsdlElementName = XMLUtils.getText(element);
    if (wsdlElementName.equals(""))
    {
      // Throw exception
      throw new IllegalArgumentException(
        getMessage("config19", "The WSDL element name must be specified."));
    }
    wsdlElement.setName(wsdlElementName);

    return wsdlElement;
  }
View Full Code Here

TOP

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

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.