Package org.jboss.resource

Examples of org.jboss.resource.JBossResourceException


             xaConnection.close();
       }
       catch (Throwable ignored)
       {
       }
       throw new JBossResourceException("Could not create connection", e);
    }
  }
View Full Code Here


       return xada.xads;
    }
      if (xads == null)
      {
         if (xaDataSourceClass == null)
            throw new JBossResourceException("No XADataSourceClass supplied!");
         try
         {
            Class clazz = Thread.currentThread().getContextClassLoader().loadClass(xaDataSourceClass);
            xads = (XADataSource) clazz.newInstance();
            Class[] NOCLASSES = new Class[] {};
            for (Iterator i = xaProps.keySet().iterator(); i.hasNext();)
            {
               String name = (String) i.next();
               String value = xaProps.getProperty(name);     
               char firstCharName = Character.toUpperCase(name.charAt(0));
                if (name.length() > 1)
                     name = firstCharName+name.substring(1);
                else
                   name = ""+firstCharName;                                                                                                  
               //This is a bad solution.  On the other hand the only known example
               // of a setter with no getter is for Oracle with password.
               //Anyway, each xadatasource implementation should get its
               //own subclass of this that explicitly sets the
               //properties individually.
               Class type = null;
               try
               {
                  Method getter = clazz.getMethod("get" + name, NOCLASSES);
                  type = getter.getReturnType();
               }
               catch (NoSuchMethodException e)
               {
                  type = String.class;
               }

               Method setter = clazz.getMethod("set" + name, new Class[] { type });
               PropertyEditor editor = PropertyEditorManager.findEditor(type);
               if (editor == null)
                  throw new JBossResourceException("No property editor found for type: " + type);
               editor.setAsText(value);
               setter.invoke(xads, new Object[] { editor.getValue() });
            }
         }
         catch (ClassNotFoundException cnfe)
         {
            throw new JBossResourceException("Class not found for XADataSource " + xaDataSourceClass, cnfe);
         }
         catch (InstantiationException ie)
         {
            throw new JBossResourceException("Could not create an XADataSource: ", ie);
         }
         catch (IllegalAccessException iae)
         {
            throw new JBossResourceException("Could not set a property: ", iae);
         }
         catch (IllegalArgumentException iae)
         {
            throw new JBossResourceException("Could not set a property: ", iae);
         }
         catch (InvocationTargetException ite)
         {
            throw new JBossResourceException("Could not invoke setter on XADataSource: ", ite);
         }
         catch (NoSuchMethodException nsme)
         {
            throw new JBossResourceException("Could not find accessor on XADataSource: ", nsme);
         }
      }
      return xads;
   }
View Full Code Here

      if (mc.getSession().getTransacted())
        mc.getSession().commit();
    }
    catch (JMSException e)
    {
      throw new JBossResourceException("Could not commit LocalTransaction", e);
    }
    finally
    {
       mc.unlock();
    }
View Full Code Here

      if (mc.getSession().getTransacted())
        mc.getSession().rollback();
    }
    catch (JMSException ex)
    {
      throw new JBossResourceException("Could not rollback LocalTransaction", ex);
    }
    finally
    {
       mc.unlock();
    }
View Full Code Here

/* 54 */       if (this.mc.getSession().getTransacted())
/* 55 */         this.mc.getSession().commit();
/*    */     }
/*    */     catch (JMSException e)
/*    */     {
/* 59 */       throw new JBossResourceException("Could not commit LocalTransaction", e);
/*    */     }
/*    */   }
View Full Code Here

/* 67 */       if (this.mc.getSession().getTransacted())
/* 68 */         this.mc.getSession().rollback();
/*    */     }
/*    */     catch (JMSException ex)
/*    */     {
/* 72 */       throw new JBossResourceException("Could not rollback LocalTransaction", ex);
/*    */     }
/*    */   }
View Full Code Here

/* 162 */     return new WrapperDataSource(this, cm);
/*     */   }
/*     */
/*     */   public Object createConnectionFactory() throws ResourceException
/*     */   {
/* 167 */     throw new JBossResourceException("Resource Adapter does not currently support running in a non-managed environment.");
/*     */   }
View Full Code Here

/*     */
/*     */   protected Properties getConnectionProperties(Subject subject, ConnectionRequestInfo cri)
/*     */     throws ResourceException
/*     */   {
/* 473 */     if ((cri != null) && (cri.getClass() != WrappedConnectionRequestInfo.class)) {
/* 474 */       throw new JBossResourceException("Wrong kind of ConnectionRequestInfo: " + cri.getClass());
/*     */     }
/* 476 */     Properties props = new Properties();
/* 477 */     props.putAll(this.connectionProps);
/* 478 */     if (subject != null)
/*     */     {
/* 480 */       if (SubjectActions.addMatchingProperties(subject, props, this) == true)
/* 481 */         return props;
/* 482 */       throw new JBossResourceException("No matching credentials in Subject!");
/*     */     }
/* 484 */     WrappedConnectionRequestInfo lcri = (WrappedConnectionRequestInfo)cri;
/* 485 */     if (lcri != null)
/*     */     {
/* 487 */       props.setProperty("user", lcri.getUserName() == null ? "" : lcri.getUserName());
View Full Code Here

/*      */     }
/*      */     catch (Throwable t)
/*      */     {
/*  377 */       if (this.trace)
/*  378 */         this.log.trace("Could not enlist in transaction on entering meta-aware object! " + cl, t);
/*  379 */       throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
/*      */     }
/*      */   }
View Full Code Here

/*  441 */           if (!xaResource.setTransactionTimeout(this.xaResourceTimeout))
/*  442 */             this.log.debug("XAResource does not support transaction timeout configuration: " + getJndiName());
/*      */         }
/*      */         catch (XAException e)
/*      */         {
/*  446 */           throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
/*      */         }
/*      */       }
/*      */     }
/*      */
/*  451 */     ConnectionListener cli = new TxConnectionEventListener(mc, this.poolingStrategy, context, this.log, xaResource);
View Full Code Here

TOP

Related Classes of org.jboss.resource.JBossResourceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.