SunSPOT host API V6.0


com.sun.spot.resources
Class CompositeResource

java.lang.Object
  extended by com.sun.spot.resources.Resource
      extended by com.sun.spot.resources.CompositeResource
All Implemented Interfaces:
ICompositeResource, IResource
Direct Known Subclasses:
LockingCompositeResource

public class CompositeResource
extends Resource
implements ICompositeResource

Minimal implementation of the ICompositeResource interface.

Author:
Ron

Field Summary
protected  Vector resources
           
 
Constructor Summary
CompositeResource()
           
 
Method Summary
 void add(IResource res)
          Add an IResource to the composite resource.
protected  IResource internalAt(int i)
           
protected  int internalSize()
           
 IResource lookup(Class resourceInterface)
          Lookup a matching resource Interface.
 IResource lookup(Class resourceInterface, String tag)
          Lookup a matching resource Interface.
 IResource lookup(Class resourceInterface, String[] tags)
          Lookup a matching resource Interface.
 IResource lookup(String tag)
          Lookup a matching resource Interfaces.
 IResource lookup(String[] tags)
          Lookup a matching resource Interfaces.
 IResource[] lookupAll(Class resourceInterface)
          Lookup all the matching resource Interfaces.
 IResource[] lookupAll(Class resourceInterface, String tag)
          Lookup a matching resource Interface.
 IResource[] lookupAll(Class resourceInterface, String[] tags)
          Lookup all the matching resource Interfaces.
 IResource[] lookupAll(String tag)
          Lookup all the matching resource Interfaces.
 IResource[] lookupAll(String[] tags)
          Lookup all the matching resource Interfaces.
 void remove(IResource res)
          Remove an IResource from the composite resource.
 
Methods inherited from class com.sun.spot.resources.Resource
addTag, getTags, getTagValue, hasTag, removeTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

Field Detail

resources

protected Vector resources
Constructor Detail

CompositeResource

public CompositeResource()
Method Detail

internalSize

protected int internalSize()

internalAt

protected IResource internalAt(int i)

lookup

public IResource lookup(Class resourceInterface)
Lookup a matching resource Interface. Returns the first resource found that implements the specified resourceInterface. Subsequent calls may return another resourceInterface instance.

Specified by:
lookup in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
Returns:
a matching resource or null if no matches

lookupAll

public IResource[] lookupAll(Class resourceInterface)
Lookup all the matching resource Interfaces. Returns all the resources found that implement the specified resourceInterface.

Specified by:
lookupAll in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
Returns:
an array of matching resources or an empty array if no matches

lookup

public IResource lookup(Class resourceInterface,
                        String tag)
Lookup a matching resource Interface. Returns the first resource found that implements the specified resourceInterface and that has a tag that matches the one specified. Subsequent calls may return another resourceInterface instance.

Specified by:
lookup in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
tag - a tag that must match
Returns:
a matching resource or null if no matches

lookupAll

public IResource[] lookupAll(Class resourceInterface,
                             String tag)
Lookup a matching resource Interface. Returns the first resource found that implements the specified resourceInterface and that has a tag that matches the one specified. Subsequent calls may return another resourceInterface instance.

Specified by:
lookupAll in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
tag - a tag that must match
Returns:
a matching resource

lookup

public IResource lookup(Class resourceInterface,
                        String[] tags)
Lookup a matching resource Interface. Returns the first resource found that implements the specified resourceInterface and that has tags that match those specified. Subsequent calls may return another resourceInterface instance.

Specified by:
lookup in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
tags - an array of tags that must match
Returns:
a matching resource or null if no matches

lookupAll

public IResource[] lookupAll(Class resourceInterface,
                             String[] tags)
Lookup all the matching resource Interfaces. Returns all the resources found that implements the specified resourceInterface and that have tags that match those specified.

Specified by:
lookupAll in interface ICompositeResource
Parameters:
resourceInterface - the desired type of resource
tags - an array of tags that must match
Returns:
an array of matching resources or an empty array if no matches

lookup

public IResource lookup(String tag)
Lookup a matching resource Interfaces. Returns the first resource found that implements the specified resourceInterface and that have a tag that matches the one specified. Subsequent calls may return another resourceInterface instance.

Specified by:
lookup in interface ICompositeResource
Parameters:
tag - a tag that must match
Returns:
an array of matching resources or an empty array if no matches

lookupAll

public IResource[] lookupAll(String tag)
Lookup all the matching resource Interfaces. Returns all the resources found that have a tag that matches the one specified.

Specified by:
lookupAll in interface ICompositeResource
Parameters:
tag - a tag that must match
Returns:
an array of matching resources or an empty array if no matches

lookup

public IResource lookup(String[] tags)
Lookup a matching resource Interfaces. Returns the first resource found that implements the specified resourceInterface and that has tags that match those specified. Subsequent calls may return another resourceInterface instance.

Specified by:
lookup in interface ICompositeResource
Parameters:
tags - an array of tags that must match
Returns:
an array of matching resources or an empty array if no matches

lookupAll

public IResource[] lookupAll(String[] tags)
Lookup all the matching resource Interfaces. Returns all the resources found that have tags that match those specified.

Specified by:
lookupAll in interface ICompositeResource
Parameters:
tags - an array of tags that must match
Returns:
an array of matching resources or an empty array if no matches

add

public void add(IResource res)
Add an IResource to the composite resource.

Specified by:
add in interface ICompositeResource
Parameters:
res - the IResource instance to add to the composite resource

remove

public void remove(IResource res)
Remove an IResource from the composite resource.

Specified by:
remove in interface ICompositeResource
Parameters:
res - the IResource instance to remove from the composite resource

SunSPOT host API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.