Package org.jpox.exceptions

Examples of org.jpox.exceptions.JPOXException


                return;
            }

            if (sco.getOwner() != null)
            {
                throw new JPOXException(LOCALISER.msg("CollectionMapping.WrongOwnerError")).setFatal();
            }
        }

        if (!fmd.isCascadeUpdate())
        {
View Full Code Here


                return;
            }

            if (sco.getOwner() != null)
            {
                throw new JPOXException("Owned second-class object was somehow assigned to a field other than its owner's").setFatal();
            }
        }

        if (!fmd.isCascadeUpdate())
        {
View Full Code Here

                    }

                    int[] dirtyFieldNumbers = getFlagsSetTo(dirtyFields, true);
                    if (dirtyFieldNumbers == null)
                    {
                        throw new JPOXException(LOCALISER.msg("026010")).setFatal();
                    }
                    if (!isEmbedded())
                    {
                        getStoreManager().getPersistenceHandler().updateObject(this, dirtyFieldNumbers);
View Full Code Here

    {
        if (url == null)
        {
            String msg = LOCALISER.msg("044031");
            JPOXLogger.METADATA.error(msg);
            throw new JPOXException(msg);
        }

        InputStream in = null;
        try
        {
            in = url.openStream();
        }
        catch (Exception ignore)
        {
        }
        if (in == null)
        {
            try
            {
                in = new FileInputStream(StringUtils.getFileForFilename(url.getFile()));
            }
            catch (Exception ignore)
            {
            }
        }
        if (in == null)
        {
            JPOXLogger.METADATA.error(LOCALISER.msg("044032", url.toString()));
            throw new JPOXException(LOCALISER.msg("044032", url.toString()));
        }

        // Parse the file
        return parseMetaDataStream(in, url.toString(), handlerName);
    }
View Full Code Here

            }
        }
        if (in == null)
        {
            JPOXLogger.ENHANCER.error(LOCALISER.msg("044032", fileName));
            throw new JPOXException(LOCALISER.msg("044032", fileName));
        }

        // Parse the file
        return parseMetaDataStream(in, fileName, handlerName);
    }
View Full Code Here

                }
            }
            catch (Exception e)
            {
                String msg = LOCALISER.msg("044029", handlerName, e.getMessage());
                throw new JPOXException(msg, e);
            }

            // Parse the metadata
            parser.parse(in, handler);

            // Return the FileMetaData that has been parsed
            return ((AbstractMetaDataHandler)handler).getMetaData();
        }
        catch (JPOXException e)
        {
            throw e;
        }
        catch (Exception e)
        {
            Throwable cause = e;
            if (e instanceof SAXException)
            {
                SAXException se = (SAXException)e;
                cause = se.getException();
            }
            if (JavaUtils.isJRE1_4OrAbove())
            {
                cause = e.getCause() == null ? cause : e.getCause();
            }

            JPOXLogger.METADATA.error(LOCALISER.msg("044040", filename, cause));
            if (cause instanceof InvalidMetaDataException)
            {
                throw (InvalidMetaDataException)cause;
            }
            else
            {
                String message = LOCALISER.msg("044033", e);
                throw new JPOXException(message, cause);
            }
        }
        finally
        {
            try
View Full Code Here

    public synchronized void markDirty(StateManager sm, boolean directUpdate)
    {
        if (tx.isCommitting() && !tx.isActive())
        {
            //post commit cannot change objects (sanity check - avoid changing avoids on detach)
            throw new JPOXException("Cannot change objects when transaction is no longer active.");
        }

        boolean isInDirty = dirtySMs.contains(sm);
        boolean isInIndirectDirty = indirectDirtySMs.contains(sm);
        if (!isDelayDatastoreOperationsEnabled() && !isInDirty && !isInIndirectDirty &&
View Full Code Here

                {
                    throw (JPOXException) t;
                }
                else
                {
                    throw new JPOXException("Unexpected error during precommit",t);
                }
            }
            finally
            {
                runningPBRAtCommit = false;
View Full Code Here

                {
                    resources = clr.getResources(location, cls != null ? cls.getClassLoader() : null);
                }
                catch (IOException e)
                {
                    throw new JPOXException("Error loading resource", e).setFatal();
                }
                while (resources.hasMoreElements())
                {
                    URL fileURL = (URL) resources.nextElement();
                    if (fileMetaDataByURLString.get(fileURL.toString()) == null)
                    {
                        // File hasn't been loaded so load it
                        FileMetaData filemd = parseFile(fileURL);
                        filemd.setType(FileMetaData.JDOQUERY_FILE); // TODO Remove this since set in the parser at <jdoquery>
                        registerFile(fileURL.toString(), filemd, clr);

                        // Populate all classes in this file we've just parsed
                        // TODO Populate the classes found in this file
                    }
                }
                cmd = getMetaDataForClass(cls, clr);

                qmd = (QueryMetaData)queryMetaDataByName.get(query_key);
                if (qmd != null)
                {
                    if (JPOXLogger.METADATA.isDebugEnabled())
                    {
                        JPOXLogger.METADATA.debug(LOCALISER.msg("044053",query_key,location));
                    }
                    return qmd;
                }
                if (JPOXLogger.METADATA.isDebugEnabled())
                {
                    JPOXLogger.METADATA.debug(LOCALISER.msg("044050",query_key,location));
                }
            }
            return null;
        }

        // Query isn't scoped to a candidate class, so search the valid package-independent locations
        List locations = new ArrayList();
        locations.addAll(getValidMetaDataLocationsForItem(getJDOFileSuffix(), null, null, false));
        locations.addAll(getValidMetaDataLocationsForItem(getORMFileSuffix(), getORMMappingName(), null, false));
        locations.addAll(getValidMetaDataLocationsForItem(getJDOQueryFileSuffix(), null, null, false));

        for (int i=0; i<locations.size(); i++)
        {
            String location = (String) locations.get(i);
            // Process all resources for this location
            Enumeration resources;
            try
            {
                resources = clr.getResources(location, cls != null ? cls.getClassLoader() : null);
            }
            catch (IOException e)
            {
                throw new JPOXException("Error loading resources", e).setFatal();
            }
            while (resources.hasMoreElements())
            {
                URL fileURL = (URL) resources.nextElement();
                if (fileMetaDataByURLString.get(fileURL.toString()) == null)
View Full Code Here

            {
                resources = clr.getResources(location, null);
            }
            catch (IOException e)
            {
                throw new JPOXException("Error loading resource", e).setFatal();
            }
            while (resources.hasMoreElements())
            {
                URL fileURL = (URL) resources.nextElement();
                if (fileMetaDataByURLString.get(fileURL.toString()) == null)
View Full Code Here

TOP

Related Classes of org.jpox.exceptions.JPOXException

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.