com.splunk
Class ResourceCollection<T extends Resource>

java.lang.Object
  extended by com.splunk.Resource
      extended by com.splunk.ResourceCollection<T>
Type Parameters:
T - The type of members of the collection.
All Implemented Interfaces:
java.util.Map<java.lang.String,T>
Direct Known Subclasses:
ConfCollection, EntityCollection

public class ResourceCollection<T extends Resource>
extends Resource
implements java.util.Map<java.lang.String,T>

The ResourceCollection abstract base class represents a collection of Splunk resources.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 void clear()
          
 boolean containsKey(java.lang.Object key)
          
 boolean containsKey(java.lang.Object key, Args namespace)
          Determines whether a scoped, namespace-constrained key exists within this collection.
 boolean containsValue(java.lang.Object value)
          
 java.util.Set<java.util.Map.Entry<java.lang.String,T>> entrySet()
          
 boolean equals(java.lang.Object o)
          
 T get(java.lang.Object key)
          Gets the value of a given key, if it exists within this collection.
 T get(java.lang.Object key, Args namespace)
          Gets a the value of a scoped, namespace-constrained key, if it exists within this collection.
 int hashCode()
           
 boolean isEmpty()
          
 java.util.Set<java.lang.String> keySet()
          
 ResponseMessage list()
          Issues an HTTP request to list the contents of the collection resource.
 T put(java.lang.String key, T value)
          
 void putAll(java.util.Map<? extends java.lang.String,? extends T> map)
          Copies all mappings from a given map to this map (unsupported).
 ResourceCollection refresh()
          Refreshes the local state of this resource.
 T remove(java.lang.Object key)
          
 int size()
          
 ResourceCollection<T> validate()
          Ensures that the local state of the resource is current, calling refresh if necessary.
 java.util.Collection<T> values()
          
 int valueSize(java.lang.Object key)
          Returns the number of values that a specific key represents.
 
Methods inherited from class com.splunk.Resource
getName, getPath, getService, getTitle, invalidate
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clear

public void clear()

Specified by:
clear in interface java.util.Map<java.lang.String,T extends Resource>

containsKey

public boolean containsKey(java.lang.Object key)

Specified by:
containsKey in interface java.util.Map<java.lang.String,T extends Resource>

containsKey

public boolean containsKey(java.lang.Object key,
                           Args namespace)
Determines whether a scoped, namespace-constrained key exists within this collection.

Parameters:
key - The key to look up.
namespace - The namespace to constrain the search to.
Returns:
true if the key exists, false if not.

containsValue

public boolean containsValue(java.lang.Object value)

Specified by:
containsValue in interface java.util.Map<java.lang.String,T extends Resource>

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,T>> entrySet()

Specified by:
entrySet in interface java.util.Map<java.lang.String,T extends Resource>

equals

public boolean equals(java.lang.Object o)

Specified by:
equals in interface java.util.Map<java.lang.String,T extends Resource>
Overrides:
equals in class java.lang.Object

get

public T get(java.lang.Object key)
Gets the value of a given key, if it exists within this collection.

Specified by:
get in interface java.util.Map<java.lang.String,T extends Resource>
Parameters:
key - The key to look up.
Returns:
The value indexed by the key, or null if it doesn't exist.
Throws:
SplunkException - The exception to throw if there is more than one value represented by this key.

get

public T get(java.lang.Object key,
             Args namespace)
Gets a the value of a scoped, namespace-constrained key, if it exists within this collection.

Parameters:
key - The key to look up.
namespace - The namespace to constrain the search to.
Returns:
The value indexed by the key, or null if it doesn't exist.

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Map<java.lang.String,T extends Resource>
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface java.util.Map<java.lang.String,T extends Resource>

keySet

public java.util.Set<java.lang.String> keySet()

Specified by:
keySet in interface java.util.Map<java.lang.String,T extends Resource>

list

public ResponseMessage list()
Issues an HTTP request to list the contents of the collection resource.

Returns:
The list response message.

put

public T put(java.lang.String key,
             T value)

Specified by:
put in interface java.util.Map<java.lang.String,T extends Resource>

putAll

public void putAll(java.util.Map<? extends java.lang.String,? extends T> map)
Copies all mappings from a given map to this map (unsupported).

Specified by:
putAll in interface java.util.Map<java.lang.String,T extends Resource>
Parameters:
map - The set of mappings to copy into this map.

refresh

public ResourceCollection refresh()
Refreshes the local state of this resource.

Specified by:
refresh in class Resource
Returns:
The current Resource instance.

remove

public T remove(java.lang.Object key)

Specified by:
remove in interface java.util.Map<java.lang.String,T extends Resource>

size

public int size()

Specified by:
size in interface java.util.Map<java.lang.String,T extends Resource>

validate

public ResourceCollection<T> validate()
Ensures that the local state of the resource is current, calling refresh if necessary.

Overrides:
validate in class Resource
Returns:
The current Resource instance.

values

public java.util.Collection<T> values()

Specified by:
values in interface java.util.Map<java.lang.String,T extends Resource>

valueSize

public int valueSize(java.lang.Object key)
Returns the number of values that a specific key represents.

Parameters:
key - The key to look up.
Returns:
The number of entity values represented by the key.