当前位置: 首页>>代码示例>>Java>>正文


Java Referenceable类代码示例

本文整理汇总了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;
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:32,代码来源:AORAA.java

示例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;
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:28,代码来源:CFReferenceable.java

示例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
         }
      }
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:57,代码来源:JNPStrategy.java


注:本文中的javax.resource.Referenceable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。