Examples of ObjectNotFoundException


Examples of org.apache.openjpa.util.ObjectNotFoundException

            int len = (fields == null) ? 0 : fields.length();
            if (len > 0) {
                if (fetch == null)
                    fetch = _broker.getFetchConfiguration();
                if (!_broker.getStoreManager().load(this, fields, fetch, lockLevel, sdata)) {
                    throw new ObjectNotFoundException(_loc.get("del-instance", _meta.getDescribedType(), _oid)).
                        setFailedObject(getManagedInstance());
                }
                ret = true;
            }
View Full Code Here

Examples of org.apache.openjpa.util.ObjectNotFoundException

        if (call == null)
            call = this;
        oid = call.processArgument(oid);
        if (oid == null) {
            if ((flags & OID_NOVALIDATE) == 0)
                throw new ObjectNotFoundException(_loc.get("null-oid"));
            return call.processReturn(oid, null);
        }
        if (fetch == null)
            fetch = _fc;

        beginOperation(true);
        try {
            assertNontransactionalRead();

            // cached instance?
            StateManagerImpl sm = getStateManagerImplById(oid,
                (flags & OID_ALLOW_NEW) != 0 || hasFlushed());
            if (sm != null) {
                if (!requiresLoad(sm, true, fetch, edata, flags))
                    return call.processReturn(oid, sm);

                if (!sm.isLoading()) {
                    // make sure all the configured fields are loaded; do this
                    // after making instance transactional for locking
                    if (!sm.isTransactional() && useTransactionalState(fetch))
                        sm.transactional();
                    boolean loaded;
                    try {
                        loaded = sm.load(fetch, StateManagerImpl.LOAD_FGS,
                            exclude, edata, false);
                    } catch (ObjectNotFoundException onfe) {
                        if ((flags & OID_NODELETED) != 0
                            || (flags & OID_NOVALIDATE) != 0)
                            throw onfe;
                        return call.processReturn(oid, null);
                    }

                    // if no data needed to be loaded and the user wants to
                    // validate, just make sure the object exists
                    if (!loaded && (flags & OID_NOVALIDATE) == 0
                        && _compat.getValidateTrueChecksStore()
                        && !sm.isTransactional()
                        && !_store.exists(sm, edata)) {
                        if ((flags & OID_NODELETED) == 0)
                            return call.processReturn(oid, null);
                        throw new ObjectNotFoundException(_loc.get
                            ("del-instance", sm.getManagedInstance(), oid)).
                            setFailedObject(sm.getManagedInstance());
                    }
                }

                // since the object was cached, we may need to upgrade lock
                // if current level is higher than level of initial load
                if ((_flags & FLAG_ACTIVE) != 0) {
                    int level = fetch.getReadLockLevel();
                    _lm.lock(sm, level, fetch.getLockTimeout(), edata);
                    sm.readLocked(level, fetch.getWriteLockLevel());
                }
                return call.processReturn(oid, sm);
            }

            // if there's no cached sm for a new/transient id type, we
            // it definitely doesn't exist
            if (oid instanceof StateManagerId)
                return call.processReturn(oid, null);

            // initialize a new state manager for the datastore instance
            sm = newStateManagerImpl(oid, (flags & OID_COPY) != 0);
            boolean load = requiresLoad(sm, false, fetch, edata, flags);
            sm = initialize(sm, load, fetch, edata);
            if (sm == null) {
                if ((flags & OID_NOVALIDATE) != 0)
                    throw new ObjectNotFoundException(oid);
                return call.processReturn(oid, null);
            }

            // make sure all configured fields were loaded
            if (load) {
View Full Code Here

Examples of org.apache.openjpa.util.ObjectNotFoundException

    private static ObjectNotFoundException newObjectNotFoundException
        (Collection failed) {
        Throwable[] t = new Throwable[failed.size()];
        int idx = 0;
        for (Iterator itr = failed.iterator(); itr.hasNext(); idx++)
            t[idx] = new ObjectNotFoundException(itr.next());
        return new ObjectNotFoundException(failed, t);
    }
View Full Code Here

Examples of org.apache.openjpa.util.ObjectNotFoundException

        case StoreException.LOCK:
              return new LockException(msg);
        case StoreException.OBJECT_EXISTS:
              return new ObjectExistsException(msg);
        case StoreException.OBJECT_NOT_FOUND:
              return new ObjectNotFoundException(msg);
        case StoreException.OPTIMISTIC:
              return new OptimisticException(msg);
        case StoreException.REFERENTIAL_INTEGRITY:
              return new ReferentialIntegrityException(msg);
          default:
View Full Code Here

Examples of org.apache.slide.structure.ObjectNotFoundException

                    constructor = parent.getClass().getConstructor(types2);
                    object = (ObjectNode) constructor.newInstance(args2);
                    parentUri.getStore().storeObject(parentUri, object);
                } catch (ClassNotFoundException ex) {
                    // Can't find role implementing class
                    throw new ObjectNotFoundException(subjectUri);
                } catch (NoSuchMethodException ex) {
                    // Can't find appropriate constructor
                    throw new ObjectNotFoundException(subjectUri);
                } catch (InstantiationException ex) {
                    // Can't instatiate object
                    throw new ObjectNotFoundException(subjectUri);
                } catch (InvocationTargetException ex) {
                    // Can't invoke constructor
                    throw new ObjectNotFoundException(subjectUri);
                } catch (IllegalAccessException ex) {
                    // Constructor is not public
                    throw new ObjectNotFoundException(subjectUri);
                } catch (ObjectAlreadyExistsException ex) {
                    // Should never happen
                    e.printStackTrace();
                    throw new ObjectNotFoundException(subjectUri);
                }
                return subjectUri.getStore().retrieveObject(subjectUri);
            }
        }
    }
