Forge - Shell API 1.2.0.Final

org.jboss.forge.resources
Class URLResource

java.lang.Object
  extended by org.jboss.forge.resources.AbstractResource<URL>
      extended by org.jboss.forge.resources.URLResource
All Implemented Interfaces:
Resource<URL>

public class URLResource
extends AbstractResource<URL>

Represents an URL

Author:
George Gastaldi

Field Summary
 
Fields inherited from class org.jboss.forge.resources.AbstractResource
flags, parent, resourceFactory
 
Constructor Summary
URLResource(ResourceFactory factory, URL url)
           
 
Method Summary
 Resource<URL> createFrom(URL url)
          Create a new resource instance for the target resource reference of the type that this current resource is.
 boolean delete()
          Delete this resource, return true if successful, false if not.
 boolean delete(boolean recursive)
          Delete this resource, return true if successful, false if not.
protected  List<Resource<?>> doListResources()
          Strategy method for returning child resources.
 boolean exists()
          Return true if this Resource exists, return false if not.
 Resource<?> getChild(String name)
          Get a child of this resource.
 String getName()
          Return the common name of the resource.
 InputStream getResourceInputStream()
          Get the InputStream represented by this Resource.
 URL getUnderlyingResourceObject()
          Get the underlying object represented by this Resource
 
Methods inherited from class org.jboss.forge.resources.AbstractResource
equals, getFlags, getFullyQualifiedName, getParent, getResourceFactory, hashCode, isFlagSet, listResources, listResources, reify, setFlag, unsetFlag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLResource

public URLResource(ResourceFactory factory,
                   URL url)
Method Detail

delete

public boolean delete()
               throws UnsupportedOperationException
Description copied from interface: Resource
Delete this resource, return true if successful, false if not.

Throws:
UnsupportedOperationException - if deleting is not supported by the underlying implementation.

delete

public boolean delete(boolean recursive)
               throws UnsupportedOperationException
Description copied from interface: Resource
Delete this resource, return true if successful, false if not.

Parameters:
recursive - if false and this resource both supports recursive deletion and contains children, deletion will not occur; otherwise, if true, deletion will propagate to all child resources. Implementations may choose simply to delegate to Resource.delete()
Throws:
UnsupportedOperationException - if deleting is not supported by the underlying implementation.

getName

public String getName()
Description copied from interface: Resource
Return the common name of the resource. If it's a file, for instance, just the file name.

Returns:
The name of the resource.

createFrom

public Resource<URL> createFrom(URL url)
Description copied from interface: Resource
Create a new resource instance for the target resource reference of the type that this current resource is.

Parameters:
url - The target reference to create the resource instance from.
Returns:
A new resource.

getUnderlyingResourceObject

public URL getUnderlyingResourceObject()
Description copied from interface: Resource
Get the underlying object represented by this Resource


getResourceInputStream

public InputStream getResourceInputStream()
Description copied from interface: Resource
Get the InputStream represented by this Resource.


getChild

public Resource<?> getChild(String name)
Description copied from interface: Resource
Get a child of this resource. Returns null if no child by the given name can be found.


exists

public boolean exists()
Description copied from interface: Resource
Return true if this Resource exists, return false if not.


doListResources

protected List<Resource<?>> doListResources()
Description copied from class: AbstractResource
Strategy method for returning child resources. Subclasses should implement or override this method.

Specified by:
doListResources in class AbstractResource<URL>
Returns:

Forge - Shell API 1.2.0.Final

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.