Package javax.resource.spi

Examples of javax.resource.spi.ConnectionRequestInfo


   
    /**
     * Client managed login
     */
    public BlasterConnection getConnection(String userName, String password) throws ResourceException{
        ConnectionRequestInfo info =
            new BlasterConnectionRequestInfo(userName, password);
        Object o = cm.allocateConnection(mcf, info);
        System.out.println(o);
        return  (BlasterConnection)o;
        //return (BlasterConnection) cm.allocateConnection(mcf, info);
View Full Code Here


    * @return <description>
    * @exception java.sql.SQLException <description>
    */
   public Connection getConnection(String user, String password) throws SQLException
   {
      ConnectionRequestInfo cri = new WrappedConnectionRequestInfo(user, password);
      try
      {
         return (Connection)cm.allocateConnection(mcf, cri);
      }
      catch (ResourceException re)
View Full Code Here

        mc.setSubject(s);
        assertEquals("got back what we set", s, mc.getSubject());
    }

    public void testGetSetConnectionRequestInfo() {
        ConnectionRequestInfo ri = new ConnectionRequestInfo() {
        };

        mc.setConnectionRequestInfo(ri);
        assertEquals("got back what we set", ri, mc.getConnectionRequestInfo());
    }
View Full Code Here

   
    public void testMatchConnectionSameConnectioRequestInfoNotBound() throws Exception {
        Subject subject = null;
        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
        ConnectionRequestInfo cri = new DummyConnectionRequestInfo();
        DummyManagedConnectionImpl con1 = new DummyManagedConnectionImpl(mcf, cri, subject);
        connectionSet.add(con1);

        ManagedConnection mcon = mcf.matchManagedConnections(connectionSet, subject, cri);
        assertEquals(con1, mcon);
View Full Code Here

  
    public void testMatchConnectionSameConnectioRequestInfoBound() throws Exception {
        Subject subject = null;
        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
        ConnectionRequestInfo cri = new DummyConnectionRequestInfo();
        DummyManagedConnectionImpl con1 = new DummyManagedConnectionImpl(mcf, cri, subject);
        con1.setBound(true);
        connectionSet.add(con1);

        ManagedConnection mcon = mcf.matchManagedConnections(connectionSet, subject, cri);
View Full Code Here

        assertEquals(con1, mcon);
    }

   
    public void testMatchConnectionDifferentConnectioRequestInfoNotBound() throws Exception {
        ConnectionRequestInfo cri1 = new DummyConnectionRequestInfo();
        ConnectionRequestInfo cri2 = new DummyConnectionRequestInfo();

        Subject subject = null;
        assertTrue("request info object are differnt", cri1 != cri2);

        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
View Full Code Here

        assertEquals("incorrect connection returned", con1, mcon);
    }

  
    public void testMatchConnectionDifferentConnectioRequestInfoBound() throws Exception {
        ConnectionRequestInfo cri1 = new DummyConnectionRequestInfo();
        ConnectionRequestInfo cri2 = new DummyConnectionRequestInfo();

        Subject subject = null;

        assertTrue("request info object are differnt", cri1 != cri2);
View Full Code Here

   
    public void testMatchConnectionInvalidatedWithSameConnectioRequestInfo() throws Exception {
        Subject subject = null;
        Set<AbstractManagedConnectionImpl> connectionSet = new HashSet<AbstractManagedConnectionImpl>();
        ConnectionRequestInfo cri = new DummyConnectionRequestInfo();

        DummyManagedConnectionImpl con1 = new DummyManagedConnectionImpl(mcf, cri, subject);
        con1.setBound(true);
        con1.setCon(connectionSet);
        connectionSet.add(con1);
View Full Code Here

    private boolean isMatch(final AbstractManagedConnectionImpl canditateConn,
                            final ConnectionRequestInfo crInfo, final Subject subject)
        throws ResourceAdapterInternalException {
        boolean result = false;
        final ConnectionRequestInfo canditate = canditateConn.getConnectionRequestInfo();

        if (canditate.equals(crInfo)) {
            LOG.fine("found match canditate=" + canditate + ", info=" + crInfo);
            LOG.fine("Checking Subjects Match " + subject + " " + canditateConn.getSubject());

            if ((subject == null)
                || (subject.equals(((AbstractManagedConnectionImpl)canditateConn).getSubject()))) {
View Full Code Here

    private boolean isMatch(final AbstractManagedConnectionImpl candidateConn,
                            final ConnectionRequestInfo crInfo, final Subject subject)
        throws ResourceAdapterInternalException {
        boolean result = false;
        final ConnectionRequestInfo candidate = candidateConn.getConnectionRequestInfo();

        if (candidate.equals(crInfo) && (subject == null || subject.equals(candidateConn.getSubject()))) {
            try {
                validateReference(candidateConn, subject);
                result = true;
            } catch (Exception thrown) {
                result = false;
View Full Code Here

TOP

Related Classes of javax.resource.spi.ConnectionRequestInfo

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.