Package javax.resource

Examples of javax.resource.ResourceException


      userName = this.userName;
    else {
      if (! (cxRequest instanceof ConnectionRequest)) {
          if (out != null)
              out.print("Provided ConnectionRequestInfo instance is not a JORAM object.");
        throw new ResourceException("Provided ConnectionRequestInfo instance "
                                    + "is not a JORAM object.");
      }

      userName = ((ConnectionRequest) cxRequest).getUserName();
View Full Code Here


    }
    catch (javax.jms.IllegalStateException exc) {
      throw new CommException("Connection with the JORAM server is lost.");
    }
    catch (JMSException exc) {
      throw new ResourceException("Could not set asynchronous consumer: "
                                  + exc);
    }
  }
View Full Code Here

    if (this.ra != null)
      throw new IllegalStateException("Can not change resource adapter"
                                      + " association.");

    if (! (ra instanceof JoramAdapter))
      throw new ResourceException("Provided resource adapter is not a JORAM "
                                  + "resource adapter: "
                                  + ra.getClass().getName());

    this.ra = ra;
  }
View Full Code Here

    } catch (IllegalStateException exc) {
      throw new CommException("Could not access the JORAM server: " + exc);
    } catch (JMSSecurityException exc) {
      throw new SecurityException("Invalid user identification: " + exc);
    } catch (JMSException exc) {
      throw new ResourceException("Failed connecting process: " + exc);
    }
  }
View Full Code Here

    public void begin() throws ResourceException {
        try {
            Connection con = mc.getJdbcConnection();
            con.setAutoCommit(false);
        } catch (SQLException ex) {
            ResourceException re = new EISSystemException(ex.getMessage());
            re.setLinkedException(ex);
            throw re;
        }
    }
View Full Code Here

        Connection con = null;
        try {
            con = mc.getJdbcConnection();
            con.commit();
        } catch (SQLException ex) {
            ResourceException re = new EISSystemException(ex.getMessage());
            re.setLinkedException(ex);
            throw re;
        } finally {
            try {
                con.setAutoCommit(true);
            } catch (Exception ex) {}
View Full Code Here

        Connection con = null;
        try {
            con = mc.getJdbcConnection();
            con.rollback();
        } catch (SQLException ex) {
            ResourceException re = new EISSystemException(ex.getMessage());
            re.setLinkedException(ex);
            throw re;
        } finally {
            try {
                con.setAutoCommit(true);
            } catch (Exception ex) {}
View Full Code Here

      identityClass = this.identityClass;
    } else {
      if (! (cxRequest instanceof ConnectionRequest)) {
        if (out != null)
          out.print("Provided ConnectionRequestInfo instance is not a JORAM object.");
        throw new ResourceException("Provided ConnectionRequestInfo instance "
                                    + "is not a JORAM object.");
      }

      userName = ((ConnectionRequest) cxRequest).getUserName();
      password = ((ConnectionRequest) cxRequest).getPassword();
      identityClass = ((ConnectionRequest) cxRequest).getIdentityClass();
    }

    XAConnectionFactory factory;
    XAConnection cnx = null;

    if (collocated) {
      hostName = "localhost";
      serverPort = -1;
    }

    if (isHa) {
      if (collocated) {
        if (ra.haURL != null) {
          factory = XAHATcpConnectionFactory.create(ra.haURL);
        } else {
          factory = XAHALocalConnectionFactory.create();
        }
      } else {
        String urlHa = "hajoram://" + hostName + ":" + serverPort;
        factory = XAHATcpConnectionFactory.create(urlHa);
      }
    } else {
      if (collocated) {
        factory = XALocalConnectionFactory.create();
      } else {
        factory = XATcpConnectionFactory.create(hostName, serverPort);
      }
    }

    setParameters(factory);
   
    ((AbstractConnectionFactory) factory).setIdentityClassName(identityClass);

    try {
      cnx = factory.createXAConnection(userName, password);

      if (AdapterTracing.dbgAdapter.isLoggable(BasicLevel.DEBUG))
        AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG,
                                      this + " createManagedConnection cnx = " + cnx);
    } catch (IllegalStateException exc) {
      if (out != null)
        out.print("Could not access the JORAM server: " + exc);
      throw new CommException("Could not access the JORAM server: " + exc);
    } catch (JMSSecurityException exc) {
      if (out != null)
        out.print("Invalid user identification: " + exc);
      throw new SecurityException("Invalid user identification: " + exc);
    } catch (JMSException exc) {
      if (out != null)
        out.print("Failed connecting process: " + exc);
      throw new ResourceException("Failed connecting process: " + exc);
    }

    ManagedConnectionImpl managedCx = new ManagedConnectionImpl(ra,
                                                                cnx,
                                                                hostName,
View Full Code Here

    if (cxRequest == null)
      userName = this.userName;
    else {
      if (! (cxRequest instanceof ConnectionRequest)) {
        out.print("Provided ConnectionRequestInfo instance is not a JORAM object.");
        throw new ResourceException("Provided ConnectionRequestInfo instance "
                                    + "is not a JORAM object.");
      }

      if (cxRequest instanceof QueueConnectionRequest)
        mode = "PTP";
View Full Code Here

    public String getEISProductName() throws ResourceException {
        try {
            Connection con = mc.getJdbcConnection();
            return con.getMetaData().getDatabaseProductName();
        } catch (SQLException ex) {
            ResourceException re = new EISSystemException(ex.getMessage());
            re.setLinkedException(ex);
            throw re;
        }
    }
View Full Code Here

TOP

Related Classes of javax.resource.ResourceException

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.