Package javax.jdo

Examples of javax.jdo.JDOFatalUserException


                boolean redefined = false;
                if ("table".equals(key)) {
                    redefined = table != null;
                    table = getTable(value);
                    if (table == null) {
                        throw new JDOFatalUserException(I18N.msg("E_unknown_table", value));
                    }
                } else if (ATTR_SOURCE.equals(key)) {
                    redefined = sourceStr != null;
                    sourceStr = value;
                } else if (ATTR_TARGET.equals(key)) {
                    redefined = targetStr != null;
                    targetStr = value;
                } else if (ATTR_ORDER_BY.equals(key)) {
                    redefined = relationship.getOrderBy() != null;
                    relationship.setOrderBy(value);
                } else if (ATTR_INDEX.equals(key)) {
                    redefined = indexStr != null;
                    indexStr = value;
                } else if (ATTR_FILTER.equals(key)) {
                    // Filtered collection query
                    redefined = filterStr != null;
                    filterStr = value;
                } else if (ATTR_PARAMETERS.equals(key)) {
                    // Filtered collection query parameters
                    redefined = parametersStr != null;
                    parametersStr = value;
                } else if (ATTR_VARIABLES.equals(key)) {
                    // Filtered collection query variables
                    redefined = variablesStr != null;
                    variablesStr = value;
                } else if (ATTR_ORDERING.equals(key)) {
                    // JDO-style ordering
                    redefined = relationship.getOrdering() != null;
                    relationship.setOrdering(value);
                } else if (ATTR_IMPORTS.equals(key)) {
                    redefined = importsStr != null;
                    importsStr = value;
                }
                if (redefined) {
                    throw new JDOFatalUserException(I18N.msg("E_collection_redefinition", key, field.getName(), jdoClass.getName()));
                }
            }
        } // for each "extension" element

        if (sourceStr == null && filterStr == null) {
            if (useDefaultMapping) {
                sourceStr = "source_" + ownerClass.getName();
            } else {
                // You have to specify either a source or a filter or both.
                throw new JDOFatalUserException(I18N.msg("E_collection_no_source", field.getName(), jdoClass.getName()));
            }
        }
       
        if (table == null) {
            // The table wasn't explicitly specified.  We can safely
            // assume that if a collection is specified without an explicit
            // table, then the table is the collection element type's table.
            ClassMapping mapping = getClassMapping(elementClass);
            if ((table = mapping.getTable()) == null) {
                // Not much we can do about this.  I don't think it will ever
                // happen, but just in case...
                throw new JDOFatalUserException(I18N.msg("E_collection_no_table", field.getName(), jdoClass.getName()));
            }
            logger.fine("No table specified for collection field \"" +
                        field.getName() +
                        "\"...assuming element type table: " +
                        table.getName());
        }

        if (relationship.getOrderBy() != null &&
            relationship.getOrdering() != null) {
            // Don't even bother trying to interpret precedence
            throw new JDOFatalUserException(I18N.msg("E_collection_order_by_and_ordering"));
        }

        if (relationship.getOrdering() != null && filterStr == null) {
            throw new JDOFatalUserException(I18N.msg("E_collection_ordering_without_filter", field.getName(), jdoClass.getName()));
        }
       
        if (sourceStr != null) {
            source.setColumn(table.getColumnByName(sourceStr));
        }
View Full Code Here


    public static Object resolveJNDI(String name) {
        try {
            InitialContext initCtx = new InitialContext();
            return initCtx.lookup(name);
        } catch (Exception e) {
            throw new JDOFatalUserException("Cannot resolve JNDI name " + name, e);
        }
    }
View Full Code Here

     * be implemented by subclasses.
     */
    public abstract DatastoreDriver getDriver();

    public Table describeTable(String tableName) {
        throw new JDOFatalUserException("No driver support for runtime metadata");
    }
View Full Code Here

     * Helper method that is called by all PersistenceManager
     * interface methods.
     */
    private void assertNotClosed() {
        if (closed) {
            throw new JDOFatalUserException(I18N.msg("E_PM_closed"));
        }
    }
View Full Code Here

    public static PersistenceManagerFactory newPersistenceManagerFactory(ClassLoader loader) {
        // Uses the defaults
        InputStream stream = null;
        String xormProperties = System.getProperty(XORM_PROPERTIES);
        if (xormProperties == null) {
            throw new JDOFatalUserException(I18N.msg("E_no_sys_prop", XORM_PROPERTIES));
        }
        try {
            stream = new FileInputStream(xormProperties);
        } catch (FileNotFoundException e) {
            stream = XORM.class.getResourceAsStream(xormProperties);
            if(stream == null){
              stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(xormProperties);
            }
            if (stream == null) {
                throw new JDOFatalUserException(I18N.msg("E_no_prop_file", xormProperties));
            }
        }
        return newPersistenceManagerFactory(stream, loader);
    }
View Full Code Here

            stream = new FileInputStream(propertiesFilename);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        if (stream == null) {
            throw new JDOFatalUserException(I18N.msg("E_no_prop_file", propertiesFilename));
        }
        return newPersistenceManagerFactory(stream,loader);
    }
View Full Code Here

     * Creates a new instance managed by the given PersistenceManager and implementing
     * the interface of the given interface class.
     */
    public static Object newInstance(PersistenceManager mgr, Class mappedClass) {
        if (!(mgr instanceof InterfaceManager)) {
            throw new JDOFatalUserException(I18N.msg("E_non_xorm_pm"));
        }
        return create((InterfaceManagerFactory) mgr.getPersistenceManagerFactory(), mappedClass);
    }
View Full Code Here

     * Creates a new instance managed by the given PersistenceManager and implementing
     * the interface of the given interface class.
     */
    public static Object newInstance(PersistenceManagerFactory factory, Class mappedClass) {
        if (!(factory instanceof InterfaceManagerFactory)) {
            throw new JDOFatalUserException(I18N.msg("E_non_xorm_pmf"));
        }
        return create((InterfaceManagerFactory) factory, mappedClass);
    }
View Full Code Here

     * Returns the ModelMapping associated with the given manager's factory.
     * Throws JDOFatalUserException if it is invoked on a non-XORM manager.
     */
    public static ModelMapping getModelMapping(PersistenceManager mgr) {
        if (!(mgr instanceof InterfaceManager)) {
            throw new JDOFatalUserException(I18N.msg("E_non_xorm_pm"));
        }
        return ((InterfaceManager) mgr).getInterfaceManagerFactory().getModelMapping();
    }
View Full Code Here

     * Returns the ModelMapping associated with the given factory.
     * Throws JDOFatalUserException if it is invoked on a non-XORM factory.
     */
    public static ModelMapping getModelMapping(PersistenceManagerFactory factory) {
        if (!(factory instanceof InterfaceManagerFactory)) {
            throw new JDOFatalUserException(I18N.msg("E_non_xorm_pmf"));
        }
        return ((InterfaceManagerFactory) factory).getModelMapping();
    }
View Full Code Here

TOP

Related Classes of javax.jdo.JDOFatalUserException

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.