org.specrunner.source.resource.core
Class ResourceManagerImpl

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList<IResource>
                  extended by org.specrunner.source.resource.core.ResourceManagerImpl
All Implemented Interfaces:
Serializable, Cloneable, Iterable<IResource>, Collection<IResource>, Deque<IResource>, List<IResource>, Queue<IResource>, IResourceManager

public class ResourceManagerImpl
extends LinkedList<IResource>
implements IResourceManager

Default resource manager implementation.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface org.specrunner.source.resource.IResourceManager
DEFAULT_ADD_RESOURCES, FEATURE_ADD_RESOURCES
 
Constructor Summary
ResourceManagerImpl(ISource parent)
          Creates a resource manager to a source.
 
Method Summary
 boolean add(IResource resource)
           
 IResource addCss(String path, boolean classpath, EType ref)
          Adds a CSS to the head end.
 IResource addCss(String path, boolean classpath, EType ref, Position position)
          Adds a CSS specified by path to a given position.
 void addDefaultCss()
          Add default CSS files.
 void addDefaultJs()
          Add default JavaScript files.
 IResource addJs(String path, boolean classpath, EType ref)
          Adds a JS specified by path to a given position.
 IResource addJs(String path, boolean classpath, EType ref, Position position)
          Adds a JS specified by path to a given position.
 ISource getParent()
          The resource manager parent source.
 void merge(IResourceManager resources)
          Import resources from other manager.
 void setParent(ISource parent)
          Set resource manager parent.
 
Methods inherited from class java.util.LinkedList
add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 
Methods inherited from interface java.util.Deque
iterator
 

Constructor Detail

ResourceManagerImpl

public ResourceManagerImpl(ISource parent)
Creates a resource manager to a source.

Parameters:
parent - The parent.
Method Detail

getParent

public ISource getParent()
Description copied from interface: IResourceManager
The resource manager parent source.

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

setParent

public void setParent(ISource parent)
Set resource manager parent.

Parameters:
parent - The parent.

addDefaultCss

public void addDefaultCss()
                   throws ResourceException
Description copied from interface: IResourceManager
Add default CSS files. By default 'specrunner.css' and 'specrunner_debug.css' are added, the former always, and the remainder when debug log is enabled.

Specified by:
addDefaultCss in interface IResourceManager
Throws:
ResourceException - On add errors.

addDefaultJs

public void addDefaultJs()
                  throws ResourceException
Description copied from interface: IResourceManager
Add default JavaScript files. By default 'specrunner.js' and 'jquery.js' are added.

Specified by:
addDefaultJs in interface IResourceManager
Throws:
ResourceException - On add errors.

add

public boolean add(IResource resource)
Specified by:
add in interface Collection<IResource>
Specified by:
add in interface Deque<IResource>
Specified by:
add in interface List<IResource>
Specified by:
add in interface Queue<IResource>
Overrides:
add in class LinkedList<IResource>

addCss

public IResource addCss(String path,
                        boolean classpath,
                        EType ref)
                 throws ResourceException
Description copied from interface: IResourceManager
Adds a CSS to the head end.

Specified by:
addCss in interface IResourceManager
Parameters:
path - The reference to the resource.
classpath - true, to find in classpath, false, to find in file system.
ref - The resource type.
Returns:
The source after add changes are reflected.
Throws:
ResourceException - On add errors.

addCss

public IResource addCss(String path,
                        boolean classpath,
                        EType ref,
                        Position position)
                 throws ResourceException
Description copied from interface: IResourceManager
Adds a CSS specified by path to a given position.

Specified by:
addCss in interface IResourceManager
Parameters:
path - The reference to the resource.
classpath - true, to find in classpath, false, to find in file system.
ref - The resource type.
position - The position to place the resource in the source reference.
Returns:
The source after add changes are reflected.
Throws:
ResourceException - On add errors.

addJs

public IResource addJs(String path,
                       boolean classpath,
                       EType ref)
                throws ResourceException
Description copied from interface: IResourceManager
Adds a JS specified by path to a given position.

Specified by:
addJs in interface IResourceManager
Parameters:
path - The reference to the resource.
classpath - true, to find in classpath, false, to find in file system.
ref - The resource type.
Returns:
The source after add changes are reflected.
Throws:
ResourceException - On add errors.

addJs

public IResource addJs(String path,
                       boolean classpath,
                       EType ref,
                       Position position)
                throws ResourceException
Description copied from interface: IResourceManager
Adds a JS specified by path to a given position.

Specified by:
addJs in interface IResourceManager
Parameters:
path - The reference to the resource.
classpath - true, to find in classpath, false, to find in file system.
ref - The resource type.
position - The position to place the resource in the source reference.
Returns:
The source after add changes are reflected.
Throws:
ResourceException - On add errors.

merge

public void merge(IResourceManager resources)
Description copied from interface: IResourceManager
Import resources from other manager.

Specified by:
merge in interface IResourceManager
Parameters:
resources - Resources to the copied.


Copyright © 2014. All rights reserved.