org.knime.core.node.workflow
Class CredentialsStore

java.lang.Object
  extended by org.knime.core.node.workflow.CredentialsStore
All Implemented Interfaces:
Observer

public final class CredentialsStore
extends Object
implements Observer

Container for credentials defined on a workflow. Elements in this store are used by individual node implementations to get password information.

This store is modified by the workbench GUI (not by nodes). Any modification should be synchronized (all methods are synchronized) but batch modification should be done when synchronizing on this object.

Author:
Bernd Wiswedel, KNIME.com, Zurich, Switzerland

Constructor Summary
CredentialsStore(WorkflowManager manager)
          Create new credential store for a workflow.
CredentialsStore(WorkflowManager manager, List<Credentials> creds)
          Create new credential store for a workflow.
 
Method Summary
 void add(Credentials cred)
          Add a new credentials object to this store.
 void clearClient(NodeContainer nc)
          Clear any access history of the given client on any of the credentials.
 boolean contains(String name)
          Checks, if a CredentialsStore is contained in this store under the given name.
 Credentials get(String name)
          Read out credentials under a given name.
 Credentials get(String name, NodeContainer client)
          Read out credentials under a given name.
 Iterable<Credentials> getCredentials()
          Get iterable for credentials.
 Collection<String> listNames()
          Get a list with identifiers of the available credential variables.# Each element in the returned list is a valid argument for the get(String, NodeContainer) and remove(String) method.
 void remove(String name)
          Remove a credentials variable from this store.
 String toString()
          
(package private)  boolean update(Credentials... credentialsList)
          Update the Credentials with the names from the given crendentials list.
 void update(Observable o, Object arg)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CredentialsStore

CredentialsStore(WorkflowManager manager)
Create new credential store for a workflow.

Parameters:
manager - The workflow keeping this store to persist credentials.

CredentialsStore

CredentialsStore(WorkflowManager manager,
                 List<Credentials> creds)
Create new credential store for a workflow.

Parameters:
manager - The workflow keeping this store to persist credentials.
creds - The list of initial credentials.
Method Detail

get

public Credentials get(String name,
                       NodeContainer client)
Read out credentials under a given name. The name is the (global) identifier under which this credentials are store (see Credentials.getName()).

Parameters:
name - The name to lookup
client - The client accessing the credential (used to keep lookup history and (possibly in future versions) to implement access restrictions
Returns:
The credentials for this name
Throws:
IllegalArgumentException - If the identifier is unknown

get

public Credentials get(String name)
Read out credentials under a given name. The name is the (global) identifier under which this credentials are store (see Credentials.getName()).

Parameters:
name - The name to lookup
Returns:
The credentials for this name
Throws:
IllegalArgumentException - If the identifier is unknown

contains

public boolean contains(String name)
Checks, if a CredentialsStore is contained in this store under the given name.

Parameters:
name - credential's name to check
Returns:
true, if a credentials exists, otherwise false

update

boolean update(Credentials... credentialsList)
Update the Credentials with the names from the given crendentials list. Only the login and password are updated.

Parameters:
credentialsList - the list of credentials to change
Returns:
true, if there were changes in any of the fields
Throws:
IllegalArgumentException - If the identifier is unknown

getCredentials

public Iterable<Credentials> getCredentials()
Get iterable for credentials. Used internally (load/save). Caller must not modify the list!

Returns:
The credentials in this store.

clearClient

public void clearClient(NodeContainer nc)
Clear any access history of the given client on any of the credentials.

Parameters:
nc - The client to clear.

add

public void add(Credentials cred)
Add a new credentials object to this store. Its name must be unique across all credentials in this store.

Parameters:
cred - The new credentials to add.
Throws:
NullPointerException - If the argument is null
IllegalArgumentException - If the the argument's name is already in use

remove

public void remove(String name)
Remove a credentials variable from this store.

Parameters:
name - Name of variable to remove.
Throws:
NullPointerException - If the argument is null
IllegalArgumentException - If the variable is unknown.

listNames

public Collection<String> listNames()
Get a list with identifiers of the available credential variables.# Each element in the returned list is a valid argument for the get(String, NodeContainer) and remove(String) method.

Returns:
A collection of valid identifiers.

toString

public String toString()

Overrides:
toString in class Object

update

public void update(Observable o,
                   Object arg)

Specified by:
update in interface Observer


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.