public class ComponentFactory<T extends SshComponent> extends Object implements Cloneable
A utility class used to store the available transport components and provide delimited listing as required in the key exchange initialization process.
| Modifier and Type | Field and Description |
|---|---|
protected Vector<String> |
order |
protected Hashtable<String,Class<T>> |
supported
The supported components stored in a Hashtable with a String
key as the component name such as "3des-cbc" and a Class value
storing the implementation class.
|
| Constructor and Description |
|---|
ComponentFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
Class cls)
Add a new component type to the factory.
|
String |
changePositionofAlgorithm(String name,
int position) |
void |
clear()
Clear all of the entries in this component factory.
|
Object |
clone() |
boolean |
contains(String name)
Determine whether the factory supports a given component type.
|
protected T |
createInstance(String name)
Override this method to create an instance of the component.
|
String |
createNewOrdering(int[] ordering) |
T |
getInstance(String name)
Get a new instance of a supported component.
|
String |
list(String preferred)
List the types of components supported by this factory.
|
void |
remove(String name)
Remove a supported component
|
void |
removeAllBut(String names) |
protected Hashtable<String,Class<T extends SshComponent>> supported
public String changePositionofAlgorithm(String name, int position) throws SshException
SshExceptionpublic String createNewOrdering(int[] ordering) throws SshException
SshExceptionpublic boolean contains(String name)
name - true if the component is supported otherwise
falsepublic String list(String preferred)
preferred - The preferred component type.public void add(String name, Class cls)
name - cls - ClassNotFoundExceptionpublic T getInstance(String name) throws SshException
name - The name of the component; for example "3des-cbc"ClassNotFoundExceptionSshExceptionprotected T createInstance(String name) throws Throwable
cls - Throwablepublic void remove(String name)
name - public void removeAllBut(String names)
public void clear()
Copyright © 2013. All Rights Reserved.