Package net.java.dev.wadl.x2009.x02.MethodDocument

Examples of net.java.dev.wadl.x2009.x02.MethodDocument.Method


              // XmlObject obj = XmlObject.Factory.parse(
              // content.replaceFirst( "<(([a-z]+:)?)fault ",
              // "<$1representation " ), options );
              XmlObject obj = XmlUtils.createXmlObject(
                  content.replaceFirst( "<(([a-z]+:)?)fault ", "<$1representation " ), options );
              RepresentationDocument representation = ( RepresentationDocument )obj
                  .changeType( RepresentationDocument.type );
              addRepresentation( response, restMethod, representation.getRepresentation() );
            }
            catch( XmlException e )
            {
            }
          }
View Full Code Here


                            // XmlObject obj = XmlObject.Factory.parse(
                            // content.replaceFirst( "<(([a-z]+:)?)fault ",
                            // "<$1representation " ), options );
                            XmlObject obj = XmlUtils.createXmlObject(
                                    content.replaceFirst("<(([a-z]+:)?)fault ", "<$1representation "), options);
                            RepresentationDocument representation = (RepresentationDocument) obj
                                    .changeType(RepresentationDocument.type);
                            addRepresentation(response, restMethod, representation.getRepresentation());
                        } catch (XmlException e) {
                        }
                    }
                }
            }
