Package org.datanucleus.exceptions

Examples of org.datanucleus.exceptions.NucleusUserException


        this.parameterName = parameterName;

        this.value = value;
        if (value != null && !value.getClass().isArray())
        {
            throw new NucleusUserException("Invalid argument literal : " + value);
        }

        if (parameterName != null)
        {
            st.appendParameter(parameterName, mapping, this.value);
View Full Code Here


            sqlMethodClassName = methodClassByDatastoreMethodName.get(key);
            if (sqlMethodClassName == null)
            {
                if (className != null)
                {
                    throw new NucleusUserException(LOCALISER.msg("060008", methodName, className));
                }
                else
                {
                    throw new NucleusUserException(LOCALISER.msg("060009", methodName));
                }
            }
        }

        // Use SQLMethod().getExpression(SQLExpression, args)
        try
        {
            method = (SQLMethod)stmt.getClassLoaderResolver().classForName(sqlMethodClassName).newInstance();
            synchronized (method) // Only permit sole usage at any time
            {
                method.setStatement(stmt);

                // Cache the method in case its used later
                methodByClassMethodName.put(classMethodKey, method);

                return method.getExpression(expr, args);
            }
        }
        catch (ClassNotResolvedException cnre)
        {
            throw new NucleusUserException(LOCALISER.msg("060010", sqlMethodClassName));
        }
        catch (InstantiationException e)
        {
            throw new NucleusUserException(LOCALISER.msg("060011", sqlMethodClassName), e);
        }
        catch (IllegalAccessException e)
        {
            throw new NucleusUserException(LOCALISER.msg("060011", sqlMethodClassName), e);
        }
    }
View Full Code Here

     */
    public SQLExpression getExpression(SQLExpression ignore, List args)
    {
        if (args == null || args.size() == 0)
        {
            throw new NucleusUserException("Cannot invoke JDOHelper.getVersion without an argument");
        }

        SQLExpression expr = (SQLExpression)args.get(0);
        if (expr == null)
        {
            throw new NucleusUserException("Cannot invoke JDOHelper.getVersion on null expression");
        }
        if (expr instanceof SQLLiteral)
        {
            RDBMSStoreManager storeMgr = stmt.getRDBMSManager();
            ApiAdapter api = storeMgr.getApiAdapter();
            Object obj = ((SQLLiteral)expr).getValue();
            if (obj == null || !api.isPersistable(obj))
            {
                return new NullLiteral(stmt, null, null, null);
            }
            else
            {
                Object ver = stmt.getRDBMSManager().getApiAdapter().getVersionForObject(obj);
                JavaTypeMapping m = getMappingForClass(ver.getClass());
                return new ObjectLiteral(stmt, m, ver, null);
            }
        }
        else if (ObjectExpression.class.isAssignableFrom(expr.getClass()))
        {
            if (((ObjectExpression)expr).getJavaTypeMapping() instanceof PersistableMapping)
            {
                NucleusLogger.QUERY.info(">> JDOHelper.getVersion for " + expr + " table=" + expr.getSQLTable() + " mapping=" + expr.getJavaTypeMapping());
                throw new NucleusUserException("Dont currently support JDOHelper.getVersion(ObjectExpression)");
                // TODO Implement this
            }
            return expr;
        }

View Full Code Here

     */
    public SQLExpression getExpression(SQLExpression ignore, List args)
    {
        if (args == null || args.size() == 0)
        {
            throw new NucleusUserException("Cannot invoke Math.ceil without an argument");
        }

        SQLExpression expr = (SQLExpression)args.get(0);
        if (expr == null)
        {
View Full Code Here

     */
    public SQLExpression getExpression(SQLExpression ignore, List args)
    {
        if (args == null || args.size() == 0)
        {
            throw new NucleusUserException("Cannot invoke Math.acos without an argument");
        }

        SQLExpression expr = (SQLExpression)args.get(0);
        if (expr == null)
        {
View Full Code Here

                {
                    m = getMappingForClass(argExpr.getJavaTypeMapping().getJavaType());
                }
                else
                {
                    throw new NucleusUserException("Cannot perform SUM on " + expr + " of type " + cls.getName());
                }
            }
            else
            {
                // Fallback to the type for this aggregate
View Full Code Here

            }
        }
        catch (Exception e)
        {
            NucleusLogger.METADATA.error(e.getMessage(), e);
            throw new NucleusUserException(e.getMessage());
        }
    }
View Full Code Here

    {
        AbstractMemberMetaData fmd = (AbstractMemberMetaData)parent;
        if (fmd.getMap() == null)
        {
            // TODO Localise this
            throw new NucleusUserException("The field "+fmd.getFullFieldName()+" is defined with <value>, however no <map> definition was found.").setFatal();
        }

        // Make sure value type is set and is valid
        fmd.getMap().value.populate(fmd.getAbstractClassMetaData().getPackageName(), clr, primary, mmgr);
        String valueType = fmd.getMap().getValueType();
View Full Code Here

                    "org.datanucleus.metadata_handler",
                    "name", handlerName, "class-name", argTypes, argValues);
                if (handler == null)
                {
                    // Plugin of this name not found
                    throw new NucleusUserException(LOCALISER.msg("044028", handlerName)).setFatal();
                }
            }
            catch (Exception e)
            {
                String msg = LOCALISER.msg("044029", handlerName, e.getMessage());
View Full Code Here

     */
    public AbstractExtent(ExecutionContext ec, Class cls, boolean subclasses, AbstractClassMetaData cmd)
    {
        if (cls == null)
        {
            throw new NucleusUserException(LOCALISER.msg("033000")).setFatal();
        }

        // Find the MetaData for this class
        storeMgr = ec.getStoreManager();
        this.cmd = cmd;
        if (cmd == null)
        {
            throw new NucleusUserException(LOCALISER.msg("033001", cls.getName())).setFatal();
        }

        this.ec = ec;
        this.candidateClass = cls;
        this.subclasses = subclasses;
View Full Code Here

TOP

Related Classes of org.datanucleus.exceptions.NucleusUserException

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.