public class ComponentFactory<T> 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<? extends 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(ComponentManager componentManager) |
ComponentFactory(ComponentManager componentManager,
String configurationDirective) |
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Class<? extends T> 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() |
void |
configureSecurityLevel(SecurityLevel securityLevel) |
void |
configureSecurityLevel(SecurityLevel securityLevel,
boolean locked) |
boolean |
contains(String name)
Determine whether the factory supports a given component type.
|
protected T |
createInstance(String name,
Class<? extends T> cls)
Override this method to create an instance of the component.
|
String |
createNewOrdering(int[] ordering) |
String |
filter(String list,
String... ignores) |
Object |
getInstance(String name)
Get a new instance of a supported component.
|
SecurityLevel |
getMaximumSecurity() |
SecurityLevel |
getMinimumSecurity() |
SecurityLevel |
getSecurityLevel() |
SecurityLevel |
getSecurityLevel(String algorithm) |
boolean |
hasComponents() |
String |
list() |
String |
list(String preferred)
List the types of components supported by this factory.
|
String |
list(String preferred,
String... ignores)
List the types of components supported by this factory.
|
String |
listInclusive(String preference,
Set<String> includes) |
void |
lockComponents() |
Collection<String> |
names() |
Collection<String> |
order() |
String |
order(String[] ordering) |
void |
remove(String name)
Remove a supported component
|
void |
removeAllBut(String names) |
String |
selectStrongestComponent(String[] remoteAlgs) |
String[] |
toArray() |
protected Hashtable<String,Class<? extends T>> supported
public ComponentFactory(ComponentManager componentManager, String configurationDirective)
public ComponentFactory(ComponentManager componentManager)
public SecurityLevel getSecurityLevel()
public String changePositionofAlgorithm(String name, int position) throws SshException
SshException
public Collection<String> names()
public String order(String[] ordering) throws SshException
SshException
public String createNewOrdering(int[] ordering) throws SshException
SshException
public boolean contains(String name)
name
- true
if the component is supported otherwise
false
public String list(String preferred, String... ignores)
preferred
- The preferred component type.ignores
- Any items you want to exclude from the returned list.public String list(String preferred)
preferred
- The preferred component type.public void add(String name, Class<? extends T> cls)
name
- cls
- ClassNotFoundException
public Object getInstance(String name) throws SshException
name
- The name of the component; for example "3des-cbc"ClassNotFoundException
SshException
protected T createInstance(String name, Class<? extends T> cls) throws Throwable
cls
- Throwable
public void remove(String name)
name
- public void clear()
public String[] toArray()
public void removeAllBut(String names)
public void lockComponents()
public void configureSecurityLevel(SecurityLevel securityLevel) throws SshException
SshException
public void configureSecurityLevel(SecurityLevel securityLevel, boolean locked) throws SshException
SshException
public String selectStrongestComponent(String[] remoteAlgs) throws SshException
SshException
public boolean hasComponents()
public Collection<String> order()
public String list()
public SecurityLevel getSecurityLevel(String algorithm)
public SecurityLevel getMaximumSecurity()
public SecurityLevel getMinimumSecurity()
Copyright © 2024. All rights reserved.