public boolean isStoreRequired(EntityEnterpriseContext ctx) throws Exception { if(isModified == null) { return true; } Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), EMPTY_OBJECT_ARRAY); return modified.booleanValue(); }
public boolean isStoreRequired(final EntityEnterpriseContext ctx) throws Exception { if (isModified == null) { return true; } Boolean modified = (Boolean) isModified.invoke(ctx.getInstance(), new Object[0]); return modified.booleanValue(); }
/** * This method is used to determine if an entity should be stored. * * @param ctx the instance to check * @return true, if the entity has been modified * @throws Exception thrown if some system exception occurs */ public boolean isStoreRequired (EntityEnterpriseContext ctx) throws Exception { if(isModified == null) { return true; } Boolean modified = (Boolean) isModified.invoke (ctx.getInstance (), new Object[0]); return modified.booleanValue (); }
/** * This method is used to determine if an entity should be stored. * * @param ctx the instance to check * @return true, if the entity has been modified * @throws Exception thrown if some system exception occurs */ public boolean isStoreRequired (EntityEnterpriseContext ctx) throws Exception { if(isModified == null) { return true; } Object[] args = {}; Boolean modified = (Boolean) isModified.invoke (ctx.getInstance (), args); return modified.booleanValue (); }
public void setContext(EntityEnterpriseContext ctx) { if(ctx != null && !beanClass.isInstance(ctx.getInstance())) { throw new EJBException("Instance must be an instance of beanClass"); } this.ctx = ctx; }
/** * This method is called whenever an entity shall be stored to the * underlying storage. The persistence manager must call ejbStore on the * supplied instance and then store the state to the underlying storage. * * @param ctx the instance to synchronize */ public void storeEntity (EntityEnterpriseContext ctx) { storeEntity (ctx.getId (), ctx.getInstance ()); }
public void storeEntity(final EntityEnterpriseContext ctx) { storeEntity(ctx.getId(), ctx.getInstance()); }
/** * This method is called whenever an entity shall be stored to the * underlying storage. The persistence manager must call ejbStore on the * supplied instance and then store the state to the underlying storage. *B * @param ctx the instance to synchronize * * @throws java.rmi.RemoteException thrown if some system exception occurs */ public void storeEntity (EntityEnterpriseContext ctx) throws java.rmi.RemoteException { try { storeEntity (ctx.getId (), ctx.getInstance ()); } catch (Exception e) { throw new java.rmi.RemoteException (e.toString ()); } }
public Object createEntity(final Method m, final Object[] args, final EntityEnterpriseContext ctx) throws Exception { try { Object id = idField.get(ctx.getInstance()); // Check exist if (getFile(id).exists()) throw new DuplicateKeyException("Already exists: "+id); // Store to file storeEntity(id, ctx.getInstance()); return id; } catch (IllegalAccessException e) { throw new CreateException("Could not create entity: "+e); } }
private void ejbStore(EntityEnterpriseContext ctx) throws RemoteException { try { EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbStore(); } catch(Exception e) { throwRemoteException(e); } }
public void initPersistenceContext(EntityEnterpriseContext ctx) { // If we have an EJB 2.0 dynaymic proxy, // notify the handler of the assigned context. Object instance = ctx.getInstance(); if(instance instanceof Proxies.ProxyTarget) { InvocationHandler handler = ((Proxies.ProxyTarget) instance).getInvocationHandler(); if(handler instanceof EntityBridgeInvocationHandler) { ((EntityBridgeInvocationHandler) handler).setContext(ctx); } } }
public static void destroyPersistenceContext(EntityEnterpriseContext ctx) { // If we have an EJB 2.0 dynaymic proxy, // notify the handler of the assigned context. Object instance = ctx.getInstance(); if(instance instanceof Proxies.ProxyTarget) { InvocationHandler handler = ((Proxies.ProxyTarget)instance).getInvocationHandler(); if(handler instanceof EntityBridgeInvocationHandler) ((EntityBridgeInvocationHandler)handler).setContext(null); } ctx.setPersistenceContext(null); }
public void storeEntity(EntityEnterpriseContext ctx) throws RemoteException { Object key = ctx.getInstance(); try { ccm.pushMetaAwareObject(key, unsharableResources); try { pm.storeEntity(ctx); } finally { ccm.popMetaAwareObject(unsharableResources); } } catch (ResourceException e) { throw new RemoteException("Could not store!: ", e); } }
public void invokeEjbStore(EntityEnterpriseContext ctx) throws RemoteException { Object key = ctx.getInstance(); try { ccm.pushMetaAwareObject(key, unsharableResources); try { pm.invokeEjbStore(ctx); } finally { ccm.popMetaAwareObject(unsharableResources); } } catch (ResourceException e) { throw new RemoteException("Could not store!: ", e); } }
public static void destroyPersistenceContext(EntityEnterpriseContext ctx) { // If we have an EJB 2.0 dynaymic proxy, // notify the handler of the assigned context. Object instance = ctx.getInstance(); if(instance instanceof Proxies.ProxyTarget) { InvocationHandler handler = ((Proxies.ProxyTarget) instance).getInvocationHandler(); if(handler instanceof EntityBridgeInvocationHandler) { ((EntityBridgeInvocationHandler) handler).setContext(null); } } ctx.setPersistenceContext(null); }
public void setInstanceValue(EntityEnterpriseContext ctx, Object value) { try { field.set(ctx.getInstance(), value); FieldState fieldState = getFieldState(ctx); fieldState.setLoaded(); fieldState.setCheckDirty(); } catch(Exception e) { // Non recoverable internal exception throw new EJBException("Internal error setting instance field " + getFieldName(), e); } }
protected void invokeLoad(EntityEnterpriseContext ctx) throws RemoteException { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_LOAD); EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbLoad(); } catch(Exception e) { throwRemoteException(e); } finally { AllowedOperationsAssociation.popInMethodFlag(); } }
public Object getInstanceValue(EntityEnterpriseContext ctx) { FieldState fieldState = getFieldState(ctx); if(!fieldState.isLoaded()) { throw new EJBException("CMP 1.1 field not loaded: " + getFieldName()); } try { return field.get(ctx.getInstance()); } catch(Exception e) { // Non recoverable internal exception throw new EJBException("Internal error getting instance field " + getFieldName(), e); } }
public void initPersistenceContext(EntityEnterpriseContext ctx) { // If we have an EJB 2.0 dynaymic proxy, // notify the handler of the assigned context. Object instance = ctx.getInstance(); if(instance instanceof Proxies.ProxyTarget) { InvocationHandler handler = ((Proxies.ProxyTarget)instance).getInvocationHandler(); if(handler instanceof EntityBridgeInvocationHandler) ((EntityBridgeInvocationHandler)handler).setContext(ctx); } ctx.setPersistenceContext(new JDBCContext(jdbcContextSize, new EntityState())); }
public void passivateEntity(EntityEnterpriseContext ctx) throws RemoteException { try { AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_PASSIVATE); EntityBean eb = (EntityBean) ctx.getInstance(); eb.ejbPassivate(); } catch(Exception e) { throwRemoteException(e); } finally { AllowedOperationsAssociation.popInMethodFlag(); } store.passivateEntity(ctx); ctx.setEJBObject(null); ctx.setEJBLocalObject(null); }