Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.Resource


    protected Resource createVirtualResource( File directory,
                RequestInterface req,
                String name,
                Hashtable defs)
    {
  Resource res = super.createVirtualResource(directory, req, name, defs);
  if (res != null)
      return res;
  //could be a servlet
  char fileSeparatorChar = File.separatorChar;
  String sname = name.replace('.', fileSeparatorChar)+".class";
View Full Code Here


    public static Resource readResource(InputStream in)
  throws IOException, AdminProtocolException
    {
  try {
      Reader reader = new BufferedReader(new InputStreamReader(in));
      Resource resources[] =
    serializer.readResources(reader);
      if (resources.length < 1)
    throw new AdminProtocolException("No resource found.");
      return resources[0];
  } catch (SerializationException ex) {
View Full Code Here

    continue;
      // delete file now... avoit deleting CVS and lister
      // (should be in an attribute)
      synchronized (this) {
    DirectoryResource dr;
    Resource toDeleteRes;
    ResourceReference rr;
    File dir, toDeleteFile;
    try {
        dr = (DirectoryResource) getDirResourceRef().lock();
        dir = dr.getDirectory();
        if (debug)
      System.out.println("Deleting " + name);
        rr = dr.lookup(name);
        if (rr != null) {
      try {
          toDeleteFile = new File(dir, name);
          toDeleteFile.delete();
      } catch (Exception ex) {
          // fancy message. file not present
          // Or security manager forbiding deletion.
      }
      // and now, at least remove the resource
      try {
          toDeleteRes = (Resource) rr.lock();
          toDeleteRes.delete();
      } catch (Exception ex) {
          // some other locks... or pb with the resource
      } finally {
          rr.unlock();
      }
View Full Code Here

    protected synchronized File getResourceDirectory() {
  if (resDirectory == null) {
      ResourceReference rr = getFileResource().getParent();
      ResourceReference rrtemp = null;
      Resource p = null;
      while ( true ) {
    try {
        if (rr == null)
      return null;
        p = rr.lock();
        if (p instanceof DirectoryResource) {
      resDirectory = ((DirectoryResource)p).getDirectory();
      break;
        }
        rrtemp = p.getParent();
    } catch (InvalidResourceException ex) {
        return null;
    } finally {
        if (rr != null)
      rr.unlock();
View Full Code Here

      accept = false;
  } else {
      Enumeration e      = resources.elements();
      while ( e.hasMoreElements() ) {
    ResourceIndex entry    = (ResourceIndex) e.nextElement();
    Resource      resource = entry.getResource();
    synchronized (entry) {
        if (! resource.acceptUnload() )
      accept = false;
    }
      }
  }
  if ( ! accept ) {
View Full Code Here

  }
  //1st, build the resource array
  Enumeration e    = resources.elements();
  Vector      vres = new Vector(11);
  while (e.hasMoreElements()) {
      Resource res = ((ResourceIndex)e.nextElement()).getResource();
      vres.addElement(res);
  }
  Resource resourcearray[] = new Resource[vres.size()];
  vres.copyInto(resourcearray);

  //try to save in a temporary file
  File tmp = new File(repository.getParent(),
          repository.getName()+".tmp") ;
View Full Code Here

      try {
    resources = new Hashtable(11);
    if (repository.exists()) {
        Reader reader =
      new BufferedReader(new FileReader(repository));
        Resource resourceArray[] =
      serializer.readResources(reader);
        for (i = 0 ; i < resourceArray.length ; i++) {
      ResourceIndex entry =
          new ResourceIndex(resourceArray[i], false);
      if (entry != null &&
View Full Code Here

  }
  if (entry == null)
      throw new InvalidResourceException(identifier,
          "This reference has been invalidated");
  ResourceStore store = entry.getStore();
  Resource resource = store.lookupResource(identifier);
  if (debug) {
      if (defs.get("context") == null) {
    System.out.println("**** Context null for : "+identifier);
      } else if (((ResourceContext)(defs.get("context"))).getServer()
           == null) {
View Full Code Here

  if (entry == null) {
      throw new InvalidResourceException(identifier,
          "This reference has been invalidated");
  }
  ResourceStore store = entry.getStore();
  Resource resource = store.lookupResource(identifier);
  if (debug) {
      if (defs.get("context") == null) {
    System.out.println("**** Context null for : "+identifier);
      } else if (((ResourceContext)(defs.get("context"))).getServer()
           == null) {
View Full Code Here

  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 {
View Full Code Here

TOP

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

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.