org.specrunner.source.resource.core
Class AbstractResource

java.lang.Object
  extended by org.specrunner.source.resource.core.AbstractResource
All Implemented Interfaces:
IResource, IPresentation
Direct Known Subclasses:
AbstractResourceElement, AbstractResourcePositional

public abstract class AbstractResource
extends Object
implements IResource

Partial resource implementation.

Author:
Thiago Santos

Constructor Summary
protected AbstractResource(ISource parent, String resourcePath, boolean classpath, EType type)
          Partial constructor.
 
Method Summary
protected  List<URL> filterExisting(List<URL> urls)
          Filter only available resources.
 ISource getParent()
          The reference parent.
 String getResourcePath()
          The resource path, relative to classpath. i.e.
protected  List<URL> getResourceURLs()
          Gets the list of URL resources.
 EType getType()
          The resource type.
 boolean isClasspath()
          The resource is relative to classpath?
 void setClasspath(boolean classpath)
          Set the classpath context.
 void setParent(ISource parent)
          Change the resource parent.
 void setResourcePath(String resourcePath)
          Set the resource path.
 void setType(EType type)
          Resource type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.specrunner.source.resource.IResource
writeTo
 
Methods inherited from interface org.specrunner.util.xom.IPresentation
asNode, asString
 

Constructor Detail

AbstractResource

protected AbstractResource(ISource parent,
                           String resourcePath,
                           boolean classpath,
                           EType type)
Partial constructor.

Parameters:
parent - The parent.
resourcePath - The resource path.
classpath - The classpath flag.
type - The resource nature.
Method Detail

getParent

public ISource getParent()
Description copied from interface: IResource
The reference parent.

Specified by:
getParent in interface IResource
Returns:
The parent.

setParent

public void setParent(ISource parent)
Description copied from interface: IResource
Change the resource parent.

Specified by:
setParent in interface IResource
Parameters:
parent - The new parent.

getResourcePath

public String getResourcePath()
Description copied from interface: IResource
The resource path, relative to classpath. i.e. '/css/specrunner.css'

Specified by:
getResourcePath in interface IResource
Returns:
The path.

setResourcePath

public void setResourcePath(String resourcePath)
Description copied from interface: IResource
Set the resource path.

Specified by:
setResourcePath in interface IResource
Parameters:
resourcePath - The resource path.

getType

public EType getType()
Description copied from interface: IResource
The resource type.

Specified by:
getType in interface IResource
Returns:
The resource.

setType

public void setType(EType type)
Description copied from interface: IResource
Resource type.

Specified by:
setType in interface IResource
Parameters:
type - The new type.

isClasspath

public boolean isClasspath()
Description copied from interface: IResource
The resource is relative to classpath?

Specified by:
isClasspath in interface IResource
Returns:
true, if so, false, otherwise.

setClasspath

public void setClasspath(boolean classpath)
Description copied from interface: IResource
Set the classpath context.

Specified by:
setClasspath in interface IResource
Parameters:
classpath - true, for classpath relative, false, otherwise.

getResourceURLs

protected List<URL> getResourceURLs()
                             throws ResourceException
Gets the list of URL resources.

Returns:
List of resources.
Throws:
ResourceException - On resource listing errors.

filterExisting

protected List<URL> filterExisting(List<URL> urls)
                            throws ResourceException
Filter only available resources.

Parameters:
urls - List of resource URLs.
Returns:
The filtered version.
Throws:
ResourceException - On file loca


Copyright © 2014. All rights reserved.