private void debugLockMap () { final StringBuffer sb = new StringBuffer(); synchronized (this.lockMap) { final java.util.Iterator it = this.lockMap.keySet().iterator(); while (it.hasNext()) { final FlowExpressionId id = (FlowExpressionId)it.next(); final Lock lock = (Lock)this.lockMap.get(id); sb.append(" - "); sb.append(id); sb.append(" <-- "); sb.append(openwfe.org.auth.BasicPrincipal .getBasicPrincipal(lock.getLocker()).getName()); if (it.hasNext()) sb.append("\n"); } } log.debug("debugLockMap() :\n"+sb.toString()); }
public boolean hasLockOn (Subject s, FlowExpressionId expressionId) { if (log.isDebugEnabled()) log.debug(getName()+" hasLockOn() "+expressionId); final Lock lock = (Lock)this.lockMap.get(expressionId); if (log.isDebugEnabled()) log.debug(getName()+" hasLockOn() found lock "+lock); if (lock == null) return false; //log.debug("hasLockOn() subject >"+s+"<"); //log.debug("hasLockOn() locker >"+lock.getLocker()+"<"); if ( ! s.equals(lock.getLocker())) return false; lock.touch(); // ensure that the dispatching (that happens next) will be ok return true; }
/** * Returns true if the given workitem (id) has been locked by another * subject (principal). */ public boolean isLockedBySomeoneElse (final Subject s, final FlowExpressionId workitemId) { final Lock l = getLock(workitemId); if (l == null) return false; return ! l.getLocker().equals(s); }
/** * Will return true if the given subject has a lock on the workitem * designated by its lastExpressionId. */ public boolean hasLockOn (Subject s, FlowExpressionId expressionId) { if (log.isDebugEnabled()) log.debug(getName()+" hasLockOn() "+expressionId); final Lock lock = (Lock)this.lockMap.get(expressionId); if (log.isDebugEnabled()) log.debug(getName()+" hasLockOn() found lock "+lock); if (lock == null) return false; //log.debug("hasLockOn() subject >"+s+"<"); //log.debug("hasLockOn() locker >"+lock.getLocker()+"<"); if ( ! s.equals(lock.getLocker())) return false; lock.touch(); // ensure that the dispatching (that happens next) will be ok return true; }
/** * Returns the name of the locker of this workitem, or null if the * workitem is not locked. */ public String getLockerName (final FlowExpressionId workitemId) { final Lock l = getLock(workitemId); if (l == null) return null; return BasicPrincipal.getBasicPrincipal(l.getLocker()).getName(); }
/** * Returns the name of the principal that locked this workitem (or * null if it's not locked). */ protected String getLockerName (final InFlowWorkItem wi) { final Lock lock = getLock(wi.getLastExpressionId()); if (lock == null) return null; return BasicPrincipal.getBasicPrincipal(lock.getLocker()).getName(); }
final Subject locker = lock.getLocker();
final Subject locker = lock.getLocker();
Subject locker = lock.getLocker();
Subject locker = lock.getLocker();
if (lock != null) Subject locker = lock.getLocker();
if (lock != null) Subject locker = lock.getLocker();