Methods Summary |
---|
public synchronized void | commit(Transaction trans)
lastUpdateID = trans.getIdentifier().getUserID();
lastUpdateTime = trans.getTimestamp();
lock = null;
|
public final synchronized void | create(Transaction trans)
handler.create(trans, new Memento(this));
|
public boolean | equals(java.lang.Object target)
if( !Entity.class.isAssignableFrom(target.getClass()) ) {
return false;
}
else {
Entity ent = (Entity)target;
try {
long oid = ent.getObjectID();
if( oid == objectID ) {
return true;
}
else {
return false;
}
}
catch( RemoteException e ) {
e.printStackTrace();
return false;
}
}
|
public BaseFacade | getFacade()
String cname = getFacadeClass();
try {
BaseFacade ref;
ref = (BaseFacade)Class.forName(cname).newInstance();
ref.assign(objectID, this);
return ref;
}
catch( Exception e ) {
e.printStackTrace();
return null;
}
|
public java.lang.String | getFacadeClass()
String cname = getClass().getName();
int len = cname.length();
if( cname.substring(len-4).equals("Impl") ) {
return (cname.substring(0, len-4) + "Facade");
}
else {
return cname + "Facade";
}
|
public synchronized long | getLastTouched()
return lastTouched;
|
public synchronized java.lang.String | getLastUpdateID()
return lastUpdateID;
|
public synchronized long | getLastUpdateTime()
return lastUpdateTime;
|
public long | getObjectID()
return objectID;
|
static PersistenceSupport | getPersistenceSupport(java.lang.String cname)
synchronized( supporters ) {
if( supporters.containsKey(cname) ) {
return (PersistenceSupport)supporters.get(cname);
}
else {
PersistenceSupport sp;
try {
String hcls, prop;
prop = LWPProperties.HNDLR_PREFIX + cname;
hcls = System.getProperty(prop);
sp = (PersistenceSupport)Class.forName(hcls).newInstance();
supporters.put(cname, sp);
return sp;
}
catch( Exception e ) {
throw new ConfigurationException(e.getMessage());
}
}
}
|
public int | hashCode()
return (new Long(objectID)).hashCode();
|
public synchronized boolean | isChanged(long luit)
lastTouched = System.currentTimeMillis();
if( luit == lastUpdateTime ) {
return false;
}
else {
return true;
}
|
public final synchronized void | load(Transaction trans, long oid)
Memento mem = new Memento();
handler.load(trans, mem, oid);
try {
mem.map(this);
}
catch( NoSuchFieldException e ) {
e.printStackTrace();
throw new PersistenceException(e.getMessage());
}
|
private void | lock(Transaction trans)
if( lock == null ) {
lock = trans;
}
else {
if( !lock.equals(trans) ) {
throw new TransactionException("Attempt to access " +
getClass().getName() + " by " +
trans.getIdentifier().getUserID() +
"denied due to lock held by " +
lock.getIdentifier().getUserID());
}
}
|
protected final synchronized void | prepareCreate(Identifier id)
Transaction trans = Transaction.getCurrent(id);
lock(trans);
if( !Identifier.validateCreate(id, this) ) {
throw new SecurityException("Illegal create attempt on class " +
getClass().getName() + " by " +
id.getUserID());
}
try {
objectID = SequenceGenerator.nextObjectID();
}
catch( PersistenceException e ) {
throw new TransactionException("Failed to generate new objectID.");
}
trans.prepareCreate(this);
|
protected final synchronized void | prepareRead(Identifier id)
if( !Identifier.validateRead(id, this) ) {
throw new SecurityException("Illegal read attempt on class " +
getClass().getName() + " by " +
id.getUserID());
}
|
protected final synchronized void | prepareRemove(Identifier id)
Transaction trans = Transaction.getCurrent(id);
lock(trans);
if( !Identifier.validateRemove(id, this) ) {
throw new SecurityException("Illegal delete attempt on class " +
getClass().getName() + " by " +
id.getUserID());
}
trans.prepareRemove(this);
|
protected final synchronized void | prepareStore(Identifier id)
Transaction trans = Transaction.getCurrent(id);
lock(trans);
if( !Identifier.validateStore(id, this) ) {
throw new SecurityException("Illegal update attempt on class " +
getClass().getName() + " by " +
id.getUserID());
}
trans.prepareStore(this);
|
public synchronized void | reload(Transaction trans)
lastUpdateID = "unknown";
lastUpdateTime = -1L;
lock = null;
load(trans, objectID);
|
public final synchronized void | remove(Transaction trans)
handler.remove(trans, objectID);
|
public final synchronized void | store(Transaction trans)
handler.store(trans, new Memento(this));
|