本文整理汇总了Java中javax.resource.Referenceable类的典型用法代码示例。如果您正苦于以下问题:Java Referenceable类的具体用法?Java Referenceable怎么用?Java Referenceable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Referenceable类属于javax.resource包,在下文中一共展示了Referenceable类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import javax.resource.Referenceable; //导入依赖的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: validate
import javax.resource.Referenceable; //导入依赖的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.CONNECTION_FACTORY == vo.getKey())
{
if (vo.getClazz() != null && !Referenceable.class.isAssignableFrom(vo.getClazz()))
{
List<Failure> failures = new ArrayList<Failure>(1);
Failure failure = new Failure(Severity.ERROR,
SECTION,
rb.getString("cf.CFReferenceable"),
vo.getClazz().getName());
failures.add(failure);
return failures;
}
}
return null;
}
示例3: bind
import javax.resource.Referenceable; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void bind(String jndiName, Object o) throws NamingException
{
if (jndiName == null)
throw new NamingException();
if (o == null)
throw new NamingException();
Context context = createContext();
try
{
String className = o.getClass().getName();
if (trace)
log.trace("Binding " + className + " under " + jndiName);
Reference ref = new Reference(className,
new StringRefAddr("class", className),
JNPStrategy.class.getName(),
null);
ref.add(new StringRefAddr("name", jndiName));
if (objs.putIfAbsent(qualifiedName(jndiName, className), o) != null)
{
throw new NamingException(bundle.deploymentFailedSinceJndiNameHasDeployed(className, jndiName));
}
if (o instanceof Referenceable)
{
Referenceable referenceable = (Referenceable)o;
referenceable.setReference(ref);
}
Util.bind(context, jndiName, o);
if (log.isDebugEnabled())
log.debug("Bound " + className + " under " + jndiName);
}
finally
{
if (context != null)
{
try
{
context.close();
}
catch (NamingException ne)
{
// Ignore
}
}
}
}