@Override public Principal readPrincipal( final ObjectInputStream ois ) throws ClassNotFoundException, IOException { return SerializablePrincipal.readPrincipal( ois ); }
private byte[] getSerializedPrincipal() { if (this.serializedPrincipal == null) { if (this.principal != null && this.principal instanceof GenericPrincipal) { GenericPrincipal gp = (GenericPrincipal) this.principal; SerializablePrincipal sp = SerializablePrincipal.createPrincipal(gp); this.serializedPrincipal = serialize(sp); if (manager != null) { DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Serialized principal: " + sp); // mgr.logCurrentStack(); } } } } return this.serializedPrincipal; }
@Override public Principal getPrincipal() { if (this.principal == null && this.serializedPrincipal != null) { SerializablePrincipal sp = null; try { sp = (SerializablePrincipal) BlobHelper.deserializeBlob(this.serializedPrincipal); } catch (Exception e) { StringBuilder builder = new StringBuilder(); builder.append(this).append( ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); return null; } this.principal = sp.getPrincipal(((DeltaSessionManager) this.manager).getTheContext().getRealm()); if (getManager() != null) { DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Deserialized principal: " + this.principal); // mgr.logCurrentStack(); } } } return this.principal; }
public void resetDeltaRequest() { try { lock(); if (deltaRequest == null) { deltaRequest = new DeltaRequest(getIdInternal(), false); } else { deltaRequest.reset(); deltaRequest.setSessionId(getIdInternal()); } }finally{ unlock(); } }
/** * Returns a diff and sets the dirty map to false * @return byte[] * @throws IOException */ @Override public byte[] getDiff() throws IOException { try{ lock(); return getDeltaRequest().serialize(); }finally{ unlock(); } }
public void setMaxInactiveInterval(int interval, boolean addDeltaRequest) { super.maxInactiveInterval = interval; if (addDeltaRequest && (deltaRequest != null)) { try { lock(); deltaRequest.setMaxInactiveInterval(interval); }finally{ unlock(); } } }
/** * Has the object changed since last replication * and is not in a locked state * @return boolean */ @Override public boolean isDirty() { return getDeltaRequest().getSize()>0; }
@Override public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException { try { lock(); readObjectData(in); }finally{ unlock(); } }
@Override public void writePrincipal( @Nonnull Principal principal, @Nonnull ObjectOutputStream oos) throws IOException { SerializablePrincipal.writePrincipal((GenericPrincipal) principal, oos ); }
/** * Create DeltaSession * @see org.apache.catalina.Manager#createEmptySession() */ @Override public Session createEmptySession() { return getNewDeltaSession() ; }
/** * Get new session class to be used in the doLoad() method. */ protected DeltaSession getNewDeltaSession() { return new DeltaSession(this); }
public void resetDeltaRequest() { try { lock(); if (deltaRequest == null) { deltaRequest = new DeltaRequest(getIdInternal(), false); } else { deltaRequest.reset(); deltaRequest.setSessionId(getIdInternal()); } }finally{ unlock(); } }
/** * Returns a diff and sets the dirty map to false * @return byte[] * @throws IOException */ @Override public byte[] getDiff() throws IOException { try{ lock(); return getDeltaRequest().serialize(); }finally{ unlock(); } }
public void setMaxInactiveInterval(int interval, boolean addDeltaRequest) { super.maxInactiveInterval = interval; if (addDeltaRequest && (deltaRequest != null)) { lock(); try { deltaRequest.setMaxInactiveInterval(interval); } finally{ unlock(); } } }
/** * Has the object changed since last replication * and is not in a locked state * @return boolean */ @Override public boolean isDirty() { return getDeltaRequest().getSize()>0; }
@Override public Principal readPrincipal( final ObjectInputStream ois ) throws ClassNotFoundException, IOException { return SerializablePrincipal.readPrincipal( ois, getContainer().getRealm() ); }
@Override public void writePrincipal( @Nonnull Principal principal, @Nonnull ObjectOutputStream oos) throws IOException { SerializablePrincipal.writePrincipal((GenericPrincipal) principal, oos ); }
public void resetDeltaRequest() { lock(); try { if (deltaRequest == null) { boolean recordAllActions = manager instanceof ClusterManagerBase && ((ClusterManagerBase)manager).isRecordAllActions(); deltaRequest = new DeltaRequest(getIdInternal(), recordAllActions); } else { deltaRequest.reset(); deltaRequest.setSessionId(getIdInternal()); } } finally{ unlock(); } }
public void setMaxInactiveInterval(int interval, boolean addDeltaRequest) { super.maxInactiveInterval = interval; if (addDeltaRequest && (deltaRequest != null)) { try { lock(); deltaRequest.setMaxInactiveInterval(interval); }finally{ unlock(); } } }
/** * Has the object changed since last replication * and is not in a locked state * @return boolean */ @Override public boolean isDirty() { return getDeltaRequest().getSize()>0; }