Package org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemasDocument

Examples of org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemasDocument.DownloadedSchemas


        {
            SchemaResource resource = (SchemaResource)i.next();
            seenCacheEntries.add(resource._cacheEntry);
        }

        DownloadedSchemas downloadedSchemas = _importsDoc.getDownloadedSchemas();
        for (int i = 0; i < downloadedSchemas.sizeOfEntryArray(); i++)
        {
            DownloadedSchemaEntry cacheEntry = downloadedSchemas.getEntryArray(i);

            if (seenCacheEntries.contains(cacheEntry) == setToDelete)
            {
                SchemaResource resource = (SchemaResource)_resourceForCacheEntry.get(cacheEntry);
                warning("Removing obsolete cache entry for " + resource.getFilename());

                if (resource != null)
                {
                    _resourceForCacheEntry.remove(cacheEntry);

                    if (resource == _resourceForFilename.get(resource.getFilename()))
                        _resourceForFilename.remove(resource.getFilename());

                    if (resource == _resourceForDigest.get(resource.getSha1()))
                        _resourceForDigest.remove(resource.getSha1());

                    if (resource == _resourceForNamespace.get(resource.getNamespace()))
                        _resourceForNamespace.remove(resource.getNamespace());

                    // Finally, any or all URIs
                    String[] urls = resource.getSchemaLocationArray();
                    for (int j = 0; j < urls.length; j++)
                    {
                        if (resource == _resourceForURL.get(urls[j]))
                            _resourceForURL.remove(urls[j]);
                    }
                }

                downloadedSchemas.removeEntry(i);
                i -= 1;
            }
        }
    }
View Full Code Here


          || !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

TOP

Related Classes of org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemasDocument.DownloadedSchemas

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.