Fields Summary |
---|
private final String | MQ_RAR |
private final String | SYSTEM_APP_DIR |
private final String | MQ_RAR_MANIFEST |
private final String | MANIFEST_TAG |
private static final String | propName_reconnect_delay_in_seconds |
private static final String | propName_reconnect_max_retries |
private static final String | propName_reconnect_enabled |
private static final int | DEFAULT_RECONNECT_DELAY |
private static final int | DEFAULT_RECONNECT_RETRIES |
private static final String | propName_cmt_max_runtime_exceptions |
private static final int | DEFAULT_CMT_MAX_RUNTIME_EXCEPTIONS |
private static final String | ENABLE_AUTO_CLUSTERING |
private int | cmtMaxRuntimeExceptions |
private int | reconnectDelayInSeconds |
private int | reconnectMaxRetries |
private boolean | reconnectEnabled |
ServerContext | sc |
ConfigContext | ctx |
JmsService | js |
MQAddressList | list |
static Logger | _mdblogger |
static Logger | _rarlogger |
Methods Summary |
---|
public void | configureDescriptor(ConnectorDescriptor cd)
Object[] envProps = cd.getConfigProperties().toArray();
for (int i = 0; i < envProps.length; i++) {
EnvironmentProperty envProp = (EnvironmentProperty) envProps[i];
String name = envProp.getName();
if (!name.equals("ConnectionURL")) {
continue;
}
String userValue = getUrl();
if (userValue != null) {
cd.removeConfigProperty(envProp);
cd.addConfigProperty(new EnvironmentProperty(
name, userValue, userValue, envProp.getType()));
}
}
|
private static boolean | enableClustering()
try {
/* This flag disables the auto clustering functionality
* No MQ clusters will be created with AS cluster if
* this flag is set to false. Default is true.
*/
String enablecluster = System.getProperty(ENABLE_AUTO_CLUSTERING);
_rarlogger.log(Level.FINE,"Sun MQ Auto cluster system property" + enablecluster);
if ((enablecluster != null) &&
(enablecluster.trim().equals("false"))){
_rarlogger.log(Level.FINE,"Disabling Sun MQ Auto Clustering");
return false;
}
}catch (Exception e) {
;
}
_rarlogger.log(Level.FINE,"Enabling Sun MQ Auto Clustering");
return true;
|
public java.lang.String | getAddressListBehaviour()
return js.getAddresslistBehavior();
|
public java.lang.String | getAddressListIterations()
return js.getAddresslistIterations();
|
private java.lang.String | getDeployedMqVersion()
String ver = null;
// Full path of Mq client library that is deployed in appserver.
String deployed_dir =
java.lang.System.getProperty(Constants.INSTALL_ROOT)
+ File.separator + SYSTEM_APP_DIR;
String manifestFile = deployed_dir + File.separator +
MQ_RAR_MANIFEST;
_rarlogger.log(Level.FINE,"Deployed MQ version Manifest file" + manifestFile);
try {
Manifest mf = new Manifest(new FileInputStream(manifestFile));
ver = mf.getMainAttributes().getValue(MANIFEST_TAG);
return ver;
} catch (Exception e) {
_rarlogger.log(Level.WARNING, "jmsra.upgrade_check_failed",
e.getMessage() + ":" + manifestFile );
throw e;
}
|
private java.lang.String | getInstalledMqVersion()
String ver = null;
// Full path of installed Mq Client library
String installed_dir =
java.lang.System.getProperty(Constants.INSTALL_IMQ_LIB);
String jarFile = installed_dir + File.separator + MQ_RAR;
_rarlogger.log(Level.FINE,"Installed MQ JAR " + jarFile);
JarFile jFile = null;
try {
if ((new File(jarFile)).exists()) {
/* This is for a file based install
* RAR has to be present in this location
* ASHOME/imq/lib
*/
jFile = new JarFile(jarFile);
} else {
/* This is for a package based install
* RAR has to be present in this location
* /usr/lib
*/
jFile = new JarFile(installed_dir + File.separator + ".." + File.separator + MQ_RAR);
}
Manifest mf = jFile.getManifest();
ver = mf.getMainAttributes().getValue(MANIFEST_TAG);
return ver;
} catch (Exception e) {
_rarlogger.log(Level.WARNING, "jmsra.upgrade_check_failed",
e.getMessage() + ":" + jarFile );
throw e;
}
|
public java.lang.String | getJMSServiceType()
return this.js.getType();
|
public java.lang.String | getReconnectAttempts()
return js.getReconnectAttempts();
|
public boolean | getReconnectEnabled()
return js.isReconnectEnabled();
|
public java.lang.String | getReconnectInterval()
return js.getReconnectIntervalInSeconds();
|
public java.lang.String | getUrl()
try {
return list.toString();
} catch (Exception e) {
return null;
}
|
public MQAddressList | getUrlList()
return list;
|
private static ConnectorRuntimeException | handleException(java.lang.Exception e)
ConnectorRuntimeException cre =
new ConnectorRuntimeException(e.getMessage());
cre.initCause(e);
return cre;
|
public static boolean | isClustered()
try {
ConfigContext ctxt = ApplicationServer.getServerContext().getConfigContext();
return (enableClustering() &&
ServerHelper.isServerClustered(ctxt,
ApplicationServer.getServerContext().getInstanceName())
);
} catch (Exception e) {
throw handleException(e);
}
|
public void | setMdbContainerProperties()
com.sun.enterprise.config.serverbeans.MdbContainer mdbc = null;
try {
com.sun.enterprise.server.ServerContext sc =
com.sun.enterprise.server.ApplicationServer.getServerContext();
mdbc = com.sun.enterprise.config.serverbeans.ServerBeansFactory.
getMdbContainerBean(sc.getConfigContext());
}
catch (Exception e) {
_mdblogger.log(Level.WARNING, "containers.mdb.config_exception",
new Object[]{e.getMessage()});
if (_mdblogger.isLoggable(Level.FINE)) {
_mdblogger.log(Level.FINE, e.getClass().getName(), e);
}
}
if (mdbc != null) {
ElementProperty[] props = mdbc.getElementProperty();
if (props != null) {
for (int i = 0; i < props.length; i++) {
ElementProperty p = props[i];
if (p == null) continue;
String name = p.getName();
if (name == null) continue;
try {
if (name.equals(propName_reconnect_enabled)) {
if (p.getValue() == null) continue;
reconnectEnabled =
Boolean.valueOf(p.getValue()).booleanValue();
}
else if (name.equals
(propName_reconnect_delay_in_seconds)) {
try {
reconnectDelayInSeconds =
Integer.parseInt(p.getValue());
} catch (Exception e) {
_mdblogger.log(Level.WARNING,
"containers.mdb.config_exception",
new Object[]{e.getMessage()});
}
}
else if (name.equals(propName_reconnect_max_retries)) {
try {
reconnectMaxRetries =
Integer.parseInt(p.getValue());
} catch (Exception e) {
_mdblogger.log(Level.WARNING,
"containers.mdb.config_exception",
new Object[]{e.getMessage()});
}
}
else if (name.equals
(propName_cmt_max_runtime_exceptions)) {
try {
cmtMaxRuntimeExceptions =
Integer.parseInt(p.getValue());
} catch (Exception e) {
_mdblogger.log(Level.WARNING,
"containers.mdb.config_exception",
new Object[]{e.getMessage()});
}
}
} catch (Exception e) {
_mdblogger.log(Level.WARNING,
"containers.mdb.config_exception",
new Object[]{e.getMessage()});
if (_mdblogger.isLoggable(Level.FINE)) {
_mdblogger.log(Level.FINE, e.getClass().getName(), e);
}
}
}
}
}
if (reconnectDelayInSeconds < 0) {
reconnectDelayInSeconds = DEFAULT_RECONNECT_DELAY;
}
if (reconnectMaxRetries < 0) {
reconnectMaxRetries = DEFAULT_RECONNECT_RETRIES;
}
if (_mdblogger.isLoggable(Level.FINE)) {
_mdblogger.log(Level.FINE,
propName_reconnect_delay_in_seconds+"="+
reconnectDelayInSeconds +", "+
propName_reconnect_max_retries+ "="+reconnectMaxRetries + ", "+
propName_reconnect_enabled+"="+reconnectEnabled);
}
//Now set all these properties in the active resource adapter
MdbContainerProps.setReconnectDelay(reconnectDelayInSeconds);
MdbContainerProps.setReconnectMaxRetries(reconnectMaxRetries);
MdbContainerProps.setReconnectEnabled(reconnectEnabled);
MdbContainerProps.setMaxRuntimeExceptions(cmtMaxRuntimeExceptions);
|
public void | setupAddressList()
try {
list.setup();
} catch (Exception e) {
throw handleException(e);
}
|
public void | upgradeIfNecessary()Obtains the Implementation-Version from the MQ Client libraries
that are deployed in the application server and in MQ installation
directory.
String installedMqVersion = null;
String deployedMqVersion = null;
try {
installedMqVersion = getInstalledMqVersion();
_rarlogger.log(Level.FINE,"installedMQVersion :: " + installedMqVersion);
deployedMqVersion = getDeployedMqVersion();
_rarlogger.log(Level.FINE,"deployedMQVersion :: " + deployedMqVersion);
}catch (Exception e) {
return;
}
String deployed_dir =
java.lang. System.getProperty(Constants.INSTALL_ROOT)
+ File.separator + SYSTEM_APP_DIR + File.separator
+ ConnectorConstants.DEFAULT_JMS_ADAPTER;
// If the Manifest entry has different versions, then attempt to
// explode the MQ resource adapter.
if (!installedMqVersion.equals(deployedMqVersion)) {
try {
_rarlogger.log(Level.INFO, "jmsra.upgrade_started" );
ZipFile rarFile = new ZipFile(java.lang.System.getProperty
(Constants.INSTALL_IMQ_LIB) +
File.separator + MQ_RAR, deployed_dir);
rarFile.explode();
_rarlogger.log(Level.INFO, "jmsra.upgrade_completed");
} catch(ZipFileException ze) {
_rarlogger.log(Level.SEVERE,"jmsra.upgrade_failed",ze.getMessage());
}
}
|