Package org.jpox.exceptions

Examples of org.jpox.exceptions.JPOXException


            cls = objectMgr.getOMFContext().getPluginManager().loadClass(
                elem.getExtension().getPlugin().getSymbolicName(), elem.getAttribute("class-name"));
        }
        if (cls == null)
        {
            throw new JPOXException("Cannot create Poid Generator for strategy "+poidGeneratorName);
        }
        generator = mgr.createPoidGenerator(seqMetaData.getName(), cls, props, storeManager, connProvider);

        if (JPOXLogger.JDO.isDebugEnabled())
        {
View Full Code Here


                            {
                                throw (Error) t;
                            }
                            else
                            {
                                throw new JPOXException(t.getMessage(), t).setFatal();
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new JPOXException(ex.getMessage(), ex).setFatal();
                        }
                        JPOXLogger.JDO.info(">> Found StoreManager " + storeMgrClassName);
                    }
                }
            }
            if (srm == null)
            {
                // No StoreManager of the specified type exists, so check plugins in CLASSPATH
                throw new JPOXUserException(LOCALISER.msg("008004", storeManagerType)).setFatal();
            }
        }

        if (srm == null)
        {
            // Try using the URL of the data source
            String url = getOMFContext().getPersistenceConfiguration().getStringProperty("org.jpox.ConnectionURL");
            if (url != null)
            {
                int idx = url.indexOf(':');
                if (idx > -1)
                {
                    url = url.substring(0, idx);
                }
            }

            for (int e=0; srm == null && e<exts.length; e++)
            {
                ConfigurationElement[] confElm = exts[e].getConfigurationElements();
                for (int c=0; srm == null && c<confElm.length; c++)
                {
                    String urlKey = confElm[c].getAttribute("url-key");
                    if (url == null || urlKey.equalsIgnoreCase(url))
                    {
                        // Either no URL, or url defined so take this StoreManager
                        Class[] ctrArgTypes = new Class[] {ClassLoaderResolver.class, OMFContext.class};
                        Object[] ctrArgs = new Object[] {clr, getOMFContext()};
                        try
                        {
                            srm = (StoreManager) getOMFContext().getPluginManager().createExecutableExtension(
                                "org.jpox.store_manager", "url-key", url, "class-name", ctrArgTypes, ctrArgs);
                        }
                        catch (InvocationTargetException ex)
                        {
                            Throwable t = ex.getTargetException();
                            if (t instanceof RuntimeException)
                            {
                                throw (RuntimeException) t;
                            }
                            else if (t instanceof Error)
                            {
                                throw (Error) t;
                            }
                            else
                            {
                                throw new JPOXException(t.getMessage(), t).setFatal();
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new JPOXException(ex.getMessage(), ex).setFatal();
                        }
                    }
                }
            }
View Full Code Here

            if (jpe.getNestedExceptions() != null)
            {
                // TODO What if there is more than 1 exception?
                if( jpe.getNestedExceptions()[0] instanceof JPOXOptimisticException)
                {
                    JPOXException ex;
                    if (jpe.getNestedExceptions()[0] instanceof JPOXException)
                    {
                        ex = (JPOXException)jpe.getNestedExceptions()[0];
                    }
                    else
                    {
                        ex = new JPOXException(jpe.getNestedExceptions()[0].getMessage(),jpe.getNestedExceptions()[0]);                       
                    }
                    // Optimistic exceptions - return a single JDOOptimisticVerificationException
                    // with all individual exceptions nested
                    Throwable[] nested = ex.getNestedExceptions();
                    JDOOptimisticVerificationException[] jdoNested = new JDOOptimisticVerificationException[nested.length];
                    for (int i=0;i<nested.length;i++)
                    {
                        JPOXException nestedEx;
                        if (nested[i] instanceof JPOXException)
                        {
                            nestedEx = (JPOXException)nested[i];
                        }
                        else
                        {
                            nestedEx = new JPOXException(nested[i].getMessage(),nested[i]);                       
                        }
                        jdoNested[i] =
                            (JDOOptimisticVerificationException)JPOXJDOHelper.getJDOExceptionForJPOXException(nestedEx);
                    }
                    throw new JDOOptimisticVerificationException(jpe.getMessage(), jdoNested);
                }
                else
                {
                    JPOXException ex;
                    if (jpe.getNestedExceptions()[0] instanceof JPOXException)
                    {
                        ex = (JPOXException)jpe.getNestedExceptions()[0];
                    }
                    else
                    {
                        ex = new JPOXException(jpe.getNestedExceptions()[0].getMessage(),jpe.getNestedExceptions()[0]);                       
                    }
                    throw JPOXJDOHelper.getJDOExceptionForJPOXException(ex);
                }
            }
            else
View Full Code Here

    {
        synchronized (symbolsTable)
        {
            if( symbols.containsKey(symbol.getQualifiedName()) )
            {
                throw new JPOXException("Symbol "+symbol.getQualifiedName()+" alredy exists.");
            }
            symbols.put(symbol.getQualifiedName(), symbol);
            symbolsTable.add(symbol);
            return symbolsTable.size();
        }
View Full Code Here

    {
        jndiLocation = omfCtx.getPersistenceConfiguration().getStringProperty("org.jpox.jtaJndiLocation");
        if (jndiLocation == null)
        {
            // TODO Localise this
            new JPOXException("NO Custom JNDI Location specified in configuration.").setFatal();
        }
    }
View Full Code Here

    public synchronized void populate(ClassLoaderResolver clr, ClassLoader primary)
    {
        if (isInitialised() || isPopulated())
        {
            JPOXLogger.METADATA.error(LOCALISER.msg("044068",name));
            throw new JPOXException(LOCALISER.msg("044068",fullName)).setFatal();
        }
        if (populating)
        {
            return;
        }
View Full Code Here

            }
        }
        catch (NamingException ne)
        {
            // probably NoInitialContextException, other NamingExceptions due to bad names are silently caught above
            throw new JPOXException(LOCALISER.msg("015029"), ne);
        }
    }
View Full Code Here

            }
            obj = ctor.newInstance(parameters);
        }
        catch (NoSuchMethodException e)
        {
            throw new JPOXException(LOCALISER.msg("030004", type.getName(),
                Arrays.asList(parameterTypes).toString()+" "+Arrays.asList(type.getConstructors()).toString()), new Exception[]{e}).setFatal();
        }
        catch (IllegalAccessException e)
        {
            throw new JPOXException(LOCALISER.msg("030005", type.getName()), new Exception[]{e}).setFatal();
        }
        catch (InstantiationException e)
        {
            throw new JPOXException(LOCALISER.msg("030006", type.getName()), new Exception[]{e}).setFatal();
        }
        catch (InvocationTargetException e)
        {
            Throwable t = e.getTargetException();
            if (t instanceof RuntimeException)
            {
                throw (RuntimeException) t;
            }
            else if (t instanceof Error)
            {
                throw (Error) t;
            }
            else
            {
                throw new JPOXException(LOCALISER.msg("030007", type.getName(), t)).setFatal();
            }
        }
        return obj;
    }
View Full Code Here

            return FieldPersistenceModifier.PERSISTENT;
        }

        if (c == null)
        {
            throw new JPOXException("class is null");
        }

        if (Arrays.binarySearch(DEFAULT_PERSISTENT_TYPE, c.getName()) >= 0)
        {
            // Use the specified "jpoxtypes" default persistence modifier for this type (if specified)
View Full Code Here

                set.add(paths.nextElement());
            }
        }
        catch (IOException e)
        {
            throw new JPOXException("Error loading resource", e).setFatal();
        }
        return set;
    }
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.