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

Examples of org.apache.xml.xmlbeans.x2004.x02.xmlbean.xsdownload.DownloadedSchemaEntry


            {
                // unable to read digest... no problem, ignore then
            }

            // ok, this really is a new XSD file then, of unknown URL origin
            DownloadedSchemaEntry newEntry = addNewEntry();
            newEntry.setFilename(filename);
            warning("Caching information on new local file " + filename);
            if (digest != null)
                newEntry.setSha1(digest);

            seenResources.add(updateResource(newEntry));
        }

        if (deleteOnlyMentioned)
View Full Code Here


        }

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

            return result;
        }

        warning("Downloaded " + schemaLocation + " to " + targetFilename);

        DownloadedSchemaEntry newEntry = addNewEntry();
        newEntry.setFilename(targetFilename);
        newEntry.setSha1(digest);
        if (namespace != null)
            newEntry.setNamespace(namespace);
        newEntry.addSchemaLocation(schemaLocation);
        return updateResource(newEntry);
    }
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

TOP

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

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.