Methods Summary |
---|
public java.lang.Object | createConnectionFactory()
return mcf.createConnectionFactory();
|
public java.lang.Object | createConnectionFactory(javax.resource.spi.ConnectionManager cxManager)
return mcf.createConnectionFactory(cxManager);
|
public javax.resource.spi.ManagedConnection | createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
return mcf.createManagedConnection(subject, cxRequestInfo);
|
public boolean | equals(java.lang.Object other)
return mcf.equals(other);
|
public java.lang.String | getAuthenticationMechanismType()
return authenticationMechanismType;
|
public java.lang.String | getConnectionDefinition()
return connectionDefinition;
|
public java.lang.String | getConnectionFactoryImplClass()
return connectionFactoryImplClass;
|
public java.lang.String | getConnectionFactoryInterface()
return connectionFactoryInterface;
|
public java.lang.String | getConnectionImplClass()
return connectionImplClass;
|
public java.lang.String | getConnectionInterface()
return connectionInterface;
|
public java.lang.String | getCredentialInterface()
return credentialInterface;
|
public java.lang.String | getEisType()
return eisType;
|
public java.io.PrintWriter | getLogWriter()
return mcf.getLogWriter();
|
public java.lang.Object | getManagedConnectionFactoryAttribute(java.lang.String name)
if (name == null || name.length() == 0)
throw new IllegalArgumentException("Null or empty attribute name " + name);
String getterName = "get" + Character.toUpperCase(name.charAt(0));
if (name.length() > 1)
getterName = getterName.concat(name.substring(1));
Method getter;
try
{
getter = mcfClass.getMethod(getterName, new Class[] {});
}
catch (NoSuchMethodException e)
{
String msg = "The class '" + mcfClass + "' has no getter("
+ getterName + ") for config property '" + name + "'";
log.debug(msg, e);
throw new IllegalArgumentException(msg);
}
try
{
Object value = getter.invoke(mcf, new Object[]{});
log.debug("get property " + name + ": value " + value);
return value;
}
catch (Exception e)
{
String error = "Unable to invoke getter method '" + getter + "' " + "on object '" + mcf + "'";
log.debug(error, e);
if (e instanceof InvocationTargetException)
throw new NestedRuntimeException(error, ((InvocationTargetException) e).getCause());
else
throw new NestedRuntimeException(error, e);
}
|
public java.lang.String | getManagedConnectionFactoryClass()
return managedConnectionFactoryClass;
|
public org.w3c.dom.Element | getManagedConnectionFactoryProperties()
return managedConnectionFactoryProperties;
|
public javax.resource.spi.ManagedConnectionFactory | getMcfInstance()
return mcf;
|
public javax.management.ObjectName | getOldRarDeployment()
return oldRarDeployment;
|
public java.lang.String | getRARName()
return rarName;
|
public java.lang.String | getSpecVersion()
return specVersion;
|
public java.lang.String | getTransactionSupport()
return transactionSupport;
|
public java.lang.String | getVendorName()
return vendorName;
|
public java.lang.String | getVersion()
return version;
|
public int | hashCode()
return mcf.hashCode();
|
public boolean | isReauthenticationSupport()
return reauthenticationSupport;
|
public javax.resource.spi.ManagedConnection | matchManagedConnections(java.util.Set connectionSet, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
return mcf.matchManagedConnections(connectionSet, subject, cxRequestInfo);
|
public void | setAuthenticationMechanismType(java.lang.String authenticationMechanismType)
this.authenticationMechanismType = authenticationMechanismType;
|
public void | setConnectionDefinition(java.lang.String connectionDefinition)
this.connectionDefinition = connectionDefinition;
|
public void | setConnectionFactoryImplClass(java.lang.String connectionFactoryImplClass)
this.connectionFactoryImplClass = connectionFactoryImplClass;
|
public void | setConnectionFactoryInterface(java.lang.String connectionFactoryInterface)
this.connectionFactoryInterface = connectionFactoryInterface;
|
public void | setConnectionImplClass(java.lang.String connectionImplClass)
this.connectionImplClass = connectionImplClass;
|
public void | setConnectionInterface(java.lang.String connectionInterface)
this.connectionInterface = connectionInterface;
|
public void | setCredentialInterface(java.lang.String credentialInterface)
this.credentialInterface = credentialInterface;
|
public void | setEisType(java.lang.String eisType)
this.eisType = eisType;
|
public void | setLogWriter(java.io.PrintWriter out)
mcf.setLogWriter(out);
|
public void | setManagedConnectionFactoryAttribute(java.lang.String name, java.lang.Class clazz, java.lang.Object value)
setManagedConnectionFactoryAttribute(name, clazz, value, false);
|
protected void | setManagedConnectionFactoryAttribute(java.lang.String name, java.lang.Class clazz, java.lang.Object value, boolean mustExist)
if (name == null || name.length() == 0)
throw new IllegalArgumentException("Null or empty attribute name " + name);
String setterName = "set" + Character.toUpperCase(name.charAt(0));
if (name.length() > 1)
setterName = setterName.concat(name.substring(1));
Method setter;
try
{
setter = mcfClass.getMethod(setterName, new Class[] {clazz});
}
catch (NoSuchMethodException nsme)
{
String error = "The class '" + mcfClass.toString() + "' has no setter for config property '" + name + "'";
if (mustExist)
throw new IllegalArgumentException(error);
else
{
log.trace(error, nsme);
return;
}
}
try
{
setter.invoke(mcf, new Object[] {value});
log.debug("set property " + name + " to value " + value);
}
catch (Exception e)
{
String error = "Unable to invoke setter method '" + setter + "' " + "on object '" + mcf + "'";
if (e instanceof InvocationTargetException)
throw new NestedRuntimeException(error, ((InvocationTargetException) e).getCause());
else
throw new NestedRuntimeException(error, e);
}
sendNotification(new Notification(MCF_ATTRIBUTE_CHANGED_NOTIFICATION, getServiceName(),
getNextNotificationSequenceNumber()));
|
public void | setManagedConnectionFactoryClass(java.lang.String managedConnectionFactoryClass)
this.managedConnectionFactoryClass = managedConnectionFactoryClass;
|
public void | setManagedConnectionFactoryProperties(org.w3c.dom.Element managedConnectionFactoryProperties)
this.managedConnectionFactoryProperties = managedConnectionFactoryProperties;
|
protected void | setMcfProperties(java.util.Collection properties, boolean mustExist)
for (Iterator i = properties.iterator(); i.hasNext();)
{
ConfigPropertyMetaData cpmd = (ConfigPropertyMetaData) i.next();
String name = cpmd.getName();
String type = cpmd.getType();
String value = cpmd.getValue();
if (name == null || name.length() == 0 || value == null || value.length() == 0)
{
log.debug("Not setting config property '" + name + "'");
continue;
}
// see if it is a primitive type first
Class clazz = Classes.getPrimitiveTypeForName(type);
if (clazz == null)
{
//not primitive, look for it.
try
{
clazz = Thread.currentThread().getContextClassLoader().loadClass(type);
}
catch (ClassNotFoundException cnfe)
{
log.warn("Unable to find class '" + type + "' for " + "property '" + name + "' - skipping property.");
continue;
}
}
PropertyEditor pe = PropertyEditorManager.findEditor(clazz);
if (pe == null)
{
log.warn("Unable to find a PropertyEditor for class '" + clazz + "' of property '" + name + "' - "
+ "skipping property");
continue;
}
log.debug("setting property: " + name + " to value " + value);
try
{
pe.setAsText(value);
}
catch (IllegalArgumentException iae)
{
log.warn("Value '" + value + "' is not valid for property '" + name + "' of class '" + clazz
+ "' - skipping " + "property");
continue;
}
Object v = pe.getValue();
setManagedConnectionFactoryAttribute(name, clazz, v, mustExist);
}
|
protected void | setMcfProperties(org.w3c.dom.Element mcfProps)
if (mcfProps == null)
return;
// the properties that the deployment descriptor says we need to set
NodeList props = mcfProps.getChildNodes();
for (int i = 0; i < props.getLength(); i++)
{
if (props.item(i).getNodeType() == Node.ELEMENT_NODE)
{
Element prop = (Element) props.item(i);
if (prop.getTagName().equals("config-property"))
{
String name = null;
String type = null;
String value = null;
//Support for more friendly config style
//<config-property name="" type=""></config-property>
if (prop.hasAttribute("name"))
{
name = prop.getAttribute("name");
type = prop.getAttribute("type");
value = MetaData.getElementContent(prop, null, false);
}
else
{
name = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-name"));
type = MetaData.getElementContent(MetaData.getUniqueChild(prop, "config-property-type"));
value = MetaData.getElementContent(MetaData.getOptionalChild(prop, "config-property-value"), null, false);
}
if (name == null || name.length() == 0 || value == null || value.length() == 0)
{
log.debug("Not setting config property '" + name + "'");
continue;
}
if (type == null || type.length() == 0)
{
// Default to String for convenience.
type = "java.lang.String";
}
// see if it is a primitive type first
Class clazz = Classes.getPrimitiveTypeForName(type);
if (clazz == null)
{
//not primitive, look for it.
try
{
clazz = Thread.currentThread().getContextClassLoader().loadClass(type);
}
catch (ClassNotFoundException cnfe)
{
log.warn("Unable to find class '" + type + "' for " + "property '" + name
+ "' - skipping property.");
continue;
}
}
PropertyEditor pe = PropertyEditorManager.findEditor(clazz);
if (pe == null)
{
log.warn("Unable to find a PropertyEditor for class '" + clazz + "' of property '" + name + "' - "
+ "skipping property");
continue;
}
log.debug("setting property: " + name + " to value " + value);
try
{
pe.setAsText(value);
}
catch (IllegalArgumentException iae)
{
log.warn("Value '" + value + "' is not valid for property '" + name + "' of class '" + clazz
+ "' - skipping " + "property");
continue;
}
Object v = pe.getValue();
setManagedConnectionFactoryAttribute(name, clazz, v);
}
}
}
|
public void | setOldRarDeployment(javax.management.ObjectName oldRarDeployment)
this.oldRarDeployment = oldRarDeployment;
|
public void | setRARName(java.lang.String rarName)
this.rarName = rarName;
|
public void | setReauthenticationSupport(boolean reauthenticationSupport)
this.reauthenticationSupport = reauthenticationSupport;
|
public void | setSpecVersion(java.lang.String specVersion)
this.specVersion = specVersion;
|
public void | setTransactionSupport(java.lang.String transactionSupport)
this.transactionSupport = transactionSupport;
|
public void | setVendorName(java.lang.String vendorName)
this.vendorName = vendorName;
|
public void | setVersion(java.lang.String version)
this.version = version;
|
protected void | startService()
if (mcf != null)
throw new DeploymentException("Stop the RARDeployment before restarting it");
ConnectorMetaData cmd = null;
ConnectionDefinitionMetaData cdmd = null;
ResourceAdapter resourceAdapter = null;
if (oldRarDeployment != null)
{
try
{
resourceAdapter = (ResourceAdapter) getServer().getAttribute(oldRarDeployment, "ResourceAdapter");
cmd = (ConnectorMetaData) getServer().getAttribute(oldRarDeployment, "MetaData");
cdmd = cmd.getConnectionDefinition(connectionDefinition);
if (cdmd == null)
throw new DeploymentException("ConnectionDefinition '" + connectionDefinition + "' not found in rar '" + rarName + "'");
setManagedConnectionFactoryClass(cdmd.getManagedConnectionFactoryClass());
setReauthenticationSupport(cmd.getReauthenticationSupport());
}
catch (Exception e)
{
throw new DeploymentException("couldn't get oldRarDeployment! " + oldRarDeployment, e);
}
}
try
{
mcfClass = Thread.currentThread().getContextClassLoader().loadClass(managedConnectionFactoryClass);
}
catch (ClassNotFoundException cnfe)
{
log.error("Could not find ManagedConnectionFactory class: " + managedConnectionFactoryClass, cnfe);
throw new DeploymentException("Could not find ManagedConnectionFactory class: "
+ managedConnectionFactoryClass);
}
try
{
mcf = (ManagedConnectionFactory) mcfClass.newInstance();
}
catch (Exception e)
{
log.error("Could not instantiate ManagedConnectionFactory: " + managedConnectionFactoryClass, e);
throw new DeploymentException("Could not instantiate ManagedConnectionFactory: "
+ managedConnectionFactoryClass);
}
if (cmd != null)
{
// Set the resource adapter properties
setMcfProperties(cmd.getProperties(), false);
// Set the connection definition properties
setMcfProperties(cdmd.getProperties(), true);
}
//set overridden properties;
setMcfProperties(managedConnectionFactoryProperties);
if (resourceAdapter != null && mcf instanceof ResourceAdapterAssociation)
{
ResourceAdapterAssociation raa = (ResourceAdapterAssociation) mcf;
raa.setResourceAdapter(resourceAdapter);
}
|
protected void | stopService()
mcf = null;
mcfClass = null;
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append(getClass().getName());
buffer.append('@");
buffer.append(Integer.toHexString(System.identityHashCode(this)));
return buffer.toString();
|