public class FabricConnectionFactory
extends com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
implements java.io.Serializable, javax.naming.Referenceable, javax.naming.spi.ObjectFactory
Title: Service Event Fabric Client
Description: Defines a factory intended for creation of the FabricConnection
instances.
Usage example:
FabricConnectionFactory factory = new FabricConnectionFactory(); factory.setDescription("Example"); // This description will be passed to the connection created below. FabricConnection connection = factory.createConnection(); connection.open();
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Constructor and Description |
---|
FabricConnectionFactory()
Creates a new factory.
|
FabricConnectionFactory(java.util.List urls)
Creates a new factory with the specified list of URLs.
|
FabricConnectionFactory(java.lang.String url)
Creates a new factory with the specified URL (or list of URLs).
|
Modifier and Type | Method and Description |
---|---|
void |
addURL(java.lang.String url)
Adds the specified URL to the list of URLs.
|
FabricConnection |
createConnection()
Creates a new connection.
|
FabricConnection |
createConnection(java.lang.String securityToken)
Creates a new connection with the specified
Web Application Token token. |
FabricConnection |
createConnection(java.lang.String userName,
java.lang.String password)
Creates a new connection with the specified user credentials.
|
java.lang.String |
getDescription()
Returns a description of the factory.
|
EventScope |
getEventScope()
Returns an event scope of the factory.
|
java.lang.String |
getName()
Returns a name of the factory.
|
java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable environment)
This operation is not supported yet.
|
int |
getReconnectAttempts()
Returns a number of reconnect attempts that will be made by the Fabric Connection in a case of the remote node disconnection.
|
long |
getReconnectInterval()
Returns a time (in seconds) between successive reconnect attempts that will be made by the Fabric Connection
in a case of the remote node disconnection.
|
javax.naming.Reference |
getReference()
This operation is not supported yet.
|
java.lang.String |
getType()
Returns a type of the factory.
|
java.util.List |
getURLs()
Returns a list of URLs.
|
java.lang.String |
getUserName()
Returns a user name of the factory.
|
void |
removeURL(java.lang.String url)
Removes the specified URLs from the list of URLs.
|
void |
setDescription(java.lang.String description)
Sets the specified factory description.
|
void |
setEventScope(EventScope eventScope)
Sets the specified event scope.
|
void |
setName(java.lang.String name)
Sets the specified name of the factory.
|
void |
setPassword(java.lang.String password)
Sets the specified user password of the factory.
|
void |
setReconnectAttempts(int reconnectAttempts)
Sets a number of reconnect attempts that will be made by the Fabric Connection in a case of the remote node disconnection.
|
void |
setReconnectInterval(long reconnectInterval)
Sets a time (in seconds) between successive reconnect attempts that will be made by the Fabric Connection
in a case of the remote node disconnection.
|
void |
setSecurityToken(java.lang.String securityToken)
Sets the specified security token of the factory.
|
void |
setType(java.lang.String type)
Sets the specified type of the factory.
|
void |
setUserName(java.lang.String userName)
Sets the specified user name of the factory.
|
getContext, getContextType, hasContext
clone, getSerialVersionUID
public FabricConnectionFactory()
public FabricConnectionFactory(java.lang.String url) throws FabricConnectionFactoryException
tlp://localhost:5000
).
The specified parameter can include a list of URLs separated by '&' delimiter.
E.g. tlp://localhost:5001&tlp://localhost:5001&tlp://localhost:5002
.
This list cannot contain a combination of local URL (tlp://local
) and non-local URLs.
url
- the URL or list of URLs.FabricConnectionFactoryException
- if a combination of the specified URLs is not allowed.public FabricConnectionFactory(java.util.List urls) throws FabricConnectionFactoryException
tlp://localhost:5000
).
This list cannot contain a combination of local URL (tlp://local
) and non-local URLs.
urls
- the list of URLs.
throws FabricConnectionFactoryException if a combination of the specified URLs is not allowed.FabricConnectionFactoryException
public FabricConnection createConnection() throws FabricConnectionFactoryException
tlp://local
)
a local (embedded) connection will be created. In other case a remote connection will be created.createConnection
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
FabricConnectionFactoryException
- if some error occurs.public FabricConnection createConnection(java.lang.String userName, java.lang.String password) throws FabricConnectionFactoryException
tlp://local
)
a local (embedded) connection will be created. In other case a remote connection will be created.createConnection
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
userName
- the specified user name.password
- the specified user password.FabricConnectionFactoryException
- if some error occurs.public FabricConnection createConnection(java.lang.String securityToken) throws FabricConnectionFactoryException
Web Application Token
token.
tlp://local
)
a local (embedded) connection will be created. In other case a remote connection will be created.securityToken
- the specified security token.FabricConnectionFactoryException
- if some error occurs.public java.lang.String getName()
getName
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setName(java.lang.String name)
setName
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
name
- the value to be set.public java.lang.String getType()
getType
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setType(java.lang.String type)
setType
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
type
- the value to be set.public java.lang.String getDescription()
getDescription
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setDescription(java.lang.String description) throws FabricConnectionFactoryException
Length of the description cannot be more than 20 characters.
setDescription
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
description
- the value to be set.FabricConnectionFactoryException
- if a length of the description more than 20 characters.public void addURL(java.lang.String url) throws FabricConnectionFactoryException
If this list contains only local URLs (tlp://local
) other URLs cannot be added.
And vice versa, a local URL cannot be added to the list containing non-local URLs.
Non-local URLs must have the following format: <Protocol>://<Host>:<Port>
(e.g. tlp://localhost:5000
).
addURL
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
url
- the URL to be added.FabricConnectionFactoryException
- if the specified URL has wrong format or
if the specified URL is not allowed.public void removeURL(java.lang.String url)
removeURL
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
url
- the URL to be removed.public java.util.List getURLs()
getURLs
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public EventScope getEventScope()
getEventScope
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setEventScope(EventScope eventScope)
setEventScope
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
eventScope
- the value to be set.public java.lang.String getUserName()
getUserName
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setUserName(java.lang.String userName)
setUserName
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
userName
- the value to be set.public void setPassword(java.lang.String password)
setPassword
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
password
- the value to be set.public void setSecurityToken(java.lang.String securityToken)
setSecurityToken
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
securityToken
- the value to be set.public int getReconnectAttempts()
Value 0
means that the connection will not attempt to reconnect.
Negative value means that the connection will try to reconnect infinitely (until successful connecting).
Default value is -1
.
This method is applicable to the Client Context only (i.e. for remote connections).
getReconnectAttempts
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setReconnectAttempts(int reconnectAttempts)
Value 0
means that the connection will not attempt to reconnect.
Negative value means that the connection will try to reconnect infinitely (until successful connecting).
This method is applicable to the Client Context only (i.e. for remote connections).
setReconnectAttempts
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
reconnectAttempts
- the value to be set.public long getReconnectInterval()
Default value is 30L
.
This method is applicable to the Client Context only (i.e. for remote connections).
getReconnectInterval
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
public void setReconnectInterval(long reconnectInterval) throws FabricConnectionFactoryException
This method is applicable to the Client Context only (i.e. for remote connections).
setReconnectInterval
in class com.streamscape.sef.dispatcher.AbstractFabricConnectionFactory
reconnectInterval
- the value to be set.FabricConnectionFactoryException
- if the specified interval is not positive (i.e. reconnectInterval <= 0
);public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment) throws java.lang.Exception
getObjectInstance
in interface javax.naming.spi.ObjectFactory
java.lang.Exception
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.