Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.ResourceReference


     * doesn't exist in that storeEntry.
     * @exception InvalidResourceException If the resource couldn't be
     * restored from its pickled format.
     */
    synchronized ResourceReference loadResource(String name, Hashtable defs) {
  ResourceReference rr = lookupResource(name);
  if (rr != null)
      return rr;
  rr = new NewReference(this, name, defs);
  try {
      Resource res = rr.lock();
      if (res == null)
    return null;
  } catch (InvalidResourceException ex) {
      return null;
  } finally {
      rr.unlock();
  }
  references.put(name, rr);
  return rr;
    }
View Full Code Here


     * Add a new resource to the resource store.
     * @param resource The resource to add.
     */
    ResourceReference addResource(Resource resource,
          Hashtable defs) {
  ResourceReference rr = null;
  synchronized (resource) {
      synchronized (this) {
    getStore();
    store.addResource(resource);
    String name = resource.getIdentifier();
View Full Code Here

     * Try unloading the space for this entry.
     */
    synchronized boolean unloadStore() {
  if ( store != null ) {
      Enumeration e = references.elements();
      ResourceReference rr = null;
      while (e.hasMoreElements()) {
    rr = (ResourceReference)e.nextElement();
    if (rr.isLocked())
        return false;
      }
      // Will the store unload itself ?
      if ( ! store.acceptUnload())
    return false;
View Full Code Here

      try {
    ResourceEvent event = queue.getNextEvent();
    if (queue.debug)
        System.out.println("[QUEUE] : getNextEvent()");
    Object src = event.getSource();
    ResourceReference rr = null;
    try {
        FramedResource source = null;
        if (src instanceof ResourceReference) {
      rr = (ResourceReference)src;
      Resource res = rr.lock();
      if (res instanceof FramedResource)
          source = (FramedResource) res;
      else
          source = null;
        } else if (src instanceof FramedResource) {
      source = (FramedResource) src;
        }
 
        if (source != null) {
      if (queue.debug)
          System.out.println("[QUEUE] : processEvent "+
                 event);
      source.processEvent(event);
        }
    } catch (InvalidResourceException ex) {
        if (queue.debug) {
      System.err.println("Exception occurred "+
             "in EventDispatcher:");
      ex.printStackTrace();
        }
    } finally {
        if (rr != null)
      rr.unlock();
    }
      } catch (ThreadDeath death) {
    return;
      } catch (Throwable e) {
    if (queue.debug) {
View Full Code Here

      ex.printStackTrace();
  }
    }

    protected PutedEntry lookupEntry(Request request) {
  ResourceReference rr = request.getTargetResource();
  String            k  = request.getURL().toExternalForm();
  Resource          r  = null;
  if (rr != null) {
    try {
      r = rr.lock();
      if ( r instanceof FileResource )
        k = ((FileResource) r).getFile().getAbsolutePath().toString();
    } catch (InvalidResourceException ex) {
      // continue
    } finally {
      rr.unlock();
    }
  }
  return (PutedEntry) entries.get(k);
    }
View Full Code Here

  }
  return (PutedEntry) entries.get(k);
    }

    protected DeletedEntry lookupDelEntry(Request request) {
  ResourceReference rr = request.getTargetResource();
  String            k  = request.getURL().toExternalForm();
  Resource          r  = null;
  if (rr != null) {
    try {
      r = rr.lock();
      if ( r instanceof FileResource )
        k = ((FileResource) r).getFile().getAbsolutePath().toString();
    } catch (InvalidResourceException ex) {
      // continue
    } finally {
      rr.unlock();
    }
  }
  return (DeletedEntry) dentries.get(k);
    }
View Full Code Here

     * doesn't exist in that storeEntry.
     * @exception InvalidResourceException If the resource couldn't be
     * restored from its pickled format.
     */
    synchronized ResourceReference loadResource(String name, Hashtable defs) {
  ResourceReference rr = lookupResource(name);
  if (rr != null)
      return rr;
  rr = new Reference(this, name, defs);
  try {
      Resource res = rr.lock();
      if (res == null)
    return null;
  } catch (InvalidResourceException ex) {
      return null;
  } finally {
      rr.unlock();
  }
  references.put(name, rr);
  return rr;
    }
View Full Code Here

    synchronized ResourceReference addResource(Resource resource,
                 Hashtable defs) {
  getStore();
  store.addResource(resource);
  String name = resource.getIdentifier();
  ResourceReference rr = new Reference(this, name , defs);   
  references.put(name, rr);
  return rr;
    }
View Full Code Here

     * Try unloading the space for this entry.
     */
    synchronized boolean unloadStore() {
  if ( store != null ) {
      Enumeration e = references.elements();
      ResourceReference rr = null;
      while (e.hasMoreElements()) {
    rr = (ResourceReference) e.nextElement();
    if (rr.isLocked())
        return false;
      }
      // Will the store unload itself ?
      if ( ! store.acceptUnload())
    return false;
View Full Code Here

    {
  if (resource instanceof ContainerResource) {
      Vector v = new Vector();
      ContainerResource cresource = (ContainerResource)resource;
      Enumeration e = cresource.enumerateResourceIdentifiers();
      ResourceReference rr = null;
      FramedResource    fr = null;
      while (e.hasMoreElements()) {
    String name = (String)e.nextElement();
    rr = cresource.lookup(name);
    if (rr != null) {
        try {
      fr = (FramedResource) rr.lock();
      if (fr == resource) { // for root
          continue;
      }
      DAVFrame df = (DAVFrame)fr.getFrame(DAVFrame.class);
      if (df != null) {
          v.addElement(df.getResponse(request,
              dpf,
              document));
          if (deep && (fr instanceof ContainerResource)) {
        DAVResponse responses[] =
            df.getChildResponses(request,
               dpf,
               document,
               deep);
        if (responses != null) {
            int len = responses.length;
            for (int i = 0 ; i < len ; i++) {
          v.addElement(responses[i]);
            }
        }
          }
      } else {
          // what should I do there?
      }
        } catch (InvalidResourceException ex) {
      // build error response?
        } finally {
      rr.unlock();
        }
    }
      }
      DAVResponse responses[] = new DAVResponse[v.size()];
      v.copyInto(responses);
View Full Code Here

TOP

Related Classes of org.w3c.tools.resources.ResourceReference

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.