Package javax.jdo

Examples of javax.jdo.JDOUserException


  public void commit()
  {
        if (!m_kit.getTransaction(m_conn).isInProgress())
        {
            throw new JDOUserException("Transaction not in progress");
        }
        m_kit.getTransaction(m_conn).commit();
  }
View Full Code Here


  public void rollback()
  {
    if (!m_kit.getTransaction(m_conn).isInProgress())
        {
            throw new JDOUserException("Transaction not in progress");
        }
        m_kit.getTransaction(m_conn).rollback();
  }
View Full Code Here

            if (!importDecl.isOnDemand())
            {
                shortName = importDecl.getSpec().substring(importDecl.getSpec().lastIndexOf('.'));
                if (directlyImportedClasses.containsKey(shortName))
                {
                    throw new JDOUserException("Multiple direct imports of classes with the same unqualified name "+shortName);
                }
                else
                {
                    directlyImportedClasses.put(shortName, null);
                }
View Full Code Here

                }
                break;
        }
        if (!typeWasSet)
        {
            throw new JDOUserException("Binary expression cannot be applied to expressions of types "+leftType.getName()+" and "+rightType.getName());
        }
    }
View Full Code Here

        {
            if ("contains".equals(name))
            {
                if (methodInvoc.getArguments().size() != 1)
                {
                    throw new JDOUserException("Illegal number of arguments to method Collection.contains");
                }
            }
            else if ("isEmpty".equals(name))
            {
                if (!methodInvoc.getArguments().isEmpty())
                {
                    throw new JDOUserException("Illegal number of arguments to method Collection.isEmpty");
                }
            }
            else
            {
                throw new JDOUserException("Only methods 'contains' and 'isEmpty' are allowed to be called at collection objects");
            }
            methodInvoc.setType(boolean.class);
        }
        else if (type == String.class)
        {
            if (!"startsWith".equals(name) && !"endsWith".equals(name))
            {
                throw new JDOUserException("Only methods 'contains' and 'isEmpty' are allowed to be called at collection objects");
            }
            if (methodInvoc.getArguments().size() != 1)
            {
                throw new JDOUserException("Illegal number of arguments to method String."+name);
            }
            if (((Expression)methodInvoc.getArguments().get(0)).getType() != String.class)
            {
                throw new JDOUserException("Illegal argument to method Collection."+name);
            }
            methodInvoc.setType(boolean.class);
        }
        else
        {
            throw new JDOUserException("Invocation of method "+methodInvoc.getName()+" at type "+type.getName()+" is not allowed");
        }
    }
View Full Code Here

            // so we determine the persistent type of the base expression
            ClassDescriptor classDesc = findClassDescriptorFor(baseType);
           
            if (classDesc == null)
            {
                throw new JDOUserException("Access to type "+baseType.getName()+" is not allowed because the type is not persistent");
            }

            FieldAccess fieldAccess = new FieldAccess(nameExpr.getBaseExpression(), nameExpr.getName());
           
            // it may be either a field, reference or collection descriptor -
            // this depends on whether the name expression is a base expression
            // to another name expression (not a method invocation or other expression)
            ObjectReferenceDescriptor refDesc = classDesc.getObjectReferenceDescriptorByName(nameExpr.getName());
           
            if (refDesc != null)
            {
                fieldAccess.setFieldDescriptor(refDesc);
            }
            else if (nameExpr.hasParent() && (nameExpr.getParent() instanceof NameExpression))
            {
                // if we are the base expression of another name expression, then it must be a reference
                throw new JDOUserException("Cannot find reference "+nameExpr.getName()+" in type "+baseType.getName()+" because it is not defined, not persistent or not a reference");
            }
            else
            {
                // it can be a field or collection
                CollectionDescriptor collDesc = classDesc.getCollectionDescriptorByName(nameExpr.getName());
                if (collDesc != null)
                {
                    fieldAccess.setFieldDescriptor(collDesc);
                }
                else
                {
                    FieldDescriptor fieldDesc = classDesc.getFieldDescriptorByName(nameExpr.getName());
   
                    if (fieldDesc == null)
                    {
                        throw new JDOUserException("Cannot find feature "+nameExpr.getName()+" in type "+baseType.getName()+" because it is not defined or not persistent");
                    }
                    fieldAccess.setFieldDescriptor(fieldDesc);
                }
            }
            newExpr = fieldAccess;
View Full Code Here

            {
                type = ((BinaryExpression)parent).getLeftSide().getType();
            }
            if (type.isPrimitive())
            {
                throw new JDOUserException("Illegal binary expression with a 'null' and a primitive operand");
            }
            nullLit.setType(type);
        }
    }
View Full Code Here

        {
            result = resolveUnqualifiedClassName(loader, name);
        }
        if (result == null)
        {
            throw new JDOUserException("No such class "+name);
        }
        else
        {
            type.setType(result);
        }
View Full Code Here

                        return Class.forName(importDecl.getSpec() + "." + unqualifiedName, true, loader);
                    }
                    catch (ClassNotFoundException ex)
                    {
                        // we have a direct import for the class but the import is invalid
                        throw new JDOUserException("The import "+importDecl.getSpec()+" is invalid");
                    }
                }
            }
        }
        return result;
View Full Code Here

        }
        if (!typeWasSet)
        {
            if (unaryExpr.getOperator() == UnaryExpression.OPERATOR_CAST)
            {
                throw new JDOUserException("Invalid cast expression because inner expression of type "+innerType.getName()+" cannot be cast to "+unaryExpr.getCastType().getName());
            }
            else
            {
                throw new JDOUserException("Invalid unary expression");
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.jdo.JDOUserException

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.