本文整理汇总了Java中javax.resource.spi.ResourceAdapterAssociation类的典型用法代码示例。如果您正苦于以下问题:Java ResourceAdapterAssociation类的具体用法?Java ResourceAdapterAssociation怎么用?Java ResourceAdapterAssociation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceAdapterAssociation类属于javax.resource.spi包,在下文中一共展示了ResourceAdapterAssociation类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import javax.resource.spi.ResourceAdapterAssociation; //导入依赖的package包/类
/**
* Validate
* @param vo The validate object
* @param rb The resource bundle
* @return The list of failures found; <code>null</code> if none
*/
@SuppressWarnings("unchecked")
public List<Failure> validate(Validate vo, ResourceBundle rb)
{
if (vo != null &&
Key.ADMIN_OBJECT == vo.getKey() &&
vo.getClazz() != null &&
ResourceAdapterAssociation.class.isAssignableFrom(vo.getClazz()))
{
if (!Referenceable.class.isAssignableFrom(vo.getClazz()) ||
!Serializable.class.isAssignableFrom(vo.getClazz()))
{
List<Failure> failures = new ArrayList<Failure>(1);
Failure failure = new Failure(Severity.ERROR,
SECTION,
rb.getString("ao.AORAA"),
vo.getClazz().getName());
failures.add(failure);
return failures;
}
}
return null;
}
示例2: associateResourceAdapter
import javax.resource.spi.ResourceAdapterAssociation; //导入依赖的package包/类
/**
* Associate resource adapter with the object if it implements ResourceAdapterAssociation
* @param resourceAdapter The resource adapter
* @param object The possible association object
* @throws DeployException Thrown if the resource adapter cant be associated
*/
@SuppressWarnings("unchecked")
protected void associateResourceAdapter(javax.resource.spi.ResourceAdapter resourceAdapter, Object object)
throws DeployException
{
if (resourceAdapter != null && object != null && object instanceof ResourceAdapterAssociation)
{
try
{
ResourceAdapterAssociation raa = (ResourceAdapterAssociation)object;
raa.setResourceAdapter(resourceAdapter);
}
catch (Throwable t)
{
throw new DeployException(bundle.unableToAssociate(object.getClass().getName()), t);
}
}
}
示例3: activate
import javax.resource.spi.ResourceAdapterAssociation; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public boolean activate() throws Exception
{
if (!activated)
{
if (adminObject instanceof ResourceAdapterAssociation)
{
if (!(adminObject instanceof Serializable &&
adminObject instanceof javax.resource.Referenceable))
{
throw new Exception("TODO");
}
}
else
{
if (!(adminObject instanceof javax.naming.Referenceable))
{
DelegatorInvocationHandler dih = new DelegatorInvocationHandler(adminObject);
List<Class<?>> interfaces = new ArrayList<Class<?>>();
Class<?> clz = adminObject.getClass();
while (!clz.equals(Object.class))
{
Class<?>[] is = clz.getInterfaces();
if (is != null)
{
for (Class<?> interfaceClass : is)
{
if (!interfaceClass.equals(javax.resource.Referenceable.class) &&
!interfaceClass.equals(ResourceAdapterAssociation.class) &&
!interfaceClass.equals(java.io.Serializable.class) &&
!interfaceClass.equals(java.io.Externalizable.class))
{
if (!interfaces.contains(interfaceClass))
interfaces.add(interfaceClass);
}
}
}
clz = clz.getSuperclass();
}
interfaces.add(java.io.Serializable.class);
interfaces.add(javax.resource.Referenceable.class);
jndiObject = Proxy.newProxyInstance(SecurityActions.getClassLoader(adminObject.getClass()),
interfaces.toArray(new Class<?>[interfaces.size()]),
dih);
}
}
if (jndiObject != null)
{
jndiStrategy.bind(jndiName, jndiObject);
}
else
{
jndiStrategy.bind(jndiName, adminObject);
}
activated = true;
return true;
}
return false;
}