ESBCOMP-63 Add support for application variable
parent
2436f2263b
commit
ab8d285968
|
@ -227,4 +227,6 @@ public interface Context {
|
||||||
* @return FaultMessage
|
* @return FaultMessage
|
||||||
*/
|
*/
|
||||||
public FaultMessage createFaultMessage(Source payload, QName faultMsgType);
|
public FaultMessage createFaultMessage(Source payload, QName faultMsgType);
|
||||||
|
|
||||||
|
public String getApplicationVariable(String applicationVariableName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
package org.glassfish.openesb.pojose.res.impl;
|
package org.glassfish.openesb.pojose.res.impl;
|
||||||
|
|
||||||
import com.sun.jbi.common.qos.messaging.MessagingChannel;
|
import com.sun.jbi.common.qos.messaging.MessagingChannel;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.jbi.JBIException;
|
import javax.jbi.JBIException;
|
||||||
|
@ -59,12 +60,15 @@ public class ContextImpl implements Context{
|
||||||
private MessagingChannel dc = null;
|
private MessagingChannel dc = null;
|
||||||
private ComponentContext cc = null;
|
private ComponentContext cc = null;
|
||||||
private CallTracker ct = null;
|
private CallTracker ct = null;
|
||||||
|
private Map applicationVariables;
|
||||||
|
|
||||||
private static final String LoggerName = "org.glassfish.openesb.pojose.jbi.nmr.BasePojoExecutor" ; //NOI18N
|
private static final String LoggerName = "org.glassfish.openesb.pojose.jbi.nmr.BasePojoExecutor" ; //NOI18N
|
||||||
|
|
||||||
public ContextImpl(ComponentContext ncc, MessagingChannel ndc, CallTracker callt) {
|
public ContextImpl(ComponentContext ncc, MessagingChannel ndc, CallTracker callt, Map applicationVariables) {
|
||||||
this.cc = ncc;
|
this.cc = ncc;
|
||||||
this.dc = ndc;
|
this.dc = ndc;
|
||||||
this.ct = callt;
|
this.ct = callt;
|
||||||
|
this.applicationVariables = applicationVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMessageExchange(MessageExchange me) {
|
public void setMessageExchange(MessageExchange me) {
|
||||||
|
@ -229,6 +233,16 @@ public class ContextImpl implements Context{
|
||||||
return fm;
|
return fm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getApplicationVariable(String applicationVariableName) {
|
||||||
|
String [] metadatas = (String []) this.applicationVariables.get(applicationVariableName);
|
||||||
|
|
||||||
|
if (metadatas != null) {
|
||||||
|
// IDX 0 = value & IDX 1 = type
|
||||||
|
return metadatas[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// *** End of Context Interface methods...
|
// *** End of Context Interface methods...
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,16 +32,38 @@ package org.glassfish.openesb.pojose.jbi;
|
||||||
|
|
||||||
import com.sun.jbi.common.qos.config.AbstractConfigMBean;
|
import com.sun.jbi.common.qos.config.AbstractConfigMBean;
|
||||||
import com.sun.jbi.common.qos.config.ComponentConfig;
|
import com.sun.jbi.common.qos.config.ComponentConfig;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.jbi.component.ComponentContext;
|
import javax.jbi.component.ComponentContext;
|
||||||
import javax.jbi.management.DeploymentException;
|
import javax.jbi.management.DeploymentException;
|
||||||
import javax.management.AttributeChangeNotification;
|
import javax.management.AttributeChangeNotification;
|
||||||
|
import javax.management.InvalidAttributeValueException;
|
||||||
import javax.management.ListenerNotFoundException;
|
import javax.management.ListenerNotFoundException;
|
||||||
|
import javax.management.MBeanException;
|
||||||
import javax.management.MBeanNotificationInfo;
|
import javax.management.MBeanNotificationInfo;
|
||||||
import javax.management.Notification;
|
import javax.management.Notification;
|
||||||
import javax.management.NotificationBroadcasterSupport;
|
import javax.management.NotificationBroadcasterSupport;
|
||||||
import javax.management.NotificationFilter;
|
import javax.management.NotificationFilter;
|
||||||
import javax.management.NotificationListener;
|
import javax.management.NotificationListener;
|
||||||
|
import javax.management.openmbean.CompositeData;
|
||||||
|
import javax.management.openmbean.CompositeDataSupport;
|
||||||
|
import javax.management.openmbean.CompositeType;
|
||||||
|
import javax.management.openmbean.OpenDataException;
|
||||||
|
import javax.management.openmbean.OpenType;
|
||||||
|
import javax.management.openmbean.SimpleType;
|
||||||
|
import javax.management.openmbean.TabularData;
|
||||||
|
import javax.management.openmbean.TabularDataSupport;
|
||||||
|
import javax.management.openmbean.TabularType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -50,11 +72,43 @@ import javax.management.NotificationListener;
|
||||||
public class PojoSEConfiguration extends AbstractConfigMBean
|
public class PojoSEConfiguration extends AbstractConfigMBean
|
||||||
implements PojoSEConfigurationMBean {
|
implements PojoSEConfigurationMBean {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 201-230
|
||||||
|
*/
|
||||||
|
private static final Logger logger = Logger.getLogger(PojoSEConfiguration.class.getName());
|
||||||
|
|
||||||
|
private ComponentContext ctx;
|
||||||
|
|
||||||
private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
|
private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
|
||||||
|
|
||||||
|
// Configuration file name for environment variables
|
||||||
|
private static final String PERSIST_APPLICATION_VARIABLE_CONFIG_FILE_NAME = "ApplicationVariables.properties";
|
||||||
|
|
||||||
|
// Application variables row fields
|
||||||
|
private static final String APPLICATION_VARIABLES_ROW_KEY = "name";
|
||||||
|
private static final String APPLICATION_VARIABLES_VALUE_FIELD = "value";
|
||||||
|
private static final String APPLICATION_VARIABLES_TYPE_FIELD = "type";
|
||||||
|
|
||||||
|
// Global application configurations
|
||||||
|
private Map mAppVarMap;
|
||||||
|
private CompositeType mAppVarRowType = null;
|
||||||
|
private TabularType mAppVarTabularType = null;
|
||||||
|
|
||||||
public PojoSEConfiguration(ComponentContext ctx, ComponentConfig config)
|
public PojoSEConfiguration(ComponentContext ctx, ComponentConfig config)
|
||||||
throws DeploymentException {
|
throws DeploymentException {
|
||||||
super(ctx, config);
|
super(ctx, config);
|
||||||
|
|
||||||
|
this.ctx = ctx;
|
||||||
|
|
||||||
|
try {
|
||||||
|
mAppVarMap = loadApplicationVariablesConfig(ctx.getWorkspaceRoot());
|
||||||
|
mAppVarRowType = createApplicationVariableCompositeType();
|
||||||
|
mAppVarTabularType = createApplicationVariableTabularType();
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = I18n.loc("POJOSE-7523: Failed during mbean initialization {0}", e);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new DeploymentException(msg, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCoreThreadPoolSize() {
|
public Integer getCoreThreadPoolSize() {
|
||||||
|
@ -167,5 +221,261 @@ public class PojoSEConfiguration extends AbstractConfigMBean
|
||||||
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException{
|
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException{
|
||||||
broadcasterSupport.removeNotificationListener(listener, filter, handback);
|
broadcasterSupport.removeNotificationListener(listener, filter, handback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map loadApplicationVariablesConfig(String workspaceRoot) throws MBeanException {
|
||||||
|
Properties persistedConfig = new Properties();
|
||||||
|
Map appVarMap = new HashMap();
|
||||||
|
|
||||||
|
File appVarPersistFileName = new File(workspaceRoot, PERSIST_APPLICATION_VARIABLE_CONFIG_FILE_NAME);
|
||||||
|
if (!appVarPersistFileName.exists()) {
|
||||||
|
return appVarMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
InputStream is = new FileInputStream(appVarPersistFileName);
|
||||||
|
persistedConfig.load(is);
|
||||||
|
is.close();
|
||||||
|
|
||||||
|
// load the persisted environment variable configurations in the map
|
||||||
|
for (Enumeration e = persistedConfig.propertyNames(); e.hasMoreElements(); ) {
|
||||||
|
String name = (String) e.nextElement();
|
||||||
|
String metadata = persistedConfig.getProperty(name);
|
||||||
|
int startIndex = metadata.indexOf("{");
|
||||||
|
String value = (startIndex == 0)? null : metadata.substring(0, startIndex);
|
||||||
|
String type = metadata.substring(startIndex + 1, metadata.length() -1);
|
||||||
|
appVarMap.put(name, new String[] {value, type});
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
String msg = I18n.loc("POJOSE-7539: Failed to load application variables {0} {1}", PERSIST_APPLICATION_VARIABLE_CONFIG_FILE_NAME, ex);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new MBeanException(ex, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return appVarMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompositeType createApplicationVariableCompositeType() throws OpenDataException {
|
||||||
|
if (mAppVarRowType != null) {
|
||||||
|
return mAppVarRowType;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] appVarRowAttrNames = { APPLICATION_VARIABLES_ROW_KEY, APPLICATION_VARIABLES_VALUE_FIELD, APPLICATION_VARIABLES_TYPE_FIELD };
|
||||||
|
String[] appVarRowAttrDesc = { "Application Variable Name", "Application Variable Value", "Application Variable Type" };
|
||||||
|
OpenType[] appVarRowAttrTypes = { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING };
|
||||||
|
|
||||||
|
mAppVarRowType = new CompositeType("ApplicationVariables",
|
||||||
|
"Application Variable Composite Data",
|
||||||
|
appVarRowAttrNames,
|
||||||
|
appVarRowAttrDesc,
|
||||||
|
appVarRowAttrTypes);
|
||||||
|
|
||||||
|
return mAppVarRowType;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TabularType createApplicationVariableTabularType() throws OpenDataException {
|
||||||
|
if (mAppVarTabularType != null) {
|
||||||
|
return mAppVarTabularType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mAppVarRowType == null) {
|
||||||
|
mAppVarRowType = createApplicationVariableCompositeType();
|
||||||
|
}
|
||||||
|
|
||||||
|
mAppVarTabularType = new TabularType("ApplicationVariableList",
|
||||||
|
"List of Application Variables",
|
||||||
|
mAppVarRowType,
|
||||||
|
new String[] { APPLICATION_VARIABLES_ROW_KEY } );
|
||||||
|
|
||||||
|
return mAppVarTabularType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation adds a new application variable. If a variable with the same name
|
||||||
|
* already exists, the operation fails.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @param appVar - this is the application variable compoiste
|
||||||
|
* @throws MBeanException if an error occurs in adding the application variable to the
|
||||||
|
* component.
|
||||||
|
*/
|
||||||
|
public void addApplicationVariable(String name, CompositeData appVar) throws InvalidAttributeValueException, MBeanException {
|
||||||
|
if (mAppVarMap.containsKey(name)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7524: Application variable name already exists {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new MBeanException(new Exception(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
CompositeType rowType = appVar.getCompositeType();
|
||||||
|
if (rowType.keySet().size() != 3) {
|
||||||
|
String msg = I18n.loc("POJOSE-7525: Invalid item size for app variable {0}", rowType.keySet().size());
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appVar.containsKey(APPLICATION_VARIABLES_ROW_KEY)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7526: Invalid key for composite data for app variable {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
String appVarValue = (String)appVar.get(APPLICATION_VARIABLES_VALUE_FIELD);
|
||||||
|
String appVarType = (String)appVar.get(APPLICATION_VARIABLES_TYPE_FIELD);
|
||||||
|
|
||||||
|
if (appVarValue == null) {
|
||||||
|
String msg = I18n.loc("POJOSE-7527: Invalid app variable composite data no value field {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appVarType == null) {
|
||||||
|
String msg = I18n.loc("POJOSE-7528: Invalid app variable composite data no type field", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAppVarMap.put(name, new String[] { appVarValue, appVarType });
|
||||||
|
|
||||||
|
if (logger.isLoggable(Level.FINEST)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7529: New application variable added {0} {1}", name, appVarValue);
|
||||||
|
logger.finest(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
persistApplicationVariablesConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation sets an application variable. If a variable does not exist with
|
||||||
|
* the same name, its an error.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @param appVar - this is the application variable compoiste to be updated.
|
||||||
|
* @throws MBeanException if one or more application variables cannot be deleted
|
||||||
|
*/
|
||||||
|
public void setApplicationVariable(String name, CompositeData appVar) throws InvalidAttributeValueException, MBeanException {
|
||||||
|
if (!mAppVarMap.containsKey(name)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7530: Application variable does not exist for set {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new MBeanException(new Exception(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
CompositeType rowType = appVar.getCompositeType();
|
||||||
|
if (rowType.keySet().size() != 3) {
|
||||||
|
String msg = I18n.loc("POJOSE-7531: Invalid item size for app variable", rowType.keySet().size());
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appVar.containsKey(APPLICATION_VARIABLES_ROW_KEY)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7526: Invalid key for composite data for app variable {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
String appVarValue = (String)appVar.get(APPLICATION_VARIABLES_VALUE_FIELD);
|
||||||
|
String appVarType = (String)appVar.get(APPLICATION_VARIABLES_TYPE_FIELD);
|
||||||
|
|
||||||
|
if (appVarValue == null) {
|
||||||
|
String msg = I18n.loc("POJOSE-7527: Invalid app variable composite data no value field {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appVarType == null) {
|
||||||
|
String msg = I18n.loc("POJOSE-7534: Invalid app variable composite data no type field {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new InvalidAttributeValueException(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAppVarMap.put(name, new String[] { appVarValue, appVarType });
|
||||||
|
|
||||||
|
if (logger.isLoggable(Level.FINEST)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7535: Application variable updated {0} {1}", name, appVarValue );
|
||||||
|
logger.finest(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// persist the application variable properties
|
||||||
|
persistApplicationVariablesConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation deletes an application variable, if a variable with the specified name does
|
||||||
|
* not exist, it's an error.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @throws MBeanException on errors.
|
||||||
|
*/
|
||||||
|
public void deleteApplicationVariable(String name) throws MBeanException {
|
||||||
|
if (!mAppVarMap.containsKey(name)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7536: Application variable does not exist for delete {0}", name);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new MBeanException(new Exception(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
mAppVarMap.remove(name);
|
||||||
|
|
||||||
|
if (logger.isLoggable(Level.FINEST)) {
|
||||||
|
String msg = I18n.loc("POJOSE-7537: Application variable deleted {0}", name);
|
||||||
|
logger.finest(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
persistApplicationVariablesConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TabularData getApplicationVariables() {
|
||||||
|
TabularData tabularData = new TabularDataSupport(mAppVarTabularType);
|
||||||
|
for (Iterator iter = mAppVarMap.keySet().iterator(); iter.hasNext(); ) {
|
||||||
|
String name = (String) iter.next();
|
||||||
|
String[] metadata = (String[]) mAppVarMap.get(name);
|
||||||
|
String value = metadata [0];
|
||||||
|
String type = metadata [1];
|
||||||
|
Object[] data = ("PASSWORD".equalsIgnoreCase(type) && value != null && !"".equals(value))?
|
||||||
|
new Object[] { name, "*******", type } : new Object[] {name, value, type};
|
||||||
|
try {
|
||||||
|
CompositeData rowData = new CompositeDataSupport(mAppVarRowType,
|
||||||
|
new String[] { APPLICATION_VARIABLES_ROW_KEY ,
|
||||||
|
APPLICATION_VARIABLES_VALUE_FIELD ,
|
||||||
|
APPLICATION_VARIABLES_TYPE_FIELD },
|
||||||
|
data);
|
||||||
|
|
||||||
|
tabularData.put(rowData);
|
||||||
|
} catch (OpenDataException e) {
|
||||||
|
String msg = I18n.loc("POJOSE-7538: Unable to construct composite data for app variable", e);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new RuntimeException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tabularData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map retrieveApplicationVariablesMap() {
|
||||||
|
return mAppVarMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateApplicationVariablesMap(Map appVarMap) throws MBeanException {
|
||||||
|
mAppVarMap = appVarMap;
|
||||||
|
persistApplicationVariablesConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void persistApplicationVariablesConfig() throws MBeanException {
|
||||||
|
// Persist the changed configuration
|
||||||
|
try {
|
||||||
|
File appVarPersistFileName = new File(ctx.getWorkspaceRoot(), PERSIST_APPLICATION_VARIABLE_CONFIG_FILE_NAME);
|
||||||
|
OutputStream os = new FileOutputStream(appVarPersistFileName);
|
||||||
|
for (Iterator iter = mAppVarMap.keySet().iterator(); iter.hasNext(); ) {
|
||||||
|
String key = (String) iter.next();
|
||||||
|
String[] metadata = (String[]) mAppVarMap.get(key);
|
||||||
|
String value = metadata[0];
|
||||||
|
String type = metadata[1];
|
||||||
|
String prop = (value != null)? key + "=" + value + "{" + type + "}\n" : key + "={" + type + "}\n";
|
||||||
|
os.write(prop.getBytes());
|
||||||
|
}
|
||||||
|
os.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
String msg = I18n.loc("POJOSE-7540: Failed to persist application variables {0} {1}", PERSIST_APPLICATION_VARIABLE_CONFIG_FILE_NAME, ex);
|
||||||
|
logger.severe(msg);
|
||||||
|
throw new MBeanException(ex, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,12 @@
|
||||||
|
|
||||||
package org.glassfish.openesb.pojose.jbi;
|
package org.glassfish.openesb.pojose.jbi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.management.InvalidAttributeValueException;
|
||||||
|
import javax.management.MBeanException;
|
||||||
import javax.management.NotificationEmitter;
|
import javax.management.NotificationEmitter;
|
||||||
|
import javax.management.openmbean.CompositeData;
|
||||||
|
import javax.management.openmbean.TabularData;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,4 +67,59 @@ public interface PojoSEConfigurationMBean extends NotificationEmitter{
|
||||||
*/
|
*/
|
||||||
public Integer getThreadPoolBlockingQueueSize();
|
public Integer getThreadPoolBlockingQueueSize();
|
||||||
public void setThreadPoolBlockingQueueSize(Integer cz);
|
public void setThreadPoolBlockingQueueSize(Integer cz);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation adds a new application variable. If a variable with the same name
|
||||||
|
* already exists, the operation fails.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @param appVar - this is the application variable compoiste
|
||||||
|
* @throws MBeanException if an error occurs in adding the application variable to the
|
||||||
|
* component.
|
||||||
|
*/
|
||||||
|
public void addApplicationVariable(String name, CompositeData appVar) throws InvalidAttributeValueException, MBeanException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation sets an application variable. If a variable does not exist with
|
||||||
|
* the same name, its an error.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @param appVar - this is the application variable compoiste to be updated.
|
||||||
|
* @throws MBeanException if one or more application variables cannot be deleted
|
||||||
|
*/
|
||||||
|
public void setApplicationVariable(String name, CompositeData appVar) throws InvalidAttributeValueException, MBeanException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This operation deletes an application variable, if a variable with the specified name does
|
||||||
|
* not exist, it's an error.
|
||||||
|
*
|
||||||
|
* @param name - name of the application variable
|
||||||
|
* @throws MBeanException on errors.
|
||||||
|
*/
|
||||||
|
public void deleteApplicationVariable(String name) throws MBeanException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Application Variable set for a component.
|
||||||
|
*
|
||||||
|
* @return a TabularData which has all the applicationvariables set on the component.
|
||||||
|
*/
|
||||||
|
public TabularData getApplicationVariables();
|
||||||
|
|
||||||
|
/** Retrieves the application variables map. The map key is the application
|
||||||
|
* variable name, the value is a String[] containing detailed information
|
||||||
|
* about the application variable. This method is used to communicate
|
||||||
|
* application variable data with in the component and is not intended
|
||||||
|
* for MBean clients
|
||||||
|
*
|
||||||
|
* @return a Map containing application variable information
|
||||||
|
*/
|
||||||
|
public Map retrieveApplicationVariablesMap();
|
||||||
|
|
||||||
|
/** Updates the application variable map.
|
||||||
|
* This method is used to communicate application configuration data within the component, and
|
||||||
|
* not intended for MBean clients
|
||||||
|
*
|
||||||
|
* @param a Map containing application variable information
|
||||||
|
*/
|
||||||
|
public void updateApplicationVariablesMap(Map val) throws MBeanException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,13 @@ import com.sun.jbi.common.qos.config.ConfigPersistence;
|
||||||
import com.sun.jbi.common.qos.config.RuntimeConfigurationMBean;
|
import com.sun.jbi.common.qos.config.RuntimeConfigurationMBean;
|
||||||
import com.sun.jbi.common.util.MBeanHelper;
|
import com.sun.jbi.common.util.MBeanHelper;
|
||||||
import com.sun.jbi.common.util.Util;
|
import com.sun.jbi.common.util.Util;
|
||||||
|
import com.sun.jbi.configuration.RuntimeConfigurationHelper;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.jbi.JBIException;
|
import javax.jbi.JBIException;
|
||||||
import javax.jbi.component.ComponentContext;
|
import javax.jbi.component.ComponentContext;
|
||||||
import javax.jbi.component.ComponentLifeCycle;
|
import javax.jbi.component.ComponentLifeCycle;
|
||||||
|
import javax.jbi.management.MBeanNames;
|
||||||
import javax.jbi.messaging.DeliveryChannel;
|
import javax.jbi.messaging.DeliveryChannel;
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
|
@ -50,7 +52,8 @@ public class PojoSELifeCycle implements ComponentLifeCycle {
|
||||||
private POJOComponentContext pojoCompCtx;
|
private POJOComponentContext pojoCompCtx;
|
||||||
private Logger compLifeCycleLogger;
|
private Logger compLifeCycleLogger;
|
||||||
private ComponentConfig compCfg;
|
private ComponentConfig compCfg;
|
||||||
private MBeanHelper mbeanHelper;
|
//private MBeanHelper mbeanHelper;
|
||||||
|
private RuntimeConfigurationHelper mRuntimeConfigHelper;
|
||||||
|
|
||||||
public PojoSELifeCycle(POJOComponentContext pc){
|
public PojoSELifeCycle(POJOComponentContext pc){
|
||||||
assert pc != null;
|
assert pc != null;
|
||||||
|
@ -67,8 +70,14 @@ public class PojoSELifeCycle implements ComponentLifeCycle {
|
||||||
ConfigPersistence.loadConfig(compCfg, ctx.getWorkspaceRoot());
|
ConfigPersistence.loadConfig(compCfg, ctx.getWorkspaceRoot());
|
||||||
PojoSEConfigurationMBean cfgMbean = new PojoSEConfiguration(ctx, compCfg);
|
PojoSEConfigurationMBean cfgMbean = new PojoSEConfiguration(ctx, compCfg);
|
||||||
|
|
||||||
mbeanHelper = new MBeanHelper(ctx);
|
try {
|
||||||
mbeanHelper.registerMBean(RuntimeConfigurationMBean.CONFIGURATION_EXTENSION, cfgMbean);
|
MBeanNames mbeanNames = ctx.getMBeanNames();
|
||||||
|
ObjectName runtimeConfigMBeanObjName = mbeanNames.createCustomComponentMBeanName("Configuration");
|
||||||
|
mRuntimeConfigHelper = new RuntimeConfigurationHelper(runtimeConfigMBeanObjName, ctx.getMBeanServer());
|
||||||
|
mRuntimeConfigHelper.registerMBean(cfgMbean);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new JBIException(e);
|
||||||
|
}
|
||||||
|
|
||||||
pojoCompCtx.setConfigMbean(cfgMbean);
|
pojoCompCtx.setConfigMbean(cfgMbean);
|
||||||
|
|
||||||
|
|
|
@ -218,3 +218,51 @@ POJOSE-7521 = Exception while persisting configuration changes. {0}
|
||||||
# org.glassfish.openesb.pojose.jbi.thread.InboundProcessor
|
# org.glassfish.openesb.pojose.jbi.thread.InboundProcessor
|
||||||
POJOSE-7522 = Exception while executing for ME {0}. {1}
|
POJOSE-7522 = Exception while executing for ME {0}. {1}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7523 = Failed during mbean initialization {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7524 = Application variable name already exists {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7525 = Invalid item size for app variable {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7526 = Invalid key for composite data for app variable {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7527 = Invalid app variable composite data no value field {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7528 = Invalid app variable composite data no type field
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7529 = New application variable added {0} {1}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7530 = Application variable does not exist for set {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7531 = Invalid item size for app variable
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7534 = Invalid app variable composite data no type field {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7535 = Application variable updated {0} {1}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7536 = Application variable does not exist for delete {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7537 = Application variable deleted {0}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7538 = Unable to construct composite data for app variable
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7539 = Failed to load application variables {0} {1}
|
||||||
|
|
||||||
|
# org.glassfish.openesb.pojose.jbi.PojoSEConfiguration
|
||||||
|
POJOSE-7540 = Failed to persist application variables {0} {1}
|
||||||
|
|
||||||
|
|
|
@ -234,13 +234,13 @@ public class InMsgTask extends BaseTask {
|
||||||
if (exp == null){
|
if (exp == null){
|
||||||
if (pojoMeta.getProvider() != null){
|
if (pojoMeta.getProvider() != null){
|
||||||
// Using current @Provider annotation.
|
// Using current @Provider annotation.
|
||||||
ContextImpl ctximpl = new ContextImpl(ctx.getJBIComponentContext(), ctx.getDC(), (CallTracker)this.pt);
|
ContextImpl ctximpl = new ContextImpl(ctx.getJBIComponentContext(), ctx.getDC(), (CallTracker)this.pt, ctx.getConfigMbean().retrieveApplicationVariablesMap());
|
||||||
ctximpl.setMessageExchange(me);
|
ctximpl.setMessageExchange(me);
|
||||||
|
|
||||||
POJOAnnotationProcessor.injectFields(pojoMeta, pojoObj, ctximpl, (CallTracker)this.pt);
|
POJOAnnotationProcessor.injectFields(pojoMeta, pojoObj, ctximpl, (CallTracker)this.pt);
|
||||||
} else {
|
} else {
|
||||||
// Using old @POJO annotation.
|
// Using old @POJO annotation.
|
||||||
ContextImpl ctximpl = new ContextImpl(ctx.getJBIComponentContext(), ctx.getDC(), (CallTracker)this.pt);
|
ContextImpl ctximpl = new ContextImpl(ctx.getJBIComponentContext(), ctx.getDC(), (CallTracker)this.pt, ctx.getConfigMbean().retrieveApplicationVariablesMap());
|
||||||
ctximpl.setMessageExchange(me);
|
ctximpl.setMessageExchange(me);
|
||||||
|
|
||||||
POJOContextImpl pjctx = new POJOContextImpl(ctx.getJBIComponentContext(), ctx.getDC());
|
POJOContextImpl pjctx = new POJOContextImpl(ctx.getJBIComponentContext(), ctx.getDC());
|
||||||
|
|
|
@ -74,6 +74,12 @@
|
||||||
<cfg:Constraint facet="maxInclusive" value="50000"/>
|
<cfg:Constraint facet="maxInclusive" value="50000"/>
|
||||||
</cfg:Property>
|
</cfg:Property>
|
||||||
</cfg:PropertyGroup>
|
</cfg:PropertyGroup>
|
||||||
|
|
||||||
|
<cfg:ApplicationVariable isApplicationRestartRequired="true">
|
||||||
|
<cfg:name/>
|
||||||
|
<cfg:type/>
|
||||||
|
<cfg:value/>
|
||||||
|
</cfg:ApplicationVariable>
|
||||||
</cfg:Configuration>
|
</cfg:Configuration>
|
||||||
<logging:Logging root="org.glassfish.openesb.pojose">
|
<logging:Logging root="org.glassfish.openesb.pojose">
|
||||||
<!-- QoS
|
<!-- QoS
|
||||||
|
|
Loading…
Reference in New Issue