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

Examples of net.java.dev.wadl.x2009.x02.RepresentationDocument.Representation


          || !element.getNamespaceURI().equals( Constants.WADL11_NS ) )
      {
        throw new Exception( "Document is not a WADL application with " + Constants.WADL11_NS + " namespace" );
      }

      ApplicationDocument applicationDocument = ( ApplicationDocument )xmlObject
          .changeType( ApplicationDocument.type );
      application = applicationDocument.getApplication();

      resourcesList = application.getResourcesList();

      service.setName( getFirstTitle( application.getDocList(), service.getName() ) );
View Full Code Here


        return m;
    }

    try
    {
      ApplicationDocument applicationDocument = loadReferencedWadl( href );
      if( applicationDocument != null )
      {
        int ix = href.lastIndexOf( '#' );
        if( ix > 0 )
          href = href.substring( ix + 1 );
View Full Code Here

    {
      Application app = application;

      if( !href.startsWith( "#" ) )
      {
        ApplicationDocument applicationDocument = loadReferencedWadl( href );
        app = applicationDocument.getApplication();
      }

      if( app != null )
      {
        int ix = href.lastIndexOf( '#' );
View Full Code Here

    {
      Application app = application;

      if( !href.startsWith( "#" ) )
      {
        ApplicationDocument applicationDocument = loadReferencedWadl( href );
        app = applicationDocument.getApplication();
      }

      if( app != null )
      {
        int ix = href.lastIndexOf( '#' );
View Full Code Here

        return resourceType;
    }

    try
    {
      ApplicationDocument applicationDocument = loadReferencedWadl( id );
      if( applicationDocument != null )
      {
        int ix = id.lastIndexOf( '#' );
        if( ix > 0 )
          id = id.substring( ix + 1 );

        for( ResourceTypeDocument.ResourceType resourceType : applicationDocument.getApplication()
            .getResourceTypeList() )
        {
          if( resourceType.getId().equals( id ) )
            return resourceType;
        }
View Full Code Here

  private ApplicationDocument loadReferencedWadl( String id ) throws URISyntaxException, XmlException, IOException
  {
    int ix = id.indexOf( '#' );
    if( ix != -1 )
      id = id.substring( 0, ix );
    ApplicationDocument applicationDocument = refCache.get( id );

    if( applicationDocument == null )
    {
      URI uri = new URI( id );
      applicationDocument = ApplicationDocument.Factory.parse( uri.toURL() );
View Full Code Here

    this.restService = restService;
  }

  public XmlObject generateWadl()
  {
    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();
      for( String namespace : namespaces )
      {
        grammars.addNewInclude().setHref( InferredSchemaManager.filenameForNamespace( namespace ) );
      }
    }

    if( !isWADL11 )
    {
      XmlOptions options = new XmlOptions();
      StringToStringMap subst = new StringToStringMap();
      subst.put( Constants.WADL11_NS, Constants.WADL10_NS );
      options.setLoadSubstituteNamespaces( subst );
      try
      {
        // return XmlObject.Factory.parse( applicationDocument.xmlText(),
        // options );
        return XmlUtils.createXmlObject( applicationDocument.xmlText(), options );
      }
      catch( XmlException e )
      {
        e.printStackTrace();
      }
View Full Code Here

  @Override
  protected void postProcessing( XmlObject obj, InterfaceDefinitionPart part )
  {
    if( part.getType().equals( Constants.WADL11_NS ) )
    {
      ApplicationDocument document = ( ApplicationDocument )obj;
      for( Resources resources : document.getApplication().getResourcesList() )
      {
        for( Resource resource : resources.getResourceList() )
        {
          for( Method method : resource.getMethodList() )
          {
View Full Code Here

public class WadlTestCase extends TestCase
{
  public void testWadl() throws Exception
  {
    ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
    Application application = applicationDocument.addNewApplication();
  }
View Full Code Here

public class WadlTest {

    @Test
    public void testWadl() throws Exception {
        ApplicationDocument applicationDocument = ApplicationDocument.Factory.newInstance();
        Application application = applicationDocument.addNewApplication();
        assertNotNull(application);
    }
View Full Code Here

TOP

Related Classes of net.java.dev.wadl.x2009.x02.RepresentationDocument.Representation

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.