View Full Code Here

Examples of org.apache.stratum.jcs.access.exception.ObjectNotFoundException

        throws CacheException, IOException
    {
        CacheElement ce = ( CacheElement ) getCacheElement( key );
        if ( ce == null )
        {
            throw new ObjectNotFoundException( "key " + key + " is not found" );
        }
        return ce.getElementAttributes();
    }
View Full Code Here

Examples of org.exolab.castor.jdo.ObjectNotFoundException

            }

            // execute the SQL query
            rs = stmt.executeQuery();
            if (!rs.next()) {
                throw new ObjectNotFoundException(Messages.format(
                        "persist.objectNotFound", _type, identity));
            }

            // if this class is part of an extend relation (hierarchy), let's investigate
            // what the real class type is vs. the specified one as part of the load statement;
View Full Code Here

Examples of org.exoplatform.commons.exception.ObjectNotFoundException

   public Object findExactOne(Session session, String query, String id) throws Exception
   {
      Object res = session.createQuery(query).setString(0, id).uniqueResult();
      if (res == null)
      {
         throw new ObjectNotFoundException("Cannot find the object with id: " + id);
      }
      return res;
   }
View Full Code Here

Examples of org.fcrepo.server.errors.ObjectNotFoundException

                    "SELECT systemVersion FROM doRegistry WHERE doPID=?";
            s2 = conn.prepareStatement(query);
            s2.setString(1, pid);
            results = s2.executeQuery();
            if (!results.next()) {
                throw new ObjectNotFoundException("Error creating replication job: The requested object doesn't exist in the registry.");
            }
            int systemVersion = results.getInt("systemVersion");
            systemVersion++;
            query = "UPDATE doRegistry SET systemVersion=? WHERE doPID=?";
            s2 = conn.prepareStatement(query);
View Full Code Here

Examples of org.hibernate.ObjectNotFoundException

    // EntityNotFoundDelegate
    EntityNotFoundDelegate entityNotFoundDelegate = cfg.getEntityNotFoundDelegate();
    if ( entityNotFoundDelegate == null ) {
      entityNotFoundDelegate = new EntityNotFoundDelegate() {
        public void handleEntityNotFound(String entityName, Serializable id) {
          throw new ObjectNotFoundException( id, entityName );
        }
      };
    }
    this.entityNotFoundDelegate = entityNotFoundDelegate;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.