Methods Summary |
---|
public com.sun.enterprise.admin.common.JMSStatus | JMSPing()Ping the JMS service.
try {
JMSAdmin jmsAdmin = getJMSAdmin();
jmsAdmin.pingProvider();
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "JMSPing", e);
handleException(e);
}
JMSStatus js = new JMSStatus();
return (js);
|
public com.sun.enterprise.admin.common.JMSStatus | JMSPing(java.lang.String username, java.lang.String password, int port)Ping the JMS service.
try {
JMSAdmin jmsAdmin = getJMSAdmin();
jmsAdmin.pingProvider(username, password, port);
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "JMSPing", e);
handleException(e);
}
JMSStatus js = new JMSStatus();
return (js);
|
public java.lang.String | JMSPing(java.lang.String targetName)fix for bug# 6157447
Ping the JMS service.
try {
Target target = getResourceTarget(targetName);
// check and use JMX
if (JMSDestination.useJMX(target)) {
JMSDestination jmsd = new JMSDestination();
return(jmsd.JMSPing(target.getName()));
} else {
JMSAdmin jmsAdmin = getJMSAdmin(targetName);
jmsAdmin.pingProvider();
}
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "JMSPing", e);
handleException(e);
}
return JMSAdminConstants.JMS_HOST_RUNNING;
|
private java.lang.String | computeDestinationName(java.lang.String providedJndiName)Derive a destination name, valid as per MQ destination naming rules,
from the JNDI name provided for the JMS destination resource.
Scheme: merely replace all invalid identifiers in the JNDI name with
an 'underscore'.
char[] jndiName = providedJndiName.toCharArray();
char[] finalName = new char[jndiName.length];
finalName[0] = Character.isJavaIdentifierStart(jndiName[0]) ? jndiName[0] : '_";
for (int i = 1; i < jndiName.length; i++) {
finalName[i] = Character.isJavaIdentifierPart(jndiName[i])? jndiName[i] : '_";
}
return new String(finalName);
|
private java.lang.String | createAResource(com.sun.enterprise.resource.Resource resource, java.lang.String tgtName, boolean createResourceRefs)Adds a resource
//System.out.println("ResourcesMBean : createAResource " + resource.getType());
String resourceType = resource.getType();
//if the resource element is security-map then invoke connector-
//connection-pool MBean which has all the operations for
// security-map and its sub-elemnents....
// This is a special case since security-map element is a part
//of connector-connection-pool and not a resource by itself.
if(resourceType.equals(CONNECTOR_SECURITY_MAP)){
AttributeList mapAttributes = resource.getAttributes();
// get the pool name.
String poolName = null;
String username = null ;
String password = null;
if(mapAttributes != null){
int s = mapAttributes.size();
for(int i=0;i<s;i++){
Attribute attribute =(Attribute)mapAttributes.get(i);
String n= attribute.getName();
if((attribute.getName()).equalsIgnoreCase("pool-name"))
poolName = (String)attribute.getValue();
if((attribute.getName()).equalsIgnoreCase("user-name"))
username = (String)attribute.getValue();
if((attribute.getName()).equalsIgnoreCase("password"))
password = (String)attribute.getValue();
}
}
mapAttributes.add(new Attribute(POOL_NAME,poolName));
ObjectName poolObj = m_registry.getMbeanObjectName(POOL_TYPE,
new String[]{getDomainName(),poolName,CONFIG});
try{
ObjectName map =(ObjectName)getMBeanServer().invoke(poolObj,
CREATE_SECURITY_MAP, new Object[] {mapAttributes,username,
password, tgtName},
new String[] {AttributeList.class.getName(),"java.lang.String",
"java.lang.String","java.lang.String"});
String s = localStrings.getString("admin.mbeans.rmb.res_type_added", resourceType);
sLogger.log(Level.INFO, s);
return s;
}catch(Exception e){
e.printStackTrace();
String s = localStrings.getString("admin.mbeans.rmb.res_type_not_added", resourceType, e.getMessage());
sLogger.log(Level.INFO, s);
throw new Exception(s, e);
}
}
else{
AttributeList attr = resource.getAttributes();
String desc = resource.getDescription();
if (desc != null)
attr.add(new Attribute("description", desc));
Properties props = resource.getProperties();
try{
ObjectName objName = createResource(resource.getType(),
attr, props, tgtName, createResourceRefs);
//results.add("Added Resource Type :"+resourceType);
String s = localStrings.getString("admin.mbeans.rmb.res_type_added", resourceType);
sLogger.log(Level.INFO, s);
return s;
}catch(Exception e){
e.printStackTrace();
//results.add("Could not add Resource Type "
//+":"+resourceType +" because :"+e.getMessage());
String s = localStrings.getString("admin.mbeans.rmb.res_type_not_added", resourceType, e.getMessage());
sLogger.log(Level.INFO, s);
throw new Exception (s, e);
}
}
|
private void | createAResourceReference(com.sun.enterprise.resource.Resource res, java.util.List tgtNames, java.lang.Boolean isEnabled)
for (String target : tgtNames) {
createAResourceReference(res, target, isEnabled);
}
|
private void | createAResourceReference(com.sun.enterprise.resource.Resource res, java.lang.String target, java.lang.Boolean isEnabled)
TargetType targetType = getResourceTarget(target).getType();
String resourceType = res.getType();
if (isResourceReferenceValid(resourceType,targetType)) {
createResourceReference(target, isEnabled.booleanValue(), getResourceName(res.getType(), res.getAttributes()));
}
|
public javax.management.ObjectName | createAdminObjectResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
String raName = null;
String resType = null;
boolean validResType = false;
// Find out the value of raname attribute in the attrList
for (int i=0; i<attrList.size(); i++)
{
Attribute attr = (Attribute)attrList.get(i);
if (isAttrNameMatch(attr, "res-adapter")) {
raName = (String)attr.getValue();
}
if (isAttrNameMatch(attr, "res-type")) {
resType = (String)attr.getValue();
}
}
if (isValidRAName(raName)) {
// Check if the restype is valid -
// To check this, we need to get the list of admin-object-interface
// names and then find out if this list contains the restype.
String[] resTypes = ConnectorRuntime.getRuntime().getAdminObjectInterfaceNames(raName);
if (resTypes == null || resTypes.length <= 0)
throw new Exception(localStrings.getString("admin.mbeans.rmb.null_ao_intf", raName));
for (int i=0; i<resTypes.length; i++) {
if (resTypes[i].equals(resType)) {
validResType = true;
break;
}
}
if (!validResType) {
throw new Exception(localStrings.getString("admin.mbeans.rmb.invalid_res_type", resType));
}
return createResource( ADMIN_OBJECT_RESOURCE, attrList, props, tgtName );
}
else return null;
|
public javax.management.ObjectName | createConnectorConnectionPool(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
//validateCnctorConnPoolAttrList(attrList);
return createResource( CONNECTOR_CONNECTION_POOL, attrList, props, tgtName );
|
public javax.management.ObjectName | createConnectorResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( CONNECTOR_RESOURCE, attrList, props, tgtName );
|
public javax.management.ObjectName | createCustomResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( CUSTOM_RESOURCE, attrList, props, tgtName );
|
public javax.management.ObjectName | createExternalJndiResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( EXTERNAL_JNDI_RESOURCE, attrList, props, tgtName );
|
public void | createJMSDestination(java.lang.String destName, java.lang.String destType, java.util.Properties destProps, java.lang.String tgtName)Create a JMS Destination.
sLogger.entering(getClass().getName(), "createJMSDestination",
new Object[] {destName, destType, destProps, tgtName});
validateJMSDestName(destName);
validateJMSDestType(destType);
int newDestType = JMSConstants.QUEUE;
JMSAdmin jmsAdmin = null;
boolean connected = false;
try {
/* Do not restrict the number of consumers, because in 4.1 MQ
* open MQ, there is no restriction on the number of consumers
* for a queue. In 4.0 PE there was a restriction of 2.
* Fixes issue : 6543199
*/
if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE)) {
if (destProps == null) {
destProps = new Properties();
}
String maxConsumersProperty = IASJmsUtil.getMaxActiveConsumersProperty();
String maxConsumersAttribute = IASJmsUtil.getMaxActiveConsumersAttribute();
String maxConsumersValue = IASJmsUtil.getDefaultMaxActiveConsumers();
if (!destProps.containsKey(maxConsumersProperty) &&
!destProps.containsKey(maxConsumersAttribute) ) {
destProps.put(maxConsumersAttribute, maxConsumersValue);
}
}
// check and use JMX
Target target = getResourceTarget(tgtName);
if (JMSDestination.useJMX(target)) {
JMSDestination jmsd = new JMSDestination();
jmsd.createJMSDestination(destName, destType, destProps, tgtName);
return;
} else {
jmsAdmin = getJMSAdmin(tgtName);
jmsAdmin.connectToProvider();
connected = true;
if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC)) {
newDestType = JMSConstants.TOPIC;
} else if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE)) {
newDestType = JMSConstants.QUEUE;
}
jmsAdmin.createProviderDestination(destName, newDestType, destProps);
}
} catch (Exception e) {
handleException(e);
} finally {
if (connected) {
try {
jmsAdmin.disconnectFromProvider();
} catch (Exception ex) {
handleException(ex);
}
}
}
|
public javax.management.ObjectName | createJdbcConnectionPool(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( JDBC_CONNECTION_POOL, attrList, props, tgtName );
|
public javax.management.ObjectName | createJdbcResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
// fix for bug# 6531767
TargetType[] VALID_CREATE_DELETE_TYPES_JDBCRES = new TargetType[] {
TargetType.CLUSTER, TargetType.UNCLUSTERED_SERVER,
TargetType.DAS, TargetType.DOMAIN};
Target target = TargetBuilder.INSTANCE.createTarget(
VALID_CREATE_DELETE_TYPES_JDBCRES,
tgtName, getConfigContext());
return createResource( JDBC_RESOURCE, attrList, props, tgtName );
|
public javax.management.ObjectName | createJmsConnectionFactory(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createJmsResource(attrList, props, tgtName);
|
public javax.management.ObjectName | createJmsDestinationResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createJmsResource(attrList, props, tgtName);
|
public javax.management.ObjectName | createJmsResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
sLogger.info("createJmsResource -------------------" );
ObjectName mbean = null;
Properties properties = new Properties();
Target target = getResourceTarget(tgtName);
// try {
JmsRaMapping ramap = ConnectorRuntime.getRuntime().getJmsRaMapping();
/* Map MQ properties to Resource adapter properties */
if (props != null) {
Enumeration en = props.keys();
while (en.hasMoreElements()) {
String key = (String) en.nextElement();
String raKey = ramap.getMappedName(key);
if (raKey == null) raKey = key;
properties.put(raKey, (String) props.get(key));
}
}
// Get the default res adapter name from Connector-runtime
String raName = ConnectorRuntime.DEFAULT_JMS_ADAPTER;
// Find out the jndiName & resourceType from the attributeList.
String resourceType = null;
String jndiName = null;
String description = null;
Object enabled = null;
String steadyPoolSize = null;
String maxPoolSize = null;
String poolResizeQuantity = null;
String idleTimeoutInSecs = null;
String maxWaitTimeInMillis = null;
String failAllConnections = null;
String transactionSupport = null;
for (int i=0; i<attrList.size(); i++)
{
Attribute attr = (Attribute)attrList.get(i);
if (isAttrNameMatch(attr, "res-type"))
resourceType = (String)attr.getValue();
else if (isAttrNameMatch(attr, "jndi-name"))
jndiName = (String)attr.getValue();
else if (isAttrNameMatch(attr, "enabled"))
enabled = attr.getValue();
else if (isAttrNameMatch(attr, "description"))
description = (String)attr.getValue();
else if (isAttrNameMatch(attr, "steady-pool-size"))
steadyPoolSize = (String) attr.getValue();
else if (isAttrNameMatch(attr, "max-pool-size"))
maxPoolSize = (String) attr.getValue();
else if (isAttrNameMatch(attr, "pool-resize-quantity"))
poolResizeQuantity = (String) attr.getValue();
else if (isAttrNameMatch(attr, "idle-timeout-in-seconds"))
idleTimeoutInSecs = (String) attr.getValue();
else if (isAttrNameMatch(attr, "max-wait-time-in-millis"))
maxWaitTimeInMillis = (String) attr.getValue();
else if (isAttrNameMatch(attr, "transaction-support"))
transactionSupport = (String) attr.getValue();
else if(isAttrNameMatch(attr, "fail-all-connections"))
failAllConnections = (String) attr.getValue();
}
if (resourceType == null)
throw new Exception(localStrings.getString("admin.mbeans.rmb.null_res_type"));
ObjectName resObjName = m_registry.getMbeanObjectName(RESOURCES, new String[]{getDomainName()});
if (resourceType.equals(TOPIC_CF) || resourceType.equals(QUEUE_CF) || resourceType.equals(UNIFIED_CF))
{
// Add a connector-connection-pool & a connector-resource
String defPoolName = ConnectorRuntime.getRuntime().getDefaultPoolName(jndiName);
// Check for existence of this connection pool
ObjectName connPool = null;
try {
connPool = (ObjectName)getMBeanServer().invoke(resObjName, "getConnectorConnectionPoolByName",
new Object[] {defPoolName, tgtName},
new String[] {"java.lang.String", "java.lang.String"});
} catch (Exception ee){}
// If pool is already existing, do not try to create it again
if (connPool == null) {
// Add connector-connection-pool.
AttributeList cpAttrList = new AttributeList();
cpAttrList.add(new Attribute("name", (Object)defPoolName));
cpAttrList.add(new Attribute("resource_adapter_name", (Object)raName));
cpAttrList.add(new Attribute("connection_definition_name", (Object)resourceType));
cpAttrList.add(new Attribute("max_pool_size", (maxPoolSize == null) ? (Object)"250" : (Object)maxPoolSize));
cpAttrList.add(new Attribute("steady_pool_size", (steadyPoolSize == null) ? (Object)"1" : (Object)steadyPoolSize));
if (poolResizeQuantity != null) {
cpAttrList.add(new Attribute("pool_resize_quantity", (Object)poolResizeQuantity));
}
if (idleTimeoutInSecs != null) {
cpAttrList.add(new Attribute("idle_timeout_in_seconds", (Object)idleTimeoutInSecs));
}
if (maxWaitTimeInMillis != null) {
cpAttrList.add(new Attribute("max_wait_time_in_millis", (Object)maxWaitTimeInMillis));
}
if (failAllConnections != null) {
cpAttrList.add(new Attribute("fail-all-connections",(Object)failAllConnections));
}
if (transactionSupport != null) {
cpAttrList.add(new Attribute("transaction-support", (Object)transactionSupport));
}
getMBeanServer().invoke(resObjName, "createConnectorConnectionPool",
new Object[] {cpAttrList, properties, tgtName},
new String[] {AttributeList.class.getName(), Properties.class.getName(), "java.lang.String"});
}
// Add connector-resource
AttributeList crAttrList = new AttributeList();
crAttrList.add(new Attribute("jndi_name", (Object)jndiName));
crAttrList.add(new Attribute("pool_name", (Object)defPoolName));
if(enabled!=null)
crAttrList.add(new Attribute("enabled", enabled));
if(description!=null)
crAttrList.add(new Attribute("description", description));
try {
mbean = (ObjectName)getMBeanServer().invoke(resObjName, "createConnectorResource",
new Object[] {crAttrList, null, tgtName},
new String[] {AttributeList.class.getName(), Properties.class.getName(), "java.lang.String"});
} catch (MBeanException me) {
me.printStackTrace();
// Rollback the change of connector-connection-pool creation
// delete pool only if it was created in this method
if(connPool==null)
{
getMBeanServer().invoke(resObjName, "deleteConnectorConnectionPool",
new Object[] {defPoolName, tgtName},
new String[] {"java.lang.String", "java.lang.String"});
}
throw me;
}
}
else if (resourceType.equals("javax.jms.Topic") ||
resourceType.equals("javax.jms.Queue"))
{
//validate the provided properties and modify it if required.
properties = validateDestinationResourceProps(properties, jndiName);
// create admin object
AttributeList aoAttrList = new AttributeList();
aoAttrList.add(new Attribute("jndi_name", (Object)jndiName));
aoAttrList.add(new Attribute("res_type", (Object)resourceType));
aoAttrList.add(new Attribute("res_adapter", (Object)raName));
if(enabled!=null)
aoAttrList.add(new Attribute("enabled", enabled));
if(description!=null)
aoAttrList.add(new Attribute("description", description));
sLogger.info("props = " + properties);
mbean = (ObjectName)getMBeanServer().invoke(resObjName, "createAdminObjectResource",
new Object[] {aoAttrList, properties, tgtName},
new String[] {AttributeList.class.getName(), Properties.class.getName(), "java.lang.String"});
} else {
throw new Exception(localStrings.getString("admin.mbeans.rmb.invalid_res_type", resourceType));
}
/* }
catch (MBeanException me) {
throw me;
}
catch (Exception e) {
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return mbean;
|
public javax.management.ObjectName | createMailResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( MAIL_RESOURCE, attrList, props, tgtName );
|
public javax.management.ObjectName | createPMFResourceWithJDBCResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
// create jdbc-resource with the given jdbc-connection-pool
String poolName = null;
String jndiName = null;
int indx = 0;
for (int i=0; i<attrList.size(); i++)
{
Attribute attr = (Attribute)attrList.get(i);
if (isAttrNameMatch(attr, "pool-name")) {
poolName = (String)attr.getValue();
indx = i;
}
if (isAttrNameMatch(attr, "jndi-name"))
jndiName = (String)attr.getValue();
}
if (poolName != null && !(poolName.equals(""))) {
jndiName = jndiName + PMF_SUFFIX; // Add PM suffix to jndiName to indicate it has been created with PMF.
AttributeList jdbcAttrList = new AttributeList();
jdbcAttrList.add(new Attribute("jndi_name", (Object)jndiName));
jdbcAttrList.add(new Attribute("pool_name", (Object)poolName));
createResource( JDBC_RESOURCE, jdbcAttrList, null, tgtName );
// Remove the connection-pool name from the attrib list for pmf as pmf creation doesn't require it.
attrList.remove(indx);
// Add the jdbc-resource-jndi-name in the attrib list for pmf resource.
attrList.add(new Attribute("jdbc_resource_jndi_name", (Object)jndiName));
}
return createResource( PERSISTENCE_MANAGER_FACTORY_RESOURCE, attrList, props, tgtName );
|
public javax.management.ObjectName | createPersistenceManagerFactoryResource(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource( PERSISTENCE_MANAGER_FACTORY_RESOURCE, attrList, props, tgtName );
|
public void | createPhysicalDestination(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String target)calls {@link createJMSDestination } after getting the values from attribute list
String destType = null;
String destName = null;
if(attrList == null)
throw new IllegalArgumentException();
int size = attrList.size();
for(int i=0;i<size;i++){
Attribute attribute =(Attribute)attrList.get(i);
if((attribute.getName().equalsIgnoreCase(DEST_TYPE)))
destType = (String)attribute.getValue();
if((attribute.getName().equalsIgnoreCase(DEST_NAME)))
destName = (String)attribute.getValue();
}
//FIXME: Should target be passed in here???
createJMSDestination(destName,destType,props, target);
|
private javax.management.ObjectName | createResource(java.lang.String resourceType, javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
return createResource(resourceType, attrList, props, tgtName,true);
|
private javax.management.ObjectName | createResource(java.lang.String resourceType, javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName, boolean createResourceRefs)
if (resourceType.equals(CONNECTOR_CONNECTION_POOL))
validateCnctorConnPoolAttrList(attrList);
ObjectName mbean = null;
final Target target = TargetBuilder.INSTANCE.createTarget(
VALID_CREATE_DELETE_TYPES,
tgtName, getConfigContext()); // This method call fails as getConfigContext is returning null.
boolean hasReferences = isResourceReferenceValid(resourceType, target.getType());
boolean enabled = true;
String resName = getResourceName(resourceType, attrList);
int idxEnabled = -1;
if (attrList != null)
{
for(int i=0; i<attrList.size(); i++)
{
Attribute attr = (Attribute)attrList.get(i);
if (attr.getName().equals("enabled"))
{
enabled = Boolean.valueOf(attr.getValue().toString()).booleanValue();
idxEnabled = i;
}
}
}
Attribute saveEnabledAtttr = null;
if(!enabled && hasReferences)
{ //change original "enabled" value to true
saveEnabledAtttr = (Attribute)attrList.get(idxEnabled);
attrList.set(idxEnabled, new Attribute("enabled", "true"));
}
mbean = (ObjectName)super.invoke( "create" + ConfigMBeanHelper.convertTagName(resourceType),
new Object[] {attrList},
new String[] {AttributeList.class.getName()});
if(!enabled && hasReferences)
{ //restore original enabled value
attrList.set(idxEnabled, saveEnabledAtttr);
}
// Add properties
if (props != null)
{
setProperties(mbean, props);
}
/*
No need to create resource-ref if
- resource is a jdbc-connection-pool or connector-connection-pool
or resource-adapter-config
- target is domain
*/
if (!hasReferences)
{
return mbean;
}
// If target is server or cluster, resource-ref should also be
// created inside server or group/cluster element
if (target.getType() == TargetType.SERVER ||
target.getType() == TargetType.CLUSTER ||
target.getType() == TargetType.DAS)
{
if ( (resName != null) && !(resName.equals("")) && createResourceRefs )
{
//System.out.println("ResourcesMBean - default creation of resource refs "+ target.getName() + " " + resName);
getResourceReferenceHelper().createResourceReference(
target.getName(), enabled, resName);
}
}
return mbean;
|
public java.util.ArrayList | createResource(java.lang.String resourceXMLFile, java.lang.String tgtName)Creating resources from sun-resources.xml file. This method is used by
the admin framework when the add-resources command is used to create
resources
//@todo: how do we handle failures?
boolean retVal = false;
ArrayList results = new ArrayList();
com.sun.enterprise.resource.ResourcesXMLParser resourcesParser =
new com.sun.enterprise.resource.ResourcesXMLParser(resourceXMLFile);
List<Resource> resources = resourcesParser.getResourcesList();
//First add all non connector resources.
;
Iterator<Resource> nonConnectorResources = ResourcesXMLParser.getNonConnectorResourcesList(resources,false).iterator();
while (nonConnectorResources.hasNext()) {
Resource resource = (Resource) nonConnectorResources.next();
String s = "";
try {
s = createAResource(resource, tgtName, true);
} catch (Exception e) {
s = e.getMessage();
}
results.add(s);
}
//Now add all connector resources
Iterator connectorResources = ResourcesXMLParser.getConnectorResourcesList(resources, false).iterator();
while (connectorResources.hasNext()) {
Resource resource = (Resource) connectorResources.next();
String s = "";
try {
s = createAResource(resource, tgtName, true);
} catch (Exception e) {
s = e.getMessage();
}
results.add(s);
}
return results;
|
public void | createResource(java.util.List res, java.lang.Boolean isEnabled)Creating resources from sun-resources.xml file. This API
is used by the deployment backend to create Resources
//@todo: handle isEnabled. This should override the enabled flag specified
//in the individual Resources.
Iterator<Resource> resources = res.iterator();
while (resources.hasNext()) {
Resource resource = (Resource) resources.next();
createAResource(resource, null, false);
}
|
public javax.management.ObjectName | createResourceAdapterConfig(javax.management.AttributeList attrList, java.util.Properties props, java.lang.String tgtName)
final ObjectName on = createResource( RESOURCE_ADAPTER_CONFIG, attrList, props, tgtName );
return on;
|
public void | createResourceAndResourceReference(java.util.List resources, java.util.List targetNameList, java.lang.Boolean enabled)
Iterator<Resource> resourceList = resources.iterator();
while (resourceList.hasNext()) {
Resource resource = (Resource) resourceList.next();
for (String target : targetNameList) {
createAResource(resource, target, false);
createAResourceReference(resource, target, enabled);
}
}
|
public void | createResourceReference(java.lang.String targetName, boolean enabled, java.lang.String referenceName)
//System.out.println("ResourcesMBean: createResourceRef" + targetName + " " + referenceName);
getResourceReferenceHelper().createResourceReference(
targetName, enabled, referenceName);
|
public void | createResourceReference(java.lang.String targetName, boolean enabled, com.sun.enterprise.resource.Resource resource)Creates a Resource Reference for the resource passed in the targe
this.createResourceReference(targetName, enabled, getResourceName(resource.getType(), resource.getAttributes()));
|
public void | createResourceReference(java.util.List res, java.util.List tgtNames, java.lang.Boolean isEnabled)Creating resources from sun-resources.xml file. This API
is used by the deployment backend to create resource refs
Iterator<Resource> resources = res.iterator();
//@todo: handle isEnabled. This should override the enabled flag specified
//in the individual Resources.
while (resources.hasNext()) {
createAResourceReference(resources.next(), tgtNames, isEnabled);
}
|
private void | deleteAResource(com.sun.enterprise.resource.Resource resource)
//System.out.println("ResourcesMBean deleteAResource " + resource.getType());
this.destroyResource(resource.getType(),
getResourceName(resource.getType(), resource.getAttributes()));
|
private void | deleteAResourceRef(com.sun.enterprise.resource.Resource resource, java.util.List targetNames)
//System.out.println("ResourcesMBean deleteAResourceRef " + resource.getType());
for (String tgt : targetNames) {
Target target = getResourceTarget(tgt);
if (isResourceReferenceValid(resource.getType(),target.getType())) {
this.deleteResourceRef(getResourceName(resource.getType(), resource.getAttributes()), target, tgt);
}
}
|
public void | deleteAdminObjectResource(java.lang.String name, java.lang.String tgtName)
this.deleteResource(ADMIN_OBJECT_RESOURCE, name, tgtName);
|
private void | deleteConnectionPool(java.lang.String resType, java.lang.String name, java.lang.Boolean cascade, java.lang.String tgtName)
// Find out if the connection-pool is being accessed by any jdbc-resource/connector-resource
// If yes, throw MBeanException that it can't be deleted as it is being
// referenced by jdbc-resource in case cascade is false
boolean crFound = false;
boolean pmfFound = false;
Target target = getResourceTarget(tgtName);
// try {
String[] resArr = null;
String[] pmfArr = null;
String opName = GET + ConfigMBeanHelper.convertTagName(resType);
ObjectName[] resObjNames = (ObjectName[])super.invoke(opName, new Object[]{tgtName}, new String[]{"java.lang.String"});
if (resObjNames != null && resObjNames.length > 0)
{
int k=0;
resArr = new String[resObjNames.length];
for (int i=0; i<resObjNames.length; i++)
{
String poolName = (String)getMBeanServer().getAttribute(resObjNames[i], "pool_name");
if (poolName.equals(name)) {
String jndiName = (String)getMBeanServer().getAttribute(resObjNames[i], "jndi_name");
resArr[k++] = jndiName;
crFound = true;
}
}
}
if (resType.equalsIgnoreCase(JDBC_RESOURCE) && crFound)
{
// If there exists, pmf with jdbc-resource-jndi-name as the jdbc-resources' jndi-name,
// we need to delete them too as they are indirectly connected to this conn-pool.
String pmfOp = GET + ConfigMBeanHelper.convertTagName(PERSISTENCE_MANAGER_FACTORY_RESOURCE);
ObjectName[] pmfObjNames = (ObjectName[])super.invoke(pmfOp, new Object[]{tgtName}, new String[]{"java.lang.String"});
if (pmfObjNames != null && pmfObjNames.length > 0)
{
int k=0;
pmfArr = new String[pmfObjNames.length];
for (int i=0; i<pmfObjNames.length; i++)
{
String jrjnName = (String)getMBeanServer().getAttribute(pmfObjNames[i], "jdbc_resource_jndi_name");
for (int j=0; j<resArr.length && resArr[j] != null; j++)
{
if (jrjnName.equals(resArr[j])) {
String pmfJndiName = (String)getMBeanServer().getAttribute(pmfObjNames[i], "jndi_name");
pmfArr[k++] = pmfJndiName;
pmfFound = true;
break;
}
}
}
}
}
if (!cascade.booleanValue() && (crFound || pmfFound))
{
if (resType.equalsIgnoreCase(JDBC_RESOURCE))
throw new Exception(localStrings.getString("admin.mbeans.rmb.jdbc_res_pmf_ref_exists"));
else
throw new Exception(localStrings.getString("admin.mbeans.rmb.conn_res_ref_exists"));
} else if(cascade.booleanValue()) {
if (pmfFound && (pmfArr!=null))
{
// Delete the pmf resources attached with this conn pool also
for (int i=0; i<pmfArr.length && pmfArr[i] != null; i++) {
deleteResourceRefFromTargets(pmfArr[i]);
boolean isDeleted = destroyResource(PERSISTENCE_MANAGER_FACTORY_RESOURCE, pmfArr[i]);
if (!isDeleted) {
throw new Exception (localStrings.getString("admin.mbeans.rmb.pmf_not_deleted", pmfArr[i]));
}
}
}
if (resArr != null) {
// Delete the jdbc/connector resources attached with this conn pool also
for (int i=0; i<resArr.length && resArr[i] != null; i++) {
deleteResourceRefFromTargets(resArr[i]);
boolean isDeleted = destroyResource(resType, resArr[i]);
if (!isDeleted) {
if (resType.equalsIgnoreCase(JDBC_RESOURCE))
throw new Exception (localStrings.getString("admin.mbeans.rmb.jdbc_res_not_deleted", resArr[i]));
else
throw new Exception (localStrings.getString("admin.mbeans.rmb.conn_res_not_deleted", resArr[i]));
}
}
}
}
/*
There wont be any resource-refs for jdbc & connector connection
pools.
deleteResourceRef(name, target, tgtName);
*/
if (resType.equalsIgnoreCase(JDBC_RESOURCE))
destroyResource(JDBC_CONNECTION_POOL,name);
else
destroyResource(CONNECTOR_CONNECTION_POOL,name);
/* }
catch (MBeanException me) {
throw me;
}
catch (Exception e) {
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
|
public void | deleteConnectorConnectionPool(java.lang.String name, java.lang.String tgtName)
this.deleteConnectorConnectionPool(name, Boolean.valueOf(false), tgtName);
|
public void | deleteConnectorConnectionPool(java.lang.String name, java.lang.Boolean cascade, java.lang.String tgtName)
// Passing the resType as deleteConnectionPool is common method for both
// jdbc-connection-pool and connector-connection-pool deletion
deleteConnectionPool( CONNECTOR_RESOURCE, name, cascade, tgtName);
|
public void | deleteConnectorResource(java.lang.String name, java.lang.String tgtName)
this.deleteResource(CONNECTOR_RESOURCE, name, tgtName);
|
public void | deleteCustomResource(java.lang.String name, java.lang.String tgtName)Delete Methods for the resources
this.deleteResource(CUSTOM_RESOURCE, name, tgtName);
|
public void | deleteExternalJndiResource(java.lang.String name, java.lang.String tgtName)
this.deleteResource(EXTERNAL_JNDI_RESOURCE, name, tgtName);
|
public void | deleteJMSDestination(java.lang.String destName, java.lang.String destType, java.lang.String tgtName)Delete a JMS Destination.
sLogger.entering(getClass().getName(), "deleteJMSDestination",
new Object[] {destName, destType});
validateJMSDestName(destName);
validateJMSDestType(destType);
int newDestType = JMSConstants.QUEUE;
JMSAdmin jmsAdmin = null;
boolean connected = false;
try {
// check and use JMX
Target target = getResourceTarget(tgtName);
if (JMSDestination.useJMX(target)) {
JMSDestination jmsd = new JMSDestination();
jmsd.deleteJMSDestination(destName, destType, tgtName);
return;
} else {
jmsAdmin = getJMSAdmin(tgtName);
jmsAdmin.connectToProvider();
connected = true;
if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC)) {
newDestType = JMSConstants.TOPIC;
} else if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE)) {
newDestType = JMSConstants.QUEUE;
}
jmsAdmin.deleteProviderDestination(destName, newDestType);
}
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "deleteJMSDestination", e);
handleException(e);
} finally {
if (connected) {
try {
jmsAdmin.disconnectFromProvider();
} catch (Exception ex) {
handleException(ex);
}
}
}
|
public void | deleteJdbcConnectionPool(java.lang.String name, java.lang.String tgtName)
this.deleteJdbcConnectionPool(name, Boolean.valueOf(false), tgtName);
|
public void | deleteJdbcConnectionPool(java.lang.String name, java.lang.Boolean cascade, java.lang.String tgtName)
// Passing the resType as eleteConnectionPool is common method for both
// jdbc-connection-pool and connector-connection-pool deletion
deleteConnectionPool(JDBC_RESOURCE, name, cascade, tgtName);
|
public void | deleteJdbcResource(java.lang.String name, java.lang.String tgtName)
this.deleteResource(JDBC_RESOURCE, name, tgtName);
|
public void | deleteJmsConenctionFactory(java.lang.String name, java.lang.String tgtName)Helper method for deleting Jms connection factory
deleteJmsResource(name, tgtName);
|
public void | deleteJmsDestinationResource(java.lang.String name, java.lang.String tgtName)Helper method for deleting Jms destination resource
deleteJmsResource(name, tgtName);
|
public void | deleteJmsResource(java.lang.String name, java.lang.String tgtName)
// try {
Target target = getResourceTarget(tgtName);
ObjectName connResource = null;
try {
connResource = (ObjectName)super.invoke("getConnectorResourceByJndiName", new Object[]{name}, new String[]{"java.lang.String"});
} catch (Exception ee){};
if (connResource == null)
{
// delete any admin objects with this jndi name
super.invoke("deleteAdminObjectResource", new Object[]{name, tgtName}, new String[]{"java.lang.String", "java.lang.String"});
} else {
// Delete the connector resource and connector connection pool
String defPoolName = ConnectorRuntime.getRuntime().getDefaultPoolName(name);
String poolName = (String) getMBeanServer().getAttribute(connResource, "pool_name");
if (poolName != null && poolName.equals(defPoolName))
{
deleteResourceRef(name, target, tgtName);
// Delete both the resource and the poolname
destroyResource(CONNECTOR_RESOURCE, name);
ObjectName connPool = getObjectNameForResType(CONNECTOR_CONNECTION_POOL, poolName);
if (connPool != null) {
destroyResource(CONNECTOR_CONNECTION_POOL,poolName);
}
}
else
{
// There is no connector pool with the default poolName.
// However, no need to throw exception as the connector
// resource might still be there. Try to delete the
// connector-resource without touching the ref. as
// ref. might have been deleted while deleting connector-connection-pool
// as the ref. is the same.
ObjectName connResMBean = getObjectNameForResType(CONNECTOR_RESOURCE, name);
super.invoke("removeConnectorResourceByJndiName",new Object[]{name},new String[] {"java.lang.String"});
}
}
/* }
catch (MBeanException me) {
throw me;
}
catch (Exception e) {
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
|
public void | deleteMailResource(java.lang.String name, java.lang.String tgtName)
this.deleteResource(MAIL_RESOURCE, name, tgtName);
|
public void | deletePersistenceManagerFactoryResource(java.lang.String name, java.lang.String tgtName)
// *** first we remove persistence resource itself as it has references
// *** to jdbc-resources and should be removed first to avoid
// *** Validator's reject
this.deleteResource(PERSISTENCE_MANAGER_FACTORY_RESOURCE, name, tgtName);
// If creation of pmf resource also resulted in creation of jdbc-resource,
// then that needs to be removed. This will be identified by suffix PM.
Resources resources = (Resources)this.getBaseConfigBean();
if (resources.getJdbcResourceByJndiName(name + PMF_SUFFIX)!=null)
{
this.deleteResource(JDBC_RESOURCE, name + PMF_SUFFIX, tgtName);
}
|
public void | deletePhysicalDestination(java.lang.String destName, java.lang.String destType, java.lang.String target)calls {@link deleteJMSDestination }
deleteJMSDestination(destName,destType, target);
|
private void | deleteResource(java.lang.String resType, java.lang.String name, java.lang.String tgtName)
String operation = null;
String suffix = null;
if (resType.equals(RESOURCE_ADAPTER_CONFIG))
suffix = "ByResourceAdapterName";
else if (resType.equals(JDBC_CONNECTION_POOL) || resType.equals(CONNECTOR_CONNECTION_POOL))
suffix = "ByName";
else suffix = "ByJndiName";
operation = "remove" + ConfigMBeanHelper.convertTagName(resType) + suffix;
if (!(RESOURCE_ADAPTER_CONFIG.equals(resType) ||
JDBC_CONNECTION_POOL.equals(resType) ||
CONNECTOR_CONNECTION_POOL.equals(resType))) {
/*
delete the resource-refs before calling the delete for this
resource.
*/
Target target = getResourceTarget(tgtName);
deleteResourceRef(name, target, tgtName);
}
// Invoke removeXXXByXXXName() for the appropriate MBean
super.invoke(operation,new Object[]{name},new String[] {"java.lang.String"});
|
public void | deleteResource(java.util.List res)Used by the deployment backend to destroy resources defined in
sun-resources.xml
//Delete Resource and ResourceRefs in the reverse order.
int size = res.size();
for (int i = (size -1); i >= 0 ; i--) {
Resource resource = res.get(i);
//Security map deletion is not required
//They will be deleted automatically when connector connection pool is deleted
if(resource.getType().equals(CONNECTOR_SECURITY_MAP))
continue;
try{
deleteAResource(resource);
}catch(Exception ex){
String s = localStrings.getString("unable.delete.resource", resource.toString());
sLogger.log(Level.WARNING, s);
}
}
|
public void | deleteResourceAdapterConfig(java.lang.String name, java.lang.String tgtName)
this.deleteResource(RESOURCE_ADAPTER_CONFIG, name, tgtName);
|
public void | deleteResourceAndResourceReference(java.util.List resources, java.util.List targetNameList)Deleting resources from sun-resources.xml file. This API
is used by the deployment backend to delete Resources
//Delete Resource and ResourceRefs in the reverse order.
int size = resources.size();
for (int i = (size -1); i >= 0 ; i--) {
Resource resource = (Resource)resources.get(i);
//Security map deletion is not required
//They will be deleted automatically when connector connection pool is deleted
if(resource.getType().equals(CONNECTOR_SECURITY_MAP))
continue;
try{
deleteAResourceRef(resource, targetNameList);
}catch(Exception ex){
String s = localStrings.getString("unable.delete.resource.ref", resource.toString());
sLogger.log(Level.WARNING, s);
continue;
}
try{
deleteAResource(resource);
}catch(Exception ex){
String s = localStrings.getString("unable.delete.resource", resource.toString());
sLogger.log(Level.WARNING, s);
}
}
|
private void | deleteResourceRef(java.lang.String resRef, com.sun.enterprise.admin.target.Target target, java.lang.String tgtName)
//System.out.println("deleteResourceRef " + resRef + " target " + target + " tgtName " + tgtName );
// try {
//This call is a sanity check to make sure that the resource exists.
final String resType = getResourceReferenceHelper().getResourceType(resRef);
// If target is server or cluster, resource-ref should also be
// deleted from server or cluster element.
if (target.getType() == TargetType.SERVER ||
target.getType() == TargetType.DAS) {
//Delete the resource reference only if the resource is referenced
//by the target server only
if (!ServerHelper.serverReferencesResource(getConfigContext(),
tgtName, resRef)) {
throw new ConfigException(localStrings.getString("serverResourceRefDoesNotExist",
tgtName, resRef));
} else if (ResourceHelper.isResourceReferencedByServerOnly(getConfigContext(),
resRef, tgtName)) {
getResourceReferenceHelper().deleteResourceReference(tgtName, resRef);
} else {
throw new ConfigException(localStrings.getString("resourceHasMultipleRefs",
tgtName, resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
} else if (target.getType() == TargetType.CLUSTER) {
//Delete the resource reference only if the resource is referenced
//by the target cluster only
if (!ClusterHelper.clusterReferencesResource(getConfigContext(),
tgtName, resRef)) {
throw new ConfigException(localStrings.getString("clusterResourceRefDoesNotExist",
tgtName, resRef));
} else if (ResourceHelper.isResourceReferencedByClusterOnly(getConfigContext(),
resRef, tgtName)) {
getResourceReferenceHelper().deleteResourceReference(tgtName, resRef);
} else {
throw new ConfigException(localStrings.getString("resourceHasMultipleRefs",
tgtName, resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
}
//As a sanity check ensure that the resource has no references; otherwise
//it cannot be deleted from the domain
if (ResourceHelper.isResourceReferenced(getConfigContext(), resRef)) {
throw new ConfigException(localStrings.getString("resourceIsReferenced",
resRef, ResourceHelper.getResourceReferenceesAsString(
getConfigContext(), resRef)));
}
/* }
catch (javax.management.MalformedObjectNameException mone) {}
catch (javax.management.InstanceNotFoundException infe) {}
catch (javax.management.ReflectionException re) {}
*/
|
void | deleteResourceRefFromTargets(java.lang.String ref)
//System.out.println("del res ref from Targets" + ref);
final ConfigContext ctx = getConfigContext();
final String targets = ResourceHelper.getResourceReferenceesAsString(
ctx, ref);
final StringTokenizer strTok = new StringTokenizer(targets, ",");
while (strTok.hasMoreTokens())
{
final String target = strTok.nextToken();
if (ServerHelper.isAServer(ctx, target) &&
ServerHelper.isServerClustered (ctx, target))
{
//Skip the clustered servers.
continue;
}
getResourceReferenceHelper().deleteResourceReference(
target, ref);
}
|
public void | deleteResourceReference(java.lang.String targetName, com.sun.enterprise.resource.Resource resource)Deletes the Resource Reference for the resource passed in the target
Target target = getResourceTarget(targetName);
this.deleteResourceRef(getResourceName(resource.getType(), resource.getAttributes()), target, targetName);
|
public void | deleteResourceReference(java.util.List res, java.util.List targetNames)Deletes the Resource Reference for the resource passed in the target
//System.out.println("Dlete resource refs in refs");
int size = res.size();
//@todo: modify this to simplify the loop logic
for (int i = (size -1); i >= 0 ; i--) {
Resource resource = res.get(i);
try{
deleteAResourceRef(resource, targetNames);
}catch(Exception ex){
String s = localStrings.getString("unable.delete.resource.ref", resource.toString());
sLogger.log(Level.WARNING, s);
}
}
|
private boolean | destroyResource(java.lang.String resType, java.lang.String name)
String operation = null;
String suffix = null;
boolean isDeleted = false;
if (resType.equals(RESOURCE_ADAPTER_CONFIG)){
suffix = "ByResourceAdapterName";
}else if (resType.equals(JDBC_CONNECTION_POOL) || resType.equals(CONNECTOR_CONNECTION_POOL)){
suffix = "ByName";
}else{
suffix = "ByJndiName";
}
operation = "remove" + ConfigMBeanHelper.convertTagName(resType) + suffix;
try {
super.invoke(operation, new Object[]{name}, new String[] {"java.lang.String"});
isDeleted = true;
}
catch (javax.management.ReflectionException re) {}
return isDeleted;
|
public javax.management.ObjectName[] | filterForTarget(javax.management.ObjectName[] mbean, com.sun.enterprise.admin.target.Target target)
ArrayList result = new ArrayList();
try {
if (target.getType() == TargetType.SERVER ||
target.getType() == TargetType.CLUSTER ||
target.getType() == TargetType.DAS) {
//filter out only those resources referenced by the target
ResourceRef[] refs = target.getResourceRefs();
String objectProps = null;
for (int i = 0; i < mbean.length; i++) {
for (int j = 0; j < refs.length; j++) {
objectProps = mbean[i].getKeyPropertyListString();
if (objectProps.indexOf(refs[j].getRef()) > 0) {
result.add(mbean[i]);
break;
}
}
}
return (ObjectName[])result.toArray(new ObjectName[result.size()]);
}
} catch (Exception e) {
;
}
return mbean;
|
public void | flushJMSDestination(java.lang.String destName, java.lang.String destType, java.lang.String tgtName)Purge a JMS Destination.
// check and use JMX
try {
Target target = getResourceTarget(tgtName);
if (JMSDestination.useJMX(target)) {
JMSDestination jmsd = new JMSDestination();
if (isClustered(tgtName)) {
/* The MQ 4.1 JMX Apis do not clean up all
* the destintations in all the instances
* in a broker cluster, in other words, JMX
* operation purge is not cluster aware
* So we have to ensure that we purge each instance
* in the cluster one by one.
* If one of them fail just log and proceed, we will
* flag an error towards the end. Issue 6523135
* This works because we resolve the port numbers
* even for standalone instances in MQAddressList.
*/
boolean success = true;
Server [] servers = target.getServers();
for (int server = 0; server < servers.length; server++) {
try {
jmsd.purgeJMSDestination(destName, destType, servers[server].getName());
} catch (Exception e) {
success = false;
sLogger.log(Level.SEVERE,localStrings.getString("admin.mbeans.rmb.error_purging_jms_dest") + servers[server].getName());
}
}
if (!success) {
throw new Exception(localStrings.getString("admin.mbeans.rmb.error_purging_jms_dest"));
}
} else {
jmsd.purgeJMSDestination(destName, destType, tgtName);
}
} else {
sLogger.log(Level.WARNING, "Flush JMS destination not supported in the JMS SPI");
}
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "flushJMSDestination", e);
handleException(e);
}
|
public java.util.Properties | getActivationConfPropTypes(java.lang.String raName, java.lang.String msgLsnrType)Retrieve the list of activation configuration property types
for a specific message listener type from the resource adapter deployed
on the server.
Note, the types need to correspond to the names in the
same retrieval order.
// try {
return ConnectorRuntime.getRuntime().
getMessageListenerConfigPropTypes(raName, msgLsnrType);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
public java.util.Properties | getActivationConfProps(java.lang.String raName, java.lang.String msgLsnrType)Retrieve the list of activation configuration property names
for a specific message listener type from the resource adapter deployed
on the server.
// try {
return ConnectorRuntime.getRuntime().
getMessageListenerConfigProps(raName, msgLsnrType);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
public java.util.Properties | getAdminObjectConfigProps(javax.management.AttributeList attrList)Get the list of Admin Object Config Properties supported by a specific
resource adapter for the given admin object interface,
deployed on the server.
String rarName = null;
String adminObjIntf = null;
// try {
if (attrList != null)
{
int s = attrList.size();
for(int i=0; i<s; i++){
Attribute attribute =(Attribute)attrList.get(i);
String n= attribute.getName();
if(isAttrNameMatch(attribute, "resource-adapter-name"))
rarName = (String)attribute.getValue();
if(isAttrNameMatch(attribute, "admin-object-interface"))
adminObjIntf = (String)attribute.getValue();
}
} else
throw new Exception (localStrings.getString("admin.mbeans.rmb.null_attrib_list_ao"));
return ConnectorRuntime.getRuntime().
getAdminObjectConfigProps(rarName, adminObjIntf);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
public java.lang.String[] | getAdminObjectInterfaceNames(java.lang.String rarName)Get the list of Admin Object Interface Names supported by a specific
resource adapter deployed on the server.
if (rarName == null)
//throw new Exception ("Could not get Admin Object Interface Names. Resource Adapter Name is null");
throw new Exception (localStrings.getString("admin.mbeans.rmb.null_raname_ao"));
return ConnectorRuntime.getRuntime().getAdminObjectInterfaceNames(rarName);
|
public javax.management.ObjectName[] | getAdminObjectResource(java.lang.String tgtName)
return getResource( ADMIN_OBJECT_RESOURCE, tgtName );
|
public javax.management.ObjectName | getAdminObjectResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( ADMIN_OBJECT_RESOURCE, key, tgtName );
|
private java.lang.String | getAttributeValueFromList(java.lang.String name, javax.management.AttributeList list)
for (int i=0; i<list.size(); i++) {
Attribute attr = (Attribute)list.get(i);
if (isAttrNameMatch(attr, name)) {
return (String)attr.getValue();
}
}
return "";
|
public java.lang.String[] | getConnectionDefinitionNames(java.lang.String rarName)Get the list of connection definition names supported by a specific
resource adapter deployed on the server.
// try {
return ConnectorRuntime.getRuntime().
getConnectionDefinitionNames(rarName);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
public java.util.Map | getConnectionDefinitionPropertiesAndDefaults(java.lang.String dataSource)Get list of properties and default values for connection with
defined data source.
returns "null" if no info or error
try {
return new HashMap( ConnectionDefinitionUtils.
getConnectionDefinitionPropertiesAndDefaults(dataSource.trim()));
} catch(Throwable t) {
return null;
}
|
public javax.management.ObjectName[] | getConnectorConnectionPool(java.lang.String tgtName)
return getResource( CONNECTOR_CONNECTION_POOL, tgtName );
|
public javax.management.ObjectName | getConnectorConnectionPoolByName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( CONNECTOR_CONNECTION_POOL, key, tgtName );
|
public javax.management.ObjectName[] | getConnectorResource(java.lang.String tgtName)
return getResource( CONNECTOR_RESOURCE, tgtName );
|
public javax.management.ObjectName | getConnectorResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( CONNECTOR_RESOURCE, key, tgtName );
|
public javax.management.ObjectName[] | getCustomResource(java.lang.String tgtName)GETTER Methods for resources
return getResource( CUSTOM_RESOURCE, tgtName );
|
public javax.management.ObjectName | getCustomResourceByJndiName(java.lang.String key, java.lang.String tgtName)GETTER Methods for resources
return getResourceByName( CUSTOM_RESOURCE, key, tgtName );
|
public javax.management.ObjectName[] | getExternalJndiResource(java.lang.String tgtName)
return getResource( EXTERNAL_JNDI_RESOURCE, tgtName );
|
public javax.management.ObjectName | getExternalJndiResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( EXTERNAL_JNDI_RESOURCE, key, tgtName );
|
private java.lang.String | getFormattedProperties(javax.management.ObjectName objName)
StringBuffer retVal = new StringBuffer();
// try {
if (objName == null)
throw new Exception(localStrings.getString("admin.mbeans.rmb.null_rac"));
retVal.append(objName.getKeyProperty("resource-adapter-name"));
AttributeList props = (AttributeList) getMBeanServer().invoke(objName, "getProperties", null, null);
if (!props.isEmpty()) {
for (int i=0; i<props.size(); i++) {
Attribute attrib = (Attribute)props.get(i);
if (i==0) retVal.append("\n");
retVal.append("\t");
retVal.append(attrib.getName());
retVal.append("=");
retVal.append(attrib.getValue());
retVal.append("\n");
}
}
/* }
catch (Exception e) {
e.printStackTrace();
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return retVal.toString();
|
private synchronized com.sun.messaging.jmq.jmsspi.JMSAdmin | getJMSAdmin()Synchronized to serialize access to _jmsAdmin, in case there are
multiple admin clients accessing the broker and modifying
the admin username/passwd or port.
ConfigContext serverContext;
JmsService jmsService;
JMSAdminFactory jmsaf;
JMSAdmin _jmsAdmin = null;
String instanceName, portStr, username, password, localhost, jmsAdminURL;
serverContext = getConfigContext();
jmsaf = IASJmsUtil.getJMSAdminFactory();
jmsService = (JmsService)ConfigBeansFactory.getConfigBeanByXPath(
serverContext, ServerXPathHelper.XPATH_JMS_SERVICE);
localhost = java.net.InetAddress.getLocalHost().getHostName();
JmsHost hostElement = jmsService.getJmsHost(0); //ms1 krav
portStr = hostElement.getPort();
username = hostElement.getAdminUserName();
password = hostElement.getAdminPassword();
jmsAdminURL = localhost + ((portStr == null) ?
"" : ":" + portStr);
_jmsAdmin = jmsaf.getJMSAdmin(jmsAdminURL, username, password);
return _jmsAdmin;
|
private com.sun.messaging.jmq.jmsspi.JMSAdmin | getJMSAdmin(java.lang.String targetName)
final TargetType[] vaildTargetTypes = new TargetType[] {
TargetType.CLUSTER, TargetType.SERVER, TargetType.DAS, TargetType.CONFIG};
final Target target = TargetBuilder.INSTANCE.createTarget(
vaildTargetTypes, targetName, getConfigContext());
assert target != null;
final Config config = target.getConfigs()[0];
final JmsService jmsService = config.getJmsService();
JmsHost host = jmsService.getJmsHostByName(jmsService.getDefaultJmsHost());
if (host == null)
{
host = jmsService.getJmsHost(0);
}
final String hostName = host.getHost();
final String port = host.getPort();
final String adminUser = host.getAdminUserName();
final String adminPassword = host.getAdminPassword();
String url = hostName + (port == null ? "" : ":" + port);
if (adminUser == null)
{
return IASJmsUtil.getJMSAdminFactory().getJMSAdmin(url);
}
else
{
return IASJmsUtil.getJMSAdminFactory().getJMSAdmin(
url, adminUser, adminPassword);
}
|
public javax.management.ObjectName[] | getJdbcConnectionPool(java.lang.String tgtName)
return getResource( JDBC_CONNECTION_POOL, tgtName );
|
public javax.management.ObjectName | getJdbcConnectionPoolByName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( JDBC_CONNECTION_POOL, key, tgtName );
|
public javax.management.ObjectName[] | getJdbcResource(java.lang.String tgtName)
return getResource( JDBC_RESOURCE, tgtName );
|
public javax.management.ObjectName | getJdbcResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( JDBC_RESOURCE, key, tgtName );
|
public javax.management.ObjectName[] | getJmsConnectionFactory(java.lang.String tgtName)
ObjectName[] QRes = null;
ObjectName[] TRes = null;
ObjectName[] uRes = null;
ObjectName[] retVal = null;
QRes = getJmsResource( QUEUE_CF, tgtName );
TRes = getJmsResource( TOPIC_CF, tgtName );
uRes = getJmsResource( UNIFIED_CF, tgtName );
int i = 0;
if (QRes != null) i = QRes.length;
if (TRes != null) i = i + TRes.length;
if (uRes != null) i = i + uRes.length;
if (i > 0) {
ArrayList ret = new ArrayList();
if (QRes != null) ret.addAll(Arrays.asList(QRes));
if (TRes != null) ret.addAll(Arrays.asList(TRes));
if (uRes != null) ret.addAll(Arrays.asList(uRes));
if (ret.size() > 0) {
retVal = new ObjectName[ret.size()];
ret.toArray(retVal);
}
}
return retVal;
|
public javax.management.ObjectName[] | getJmsDestinationResource(java.lang.String tgtName)
ObjectName[] QRes = null;
ObjectName[] TRes = null;
ObjectName[] retVal = null;
QRes = getJmsResource( QUEUE, tgtName );
TRes = getJmsResource( TOPIC, tgtName );
int i = 0;
if (QRes != null) i = QRes.length;
if (TRes != null) i = i + TRes.length;
if (i > 0) {
ArrayList ret = new ArrayList();
if (QRes != null) ret.addAll(Arrays.asList(QRes));
if (TRes != null) ret.addAll(Arrays.asList(TRes));
if (ret.size() > 0) {
retVal = new ObjectName[ret.size()];
ret.toArray(retVal);
}
}
return retVal;
|
public java.lang.String | getJmsRaMappedName(java.lang.String name)
return ConnectorRuntime.getRuntime().getJmsRaMapping().getMappedName(name);
|
public javax.management.ObjectName[] | getJmsResource(java.lang.String tgtName)
return getJmsResource( null, tgtName );
|
public javax.management.ObjectName[] | getJmsResource(java.lang.String resType, java.lang.String tgtName)
Target target = getResourceTarget(tgtName);
ObjectName[] QRes = null;
ObjectName[] TRes = null;
ObjectName[] QCFRes = null;
ObjectName[] TCFRes = null;
ObjectName[] uCFRes = null;
ObjectName[] retVal = null;
// try {
if (resType == null || resType.equals("null")) {
// All types of JMS resources are needed
QRes = getJmsResourceForResType(QUEUE);
TRes = getJmsResourceForResType(TOPIC);
QCFRes = getJmsResourceForResType(QUEUE_CF);
TCFRes = getJmsResourceForResType(TOPIC_CF);
uCFRes = getJmsResourceForResType(UNIFIED_CF);
int i = 0;
if (QRes != null) i = QRes.length;
if (TRes != null) i = i + TRes.length;
if (QCFRes != null) i = i + QCFRes.length;
if (TCFRes != null) i = i + TCFRes.length;
if (uCFRes != null) i = i + uCFRes.length;
if (i > 0) {
ArrayList ret = new ArrayList();
if (QRes != null) ret.addAll(Arrays.asList(QRes));
if (TRes != null) ret.addAll(Arrays.asList(TRes));
if (QCFRes != null) ret.addAll(Arrays.asList(QCFRes));
if (TCFRes != null) ret.addAll(Arrays.asList(TCFRes));
if (uCFRes != null) ret.addAll(Arrays.asList(uCFRes));
if (ret.size() > 0) {
retVal = new ObjectName[ret.size()];
ret.toArray(retVal);
}
}
} else {
if (!(resType.equals(QUEUE) || resType.equals(TOPIC)
|| resType.equals(QUEUE_CF) || resType.equals(TOPIC_CF) || resType.equals(UNIFIED_CF))) {
throw new Exception(localStrings.getString("admin.mbeans.rmb.invalid_res_type", resType));
} else {
retVal = getJmsResourceForResType(resType);
}
}
/* }
catch (MBeanException me)
{
throw me;
}
catch (Exception e)
{
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
if ((tgtName != null) && (tgtName.trim().equals(""))) {
/* This basically means that someone wants the jms
* jms resources for the whole domain, this case the
* targetname is empty "". If target is null then
* it indicates the target to be Default server.
*/
return retVal;
} else {
/* This would filter out all the resources based on
* on the target. Fix for issue 6413580
*/
return filterForTarget(retVal, target);
}
|
private javax.management.ObjectName[] | getJmsResourceForResType(java.lang.String resType)
ObjectName[] retVal = null;
ArrayList al = new ArrayList();
try {
if (resType.equals(QUEUE) || resType.equals(TOPIC)) {
// get all admin-objects whose resType is Queue or Topic and
// res-adapter is Default-jms-adapter
ObjectName o = m_registry.getMbeanObjectName(RESOURCES, new String[]{getDomainName()});
ObjectName[] adminObjNames = (ObjectName[])getMBeanServer().invoke(o, "getAdminObjectResource", null, null);
if (adminObjNames != null) {
for (int i=0; i<adminObjNames.length; i++) {
String adminResType = (String)getMBeanServer().getAttribute(adminObjNames[i], "res_type");
if ((adminResType != null) && ((adminResType.equals(QUEUE) && resType.equals(QUEUE)) || (adminResType.equals(TOPIC) && resType.equals(TOPIC)))) {
//Check for the res-adapter
String adminResAdapter = (String)getMBeanServer().getAttribute(adminObjNames[i], "res_adapter");
if ((adminResAdapter != null) && (adminResAdapter.equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)))
al.add(adminObjNames[i]);
}
}
if (!al.isEmpty()) {
retVal = new ObjectName[al.size()];
al.toArray(retVal);
}
}
} else {
// get all connector-resources whose connector-connection-pool
// satisfy the criterion -
// connection-definition-name is QCF or TCF &
// resource-adapter-name is DEFAULT_JMS_ADAPTER
ObjectName o = m_registry.getMbeanObjectName(RESOURCES, new String[]{getDomainName()});
ObjectName[] CRObjNames = CRObjNames = (ObjectName[])getMBeanServer().invoke(o, "getConnectorResource", null, null);
if (CRObjNames != null) {
for (int i=0; i<CRObjNames.length; i++) {
String poolName = (String)getMBeanServer().getAttribute(CRObjNames[i], "pool_name");
if (poolName != null) {
ObjectName CCPObjName = null;
try {
CCPObjName = (ObjectName)getMBeanServer().invoke(o, "getConnectorConnectionPoolByName", new Object[]{poolName}, new String[]{"java.lang.String"});
} catch (Exception ee){
// ignore this Exception
}
if (CCPObjName != null) {
String cdn = (String)getMBeanServer().getAttribute(CCPObjName, "connection_definition_name");
if ((cdn != null) && ((cdn.equals(resType)) || ((cdn.equals(resType))))) {
//Check for the res-adapter
String resAdapter = (String)getMBeanServer().getAttribute(CCPObjName, "resource_adapter_name");
if ((resAdapter != null) && (resAdapter.equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)))
al.add(CRObjNames[i]);
}
}
}
}
if (!al.isEmpty()) {
retVal = new ObjectName[al.size()];
al.toArray(retVal);
}
}
}//end of else block
}//end of try
catch (javax.management.InstanceNotFoundException infe) {}
catch (javax.management.ReflectionException re) {}
catch (javax.management.AttributeNotFoundException anf) {}
return retVal;
|
protected javax.management.MBeanServer | getMBeanServer()
return com.sun.enterprise.admin.common.MBeanServerFactory.getMBeanServer();
|
public java.util.Properties | getMCFConfigProps(javax.management.AttributeList attrList)Get the Managed Connection Factory Config Properties supported by a
specific resource adapter for the given connection definition name,
deployed on the server.
String rarName = null;
String connDefName = null;
// try {
if (attrList != null)
{
int s = attrList.size();
for(int i=0; i<s; i++){
Attribute attribute =(Attribute)attrList.get(i);
String n= attribute.getName();
if(isAttrNameMatch(attribute, "resource-adapter-name"))
rarName = (String)attribute.getValue();
if(isAttrNameMatch(attribute, "connection-definition-name"))
connDefName = (String)attribute.getValue();
}
} else
throw new Exception (localStrings.getString("admin.mbeans.rmb.null_attrib_list_mcf"));
return ConnectorRuntime.getRuntime().
getMCFConfigProps(rarName, connDefName);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
public javax.management.ObjectName[] | getMailResource(java.lang.String tgtName)
return getResource( MAIL_RESOURCE, tgtName );
|
public javax.management.ObjectName | getMailResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( MAIL_RESOURCE, key, tgtName );
|
public java.lang.String[] | getMessageListenerTypes(java.lang.String raName)Retrieve the list of message listener types supported by a specific
resource adapter deployed on the server.
// try {
return ConnectorRuntime.getRuntime().
getMessageListenerTypes(raName);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
private javax.management.ObjectName | getObjectNameForResType(java.lang.String resType, java.lang.String name)
return m_registry.getMbeanObjectName(resType, new String[]{getDomainName(), name});
|
public javax.management.ObjectName[] | getPersistenceManagerFactoryResource(java.lang.String tgtName)
return getResource( PERSISTENCE_MANAGER_FACTORY_RESOURCE, tgtName );
|
public javax.management.ObjectName | getPersistenceManagerFactoryResourceByJndiName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( PERSISTENCE_MANAGER_FACTORY_RESOURCE, key, tgtName );
|
private java.lang.String | getProvidedDestinationName(java.util.Properties props)Get the physical destination name provided by the user. The "Name"
and "imqDestinationName" properties are used to link a JMS destination
resource to its physical destination in SJSMQ.
for (Enumeration e = props.keys() ; e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String value = (String)props.get(key);
if(NAME.equals(key) || IMQ_DESTINATION_NAME.equals(key)){
if (value != null && value.length() != 0) return value;
}
}
return null;
|
private javax.management.ObjectName[] | getResource(java.lang.String resType, java.lang.String tgtName)
ArrayList result = new ArrayList();
final Target target = TargetBuilder.INSTANCE.createTarget(
VALID_LIST_TYPES, tgtName, getConfigContext());
ObjectName[] mbean = (ObjectName[])super.invoke( GET + ConfigMBeanHelper.convertTagName(resType), null, null);
/**
resource-ref business doesnot apply to jdbc-connection-pool,
connector-connection-pool & resource-adapter-config. So return
the pools as if the target were domain. &
If the target is domain, return all the resources of the specific
type.
*/
if (CONNECTOR_CONNECTION_POOL.equals(resType) ||
JDBC_CONNECTION_POOL.equals(resType) ||
RESOURCE_ADAPTER_CONFIG.equals(resType) ||
(target.getType() == TargetType.DOMAIN))
{
return mbean;
}
if (target.getType() == TargetType.SERVER ||
target.getType() == TargetType.CLUSTER ||
target.getType() == TargetType.DAS) {
//filter out only those resources referenced by the target
ResourceRef[] refs = target.getResourceRefs();
String objectProps = null;
for (int i = 0; i < mbean.length; i++) {
for (int j = 0; j < refs.length; j++) {
objectProps = mbean[i].getKeyPropertyListString();
if (objectProps.indexOf(refs[j].getRef()) > 0) {
result.add(mbean[i]);
break;
}
}
}
}
return (ObjectName[])result.toArray(new ObjectName[result.size()]);
|
public java.util.Map | getResourceAdapterBeanProperties(java.lang.String location)Get list of properties for resource adapter defined by location
returns "null" if no info or error
try {
return new HashMap(ConnectorRuntime.getRuntime().
getResourceAdapterBeanProperties(location));
} catch(Throwable t) {
return null;
}
|
public javax.management.ObjectName[] | getResourceAdapterConfig(java.lang.String tgtName)
return getResource( RESOURCE_ADAPTER_CONFIG, tgtName );
|
public java.lang.String | getResourceAdapterConfig(java.lang.String resAdapterConfig, java.lang.Boolean verbose, java.lang.String tgtName)
String retVal = null;
StringBuffer sb = new StringBuffer();
// try {
if ((resAdapterConfig != null) && !(resAdapterConfig.equals("")) && !(resAdapterConfig.equals("null"))) {
ObjectName rac = null;
try {
rac = (ObjectName) super.invoke("getResourceAdapterConfigByResourceAdapterName", new Object[]{resAdapterConfig}, new String[]{"java.lang.String"});
} catch (Exception ee){
// fall through -- the null test below will handle the error
};
if (rac == null) {
throw new Exception(localStrings.getString("admin.mbeans.rmb.null_rac"));
}
else {
/**
get the properties if verbose=true. Otherwise return the
name.
*/
retVal = verbose.booleanValue() ?
getFormattedProperties(rac) :
rac.getKeyProperty("resource-adapter-name");
}
}
else {
ObjectName[] rac = getResource( RESOURCE_ADAPTER_CONFIG, tgtName );
if (verbose.booleanValue() && rac != null && rac.length>0) {
for (int i=0; i<rac.length; i++) {
sb.append(getFormattedProperties(rac[i]));
sb.append("\n");
}
} else if(!verbose.booleanValue() && rac != null && rac.length>0) {
for (int i=0; i<rac.length; i++) {
sb.append(rac[i].getKeyProperty("resource-adapter-name"));
sb.append("\n");
}
} else sb.append("No resource-adapter-config found.");
retVal = sb.toString();
}
/* }
catch (MBeanException me) {
throw me;
}
catch (Exception e) {
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return retVal;
|
public javax.management.ObjectName | getResourceAdapterConfigByResourceAdapterName(java.lang.String key, java.lang.String tgtName)
return getResourceByName( RESOURCE_ADAPTER_CONFIG, key, tgtName );
|
public java.util.Properties | getResourceAdapterConfigProps(javax.management.AttributeList attrList)Get the resource-adapter-config properties supported by a specific
resource adapter deployed on the server.
String rarName = null;
// try {
if (attrList != null)
{
int s = attrList.size();
for(int i=0; i<s; i++)
{
Attribute attribute =(Attribute)attrList.get(i);
String n= attribute.getName();
if(isAttrNameMatch(attribute, "resource-adapter-name"))
rarName = (String)attribute.getValue();
}
} else
throw new Exception (localStrings.getString("admin.mbeans.rmb.null_attrib_list"));
return ConnectorRuntime.getRuntime().
getResourceAdapterConfigProps(rarName);
/* } catch (Exception e) {
throw new MBeanException(e, e.getMessage());
}
*/
|
private javax.management.ObjectName | getResourceByName(java.lang.String resType, java.lang.String key, java.lang.String tgtName)
ObjectName mbean = null;
// try
{
final Target target = TargetBuilder.INSTANCE.createTarget(
VALID_LIST_TYPES, tgtName, getConfigContext());
String opName = "";
if (resType.equals(RESOURCE_ADAPTER_CONFIG)) {
// opName is getResourceAdapterConfigByResourceAdapterName
opName = GET + ConfigMBeanHelper.convertTagName(resType) + "By" + ConfigMBeanHelper.convertTagName(ServerTags.RESOURCE_ADAPTER_NAME);
} else if (resType.equals(JDBC_CONNECTION_POOL) || resType.equals(CONNECTOR_CONNECTION_POOL)) {
// opName is getJdbcConnectionPoolByName or getConnectorConnectionPoolByName
opName = GET + ConfigMBeanHelper.convertTagName(resType) + BYNAME;
} else opName = GET + ConfigMBeanHelper.convertTagName(resType) + BYJNDINAME;
mbean = (ObjectName)super.invoke(opName, new Object[] {key},
new String[] {key.getClass().getName()});
}
/* catch (MBeanException me)
{
throw me;
}
catch (Exception e)
{
e.printStackTrace();
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return mbean;
|
private java.lang.String | getResourceName(java.lang.String resourceType, javax.management.AttributeList attrList)Gets the name of the resource from the attribute list associated with the
resource.
if (attrList != null) {
if (resourceType.equals(RESOURCE_ADAPTER_CONFIG)) {
for(int i=0; i<attrList.size(); i++) {
Attribute attr = (Attribute)attrList.get(i);
if ( attr.getName().equals("resource-adapter-name") ){
return (String)attr.getValue();
}
}
} else {
for(int i=0; i<attrList.size(); i++) {
Attribute attr = (Attribute)attrList.get(i);
//resource-adapter-name is for RA configs.
if (attr.getName().equals("name") || attr.getName().equals("jndi_name") ||
attr.getName().equals("jndi-name")) {
return (String)attr.getValue();
}
}
}
}
return "";
|
private com.sun.enterprise.admin.configbeans.ResourceReferenceHelper | getResourceReferenceHelper()
return new ResourceReferenceHelper(getConfigContext());
|
private com.sun.enterprise.admin.target.Target | getResourceTarget(java.lang.String tgtName)
// try
// {
return TargetBuilder.INSTANCE.createTarget(VALID_CREATE_DELETE_TYPES,
tgtName, getConfigContext());
/* }
catch (Exception e)
{
e.printStackTrace();
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
|
public java.lang.String[] | getSystemConnectorsAllowingPoolCreation()Returns an array of all system resource adapters that allow connector
connection pool creation.
Presently we need this separate method as the system resource adapters are
not registered in the config. this method will not be required if the system
resource adapters (connector modules) will have entry in domain.xml
return ConnectorRuntime.getRuntime().getSystemConnectorsAllowingPoolCreation();
|
private void | handleException(java.lang.Exception e)
if (e instanceof JMSAdminException) {
throw ((JMSAdminException)e);
}
String msg = e.getMessage();
JMSAdminException jae;
if (msg == null) {
jae = new JMSAdminException();
} else {
jae = new JMSAdminException(msg);
}
/*
* Don't do this for now because the CLI does not include jms.jar
* (at least not yet) in the classpath. Sending over a JMSException
* will cause a class not found exception to be thrown.
jae.setLinkedException(e);
*/
throw jae;
|
private static boolean | isAttrNameMatch(javax.management.Attribute attr, java.lang.String name)
//FIXME: this code should be changed after FCS
// for now we supporting both "dashed" and "underscored" names
return attr.getName().replace('_",'-").equals(name.replace('_",'-"));
|
private boolean | isClustered(java.lang.String tgt)
final TargetType[] vaildTargetTypes = new TargetType[] {
TargetType.CLUSTER, TargetType.SERVER, TargetType.DAS, TargetType.CONFIG};
final Target target = TargetBuilder.INSTANCE.createTarget(
vaildTargetTypes, tgt, getConfigContext());
assert target != null;
return target.getType() == TargetType.CLUSTER;
|
private boolean | isResourceReferenceValid(java.lang.String resourceType, com.sun.enterprise.admin.target.TargetType targetType)Checks to see if resourcerefs are valid and can be created for
the given resourceType in a TargetType
boolean hasReferences = (!( resourceType.equals(CONNECTOR_CONNECTION_POOL) ||
resourceType.equals(JDBC_CONNECTION_POOL) ||
resourceType.equals(RESOURCE_ADAPTER_CONFIG) ||
resourceType.equals(CONNECTOR_SECURITY_MAP) ||
(targetType == TargetType.DOMAIN)));
return hasReferences;
|
private boolean | isSyntaxValid(java.lang.String name)
char[] namechars = name.toCharArray();
if (Character.isJavaIdentifierStart(namechars[0])) {
for (int i = 1; i<namechars.length; i++) {
if (!Character.isJavaIdentifierPart(namechars[i])) {
return false;
}
}
} else {
return false;
}
return true;
|
private boolean | isValidConnectionDefinition(java.lang.String connectionDef, java.lang.String raName)
String [] names =
ConnectorRuntime.getRuntime().getConnectionDefinitionNames(raName);
for(int i = 0; i < names.length; i++) {
if(names[i].equals(connectionDef)) {
return true;
}
}
return false;
|
private boolean | isValidRAName(java.lang.String raName)
boolean retVal = false;
// try {
if ((raName == null) || (raName.equals("")))
throw new Exception(localStrings.getString("admin.mbeans.rmb.null_res_adapter"));
// To check for embedded conenctor module
if (raName.equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER) || raName.equals(ConnectorRuntime.JAXR_RA_NAME)) {
// System RA, so don't validate
retVal = true;
} else {
// Check if the raName contains double underscore or hash.
// If that is the case then this is the case of an embedded rar,
// hence look for the application which embeds this rar,
// otherwise look for the webconnector module with this raName.
ObjectName applnObjName = m_registry.getMbeanObjectName(ServerTags.APPLICATIONS, new String[]{getDomainName()});
int indx = raName.indexOf(
ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER);
if (indx != -1) {
String appName = raName.substring(0, indx);
ObjectName j2eeAppObjName = (ObjectName)getMBeanServer().invoke(applnObjName, "getJ2eeApplicationByName", new Object[]{appName}, new String[]{"java.lang.String"});
if (j2eeAppObjName == null)
throw new Exception(localStrings.getString("admin.mbeans.rmb.invalid_ra_app_not_found", appName));
else retVal = true;
} else {
ObjectName connectorModuleObjName = (ObjectName)getMBeanServer().invoke(applnObjName, "getConnectorModuleByName", new Object[]{raName}, new String[]{"java.lang.String"});
if (connectorModuleObjName == null)
throw new Exception(localStrings.getString("admin.mbeans.rmb.invalid_ra_cm_not_found", raName));
else retVal = true;
}
}
/* }
catch (javax.management.MBeanException me) {
throw me;
}
catch (Exception e) {
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return retVal;
|
private com.sun.enterprise.admin.common.JMSDestinationInfo[] | listAllDestinations(java.lang.String[][] s)
JMSDestinationInfo destInfo;
Vector dests = new Vector();
String destName, destType;
// Convert the array[1] from JMSAdminConstants.QUEUE/TOPIC
// to a JMSConstants.QUEUE/TOPIC
for (int i = 0; i < s[1].length; i++) {
destName = s[0][i];
if (s[1][i].equals(Integer.valueOf(JMSConstants.QUEUE).toString())) {
destType = JMSAdminConstants.JMS_DEST_TYPE_QUEUE;
} else if (s[1][i].equals(Integer.valueOf(JMSConstants.TOPIC).toString())) {
destType = JMSAdminConstants.JMS_DEST_TYPE_TOPIC;
} else {
destType = "";
}
destInfo = new JMSDestinationInfo(destName, destType);
dests.addElement(destInfo);
}
if (dests.size() > 0) {
Object objArray[] = dests.toArray();
JMSDestinationInfo jmsDestArray[];
int size = dests.size();
jmsDestArray = new JMSDestinationInfo [size];
for (int i = 0; i < size; ++i) {
jmsDestArray[i] = (JMSDestinationInfo)objArray[i];
}
return (jmsDestArray);
}
return (null);
|
private com.sun.enterprise.admin.common.JMSDestinationInfo[] | listDestinationsByType(java.lang.String destType, java.lang.String[][] s)
JMSDestinationInfo destInfo;
Vector dests = new Vector();
String destName, type;
String lookFor = null;
if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC))
lookFor = Integer.valueOf(JMSConstants.TOPIC).toString();
else
lookFor = Integer.valueOf(JMSConstants.QUEUE).toString();
// Convert the array[1] from JMSAdminConstants.QUEUE/TOPIC
// to a JMSConstants.QUEUE/TOPIC
int j = 0;
for (int i = 0; i < s[1].length; i++) {
if (s[1][i].equals(lookFor)) {
destName = s[0][i];
if (s[1][i].equals(Integer.valueOf(JMSConstants.QUEUE).toString())) {
type = JMSAdminConstants.JMS_DEST_TYPE_QUEUE;
} else if (s[1][i].equals(Integer.valueOf(JMSConstants.TOPIC).toString())) {
type = JMSAdminConstants.JMS_DEST_TYPE_TOPIC;
} else {
type = "";
}
destInfo = new JMSDestinationInfo(destName, type);
dests.addElement(destInfo);
}
}
if (dests.size() > 0) {
Object objArray[] = dests.toArray();
JMSDestinationInfo jmsDestArray[];
int size = dests.size();
jmsDestArray = new JMSDestinationInfo [size];
for (int i = 0; i < size; ++i) {
jmsDestArray[i] = (JMSDestinationInfo)objArray[i];
}
return (jmsDestArray);
}
return (null);
|
public com.sun.enterprise.admin.common.JMSDestinationInfo[] | listJMSDestinations(java.lang.String destType, java.lang.String tgtName)List JMS Destinations.
JMSDestinationInfo destInfoArray[] = null;
JMSAdmin jmsAdmin = null;
boolean connected = false;
sLogger.entering(getClass().getName(), "listJMSDestinations", destType);
try {
// check and use JMX
Target target = getResourceTarget(tgtName);
if (JMSDestination.useJMX(target)) {
JMSDestination jmsd = new JMSDestination();
return (jmsd.listJMSDestinations(tgtName, destType));
} else {
String s[][] = {null, null};
jmsAdmin = getJMSAdmin(tgtName);
jmsAdmin.connectToProvider();
connected = true;
s = jmsAdmin.getProviderDestinations();
if (destType == null) {
destInfoArray = listAllDestinations(s);
} else if (destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC) ||
destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE)) {
destInfoArray = listDestinationsByType(destType, s);
} else {
destInfoArray = listAllDestinations(s);
}
return (destInfoArray);
}
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "listJMSDestinations", e);
handleException(e);
} finally {
if (connected) {
try {
jmsAdmin.disconnectFromProvider();
} catch (Exception ex) {
handleException(ex);
}
}
}
return null;
|
public javax.management.ObjectName[] | listPhysicalDestinations(java.lang.String target)returns ObjectName array of all jms destinations
ObjectName[] objectNames = null;
JMSDestinationInfo[] destInfos = listJMSDestinations(null, target);
int infoLength=0;
if (destInfos != null && destInfos.length >0 )
infoLength = destInfos.length;
// Instead of null, convey the message that there are no jms destinations.
if (infoLength ==0 )
return null;
objectNames = new ObjectName[infoLength];
for(int i=0;i<infoLength;i++) {
String destName = destInfos[i].getDestinationName();
String destType = destInfos[i].getDestinationType();
try {
ObjectName objectName =
new ObjectName(getDomainName()+":"+DEST_NAME+"="+destName+","+DEST_TYPE+"="+destType);
objectNames[i]=objectName;
}catch(javax.management.MalformedObjectNameException e){
sLogger.warning(e.toString());
}
}
return objectNames;
|
public java.lang.Boolean | pingConnectionPool(java.lang.String poolName, java.lang.String tgtName)
boolean retVal = false;
final Target target;
// try
{
//FIXTHIS: Not sure why this can only be a server instance. We should be
//able to reference a server, domain, or cluster here.
//Ramakanth: Sure. Why can't they be?
final TargetType[] validTargets = new TargetType[]
{TargetType.CLUSTER, TargetType.DOMAIN,
TargetType.SERVER, TargetType.DAS};
target = TargetBuilder.INSTANCE.createTarget(validTargets,
tgtName, getConfigContext());
retVal = ConnectorRuntime.getRuntime().testConnectionPool(poolName);
}
/* catch (MBeanException me) {
throw me;
}
catch (Exception e) {
e.printStackTrace();
throw new MBeanException(e, e.getLocalizedMessage());
}
*/
return Boolean.valueOf(retVal);
|
private void | setProperties(javax.management.ObjectName objName, java.util.Properties props)
if ( props != null )
{
Enumeration keys = props.keys();
while (keys.hasMoreElements())
{
final String key = (String)keys.nextElement();
final Attribute property = new Attribute(key, props.get(key));
getMBeanServer().invoke(objName, "setProperty", new Object[]{property}, new String[]{Attribute.class.getName()});
}
}
|
private void | validateCnctorConnPoolAttrList(javax.management.AttributeList list)
String raName = getAttributeValueFromList("resource_adapter_name",list);
String connDef = getAttributeValueFromList("connection_definition_name",list);
if(isValidRAName(raName)) {
if(!isValidConnectionDefinition(connDef,raName)) {
throw new Exception(localStrings.getString(
"admin.mbeans.rmb.invalid_ra_connectdef_not_found",connDef));
}
}
|
private java.util.Properties | validateDestinationResourceProps(java.util.Properties props, java.lang.String jndiName)Validates the properties specified for a Destination Resource
and returns a validated Properties list.
NOTE: When "Name" property has not been specified by the user,
the properties object is updated with a computed Name.
sLogger.fine("ResourcesMBean: validateDest(" +
"props=" + props + " jndiName=" + jndiName + ")");
String providedDestinationName = getProvidedDestinationName(props);
sLogger.fine("provided destination name = "
+ providedDestinationName);
if (providedDestinationName != null) {
//check validity of provided JMS destination namei
if (!isSyntaxValid(providedDestinationName)) {
throw new Exception(localStrings.getString(
"admin.mbeans.rmb.destination_name_invalid",
jndiName, providedDestinationName));
}
} else {
//compute a valid destination name from the JNDI name.
String newDestName = computeDestinationName(jndiName);
sLogger.log(Level.WARNING,
"admin.mbeans.rmb.destination_name_missing",
new Object[]{jndiName, newDestName});
props.put(NAME, newDestName);
sLogger.fine("Computed destination name" + newDestName
+ " and updated props");
}
return props;
|
private void | validateJMSDestName(java.lang.String destName)
if(destName==null || destName.length() <= 0)
throw new IllegalArgumentException(localStrings.getString("admin.mbeans.rmb.invalid_jms_destname",destName));
|
private void | validateJMSDestType(java.lang.String destType)
if(destType==null || destType.length() <= 0)
throw new IllegalArgumentException(localStrings.getString("admin.mbeans.rmb.invalid_jms_desttype",destType));
if(!destType.equals(JMSAdminConstants.JMS_DEST_TYPE_QUEUE) &&
!destType.equals(JMSAdminConstants.JMS_DEST_TYPE_TOPIC))
throw new IllegalArgumentException(localStrings.getString("admin.mbeans.rmb.invalid_jms_desttype",destType));
|