Class ComponentFactory<T extends Component>
java.lang.Object
com.sshtools.common.ssh.components.ComponentFactory<T>
- All Implemented Interfaces:
Cloneable
A utility class used to store the available transport components and provide delimited listing as required in the key exchange initialization process.
- Author:
- Lee David Painter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ComponentInstanceFactory<?> factory) Add a new component type to the factory.changePositionofAlgorithm(String name, int position) voidclear()Clear all of the entries in this component factory.clone()voidconfigureSecurityLevel(SecurityLevel securityLevel) booleanDetermine whether the factory supports a given component type.protected TcreateInstance(String name, Class<? extends T> cls) Override this method to create an instance of the component.createNewOrdering(int[] ordering) getInstance(String name) Get a new instance of a supported component.booleanlist()List the types of components supported by this factory.List the types of components supported by this factory.voidnames()order()voidvoidRemove a supported componentvoidremoveAllBut(String names) selectStrongestComponent(String[] remoteAlgs) String[]toArray()
-
Field Details
-
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. -
order
-
-
Constructor Details
-
ComponentFactory
-
-
Method Details
-
changePositionofAlgorithm
- Throws:
SshException
-
names
-
order
- Throws:
SshException
-
order
- Throws:
SshException
-
createNewOrdering
- Throws:
SshException
-
contains
Determine whether the factory supports a given component type.- Parameters:
name-- Returns:
trueif the component is supported otherwisefalse
-
list
List the types of components supported by this factory. Returns the list as a comma delimited string with the preferred value as the first entry in the list. If the preferred value is "" then the list is returned unordered.- Parameters:
preferred- The preferred component type.ignores- Any items you want to exclude from the returned list.- Returns:
- A comma delimited String of component types; for example "3des-cbc,blowfish-cbc"
-
list
List the types of components supported by this factory. Returns the list as a comma delimited string with the preferred value as the first entry in the list. If the preferred value is "" then the list is returned unordered.- Parameters:
preferred- The preferred component type.- Returns:
- A comma delimited String of component types; for example "3des-cbc,blowfish-cbc"
-
add
Add a new component type to the factory. This method throws an exception if the class cannot be resolved. The name of the component IS NOT verified to allow component implementations to be overridden.- Parameters:
name- namefactory- factory- Throws:
ClassNotFoundException
-
getInstance
Get a new instance of a supported component.- Parameters:
name- The name of the component; for example "3des-cbc"- Returns:
- the newly instantiated object
- Throws:
ClassNotFoundExceptionSshException
-
createInstance
Override this method to create an instance of the component.- Parameters:
cls-- Returns:
- the newly instantiated object
- Throws:
Throwable
-
remove
Remove a supported component- Parameters:
name-
-
clear
public void clear()Clear all of the entries in this component factory. -
clone
-
toArray
-
removeAllBut
-
lockComponents
public void lockComponents() -
configureSecurityLevel
- Throws:
SshException
-
selectStrongestComponent
- Throws:
SshException
-
hasComponents
public boolean hasComponents() -
order
-
list
-
filter
-