Package org.w3c.tools.resources

Examples of org.w3c.tools.resources.Resource


    private HttpString getMd5Digest() {
  if (md5Digest != null)
      return md5Digest;
  // not found, compute it if necessary!
  Resource r = getResource();
  if (r instanceof FileResource) {
      try {
    Md5 md5 = new Md5 (
        new FileInputStream(((FileResource)r).getFile()));
    String s = null;
View Full Code Here


    {
  // Delete the resource if parent is extensible:
  boolean shrinkable = false;
  ResourceReference rr = fresource.getParent();
  ResourceReference rrtemp = null;
  Resource p = null;
  while ( true ) {
      try {
    if (rr == null)
        break;
    p = rr.lock();
    if (p instanceof DirectoryResource) {
        shrinkable =
      ((DirectoryResource)p).getShrinkableFlag();
        break;
    }
    rrtemp = p.getParent();
      } catch (InvalidResourceException ex) {
    break;
      } finally {
    if (rr != null)
        rr.unlock();
View Full Code Here

  // As we have enumerated all resources, just looking the store is ok
  for (int i = 0 ; i < rsize ; i++) {
      String            rname = (String) resources.elementAt(i) ;
      ResourceReference rr    = null;
      Resource          r     = null;
      try {
    rr = dresource.lookup(rname) ;
    r = rr.lock();
    // may throw InvalidResourceException
View Full Code Here

      ResourceReference rr_temp = null;
      while ( ls.hasMoreComponents() ) {
    try {
        if (rr == null)
      error(request, "url too long");
        Resource r = rr.lock();
        if ( ! ( r instanceof ContainerInterface) )
      error(request, "url too long");
        rr_temp = ((ContainerInterface) r).lookup(
                   ls.getNextComponent());
    } catch (InvalidResourceException ex) {
        error(request, "unable to restore resource");
    } finally {
        rr.unlock();
        rr = rr_temp;
    }
      }
      if ( rr == null )
    error(request, "unknown resource");
      String query = request.getQueryString();
      if ( query != null ) {
    try {
        Resource r = rr.lock();
        // Querying a frame !
        if ( ! (r instanceof FramedResource) )
      error(request, "not a framed resource");
    } catch (InvalidResourceException ex) {
        error(request, "unable to restore resource");
View Full Code Here

    {
  InputStream in = getInputStream(request);
  //Get the target resource to act on:
  ResourceReference   rr    = lookup(request);
  try {
      Resource r = rr.lock();
      ResourceDescription descr =
    AdminReader.readResourceDescription(in);
      AttributeDescription attrs[] = descr.getAttributeDescriptions();
      for (int i = 0 ; i < attrs.length ; i++) {
    AttributeDescription ad = attrs[i];
    r.setValue(ad.getName(), ad.getValue());
      }
  } catch (InvalidResourceException irex) {
      irex.printStackTrace();
      error(request, "Invalid resource");
  } catch (IOException ioex) {
View Full Code Here

  // This request has no content
  ByteArrayOutputStream bout   = new ByteArrayOutputStream();

  try {
      Resource r = rr.lock();
      writer.writeResource(r, bout);
  } catch (IOException ex) {
      error(request, "bad request");
  } catch (InvalidResourceException ex) {
      error(request, "Invalid resource");
View Full Code Here

    public Reply remoteRegisterFrame(Request request)
  throws ProtocolException
    {
   ResourceReference rr = lookup(request);
   try {
       Resource r = rr.lock();
       if ( ! ( r instanceof FramedResource) )
     error(request, "can't add frame to non-framed resource");
       // Handle the request:
       try {
    InputStream in  = getInputStream(request);
View Full Code Here

    public Reply remoteUnregisterFrame(Request request)
  throws ProtocolException
    {
   ResourceReference rr = lookup(request);
   try{
       Resource r = rr.lock();
       if(!(r instanceof FramedResource)) {
     error(request, "Can't unregister frames from a non-framed" +
           " resource");
       }
       try {
View Full Code Here

  throws ProtocolException
    {
   // Check target resource class:
   ResourceReference rr = lookup(request);
   try {
       Resource r = rr.lock();
       if ( ! ( r instanceof ContainerInterface) )
     error(request, "can't add child in non-container");
       // Handle request:
       try {
    InputStream in = getInputStream(request);
    ResourceDescription rd =
        AdminReader.readResourceDescription(in);
    String cls = rd.getClassName();
    String id  = rd.getIdentifier();
     // Create the resource:
     Resource child = null;
     try {
         child = (Resource) Class.forName(cls).newInstance();
     } catch (Exception ex) {
         error(request, "invalid resource class "+cls);
     }
View Full Code Here

    {
  // Check target resource class:
  ResourceReference rr = lookup(request);
  // Handle request:
  try {
      Resource r = rr.lock();
      if(r != null) {
    if (r instanceof org.w3c.tools.resources.DirectoryResource) {
        org.w3c.tools.resources.DirectoryResource dir =
      (org.w3c.tools.resources.DirectoryResource) r;
        dir.reindex(rec);
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.