Examples of PBKey


Examples of org.apache.ojb.broker.PBKey

        persistor.writeToFile(repository, conRepository, fos);

        ConnectionRepository second = persistor.readConnectionRepository(filename);
        int connectionCount2 = second.getAllDescriptor().size();

        PBKey defaultKey = second.getStandardPBKeyForJcdAlias(TestHelper.DEF_JCD_ALIAS);
        assertNotNull(defaultKey);
        assertEquals(TestHelper.DEF_KEY, defaultKey);

        assertTrue(connectionCount2 > 0);
        assertEquals("read in persisted connection repository should have same number of classes",
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

            * String jcdAlias, String user, String password)
     */
    public PersistenceBrokerInternal createPersistenceBroker(String jcdAlias, String user, String password)
            throws PBFactoryException
    {
        return this.createPersistenceBroker(new PBKey(jcdAlias, user, password));
    }
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

     * @throws LookupException if pool is not in cache and cannot be created
     */
    protected DataSource getDataSource(JdbcConnectionDescriptor jcd)
            throws LookupException
    {
        final PBKey key = jcd.getPBKey();
        DataSource ds = (DataSource) dsMap.get(key);
        if (ds == null)
        {
            // Found no pool for PBKey
            try
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

    }

    public void testAutoNaming() throws Exception
    {
        String jcdAlias = "testAutoNaming";
        PBKey tempKey = new PBKey(jcdAlias, TestHelper.DEF_KEY.getUser(), TestHelper.DEF_KEY.getPassword());
        MetadataManager mm = MetadataManager.getInstance();
        PersistenceBroker broker = null;
        try
        {
            JdbcConnectionDescriptor jcd = mm.connectionRepository().getDescriptor(TestHelper.DEF_KEY);
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

    {
        ConnectionRepository cr = MetadataManager.getInstance()
                .readConnectionRepository(MetadataTest.TEST_REPOSITORY);
        MetadataManager.getInstance().mergeConnectionRepository(cr);

        PersistenceBroker pb = PersistenceBrokerFactory.createPersistenceBroker(new PBKey("runtime_2"));
        try
        {
            ObjectCache oc = pb.serviceObjectCache();
            CacheObject testObj = new CacheObject(null, "testPerDatabaseCache");
            Identity oid = new Identity(testObj, pb);
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

     * @param validKey  This could be the {@link JdbcConnectionDescriptor}
     * itself, or the associated {@link JdbcConnectionDescriptor#getPBKey PBKey}.
     */
    public void removeDescriptor(Object validKey)
    {
        PBKey pbKey;
        if (validKey instanceof PBKey)
        {
            pbKey = (PBKey) validKey;
        }
        else if (validKey instanceof JdbcConnectionDescriptor)
        {
            pbKey = ((JdbcConnectionDescriptor) validKey).getPBKey();
        }
        else
        {
            throw new MetadataException("Could not remove descriptor, given object was no vaild key: " +
                    validKey);
        }
        Object removed = null;
        synchronized (jcdMap)
        {
            removed = jcdMap.remove(pbKey);
            jcdAliasToPBKeyMap.remove(pbKey.getAlias());
        }
        log.info("Remove descriptor: " + removed);
    }
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

     */
    private PBKey buildDefaultKey()
    {
        List descriptors = connectionRepository().getAllDescriptor();
        JdbcConnectionDescriptor descriptor;
        PBKey result = null;
        for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
        {
            descriptor = (JdbcConnectionDescriptor) iterator.next();
            if (descriptor.isDefaultConnection())
            {
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

     */
    public PBKey getPBKey()
    {
        if (pbKey == null)
        {
            this.pbKey = new PBKey(this.getJcdAlias(), this.getUserName(), this.getPassWord());
        }
        return pbKey;
    }
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

    }
   
    private static void initDB() {
       
        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
        PBKey connKey = cr.getStandardPBKeyForJcdAlias( "pv" );
        PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker( connKey );
        broker.beginTransaction();
        try {
            conn = broker.serviceConnectionManager().getConnection();
        } catch (LookupException ex) {
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

  getODMGImplementation();

        // Find the connection repository info
        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
        PBKey connKey = cr.getStandardPBKeyForJcdAlias( "pv" );
        JdbcConnectionDescriptor connDesc = cr.getDescriptor( connKey );
       
        // Set up the OJB connection with parameters from photovault.properties
        if ( dbDesc.getInstanceType() == PVDatabase.TYPE_EMBEDDED ) {
            connDesc.setDriver( "org.apache.derby.jdbc.EmbeddedDriver" );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.