Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.OJBRuntimeException


                }
            }
            catch(Exception e)
            {
                log.error("Can not create ObjectCache instance using class " + ocd.getObjectCache(), e);
                throw new OJBRuntimeException(e);
            }
            caches.put(key, cache);
        }
        return cache;
    }
View Full Code Here


                {
                    col = (ManageableCollection)fieldType.newInstance();
                }
                catch (Exception e)
                {
                    throw new OJBRuntimeException("Cannot instantiate the default collection type "+fieldType.getName()+" of collection "+desc.getAttributeName()+" in type "+desc.getClassDescriptor().getClassNameOfObject());
                }
            }
            else if (fieldType.isAssignableFrom(RemovalAwareCollection.class))
            {
                col = new RemovalAwareCollection();
            }
            else if (fieldType.isAssignableFrom(RemovalAwareList.class))
            {
                col = new RemovalAwareList();
            }
            else if (fieldType.isAssignableFrom(RemovalAwareSet.class))
            {
                col = new RemovalAwareSet();
            }
            else
            {
                throw new MetadataException("Cannot determine a default collection type for collection "+desc.getAttributeName()+" in type "+desc.getClassDescriptor().getClassNameOfObject());
            }
        }
        else
        {
            try
            {
                col = (ManageableCollection)collectionClass.newInstance();
            }
            catch (Exception e)
            {
                throw new OJBRuntimeException("Cannot instantiate the collection class "+collectionClass.getName()+" of collection "+desc.getAttributeName()+" in type "+desc.getClassDescriptor().getClassNameOfObject());
            }
        }
        return col;
    }
View Full Code Here

            Configuration config = configurator.getConfigurationFor(null);
            pbfClass = config.getClass(PBF_KEY, null);
            if(pbfClass == null)
            {
                log.error("Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object");
                throw new OJBRuntimeException("Property for key '" + PBF_KEY + "' can not be found in properties file");
            }
            PersistenceBrokerFactoryIF result = (PersistenceBrokerFactoryIF) ClassHelper.newInstance(pbfClass);
            configurator.configure(result);
            log.info("PersistencebrokerFactory class instantiated: " + result);
            return result;
        }
        catch (Exception e)
        {
            if(e instanceof OJBRuntimeException)
            {
                throw (OJBRuntimeException) e;
            }
            else
            {
                throw new OJBRuntimeException("Error while instantiation of PersistenceBrokerFactory class", e);
            }
        }
    }
View Full Code Here

            case 3:
                key = new OrderedTuple(oid, broker.getPBKey().getAlias(),
                        new Integer(broker.getDescriptorRepository().hashCode()));
                break;
            default:
                throw new OJBRuntimeException("Unexpected error, 'cacheType =" + cachingKeyType + "' was not supported");
        }
        return key;
    }
View Full Code Here

            ResultSet rset = null;
            boolean isValid = false;
            if (failedValidationQuery > 100)
            {
                --failedValidationQuery;
                throw new OJBRuntimeException("Validation of connection "+conn+" using validation query '"+
                        query + "' failed more than 100 times.");
            }
            try
            {
                stmt = conn.prepareStatement(query);
View Full Code Here

            /*
            arminw:
            if no PBKey is set we throw an exception, because we don't
            know which PB (connection) should be used.
            */
            throw new OJBRuntimeException("Can't find associated PBKey. Need PBKey to obtain a valid" +
                                          "PersistenceBroker instance from intern resources.");
        }
        // first try to use the current threaded broker to avoid blocking
        broker = PersistenceBrokerThreadMapping.currentPersistenceBroker(getBrokerKey());
        // current broker not found or was closed, create a intern new one
View Full Code Here

            }
        }
        catch (SQLException e)
        {
            // should never be reached
            throw new OJBRuntimeException("Restore of connection autocommit state failed", e);
        }
    }
View Full Code Here

     * is transient and former call for the same object returns already a transient Identity, the same transient
     * Identity object will be returned.
     */
    protected Identity createTransientOrRealIdentity(ClassDescriptor cld, Object objOrProxy)
    {
        if(objOrProxy == null) throw new OJBRuntimeException("Can't create Identity for 'null'-object");
        Identity result = null;
        Class topLevelClass = null;
        Class realClass = null;
        Object[] pks = null;
        try
View Full Code Here

            this.tablename = tablename;
            this.columnNames = columnNames;
            this.values = values;
            if(values != null && columnNames.length != values.length)
            {
                throw new OJBRuntimeException("Column name array and value array have NOT same length");
            }
        }
View Full Code Here

            {
                return values[indexForColumn(columnName)];
            }
            catch(Exception e)
            {
                throw new OJBRuntimeException("Can't find value for column " + columnName
                        + (indexForColumn(columnName) < 0 ? ". Column name was not found" : ""), e);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.OJBRuntimeException

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.