Examples of PBKey


Examples of org.apache.ojb.broker.PBKey

        }
        utils.fillJCDFromDataSource(jcd, dataSource, username, password);
        if ("default".equals(jcdAlias))
        {
            jcd.setDefaultConnection(true);
            MetadataManager.getInstance().setDefaultPBKey(new PBKey(jcd.getJcdAlias(), jcd.getUserName(), jcd.getPassWord()));
        }
        addDescriptor(jcd);
        return jcd;
    }
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

    {
      m_log.info("No enviroment entry was found, use default repository");
      ojbRepository = "repository.xml";
    }
    m_log.info("Use OJB repository file: " + ojbRepository);
    m_pbKey = new PBKey(ojbRepository);

    // Lookup the PBF implementation
    try
    {
      context = new InitialContext();
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

        for (Iterator iterator = descriptors.iterator(); iterator.hasNext();)
        {
            descriptor = (JdbcConnectionDescriptor) iterator.next();
            if (descriptor.isDefaultConnection())
            {
                return new PBKey(descriptor.getJcdAlias(), descriptor.getUserName(), descriptor.getPassWord());
            }
        }
        log.info("No 'default-connection' attribute set in jdbc-connection-descriptors," +
                " thus it's currently not possible to use 'defaultPersistenceBroker()' " +
                " convenience method to lookup PersistenceBroker instances. But it's possible"+
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

            * String jcdAlias, String user, String password)
     */
    public PersistenceBroker 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

        }
        if(user != null && passwd == null)
        {
            passwd = "";
        }
        PBKey key = new PBKey(dbName, user, passwd);
        return key;
    }
View Full Code Here

Examples of org.apache.ojb.broker.PBKey

     */
    public static PBKey crossCheckPBKey(PBKey key)
    {
        if(key.getUser() == null)
        {
            PBKey defKey = MetadataManager.getInstance().connectionRepository().getStandardPBKeyForJcdAlias(key.getAlias());
            if(defKey != null)
            {
                return defKey;
            }
        }
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

     * @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

        String connectionAttribute_1 = "attribute-connection-1";
        String connectionAttribute_2 = "attribute-connection-2";

        MetadataManager mm = MetadataManager.getInstance();
        ConnectionRepository cr = mm.readConnectionRepository(MetadataTest.TEST_CONNECTION_DESCRIPTOR);
        JdbcConnectionDescriptor jcd = cr.getDescriptor(new PBKey("runtime"));
        String res_1 = jcd.getAttribute(connectionAttribute_1);
        String res_2 = jcd.getAttribute(connectionAttribute_2);
        assertNotNull("No attributes found", res_1);
        assertNotNull("No attributes found", res_2);
        assertEquals("Found attribute does not match", "attribute-connection-test-value-1", res_1);
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.