protected String getFilenameForObjectProvider(ObjectProvider op) { return folderName + System.getProperty("file.separator") + op.getInternalObjectId(); }
/** * Method to transition to read-field state. * @param op ObjectProvider. * @param isLoaded if the field was previously loaded. * @return new LifeCycle state. **/ public LifeCycleState transitionReadField(ObjectProvider op, boolean isLoaded) { throw new JDOUserException(Localiser.msg("027009"),op.getInternalObjectId()); }
/** * Method to transition to nontransactional. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionMakeNontransactional(ObjectProvider op) { throw new NucleusUserException(Localiser.msg("027003"),op.getInternalObjectId()); }
/** * Method to transition to transient. * @param op ObjectProvider. * @param useFetchPlan to make transient the fields in the fetch plan * @return new LifeCycle state. **/ public LifeCycleState transitionMakeTransient(ObjectProvider op, boolean useFetchPlan, boolean detachAllOnCommit) { throw new NucleusUserException(Localiser.msg("027004"),op.getInternalObjectId()); }
/** * Method to transition to non-transactional. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionMakeNontransactional(ObjectProvider op) { throw new JDOUserException(Localiser.msg("027007"),op.getInternalObjectId()); }
/** * Method to transition to write-field state. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionWriteField(ObjectProvider op) { throw new JDOUserException(Localiser.msg("027006"),op.getInternalObjectId()); }
/** * Method to transition to write-field state. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionWriteField(ObjectProvider op) { throw new JDOUserException(Localiser.msg("027010"),op.getInternalObjectId()); }
/** * Method to transition to transient. * @param op ObjectProvider. * @param useFetchPlan to make transient the fields in the fetch plan * @return new LifeCycle state. **/ public LifeCycleState transitionMakeTransient(ObjectProvider op, boolean useFetchPlan, boolean detachAllOnCommit) { throw new JDOUserException(Localiser.msg("027008"),op.getInternalObjectId()); }
/** * Method to transition to nontransactional. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionMakeNontransactional(ObjectProvider op) { throw new NucleusUserException(Localiser.msg("027013"),op.getInternalObjectId()); }
/** * Method to transition to nontransactional. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionMakeNontransactional(ObjectProvider op) { throw new NucleusUserException(Localiser.msg("027011"),op.getInternalObjectId()); }
/** * Method to transition to read-field state. * @param op ObjectProvider. * @param isLoaded if the field was previously loaded. * @return new LifeCycle state. **/ public LifeCycleState transitionReadField(ObjectProvider op, boolean isLoaded) { throw new JDOUserException(Localiser.msg("027005"),op.getInternalObjectId()); }
/** * Method to transition to transient. * @param op ObjectProvider. * @param useFetchPlan to make transient the fields in the fetch plan * @return new LifeCycle state. **/ public LifeCycleState transitionMakeTransient(ObjectProvider op, boolean useFetchPlan, boolean detachAllOnCommit) { if (detachAllOnCommit) { return changeState(op, TRANSIENT); } throw new NucleusUserException(Localiser.msg("027014"),op.getInternalObjectId()); }
/** * Method to transition to transient. * @param op ObjectProvider. * @param useFetchPlan to make transient the fields in the fetch plan * @return new LifeCycle state. **/ public LifeCycleState transitionMakeTransient(ObjectProvider op, boolean useFetchPlan, boolean detachAllOnCommit) { if (detachAllOnCommit) { return changeState(op, TRANSIENT); } throw new NucleusUserException(Localiser.msg("027012"),op.getInternalObjectId()); }
/** * Method to transition to read-field state. * @param op ObjectProvider. * @param isLoaded if the field was previously loaded. * @return new LifeCycle state. **/ public LifeCycleState transitionReadField(ObjectProvider op, boolean isLoaded) { Transaction tx = op.getExecutionContext().getTransaction(); if (!tx.isActive() && !tx.getNontransactionalRead()) { throw new JDOUserException(Localiser.msg("027002"),op.getInternalObjectId()); } return this; }
/** * Method to return the Node/Relationship representing the specified ObjectProvider. * @param graphDB Database service * @param op The object provider * @return The Node/Relationship for this ObjectProvider (or null if not found) * @throws NucleusException if more than 1 Node/Relationship is found matching this ObjectProvider! */ public static PropertyContainer getPropertyContainerForObjectProvider(GraphDatabaseService graphDB, ObjectProvider op) { Object val = op.getAssociatedValue(Neo4jStoreManager.OBJECT_PROVIDER_PROPCONTAINER); if (val != null) { // Cached with ObjectProvider so return it return (PropertyContainer)val; } AbstractClassMetaData cmd = op.getClassMetaData(); ExecutionContext ec = op.getExecutionContext(); PropertyContainer propObj = getPropertyContainerForObjectId(graphDB, ec, cmd, op.getInternalObjectId()); if (propObj != null) { // Cache the Node with the ObjectProvider op.setAssociatedValue(Neo4jStoreManager.OBJECT_PROVIDER_PROPCONTAINER, propObj); } return propObj; }
/** * Method to transition to write-field state. * @param op ObjectProvider. * @return new LifeCycle state. */ public LifeCycleState transitionWriteField(ObjectProvider op) { Transaction tx = op.getExecutionContext().getTransaction(); if (!tx.isActive() && !tx.getNontransactionalWrite()) { throw new TransactionNotWritableException(Localiser.msg("027001"), op.getInternalObjectId()); } return changeState(op, tx.isActive() ? P_DIRTY : P_NONTRANS); }
/** * Method to transition to write-field state. * @param op ObjectProvider. * @return new LifeCycle state. **/ public LifeCycleState transitionWriteField(ObjectProvider op) { Transaction tx = op.getExecutionContext().getTransaction(); if (!tx.isActive() && !tx.getNontransactionalWrite()) { throw new TransactionNotWritableException(Localiser.msg("027001"), op.getInternalObjectId()); } if (tx.isActive()) { // Save the fields for rollback. op.saveFields(); return changeState(op, P_DIRTY); } // Save the fields for rollback. op.saveFields(); return changeState(op, P_NONTRANS_DIRTY); }
/** * Method to transition to read-field state. * @param op ObjectProvider. * @param isLoaded if the field was previously loaded. * @return new LifeCycle state. **/ public LifeCycleState transitionReadField(ObjectProvider op, boolean isLoaded) { Transaction tx = op.getExecutionContext().getTransaction(); if (!tx.isActive() && !tx.getNontransactionalRead()) { throw new TransactionNotReadableException(Localiser.msg("027002"), op.getInternalObjectId()); } if (tx.isActive() && !tx.getOptimistic()) { // Save the fields for rollback. op.saveFields(); op.refreshLoadedFields(); return changeState(op, P_CLEAN); } return this; }
/** * Method to transition to read-field state. * @param op ObjectProvider. * @param isLoaded if the field was previously loaded * @return new LifeCycle state. */ public LifeCycleState transitionReadField(ObjectProvider op, boolean isLoaded) { Transaction tx = op.getExecutionContext().getTransaction(); if (!tx.isActive() && !tx.getNontransactionalRead()) { throw new TransactionNotReadableException(Localiser.msg("027000"), op.getInternalObjectId()); } else if (!tx.isActive() && op.getClassMetaData().getIdentityType() == IdentityType.NONDURABLE) { if (!isLoaded) { // JDO2 spec 5.4.4 throw new NucleusUserException("Not able to read fields of nondurable object when in HOLLOW state"); } } if (!tx.getOptimistic() && tx.isActive()) { return changeState(op, P_CLEAN); } return changeState(op, P_NONTRANS); }
public void locateObject(ObjectProvider op) { final AbstractClassMetaData cmd = op.getClassMetaData(); if (cmd.getIdentityType() == IdentityType.APPLICATION || cmd.getIdentityType() == IdentityType.DATASTORE) { ExecutionContext ec = op.getExecutionContext(); ManagedConnection mconn = storeMgr.getConnectionManager().getConnection(ec); try { StoreData sd = storeMgr.getStoreDataForClass(cmd.getFullClassName()); if (sd == null) { storeMgr.manageClasses(op.getExecutionContext().getClassLoaderResolver(), cmd.getFullClassName()); } GraphDatabaseService db = (GraphDatabaseService)mconn.getConnection(); PropertyContainer propObj = Neo4jUtils.getPropertyContainerForObjectProvider(db, op); if (propObj == null) { throw new NucleusObjectNotFoundException("Object not found for id=" + op.getInternalObjectId()); } } finally { mconn.release(); } } }