org.jclouds.nodepool.internal
Class JsonNodeMetadataStore

java.lang.Object
  extended by org.jclouds.nodepool.internal.JsonNodeMetadataStore
All Implemented Interfaces:
NodeMetadataStore

public class JsonNodeMetadataStore
extends Object
implements NodeMetadataStore

An implementation of NodeMetadataStore that stores all that is needed by building a json string.

Author:
David Alves

Constructor Summary
JsonNodeMetadataStore(com.google.common.base.Supplier<Map<String,InputStream>> storage, Json json)
           
 
Method Summary
 void deleteAllMappings()
          Clears all mappings.
 void deleteMapping(String backendNodeId)
          Removes the mapping from storage.
 NodeMetadata load(NodeMetadata backendNodeMetadata)
          Loads the previously stored user NodeMetadata corresponding to the provided backend NodeMetadata.
 Set<NodeMetadata> loadAll(Set<NodeMetadata> backendNodes)
          Loads frontend NodeMetadata for all provided backend nodes.
 NodeMetadata store(NodeMetadata backendNodeMetadata, TemplateOptions userOptions, String userGroup)
          Associates the provided user options and group with the provided backend NodeMetadata, then build a frontend version of node metadata that has some fields from the backend node such as id, name or location, and some fields from the provided userOptions, such as userMetadata or tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonNodeMetadataStore

@Inject
public JsonNodeMetadataStore(@Named(value="METADATA")
                                    com.google.common.base.Supplier<Map<String,InputStream>> storage,
                                    Json json)
Method Detail

store

public NodeMetadata store(NodeMetadata backendNodeMetadata,
                          TemplateOptions userOptions,
                          String userGroup)
Description copied from interface: NodeMetadataStore
Associates the provided user options and group with the provided backend NodeMetadata, then build a frontend version of node metadata that has some fields from the backend node such as id, name or location, and some fields from the provided userOptions, such as userMetadata or tags.

Specified by:
store in interface NodeMetadataStore
Parameters:
backendNodeMetadata - the backend node's NodeMetadata
userOptions - the user provided options
userGroup - the user selected group
Returns:
a version of NodeMetadata that includes information from the backend node and form the user provided options and group.

load

public NodeMetadata load(NodeMetadata backendNodeMetadata)
Description copied from interface: NodeMetadataStore
Loads the previously stored user NodeMetadata corresponding to the provided backend NodeMetadata.

Specified by:
load in interface NodeMetadataStore
Returns:
the frontend NodeMetadata or null of this backend node has no mapping

loadAll

public Set<NodeMetadata> loadAll(Set<NodeMetadata> backendNodes)
Description copied from interface: NodeMetadataStore
Loads frontend NodeMetadata for all provided backend nodes.

Specified by:
loadAll in interface NodeMetadataStore
Returns:

deleteAllMappings

public void deleteAllMappings()
Description copied from interface: NodeMetadataStore
Clears all mappings.

Specified by:
deleteAllMappings in interface NodeMetadataStore

deleteMapping

public void deleteMapping(String backendNodeId)
Description copied from interface: NodeMetadataStore
Removes the mapping from storage.

Specified by:
deleteMapping in interface NodeMetadataStore


Copyright © 2009-2012 jclouds. All Rights Reserved.