public final class JoramAdapter extends JoramResourceAdapter implements JoramAdapterMBean, ExceptionListener
JoramAdapter
instance manages connectivities to an underlying
JORAM server: outbound connectivity (JCA connection management contract) and
inbound connectivity (asynchronous message delivery as specified by the JCA
message inflow contract).JoramResourceAdapter.Status
Modifier and Type | Field and Description |
---|---|
private long |
adminDurationState
The duration of admin connection before change state.
|
private String |
adminFileExportXML
Path to the XML file containing a description of the exported administered
objects (destination) from the platform.
|
private String |
adminFileXML
Path to the XML file (joramAdmin.xml) containing a description of the administered objects to
create and bind.
|
(package private) boolean |
collocated
true if the underlying JORAM server is collocated. |
int |
connectingTimer
Duration in seconds during which connecting is attempted (connecting
might take time if the server is temporarily not reachable); the 0 value
is set for connecting only once and aborting if connecting failed.
|
(package private) String |
hostName
Host name or IP of the underlying JORAM server. localhost if collocated.
|
(package private) String |
identityClass
Identity class needed for authentication
|
private boolean |
isActive
true if admin connection connection is active. |
static org.objectweb.util.monolog.api.Logger |
logger |
private String |
platformConfigDir
Path to the directory containing JORAM's configuration files
(
a3servers.xml , a3debug.cfg
and admin file), needed when StartJoramServer is set to true. |
private org.osgi.framework.ServiceRegistration |
registration |
(package private) String |
rootName
login name for administrator.
|
(package private) String |
rootPasswd
password for administrator
|
private static long |
serialVersionUID
Define serialVersionUID for interoperability.
|
private ServerDesc |
serverDesc |
(package private) short |
serverId
Identifier of the JORAM server to start.
|
(package private) int |
serverPort
Port number of the underlying JORAM server. -1 if collocated
|
(package private) boolean |
startJoramServer
true start the JoramServer
|
private String |
storage
the persistence directory of the JORAM server to start,
needed when StartJoramServer is set to true.
|
private JoramAdmin |
wrapper |
jmxRootName, jndiHelper, jndiName, name, status
Constructor and Description |
---|
JoramAdapter()
Constructs a
JoramAdapter instance. |
JoramAdapter(MBeanServer jmxServer)
Constructs a
JoramAdapter instance. |
Modifier and Type | Method and Description |
---|---|
(package private) void |
adminConnect()
Initiates an admin session.
|
(package private) void |
adminDisconnect() |
void |
createCF(String name)
Creates a non managed connection factory and binds it to JNDI.
|
String |
createQueue(short serverId,
String name)
Creates or retrieves a queue destination on the underlying JORAM server,
(re)binds the corresponding
Queue instance. |
String |
createQueue(short serverId,
String name,
String className,
Properties prop)
First tries to retrieve a queue destination on the underlying JORAM server first
using JNDI then the Joram's internal name service.
|
String |
createQueue(String name)
Creates or retrieves a queue destination on the underlying JORAM server,
(re)binds the corresponding
Queue instance. |
void |
createQueueCF(String name)
Creates a non managed PTP connection factory and binds it to JNDI.
|
String |
createTopic(short serverId,
String name)
Creates or retrieves a topic destination on the underlying JORAM server,
(re)binds the corresponding
Topic instance. |
String |
createTopic(short serverId,
String name,
String className,
Properties prop)
Creates or retrieves a topic destination on the underlying JORAM server,
(re)binds the corresponding
Topic instance. |
String |
createTopic(String name)
Creates or retrieves a topic destination on the underlying JORAM server,
(re)binds the corresponding
Topic instance. |
void |
createTopicCF(String name)
Creates a non managed PubSub connection factory and binds it to JNDI.
|
String |
createUser(String name,
String password)
Creates or retrieves a user on the underlying JORAM server.
|
String |
createUser(String name,
String password,
short serverId)
Creates or retrieves a user on the given JORAM server.
|
String |
createUser(String name,
String password,
short serverId,
String identityClass)
Creates or retrieves a user on the underlying JORAM server.
|
String |
createUser(String name,
String password,
String identityClass)
Creates or retrieves a user on the underlying JORAM server.
|
boolean |
equals(Object o)
Compares adapters according to their properties.
|
void |
executeXMLAdmin(String path)
Executes the XML configuration file.
|
void |
exportRepositoryToFile(String exportDir)
Export the repository content to an XML file with default filename
|
void |
exportRepositoryToFile(String exportDir,
String exportFilename)
Export the repository content to an XML file
- only the destinations objects are retrieved in this version
- xml script format of the admin objects (joramAdmin.xml)
|
long |
getAdminDurationBeforeChangeState()
get duration of admin connection before change state.
|
String |
getAdminDurationBeforeChangeStateDate()
get duration of admin connection before change state.
|
String |
getAdminFileExportXML()
Returns the path of XML the file containing a description of the exported
administered objects (destination) from the platform.
|
String |
getAdminFileXML()
Returns the path of XML the file containing a description of the administered
objects to create and bind at starting.
|
Boolean |
getCollocated()
Returns
true if the Joram server is collocated. |
Boolean |
getCollocatedServer()
Deprecated.
only needed for compatibility with JOnAS 5.2 administration GUI
|
String |
getConfiguration()
Returns the current servers configuration (a3servers.xml).
|
Integer |
getConnectingTimer()
Duration in seconds during which connecting is attempted (connecting
might take time if the server is temporarily not reachable); the 0 value
is set for connecting only once and aborting if connecting failed.
|
String |
getDefaultDMQId()
Returns the unique identifier of the default dead message queue for the local
server, null if not set.
|
String |
getDefaultDMQId(short serverId)
Returns the unique identifier of the default dead message queue for a given
server, null if not set.
|
int |
getDefaultThreshold()
Returns the default threshold of the Joram server.
|
int |
getDefaultThreshold(short serverId)
Returns the default threshold of the given Joram server.
|
String[] |
getDestinations()
Returns the list of all destinations that exist on the local server.
|
String[] |
getDestinations(short serverId)
Returns the list of all destinations that exist on the given server.
|
String |
getHostName()
Returns the location of the Joram server.
|
String |
getIdentityClass()
Identity class needed for authentication
|
String |
getMBeanName() |
String |
getPlatformConfigDir()
Path to the directory containing JORAM's configuration files
(
a3servers.xml , a3debug.cfg
and admin file), needed when StartJoramServer is set to true. |
String |
getRootName()
login name for administrator.
|
String |
getRootPasswd() |
Short |
getServerId()
Returns the unique identifier of the Joram server.
|
String |
getServerName()
Deprecated.
only needed for compatibility with JOnAS 5.2 administration GUI
|
Integer |
getServerPort()
Returns the listening port of the Joram server.
|
Short[] |
getServersIds()
Returns the list of the platform's servers' identifiers.
|
String[] |
getServersNames()
Returns the list of the platform's servers' names.
|
Boolean |
getStartJoramServer()
true if the resource adapter start the JoramServer
|
String |
getStorage()
The persistence directory of the JORAM server to start,
needed when StartJoramServer is set to true.
|
long |
getTimeOutToAbortRequest()
Gets timeout in ms before abort a request.
|
String[] |
getUsers()
Returns the list of all users that exist on the local server.
|
String[] |
getUsers(short serverId)
Returns the list of all users that exist on a given server.
|
JoramAdmin |
getWrapper()
The admin wrapper.
|
int |
hashCode()
Returns a code depending on the adapter properties.
|
boolean |
isActive()
return the activity of the Joram administration connection.
|
private boolean |
isJoramServerRun() |
void |
reconnect() |
void |
removeDestination(String name)
Remove a destination specified by its JNDI name on the underlying
JORAM platform.
|
private static String |
removePrefix(String name)
remove prefix name scn:comp/
|
void |
resetDefaultDMQ(short serverId)
Unset the default dead message queue for the given server.
|
void |
setAdminFileExportXML(String adminFileExportXML)
Sets the path of the XML file containing a description of the exported
administered objects (destination) from the platform.
|
void |
setAdminFileXML(String adminFileXML)
Sets the path of the XML file containing a description of the administered
objects to create and bind at starting.
|
void |
setCollocated(Boolean collocated) |
void |
setConnectingTimer(Integer connectingTimer) |
void |
setDefaultThreshold(int threshold)
Sets the default threshold of the Joram server.
|
void |
setDefaultThreshold(short serverId,
int threshold)
Sets the default threshold of the given Joram server.
|
void |
setHostName(String hostName) |
void |
setIdentityClass(String identityClass) |
void |
setPlatformConfigDir(String platformConfigDir) |
void |
setRootName(String rn) |
void |
setRootPasswd(String rp) |
void |
setServerId(Short serverId) |
void |
setServerPort(Integer serverPort) |
void |
setStartJoramServer(Boolean startJoramServer) |
void |
setStorage(String storage) |
void |
setTimeOutToAbortRequest(long timeOut)
Sets timeout in ms before abort a request.
|
void |
start() |
void |
start(BootstrapContext ctx)
Initializes the adapter; starts, if needed, a collocated JORAM server,
and if needed again, administers it.
|
void |
stop()
Notifies the adapter to terminate the connections it manages, and if
needed, to shutdown the collocated JORAM server.
|
private void |
waitAgentServerStarted() |
addProducer, bind, createCF, createQueueCF, createTopicCF, endpointActivation, endpointDeactivation, getJMSProviderName, getJMSVersion, getJndiName, getName, getProviderVersion, getStatus, getStatusInfo, getXAResources, onException, removeProducer, setJmxServer, setJndiName, setName, setWorkManager, unbind
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getJMSProviderName, getJMSVersion, getJndiName, getName, getProviderVersion
onException
private static final long serialVersionUID
public static org.objectweb.util.monolog.api.Logger logger
private boolean isActive
true
if admin connection connection is active.private long adminDurationState
private JoramAdmin wrapper
private ServerDesc serverDesc
private org.osgi.framework.ServiceRegistration registration
boolean collocated
true
if the underlying JORAM server is collocated.boolean startJoramServer
String hostName
int serverPort
String rootName
String rootPasswd
String identityClass
short serverId
private String storage
private String platformConfigDir
a3servers.xml
, a3debug.cfg
and admin file), needed when StartJoramServer is set to true.private String adminFileXML
private String adminFileExportXML
public int connectingTimer
public JoramAdapter()
JoramAdapter
instance.public JoramAdapter(MBeanServer jmxServer)
JoramAdapter
instance.public void setCollocated(Boolean collocated)
public Boolean getCollocated()
JoramAdapterMBean
true
if the Joram server is collocated.getCollocated
in interface JoramAdapterMBean
true
if the Joram server is collocated.public void setStartJoramServer(Boolean startJoramServer)
public Boolean getStartJoramServer()
JoramAdapterMBean
getStartJoramServer
in interface JoramAdapterMBean
public String getHostName()
JoramAdapterMBean
getHostName
in interface JoramAdapterMBean
public void setHostName(String hostName)
public Integer getServerPort()
JoramAdapterMBean
getServerPort
in interface JoramAdapterMBean
public void setServerPort(Integer serverPort)
public String getRootName()
JoramAdapterMBean
getRootName
in interface JoramAdapterMBean
public void setRootName(String rn)
public String getRootPasswd()
public void setRootPasswd(String rp)
public String getIdentityClass()
JoramAdapterMBean
getIdentityClass
in interface JoramAdapterMBean
public void setIdentityClass(String identityClass)
public Short getServerId()
JoramAdapterMBean
getServerId
in interface JoramAdapterMBean
public void setServerId(Short serverId)
public String getStorage()
JoramAdapterMBean
getStorage
in interface JoramAdapterMBean
public void setStorage(String storage)
public String getPlatformConfigDir()
JoramAdapterMBean
a3servers.xml
, a3debug.cfg
and admin file), needed when StartJoramServer is set to true.getPlatformConfigDir
in interface JoramAdapterMBean
public void setPlatformConfigDir(String platformConfigDir)
public String getAdminFileXML()
getAdminFileXML
in interface JoramAdapterMBean
public void setAdminFileXML(String adminFileXML)
public String getAdminFileExportXML()
getAdminFileExportXML
in interface JoramAdapterMBean
public void setAdminFileExportXML(String adminFileExportXML)
public Integer getConnectingTimer()
JoramAdapterMBean
getConnectingTimer
in interface JoramAdapterMBean
public void setConnectingTimer(Integer connectingTimer)
private boolean isJoramServerRun()
private void waitAgentServerStarted() throws ResourceAdapterInternalException
ResourceAdapterInternalException
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException
start
in interface ResourceAdapter
start
in class JoramResourceAdapter
ResourceAdapterInternalException
- If the adapter could not be
initialized.public void start() throws ResourceAdapterInternalException
start
in class JoramResourceAdapter
ResourceAdapterInternalException
void adminConnect() throws AdminException
AdminException
- If the admin session could not be started.public String getMBeanName()
void adminDisconnect()
public void stop()
stop
in interface ResourceAdapter
stop
in class JoramResourceAdapter
public void reconnect() throws Exception
reconnect
in class JoramResourceAdapter
Exception
public int hashCode()
public boolean equals(Object o)
public boolean isActive()
isActive
in interface JoramAdapterMBean
public long getAdminDurationBeforeChangeState()
getAdminDurationBeforeChangeState
in interface JoramAdapterMBean
public String getAdminDurationBeforeChangeStateDate()
getAdminDurationBeforeChangeStateDate
in interface JoramAdapterMBean
public long getTimeOutToAbortRequest() throws ConnectException
getTimeOutToAbortRequest
in interface JoramAdapterMBean
ConnectException
wrapper#getTimeOutToAbortRequest()
public void setTimeOutToAbortRequest(long timeOut) throws ConnectException
setTimeOutToAbortRequest
in interface JoramAdapterMBean
timeOut
- timeout before abort a request.ConnectException
wrapper#setTimeOutToAbortRequest(long)
public String getDefaultDMQId() throws ConnectException, AdminException
getDefaultDMQId
in interface JoramAdapterMBean
ConnectException
- If the connection fails.AdminException
- Never thrown.wrapper#getDefaultDMQId()
public String getDefaultDMQId(short serverId) throws ConnectException, AdminException
The request fails if the target server does not belong to the platform.
getDefaultDMQId
in interface JoramAdapterMBean
serverId
- Unique identifier of the server.ConnectException
- If the connection fails.AdminException
- If the request fails.wrapper#getDefaultDMQId()
public void resetDefaultDMQ(short serverId) throws ConnectException, AdminException
resetDefaultDMQ
in interface JoramAdapterMBean
serverId
- Unique identifier of the given server.ConnectException
AdminException
public int getDefaultThreshold() throws ConnectException, AdminException
getDefaultThreshold
in interface JoramAdapterMBean
ConnectException
AdminException
wrapper#getDefaultThreshold()
public int getDefaultThreshold(short serverId) throws ConnectException, AdminException
getDefaultThreshold
in interface JoramAdapterMBean
serverId
- Unique identifier of the given Joram server.ConnectException
AdminException
wrapper#getDefaultThreshold(int)
public void setDefaultThreshold(int threshold) throws ConnectException, AdminException
setDefaultThreshold
in interface JoramAdapterMBean
threshold
- the default threshold of the Joram server.ConnectException
AdminException
wrapper#setDefaultThreshold(int)
public void setDefaultThreshold(short serverId, int threshold) throws ConnectException, AdminException
setDefaultThreshold
in interface JoramAdapterMBean
serverId
- Unique identifier of the given Joram server.threshold
- the default threshold of the given Joram server.ConnectException
AdminException
wrapper#setDefaultThreshold(int, int)
public String[] getDestinations() throws ConnectException, AdminException
getDestinations
in interface JoramAdapterMBean
ConnectException
- If the connection is closed or broken.AdminException
- Never thrown.getDestinations(short)
public String[] getDestinations(short serverId) throws ConnectException, AdminException
The request fails if the target server does not belong to the platform.
getDestinations
in interface JoramAdapterMBean
ConnectException
- If the connection is closed or broken.AdminException
- Never thrown.JoramAdapterMBean.getDestinations(short)
public String createQueue(String name) throws AdminException, ConnectException
Queue
instance.createQueue
in interface JoramAdapterMBean
createQueue
in class JoramResourceAdapter
name
- The name of the queue.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokencreateQueue(short, String, String, Properties)
public String createQueue(short serverId, String name) throws AdminException, ConnectException
Queue
instance.createQueue
in interface JoramAdapterMBean
serverId
- The identifier of the server where deploying the queue.name
- The name of the queue.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokencreateQueue(short, String, String, Properties)
public String createQueue(short serverId, String name, String className, Properties prop) throws AdminException, ConnectException
serverId
- The identifier of the server where deploying the queue.name
- The name of the queue.className
- The queue class name.prop
- The queue properties.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokenpublic String createTopic(String name) throws AdminException, ConnectException
Topic
instance.createTopic
in interface JoramAdapterMBean
createTopic
in class JoramResourceAdapter
name
- The name of the topic.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokencreateTopic(short, String, String, Properties)
public String createTopic(short serverId, String name) throws AdminException, ConnectException
Topic
instance.createTopic
in interface JoramAdapterMBean
serverId
- The identifier of the server where deploying the topic.name
- The name of the topic.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokencreateTopic(short, String, String, Properties)
public String createTopic(short serverId, String name, String className, Properties prop) throws AdminException, ConnectException
Topic
instance.serverId
- The identifier of the server where deploying the topic.name
- The name of the topic.className
- The topic class name.prop
- The topic properties.AdminException
- If the creation fails.ConnectException
- if the connection is closed or brokenpublic void removeDestination(String name) throws AdminException
removeDestination
in interface JoramAdapterMBean
name
- The JNDI name of the destination.AdminException
public String[] getUsers() throws ConnectException, AdminException
getUsers
in interface JoramAdapterMBean
ConnectException
- If the connection fails.AdminException
- Never thrown.getUsers(short)
public String[] getUsers(short serverId) throws ConnectException, AdminException
The request fails if the target server does not belong to the platform.
getUsers
in interface JoramAdapterMBean
serverId
- Unique identifier of the given server.ConnectException
- If the connection fails.AdminException
- If the request fails.public String createUser(String name, String password) throws AdminException, ConnectException
createUser
in interface JoramAdapterMBean
name
- The login name of the user.password
- The password of the user.AdminException
- If the creation fails.ConnectException
- If the connection fails.createUser(String, String, short, String)
public String createUser(String name, String password, String identityClass) throws AdminException, ConnectException
createUser
in interface JoramAdapterMBean
createUser
in class JoramResourceAdapter
name
- The login name of the user.password
- The password of the user.identityClass
- The identity class used for authentication.AdminException
- If the creation fails.ConnectException
- If the connection fails.createUser(String, String, short, String)
public String createUser(String name, String password, short serverId) throws AdminException, ConnectException
createUser
in interface JoramAdapterMBean
name
- The login name of the user.password
- The password of the user.serverId
- The unique identifier of the Joram server.AdminException
- If the creation fails.ConnectException
- If the connection fails.createUser(String, String, short, String)
public String createUser(String name, String password, short serverId, String identityClass) throws AdminException, ConnectException
createUser
in interface JoramAdapterMBean
name
- The login name of the user.password
- The password of the user.serverId
- The unique identifier of the Joram server.identityClass
- The identity class used for authentication.AdminException
- If the creation fails.ConnectException
- If the connection fails.public void createCF(String name)
createCF
in interface JoramAdapterMBean
name
- Name of created connection factory.public void createQueueCF(String name)
createQueueCF
in interface JoramAdapterMBean
name
- Name of created connection factory.public void createTopicCF(String name)
createTopicCF
in interface JoramAdapterMBean
name
- Name of created connection factory.public void executeXMLAdmin(String path) throws Exception
executeXMLAdmin
in interface JoramAdapterMBean
path
- the path for the joramAdmin fileAdminException
- if an error occursException
public void exportRepositoryToFile(String exportDir) throws AdminException
exportRepositoryToFile
in interface JoramAdapterMBean
exportDir
- target directory where the export file will be putAdminException
- if an error occurspublic void exportRepositoryToFile(String exportDir, String exportFilename) throws AdminException
exportRepositoryToFile
in interface JoramAdapterMBean
exportDir
- target directory where the export file will be putexportFilename
- filename of the export fileAdminException
- if an error occurspublic Short[] getServersIds() throws ConnectException, AdminException
getServersIds
in interface JoramAdapterMBean
AdminException
- If the request fails.ConnectException
- If the connection fails.public final String[] getServersNames() throws ConnectException, AdminException
getServersNames
in interface JoramAdapterMBean
ConnectException
- If the connection fails.AdminException
- Never thrown.public final String getConfiguration() throws ConnectException, AdminException
getConfiguration
in interface JoramAdapterMBean
ConnectException
- If the connection fails.AdminException
- If the request fails.public JoramAdmin getWrapper()
public Boolean getCollocatedServer()
getCollocatedServer
in interface JoramAdapterMBean
JoramAdapterMBean.getCollocatedServer()
public String getServerName()
getServerName
in interface JoramAdapterMBean
JoramAdapterMBean.getServerName()
Copyright © 2015 ScalAgent D.T.. All Rights Reserved.