Class CollectResult
-
- All Implemented Interfaces:
public final class CollectResult
Class for managing the results of an adapter's collection call.
A CollectResult contains Objects, which can be added at initialization or later. Each Object has a Key containing one or more Identifiers plus the object type and adapter type. Keys must be unique across objects in a CollectResult.
-
-
Field Summary
Fields Modifier and Type Field Description private RelationshipUpdateModes
updateRelationships
private final JsonObject
json
-
Constructor Summary
Constructors Constructor Description CollectResult(List<Object> objectList, AdapterDefinition targetDefinition)
-
Method Summary
Modifier and Type Method Description final RelationshipUpdateModes
getUpdateRelationships()
final Unit
setUpdateRelationships(RelationshipUpdateModes updateRelationships)
final JsonObject
getJson()
final Boolean
isSuccess()
final CollectResult
withError(String errorMessage)
Set the Adapter Instance to an error state with the provided message. final Object
getOrCreateObject(String adapterType, String objectType, String name, List<Identifier> identifiers)
Get or create the Object with the Key given by the provided identification (adapterType, objectType, name, and identifiers). final Object
getOrCreateObject(String adapterType, String objectType, String name)
Get or create the Object with the Key given by the provided identification (adapterType, objectType, name, and identifiers). final Object
getOrCreateObject(Key key)
Get or create the object with key specified by the key. final Object
getObject(String adapterType, String objectType, String name, List<Identifier> identifiers)
Get and return the Object corresponding to the given identification, if it exists. final Object
getObject(String adapterType, String objectType, String name)
Get and return the Object corresponding to the given identification, if it exists. final Object
getObject(Key key)
Get and return the Object corresponding to the given Key, if it exists. final List<Object>
getObjects()
Returns all Objects in this CollectResult. final List<Object>
getObjectsByType(String objectType)
Returns all Objects with the given type. final List<Object>
getObjectsByType(String adapterType, String objectType)
Returns all Objects with the given adapter type and object type. final List<Object>
getObjectsByAdapterType(String adapterType)
Returns all Objects with the given adapter type. final Object
addObject(Object obj)
Adds the given Object to the CollectResult and returns it. final Unit
addObjects(Iterable<Object> objects)
Adds the given Objects to the CollectResult. final Unit
sendResults(String outputPipe)
Opens the output pipe and sends results directly back to the server This method can only be called once per collection. final Unit
sendResults()
Opens the output pipe and sends results directly back to the server This method can only be called once per collection. -
-
Constructor Detail
-
CollectResult
CollectResult(List<Object> objectList, AdapterDefinition targetDefinition)
- Parameters:
objectList
- An optional List of objects to send to Aria Operations.targetDefinition
- an optional description of the returned objects, used for validation purposes.
-
-
Method Detail
-
getUpdateRelationships
final RelationshipUpdateModes getUpdateRelationships()
-
setUpdateRelationships
final Unit setUpdateRelationships(RelationshipUpdateModes updateRelationships)
-
getJson
final JsonObject getJson()
-
withError
final CollectResult withError(String errorMessage)
Set the Adapter Instance to an error state with the provided message.
If this method is called multiple times, only the most recent error message will be recorded. If errorMessage is set, no other Objects (including the object's Events, Properties, Metrics, and Relationships) will be returned in the CollectResult.
- Parameters:
errorMessage
- A string containing the error message
-
getOrCreateObject
final Object getOrCreateObject(String adapterType, String objectType, String name, List<Identifier> identifiers)
Get or create the Object with the Key given by the provided identification (adapterType, objectType, name, and identifiers).
This is the preferred method for creating new Objects. If this method is used exclusively, all Object references with the same key will point to the same object.
If an Object with the same key already exists in the CollectResult, return that Object, otherwise create a new Object, add it to the CollectResult, and return it. See discussion on keys in the documentation for the Key class.
If this method is used to create an Object, it does not need to be added later using addObject or addObjects.
- Parameters:
adapterType
- The adapter type of the objectobjectType
- The type of the objectname
- The name of the objectidentifiers
- An optional list of Identifiers for the object- Returns:
-
getOrCreateObject
final Object getOrCreateObject(String adapterType, String objectType, String name)
Get or create the Object with the Key given by the provided identification (adapterType, objectType, name, and identifiers).
This is the preferred method for creating new Objects. If this method is used exclusively, all Object references with the same key will point to the same object.
If an Object with the same key already exists in the CollectResult, return that Object, otherwise create a new Object, add it to the CollectResult, and return it. See discussion on keys in the documentation for the Key class.
If this method is used to create an Object, it does not need to be added later using addObject or addObjects.
-
getOrCreateObject
final Object getOrCreateObject(Key key)
Get or create the object with key specified by the key.
This is the preferred method for creating new Objects. If this method is used exclusively, all Object references with the same key will point to the same object.
If an Object with the same key already exists in the CollectResult, return that Object, otherwise create a new Object, add it to the CollectResult, and return it. See discussion on keys in the documentation for the Key class.
If this method is used to create an Object, it does not need to be added later using addObject or addObjects.
-
getObject
final Object getObject(String adapterType, String objectType, String name, List<Identifier> identifiers)
Get and return the Object corresponding to the given identification, if it exists.
- Parameters:
adapterType
- The adapter type of the objectobjectType
- The type of the objectname
- The name of the objectidentifiers
- An optional list of Identifiers for the object- Returns:
The Object with the given Key, or null if an Object with the given Key is not in the CollectResult
-
getObject
final Object getObject(String adapterType, String objectType, String name)
Get and return the Object corresponding to the given identification, if it exists.
- Parameters:
adapterType
- The adapter type of the objectobjectType
- The type of the objectname
- The name of the object- Returns:
The Object with the given Key, or null if an Object with the given Key is not in the CollectResult
-
getObject
final Object getObject(Key key)
- Parameters:
key
- The object key to search for- Returns:
The Object with the given Key, or null if an Object with the given Key is not in the CollectResult
-
getObjects
final List<Object> getObjects()
Returns all Objects in this CollectResult.
-
getObjectsByType
final List<Object> getObjectsByType(String objectType)
Returns all Objects with the given type.
- Parameters:
objectType
- The object type to match- Returns:
A List of Objects matching the objectType
-
getObjectsByType
final List<Object> getObjectsByType(String adapterType, String objectType)
Returns all Objects with the given adapter type and object type.
- Parameters:
adapterType
- The adapter type to matchobjectType
- The object type to match- Returns:
A List of Objects matching the adapterType and objectType
-
getObjectsByAdapterType
final List<Object> getObjectsByAdapterType(String adapterType)
Returns all Objects with the given adapter type.
- Parameters:
adapterType
- The adapter type to match- Returns:
A List of Objects matching the adapterType and objectType
-
addObject
final Object addObject(Object obj)
Adds the given Object to the CollectResult and returns it.
A different Object with the same key cannot already exist in the CollectResult. If it does, an ObjectKeyAlreadyExistsException will be thrown.
- Parameters:
obj
- The Object to add to the CollectResult.- Returns:
The object.
-
addObjects
final Unit addObjects(Iterable<Object> objects)
Adds the given Objects to the CollectResult.
A different Object with the same key cannot already exist in the CollectResult. If it does, an ObjectKeyAlreadyExistsException will be thrown. All Objects will attempt to add to the CollectResult.
- Parameters:
objects
- A Collection of Objects to add to the CollectResult.
-
sendResults
final Unit sendResults(String outputPipe)
Opens the output pipe and sends results directly back to the server This method can only be called once per collection.
- Parameters:
outputPipe
- The path to the output pipe.
-
sendResults
final Unit sendResults()
Opens the output pipe and sends results directly back to the server This method can only be called once per collection.
-
-
-
-