public interface ClientFactory
extends javax.naming.Referenceable, java.io.Serializable
Title: Open Service Framework
Description: A Client Factory
interface represents a serializable configuration object that
allows service developers to create connections to arbitrary external resources. It is
loosely based on the transport factory and is intended to be extended to accommodate such
popular back end systems as FTP, HTTP, Sockets and others.
This interface may be used in conjunction with Referenceable
factories such as those supported
by JNDI
, or it may provide a wrapping mechanism that offers Referenceable
support
for connection definitions that do not normally support Naming
and JNDI
interfaces.
Client Factory
objects are created as serializable entities that are intended to be persisted
into an Entity Repository
. The artifact that represents a factory is an XML document. Reference
to the artifact may be added as a parameter to the AbstractServiceConfigurationObject
implementation. The default implementation is the ServiceConfigurationObject
.
The property will be presented as a ServiceConfigurationProperty
property with
ServicePropertyType.CLIENT_FACTORY
type.
At Service initialization time the factory's reference will be resolved and the factory artifact will be marshaled
back into an object. If the factory isManaged()
the Container Context
will automatically
manage the connection's life cycle. For instance the connection will be started when the serivice is started and it
will re-cycle and stop along with the service. The resulting connection's state may be monitored by a
State Notification Event Listener
that maybe set on the connection. Any logging that the
connection may perform can likewise be routed to a particular logger mechanism such as that used by the Service.
The factory provides methods that allow the Service to be automatically associated with error logging and
state notification. Alternatively Service developers may choose to control life cycle, logging and event management
them selves by specifying their own components.
Copyright: Copyright (c) 2008
Company: StreamScape Technologies
Modifier and Type | Field and Description |
---|---|
static long |
Day |
static long |
Hour |
static long |
Minute |
static long |
Second |
Modifier and Type | Method and Description |
---|---|
ClientConnection |
createConnection()
Creates a connection using default credentials.
|
ClientConnection |
createConnection(java.lang.String connectionName,
java.lang.String userName,
java.lang.String password)
Creates a named connection and loads it into the reference list.
|
void |
destroyAll()
Cleans up all transient objects and frees up all resources created by this factory.
|
long |
getCheckInterval()
Returns the number of milliseconds between checks of the connection's state.
|
java.lang.ClassLoader |
getClassLoader()
Returns the class loader for this factory.
|
java.lang.String |
getConnectionClassName()
Returns the name of the connection implementing class name.
|
int |
getConnectionTimeout()
Gets the number of seconds the connection attempt will wait before throwing
an exception.
|
java.lang.String |
getDefaultPassword()
Gets the default password.
|
java.lang.String |
getDefaultUser()
Gets the default user.
|
java.lang.String |
getDescription()
Sets the description of this factory.
|
java.lang.String |
getFactoryName()
Returns the name of the transport factory instance.
|
java.lang.String |
getFactoryType()
Returns the factory Type.
|
int |
getMajorVersion()
Returns the major version of the factory.
|
int |
getMinorVersion()
Returns the minor version of the factory
|
java.util.Properties |
getProperties() |
java.lang.String |
getProperty(java.lang.String name)
Returns the value of a specified property.
|
int |
getReconnectRetries()
Returns the number of times a connection will try to reconnect.
|
java.lang.String |
getUrl()
Gets the URL (or list of comma delimited URL) for this factory.
|
java.lang.String |
getVendorString()
Returns the complete version string.
|
boolean |
isManaged()
Returns
true if the factory's connection life cycle
is to be managed by the Service Context. |
boolean |
isReliable()
Returns
true if the connection created by the factory is reliable. |
java.util.List |
listConnections()
Returns a list of all connections in this factory's pool.
|
java.util.List |
listProperties()
Lists all the properties of this factory.
|
ClientConnection |
lookupConnection(java.lang.String connectionName)
Returns a connection from the pool specified by the name.
|
int |
pingConnection(java.lang.String connectionName)
Tests the connection of the specified name.
|
void |
removeConnection(java.lang.String name)
Removes a connection from the factory pool.
|
void |
setCheckInterval(long millis)
Sets the frequency at which ot check the connection's state in milliseconds.
|
void |
setConnectionClassName(java.lang.String className)
Sets the name of the connection implementing class.
|
void |
setConnectionTimeout(int seconds)
Sets the number of seconds to wait for a successful connection before throwing
an exception.
|
void |
setDefaultPassword(java.lang.String password)
Sets the default password
|
void |
setDefaultUser(java.lang.String userName)
Sets the default user.
|
void |
setDescription(java.lang.String desc)
Gets the description of the factory.
|
void |
setFactoryName(java.lang.String name)
Sets the name of this factory.
|
void |
setFactoryType(java.lang.String type)
Sets the factory type name.
|
void |
setManaged(boolean auto)
Sets wether this factory's connection life cycle is managed by the
container context or not.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets the value of a property for this factory.
|
void |
setReconnectRetries(int retry)
Sets the number of times that a reliable connection tries to reconnect.
|
void |
setReliable(boolean reliable)
Specifies if the connection that is created will be reliable.
|
void |
setUrl(java.lang.String url)
Sets the URL (or list of comma delimited URL) for this factory.
|
static final long Day
static final long Hour
static final long Minute
static final long Second
java.lang.String getFactoryName()
void setFactoryName(java.lang.String name)
name
- Stringjava.lang.String getDescription()
void setDescription(java.lang.String desc)
desc
- Stringjava.lang.String getFactoryType()
void setFactoryType(java.lang.String type)
type
- Stringint getMajorVersion()
int getMinorVersion()
java.lang.String getVendorString()
void setDefaultUser(java.lang.String userName)
userName
- Stringjava.lang.String getDefaultUser()
void setDefaultPassword(java.lang.String password)
password
- Stringjava.lang.String getDefaultPassword()
boolean isManaged()
true
if the factory's connection life cycle
is to be managed by the Service Context. When true
the
connection will be started (connected) implicitly as part of the
Service.init()
method. The connection
is established immediatley before method is invoked. If the
connection attempt results in a failure the service is put into
suspended mode on platforms that support this mode. Otherwise the
service is placed into stopped mode. If the factory defines
a reliable connection the connection's retry cycle completes
prior to the Service transitioning into a stopped or suspended
mode.void setManaged(boolean auto)
auto
- booleanvoid setReliable(boolean reliable)
TransportException
occurs.
The reconnect is attempted based on reconnection retries and timeouts.
If the connection does not succeed the service is placed in a Suspended
state or Stopped state depending on what the service hosting environment
supports.reliable
- booleanboolean isReliable()
true
if the connection created by the factory is reliable.void setReconnectRetries(int retry)
retry
- intint getReconnectRetries()
int pingConnection(java.lang.String connectionName) throws ClientException
connectionName
- StringClientException
java.lang.String getUrl()
void setUrl(java.lang.String url)
url
- Stringvoid destroyAll() throws ClientFactoryConfigurationException
ClientConnection lookupConnection(java.lang.String connectionName) throws ClientFactoryConfigurationException
connectionName
- StringClientFactoryConfigurationException
java.util.List listProperties()
ClientFactoryConfigurationException
void removeConnection(java.lang.String name) throws ClientFactoryConfigurationException
name
- StringClientFactoryConfigurationException
java.util.List listConnections()
java.lang.String getProperty(java.lang.String name)
name
- StringClientFactoryConfigurationException
void setProperty(java.lang.String name, java.lang.String value) throws ClientFactoryConfigurationException
name
- Stringvalue
- StringClientFactoryConfigurationException
java.lang.ClassLoader getClassLoader()
long getCheckInterval()
void setCheckInterval(long millis)
millis
- longint getConnectionTimeout()
void setConnectionTimeout(int seconds)
seconds
- intjava.lang.String getConnectionClassName()
void setConnectionClassName(java.lang.String className)
className
- StringClientConnection createConnection() throws ClientException
Sys$Default.[factoryType].[factoryName]
using the lookupConnection(java.lang.String)
method.ClientException
ClientConnection createConnection(java.lang.String connectionName, java.lang.String userName, java.lang.String password) throws ClientException
lookupConnection(java.lang.String)
method.connectionName
- StringuserName
- Stringpassword
- StringClientException
java.util.Properties getProperties()
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.