edu.isi.pegasus.common.credential

## Class CredentialHandlerFactory

- java.lang.Object
- - edu.isi.pegasus.common.credential.CredentialHandlerFactory

    public class CredentialHandlerFactory
    extends java.lang.Object

A factory class to load the appropriate type of Condor Style impelementations. This factory class is different from other factories, in the sense that it must be instantiated first and intialized first before calling out to any of the Factory methods.

Version:
  $Revision$
Author:
  Karan Vahi

### Field Summary

Fields
`static java.lang.String` `DEFAULT_PACKAGE_NAME` The default package where the all the implementing classes are supposed to reside.
`private static java.lang.String` `IRODS_IMPLEMENTING_CLASS`
`private PegasusBag` `mBag` Handle to the PegasusBag
`private static java.util.Map` `mImplementingClassNameTable` A table that maps, Pegasus style keys to the names of the corresponding classes implementing the CondorStyle interface.
`private java.util.Map<CredentialHandler.TYPE,CredentialHandler>` `mImplementingClassTable` A table that maps, Pegasus style keys to appropriate classes implementing the CredentialHandler interface
`private boolean` `mInitialized` A boolean indicating that the factory has been initialized.
`private static java.lang.String` `S3_IMPLEMENTING_CLASS`
`private static java.lang.String` `SSH_IMPLEMENTING_CLASS`
`private static java.lang.String` `X509_IMPLEMENTING_CLASS` The name of the class implementing the x509 credentials

### Constructor Summary

Constructors
Constructor and Description
`CredentialHandlerFactory()` The default constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`private java.lang.Object` `get(CredentialHandler.TYPE type)` Returns the implementation from the implementing class table.
`private static java.util.Map<CredentialHandler.TYPE,java.lang.String>` `implementingClassNameTable()` Returns a table that maps, the credential types to the implementing classes.
`void` `initialize(PegasusBag bag)` Initializes the Factory.
`CredentialHandler` `loadInstance(CredentialHandler.TYPE type)` This method loads the appropriate implementing CondorStyle as specified by the user at runtime.
`private CredentialHandler` `loadInstance(PegasusBag bag, java.lang.String className)` This method loads the appropriate CredentialHandler using reflection.
`private void` `put(CredentialHandler.TYPE type, CredentialHandler implementation)` Inserts an entry into the implementing class table.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### DEFAULT_PACKAGE_NAME

    public static final java.lang.String DEFAULT_PACKAGE_NAME

The default package where the all the implementing classes are supposed to reside.

See Also:
  Constant Field Values

#### X509_IMPLEMENTING_CLASS

    private static final java.lang.String X509_IMPLEMENTING_CLASS

The name of the class implementing the x509 credentials

See Also:
  Constant Field Values

#### IRODS_IMPLEMENTING_CLASS

    private static final java.lang.String IRODS_IMPLEMENTING_CLASS

See Also:
  Constant Field Values

#### S3_IMPLEMENTING_CLASS

    private static final java.lang.String S3_IMPLEMENTING_CLASS

See Also:
  Constant Field Values

#### SSH_IMPLEMENTING_CLASS

    private static final java.lang.String SSH_IMPLEMENTING_CLASS

See Also:
  Constant Field Values

#### mImplementingClassNameTable

    private static java.util.Map mImplementingClassNameTable

A table that maps, Pegasus style keys to the names of the corresponding classes implementing the CondorStyle interface.

#### mImplementingClassTable

    private java.util.Map<CredentialHandler.TYPE,CredentialHandler> mImplementingClassTable

A table that maps, Pegasus style keys to appropriate classes implementing the CredentialHandler interface

#### mInitialized

    private boolean mInitialized

A boolean indicating that the factory has been initialized.

#### mBag

    private PegasusBag mBag

Handle to the PegasusBag

### Constructor Detail

#### CredentialHandlerFactory

    public CredentialHandlerFactory()

The default constructor.

### Method Detail

#### implementingClassNameTable

    private static java.util.Map<CredentialHandler.TYPE,java.lang.String> implementingClassNameTable()

Returns a table that maps, the credential types to the implementing classes.

Returns:
  a Map indexed by Pegasus styles, and values as names of implementing classes.

#### initialize

    public void initialize(PegasusBag bag)
                    throws CredentialHandlerFactoryException

Initializes the Factory. Loads all the implementations just once.

Parameters:
  `bag` - the bag of initialization objects
Throws:
  `CredentialHandlerFactoryException` - that nests any error that might occur during the instantiation of the implementation.

#### loadInstance

    public CredentialHandler loadInstance(CredentialHandler.TYPE type)
                                   throws CredentialHandlerFactoryException

This method loads the appropriate implementing CondorStyle as specified by the user at runtime. The CondorStyle is initialized and returned.

Parameters:
  `type` - the credential type that needs to be loaded.
Throws:
  `CredentialHandlerFactoryException` - that nests any error that might occur during the instantiation of the implementation.

#### loadInstance

    private CredentialHandler loadInstance(PegasusBag bag,
                                           java.lang.String className)
                                    throws CredentialHandlerFactoryException

This method loads the appropriate CredentialHandler using reflection.

Parameters:
  `bag` - the bag of initialization objects
  `className` - the name of the implementing class.
Returns:
  the instance of the class implementing this interface.
Throws:
  `CredentialHandlerFactoryException` - that nests any error that might occur during the instantiation of the implementation.
See Also:
  `DEFAULT_PACKAGE_NAME`

#### get

    private java.lang.Object get(CredentialHandler.TYPE type)

Returns the implementation from the implementing class table.

Parameters:
  `type` - the credential handler type
Returns:
  implementation the class implementing that style, else null

#### put

    private void put(CredentialHandler.TYPE type,
                     CredentialHandler implementation)

Inserts an entry into the implementing class table.

Parameters:
  `type` - the credential handler type
  `implementation` - the class implementing that style.