View Full Code Here

      else
      {
        response = responses.get( null );
      }

      Representation representationConfig = response.addNewRepresentation();
      generateRepresentation( representationConfig, representation );

      if( !isWADL11 && representation.getType() == RestRepresentation.Type.FAULT )
      {
        Element resp = ( Element )response.getDomNode();
        Element rep = ( Element )representationConfig.getDomNode();
        Element fault = resp.getOwnerDocument().createElementNS( Constants.WADL11_NS, "fault" );

        NamedNodeMap attributes = rep.getAttributes();
        for( int i = 0; i < attributes.getLength(); i++ )
        {
View Full Code Here

                }
            } else {
                response = responses.get(null);
            }

            Representation representationConfig = response.addNewRepresentation();
            generateRepresentation(representationConfig, representation);

            if (!isWADL11 && representation.getType() == RestRepresentation.Type.FAULT) {
                Element resp = (Element) response.getDomNode();
                Element rep = (Element) representationConfig.getDomNode();
                Element fault = resp.getOwnerDocument().createElementNS(Constants.WADL11_NS, "fault");

                NamedNodeMap attributes = rep.getAttributes();
                for (int i = 0; i < attributes.getLength(); i++) {
                    fault.setAttribute(attributes.item(i).getNodeName(), attributes.item(i).getNodeValue());
View Full Code Here

  {
    Method methodConfig = resourceConfig.addNewMethod();
    createDoc( methodConfig.addNewDoc(), restMethod );
    methodConfig.setName( restMethod.getMethod().toString() );
    methodConfig.setId( restMethod.getName() );
    Request requestConfig = methodConfig.addNewRequest();

    Map<String, RestParamProperty> defaultParams = new HashMap<String, RestParamProperty>();
    for( RestParamProperty defaultParam : restMethod.getResource().getDefaultParams() )
      defaultParams.put( defaultParam.getName(), defaultParam );

    RestParamsPropertyHolder params = restMethod.getParams();
    for( int c = 0; c < params.size(); c++ )
    {
      RestParamProperty param = params.getPropertyAt( c );
      if( !defaultParams.containsKey( param.getName() ) || !param.equals( defaultParams.get( param.getName() ) ) )
        generateParam( requestConfig.addNewParam(), param );
    }

    if( restMethod.hasRequestBody() )
    {
      for( RestRepresentation representation : restMethod.getRepresentations( RestRepresentation.Type.REQUEST, null ) )
      {
        generateRepresentation( requestConfig.addNewRepresentation(), representation );
      }
    }

    Map<String, Response> responses = new HashMap<String, Response>();
    if( !isWADL11 )
View Full Code Here

    private void generateWadlMethod(Resource resourceConfig, RestMethod restMethod) {
        Method methodConfig = resourceConfig.addNewMethod();
        createDoc(methodConfig.addNewDoc(), restMethod);
        methodConfig.setName(restMethod.getMethod().toString());
        methodConfig.setId(restMethod.getName());
        Request requestConfig = methodConfig.addNewRequest();

        Map<String, RestParamProperty> defaultParams = new HashMap<String, RestParamProperty>();
        for (RestParamProperty defaultParam : restMethod.getResource().getDefaultParams()) {
            defaultParams.put(defaultParam.getName(), defaultParam);
        }

        RestParamsPropertyHolder params = restMethod.getParams();
        for (int c = 0; c < params.size(); c++) {
            RestParamProperty param = params.getPropertyAt(c);
            if (!defaultParams.containsKey(param.getName()) || !param.equals(defaultParams.get(param.getName()))) {
                generateParam(requestConfig.addNewParam(), param);
            }
        }

        if (restMethod.hasRequestBody()) {
            for (RestRepresentation representation : restMethod.getRepresentations(RestRepresentation.Type.REQUEST, null)) {
                generateRepresentation(requestConfig.addNewRepresentation(), representation);
            }
        }

        Map<String, Response> responses = new HashMap<String, Response>();
        if (!isWADL11) {
View Full Code Here

    return applicationDocument;
  }

  private XmlObject generateWadlResource( RestResource resource )
  {
    Resource resourceConfig = Resource.Factory.newInstance();
    createDoc( resourceConfig.addNewDoc(), resource );
    String path = resource.getPath();
    if( path.startsWith( "/" ) )
      path = path.length() > 1 ? path.substring( 1 ) : "";

    resourceConfig.setPath( path );
    resourceConfig.setId( resource.getName() );

    RestParamsPropertyHolder params = resource.getParams();
    for( int c = 0; c < params.size(); c++ )
    {
      generateParam( resourceConfig.addNewParam(), params.getPropertyAt( c ) );
    }

    for( int c = 0; c < resource.getChildResourceCount(); c++ )
    {
      resourceConfig.addNewResource().set( generateWadlResource( resource.getChildResourceAt( c ) ) );
    }

    for( int c = 0; c < resource.getRestMethodCount(); c++ )
    {
      RestMethod restMethod = resource.getRestMethodAt( c );
View Full Code Here

        return applicationDocument;
    }

    private XmlObject generateWadlResource(RestResource resource) {
        Resource resourceConfig = Resource.Factory.newInstance();
        createDoc(resourceConfig.addNewDoc(), resource);
        String path = resource.getPath();
        if (path.startsWith("/")) {
            path = path.length() > 1 ? path.substring(1) : "";
        }

        resourceConfig.setPath(path);
        resourceConfig.setId(resource.getName());

        RestParamsPropertyHolder params = resource.getParams();
        for (int c = 0; c < params.size(); c++) {
            generateParam(resourceConfig.addNewParam(), params.getPropertyAt(c));
        }

        for (int c = 0; c < resource.getChildResourceCount(); c++) {
            resourceConfig.addNewResource().set(generateWadlResource(resource.getChildResourceAt(c)));
        }

        for (int c = 0; c < resource.getRestMethodCount(); c++) {
            RestMethod restMethod = resource.getRestMethodAt(c);
            generateWadlMethod(resourceConfig, restMethod);
View Full Code Here

    ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
    Application application = applicationDocument.addNewApplication();

    createDoc( application.addNewDoc(), restService );

    Resources resources = application.addNewResources();

    // use first endpoint for now -> this should be configurable
    String basePath = restService.getBasePath();
    String[] endpoints = restService.getEndpoints();
    if( endpoints.length > 0 )
      basePath = endpoints[0] + basePath;

    resources.setBase( basePath );

    for( int c = 0; c < restService.getOperationCount(); c++ )
    {
      resources.addNewResource().set( generateWadlResource( restService.getOperationAt( c ) ) );
    }

    String[] namespaces = InferredSchemaManager.getInferredSchema( restService ).getNamespaces();
    if( namespaces.length > 0 )
    {
View Full Code Here

        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();

        createDoc(application.addNewDoc(), restService);

        Resources resources = application.addNewResources();

        // use first endpoint for now -> this should be configurable
        String basePath = restService.getBasePath();
        String[] endpoints = restService.getEndpoints();
        if (endpoints.length > 0) {
            basePath = endpoints[0] + basePath;
        }

        resources.setBase(basePath);

        for (int c = 0; c < restService.getOperationCount(); c++) {
            resources.addNewResource().set(generateWadlResource(restService.getOperationAt(c)));
        }

        String[] namespaces = InferredSchemaManager.getInferredSchema(restService).getNamespaces();
        if (namespaces.length > 0) {
            Grammars grammars = application.addNewGrammars();
View Full Code Here

TOP

Related Classes of net.java.dev.wadl.x2009.x02.MethodDocument.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.