Package javax.resource.spi

Examples of javax.resource.spi.ManagedConnectionFactory


    public void testCreatesVanillaConnectionFactoryIfNoConnectionManagerHasBeenConfigured() throws Exception {
       
        final Object CONNECTION_FACTORY = new Object();
       
        MockControl mockManagedConnectionFactory = MockControl.createControl(ManagedConnectionFactory.class);
        ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory) mockManagedConnectionFactory.getMock();

        managedConnectionFactory.createConnectionFactory();
        mockManagedConnectionFactory.setReturnValue(CONNECTION_FACTORY);
        mockManagedConnectionFactory.replay();

        LocalConnectionFactoryBean factory = new LocalConnectionFactoryBean();
        factory.setManagedConnectionFactory(managedConnectionFactory);
View Full Code Here


        mockManagedConnectionFactory.verify();
    }

    public void testCreatesManagedConnectionFactoryIfAConnectionManagerHasBeenConfigured() throws Exception {
        MockControl mockManagedConnectionFactory = MockControl.createControl(ManagedConnectionFactory.class);
        ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory) mockManagedConnectionFactory.getMock();

        MockControl mockConnectionManager = MockControl.createControl(ConnectionManager.class);
        ConnectionManager connectionManager = (ConnectionManager) mockConnectionManager.getMock();

        managedConnectionFactory.createConnectionFactory(connectionManager);
        mockManagedConnectionFactory.setReturnValue(null);

        mockConnectionManager.replay();
        mockManagedConnectionFactory.replay();
View Full Code Here

        ConnectionManagerFactoryBean factory = new ConnectionManagerFactoryBean();
        factory.setTransactionManager(tm);
        factory.setTransaction("xa");
        factory.afterPropertiesSet();
        ConnectionManager cm = (ConnectionManager) factory.getObject();
        ManagedConnectionFactory mcf = new DerbyDataSourceMCF("target/testdb");
        dataSource = (DataSource) mcf.createConnectionFactory(cm);

        JdbcStoreFactory storeFactory = new JdbcStoreFactory();
        storeFactory.setDataSource(dataSource);
        storeFactory.setTransactional(true);
        store = storeFactory.open("store");
View Full Code Here

public class PasswordCredentialLoginModuleWrapper extends LoginModuleGBean {
    public static final String MANAGED_CONNECTION_FACTORY_OPTION = "geronimo.managedconnectionfactory.option";

    public PasswordCredentialLoginModuleWrapper(String loginModuleClass, String objectName, boolean serverSide, boolean wrapPrincipals, ManagedConnectionFactoryWrapper managedConnectionFactoryWrapper, ClassLoader classLoader) {
        super(loginModuleClass, objectName, serverSide, wrapPrincipals, classLoader);
        ManagedConnectionFactory managedConnectionFactory = managedConnectionFactoryWrapper.$getManagedConnectionFactory();
        Properties options = getOptions();
        options.put(MANAGED_CONNECTION_FACTORY_OPTION, managedConnectionFactory);
    }
View Full Code Here

                throw new ResourceException("ManagedConnection pool has been destroyed");
            }
            try {
                if (!pool.isEmpty()) {
                    ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
                    ManagedConnectionFactory managedConnectionFactory = mci.getManagedConnectionFactory();
                    ManagedConnection matchedMC =
                            managedConnectionFactory
                            .matchManagedConnections(pool.keySet(),
                                    mci.getSubject(),
                                    mci.getConnectionRequestInfo());
                    if (matchedMC != null) {
                        connectionInfo.setManagedConnectionInfo((ManagedConnectionInfo) pool.get(matchedMC));
View Full Code Here

public class PasswordCredentialLoginModuleWrapper extends LoginModuleGBean {
    public static final String MANAGED_CONNECTION_FACTORY_OPTION = "geronimo.managedconnectionfactory.option";

    public PasswordCredentialLoginModuleWrapper(String loginModuleClass, String objectName, boolean serverSide, boolean wrapPrincipals, ManagedConnectionFactoryWrapper managedConnectionFactoryWrapper, ClassLoader classLoader) {
        super(loginModuleClass, objectName, serverSide, wrapPrincipals, classLoader);
        ManagedConnectionFactory managedConnectionFactory = managedConnectionFactoryWrapper.$getManagedConnectionFactory();
        Properties options = getOptions();
        options.put(MANAGED_CONNECTION_FACTORY_OPTION, managedConnectionFactory);
    }
View Full Code Here

                throw new ResourceException("ManagedConnection pool has been destroyed");
            }
            try {
                if (!pool.isEmpty()) {
                    ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
                    ManagedConnectionFactory managedConnectionFactory = mci.getManagedConnectionFactory();
                    ManagedConnection matchedMC =
                            managedConnectionFactory
                            .matchManagedConnections(pool.keySet(),
                                    mci.getSubject(),
                                    mci.getConnectionRequestInfo());
                    if (matchedMC != null) {
                        connectionInfo.setManagedConnectionInfo((ManagedConnectionInfo) pool.get(matchedMC));
View Full Code Here

        ConnectionManagerFactoryBean factory = new ConnectionManagerFactoryBean();
        factory.setTransactionManager(tm);
        factory.setTransaction("xa");
        factory.afterPropertiesSet();
        ConnectionManager cm = (ConnectionManager) factory.getObject();
        ManagedConnectionFactory mcf = new DerbyDataSourceMCF("target/testdb");
        dataSource = (DataSource) mcf.createConnectionFactory(cm);
       
        connection = dataSource.getConnection();
       
        JdbcStoreFactory storeFactory = new JdbcStoreFactory();
        storeFactory.setDataSource(dataSource);
View Full Code Here

                        // ignored. Not at XA_TRANSACTION level
                      }
        }     

    } else {
                    ManagedConnectionFactory mcf =
                       crt.obtainManagedConnectionFactory(poolName);
                    PasswordCredential pc = new PasswordCredential(
                       dbUser, dbPassword.toCharArray());
                    pc.setManagedConnectionFactory(mcf);
                    Principal prin = new ResourcePrincipal(dbUser, dbPassword);
                    subject.getPrincipals().add(prin);
                    subject.getPrivateCredentials().add(pc);
        ManagedConnection mc = mcf.createManagedConnection(subject, null)
                    connList.addElement(mc);
                    try {
                        XAResource xares = mc.getXAResource();
                        if (xares != null) {
                         xaresList.addElement(xares);
View Full Code Here

        if ( userPassword[0] != null && ! "".equals(userPassword[0].trim()) ) {
            return userPassword;
        }
       
        //else read the default username and password from the ra.xml
        ManagedConnectionFactory mcf =
                connectorRegistry.getManagedConnectionFactory( poolName );
        userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF(
                "UserName", poolName, mcf);
        userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF(
                "Password", poolName, mcf);
View Full Code Here

TOP

Related Classes of javax.resource.spi.ManagedConnectionFactory

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.