Class BaseConnector
- java.lang.Object
-
- org.apache.manifoldcf.core.connector.BaseConnector
-
- All Implemented Interfaces:
IConnector
- Direct Known Subclasses:
BaseAuthorityConnector,BaseMappingConnector,BaseNotificationConnector,BaseOutputConnector,BaseRepositoryConnector,BaseTransformationConnector
public abstract class BaseConnector extends java.lang.Object implements IConnector
This base class underlies all connector implementations.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected IThreadContextcurrentContextprotected ConfigParamsparams
-
Constructor Summary
Constructors Constructor Description BaseConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringcheck()Test the connection.voidclearThreadContext()Clear out any state information specific to a given thread.voidconnect(ConfigParams configParams)Connect.voiddeinstall(IThreadContext threadContext)Uninstall the connector.voiddisconnect()Close the connection.ConfigParamsgetConfiguration()Get configuration information.voidinstall(IThreadContext threadContext)Install the connector.booleanisConnected()This method is called to assess whether to count this connector instance should actually be counted as being connected.voidoutputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters, java.lang.String tabName)Output the configuration body section.voidoutputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.lang.String tabName)Output the configuration body section.voidoutputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters, java.util.List<java.lang.String> tabsArray)Output the configuration header section.voidoutputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.util.ArrayList<java.lang.Object> tabsArray)voidoutputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.util.List<java.lang.String> tabsArray)Output the configuration header section.protected static voidpack(java.lang.StringBuilder output, java.lang.String value, char delimiter)Stuffer for packing a single string with an end delimiterprotected static voidpackFixedList(java.lang.StringBuilder output, java.lang.String[] values, char delimiter)Stuffer for packing lists of fixed lengthprotected static voidpackList(java.lang.StringBuilder output, java.lang.String[] values, char delimiter)Another stuffer for packing lists of variable lengthprotected static voidpackList(java.lang.StringBuilder output, java.util.List<java.lang.String> values, char delimiter)Stuffer for packing lists of variable lengthvoidpoll()This method is periodically called for all connectors that are connected but not in active use.java.lang.StringprocessConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, java.util.Locale locale, ConfigParams parameters)Process a configuration post.java.lang.StringprocessConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, ConfigParams parameters)Process a configuration post.voidsetThreadContext(IThreadContext threadContext)Attach to a new thread.protected static intunpack(java.lang.StringBuilder sb, java.lang.String value, int startPosition, char delimiter)Unstuffer for the above.protected static intunpackFixedList(java.lang.String[] output, java.lang.String value, int startPosition, char delimiter)Unstuffer for unpacking lists of fixed lengthprotected static intunpackList(java.util.List<java.lang.String> output, java.lang.String value, int startPosition, char delimiter)Unstuffer for unpacking lists of variable length.voidviewConfiguration(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters)View configuration.voidviewConfiguration(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters)View configuration.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
params
protected ConfigParams params
-
currentContext
protected IThreadContext currentContext
-
-
Method Detail
-
install
public void install(IThreadContext threadContext) throws ManifoldCFException
Install the connector. This method is called to initialize persistent storage for the connector, such as database tables etc. It is called when the connector is registered.- Specified by:
installin interfaceIConnector- Parameters:
threadContext- is the current thread context.- Throws:
ManifoldCFException
-
deinstall
public void deinstall(IThreadContext threadContext) throws ManifoldCFException
Uninstall the connector. This method is called to remove persistent storage for the connector, such as database tables etc. It is called when the connector is deregistered.- Specified by:
deinstallin interfaceIConnector- Parameters:
threadContext- is the current thread context.- Throws:
ManifoldCFException
-
connect
public void connect(ConfigParams configParams)
Connect. The configuration parameters are included.- Specified by:
connectin interfaceIConnector- Parameters:
configParams- are the configuration parameters for this connection.
-
check
public java.lang.String check() throws ManifoldCFExceptionTest the connection. Returns a string describing the connection integrity.- Specified by:
checkin interfaceIConnector- Returns:
- the connection's status as a displayable string.
- Throws:
ManifoldCFException
-
poll
public void poll() throws ManifoldCFExceptionThis method is periodically called for all connectors that are connected but not in active use.- Specified by:
pollin interfaceIConnector- Throws:
ManifoldCFException
-
isConnected
public boolean isConnected()
This method is called to assess whether to count this connector instance should actually be counted as being connected.- Specified by:
isConnectedin interfaceIConnector- Returns:
- true if the connector instance is actually connected.
-
disconnect
public void disconnect() throws ManifoldCFExceptionClose the connection. Call this before discarding the repository connector.- Specified by:
disconnectin interfaceIConnector- Throws:
ManifoldCFException
-
clearThreadContext
public void clearThreadContext()
Clear out any state information specific to a given thread. This method is called when this object is returned to the connection pool.- Specified by:
clearThreadContextin interfaceIConnector
-
setThreadContext
public void setThreadContext(IThreadContext threadContext) throws ManifoldCFException
Attach to a new thread.- Specified by:
setThreadContextin interfaceIConnector- Parameters:
threadContext- is the new thread context.- Throws:
ManifoldCFException
-
getConfiguration
public ConfigParams getConfiguration()
Get configuration information.- Specified by:
getConfigurationin interfaceIConnector- Returns:
- the configuration information for this class.
-
outputConfigurationHeader
public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters, java.util.List<java.lang.String> tabsArray) throws ManifoldCFException, java.io.IOException
Output the configuration header section. This method is called in the head section of the connector's configuration page. Its purpose is to add the required tabs to the list, and to output any javascript methods that might be needed by the configuration editing HTML.- Specified by:
outputConfigurationHeaderin interfaceIConnector- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.locale- is the locale that the output should use.parameters- are the configuration parameters, as they currently exist, for this connection being configured.tabsArray- is an array of tab names. Add to this array any tab names that are specific to the connector.- Throws:
ManifoldCFExceptionjava.io.IOException
-
outputConfigurationHeader
public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.util.List<java.lang.String> tabsArray) throws ManifoldCFException, java.io.IOException
Output the configuration header section. This method is called in the head section of the connector's configuration page. Its purpose is to add the required tabs to the list, and to output any javascript methods that might be needed by the configuration editing HTML.- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.parameters- are the configuration parameters, as they currently exist, for this connection being configured.tabsArray- is an array of tab names. Add to this array any tab names that are specific to the connector.- Throws:
ManifoldCFExceptionjava.io.IOException
-
outputConfigurationHeader
public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.util.ArrayList<java.lang.Object> tabsArray) throws ManifoldCFException, java.io.IOException
- Throws:
ManifoldCFExceptionjava.io.IOException
-
outputConfigurationBody
public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters, java.lang.String tabName) throws ManifoldCFException, java.io.IOException
Output the configuration body section. This method is called in the body section of the authority connector's configuration page. Its purpose is to present the required form elements for editing. The coder can presume that the HTML that is output from this configuration will be within appropriate <html>, <body>, and <form> tags. The name of the form is "editconnection".- Specified by:
outputConfigurationBodyin interfaceIConnector- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.locale- is the locale that the output should use.parameters- are the configuration parameters, as they currently exist, for this connection being configured.tabName- is the current tab name.- Throws:
ManifoldCFExceptionjava.io.IOException
-
outputConfigurationBody
public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, java.lang.String tabName) throws ManifoldCFException, java.io.IOException
Output the configuration body section. This method is called in the body section of the connector's configuration page. Its purpose is to present the required form elements for editing. The coder can presume that the HTML that is output from this configuration will be within appropriate <html>, <body>, and <form> tags. The name of the form is "editconnection".- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.parameters- are the configuration parameters, as they currently exist, for this connection being configured.tabName- is the current tab name.- Throws:
ManifoldCFExceptionjava.io.IOException
-
processConfigurationPost
public java.lang.String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, java.util.Locale locale, ConfigParams parameters) throws ManifoldCFException
Process a configuration post. This method is called at the start of the authority connector's configuration page, whenever there is a possibility that form data for a connection has been posted. Its purpose is to gather form information and modify the configuration parameters accordingly. The name of the posted form is "editconnection".- Specified by:
processConfigurationPostin interfaceIConnector- Parameters:
threadContext- is the local thread context.variableContext- is the set of variables available from the post, including binary file post information.locale- is the locale that the output should use.parameters- are the configuration parameters, as they currently exist, for this connection being configured.- Returns:
- null if all is well, or a string error message if there is an error that should prevent saving of the connection (and cause a redirection to an error page).
- Throws:
ManifoldCFException
-
processConfigurationPost
public java.lang.String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, ConfigParams parameters) throws ManifoldCFException
Process a configuration post. This method is called at the start of the connector's configuration page, whenever there is a possibility that form data for a connection has been posted. Its purpose is to gather form information and modify the configuration parameters accordingly. The name of the posted form is "editconnection".- Parameters:
threadContext- is the local thread context.variableContext- is the set of variables available from the post, including binary file post information.parameters- are the configuration parameters, as they currently exist, for this connection being configured.- Returns:
- null if all is well, or a string error message if there is an error that should prevent saving of the connection (and cause a redirection to an error page).
- Throws:
ManifoldCFException
-
viewConfiguration
public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, java.util.Locale locale, ConfigParams parameters) throws ManifoldCFException, java.io.IOException
View configuration. This method is called in the body section of the authority connector's view configuration page. Its purpose is to present the connection information to the user. The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.- Specified by:
viewConfigurationin interfaceIConnector- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.locale- is the locale that the output should use.parameters- are the configuration parameters, as they currently exist, for this connection being configured.- Throws:
ManifoldCFExceptionjava.io.IOException
-
viewConfiguration
public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters) throws ManifoldCFException, java.io.IOException
View configuration. This method is called in the body section of the connector's view configuration page. Its purpose is to present the connection information to the user. The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.- Parameters:
threadContext- is the local thread context.out- is the output to which any HTML should be sent.parameters- are the configuration parameters, as they currently exist, for this connection being configured.- Throws:
ManifoldCFExceptionjava.io.IOException
-
pack
protected static void pack(java.lang.StringBuilder output, java.lang.String value, char delimiter)Stuffer for packing a single string with an end delimiter
-
unpack
protected static int unpack(java.lang.StringBuilder sb, java.lang.String value, int startPosition, char delimiter)Unstuffer for the above.
-
packFixedList
protected static void packFixedList(java.lang.StringBuilder output, java.lang.String[] values, char delimiter)Stuffer for packing lists of fixed length
-
unpackFixedList
protected static int unpackFixedList(java.lang.String[] output, java.lang.String value, int startPosition, char delimiter)Unstuffer for unpacking lists of fixed length
-
packList
protected static void packList(java.lang.StringBuilder output, java.util.List<java.lang.String> values, char delimiter)Stuffer for packing lists of variable length
-
packList
protected static void packList(java.lang.StringBuilder output, java.lang.String[] values, char delimiter)Another stuffer for packing lists of variable length
-
unpackList
protected static int unpackList(java.util.List<java.lang.String> output, java.lang.String value, int startPosition, char delimiter)Unstuffer for unpacking lists of variable length.- Parameters:
output- is the array to write the unpacked result into.value- is the value to unpack.startPosition- is the place to start the unpack.delimiter- is the character to use between values.- Returns:
- the next position beyond the end of the list.
-
-