protected void fireSessionDestroyed(Session session) { SessionEvent e = new SessionEvent(session, OperationType.KILL); for (SessionListener l : listeners) l.sessionChanged(e); }
protected void fireScopeDetached(String scopeId) { for (SessionListener l : listeners) l.scopeDetached(this, scopeId); }
protected void fireScopeAppended(String scopeId) { for (SessionListener l : listeners) l.scopeAppended(this, scopeId); }
protected synchronized void removeSession(Session session) { String id = session.getID(); Session s2 = sessionsByID.get(id); if (session == s2) sessionsByID.remove(id); }
@Override public void sessionChanged(SessionEvent event) { switch (event.getOperationType()) { case CREATE: updateSessionRegistration(event.getSession()); break; case KILL: updateSessionUnregistration(event.getSession()); break; default: break; } }
@Override public Session getSession() { // TODO Auto-generated method stub org.apache.stanbol.ontologymanager.servicesapi.session.Session session = super.getSession(); if (session instanceof Session) return (Session) session; else throw new UnsupportedOperationException("Referenced session must be from the deprecated API."); }
@Override public Session createSession() throws SessionLimitException { checkSessionLimit(); Set<String> exclude = getRegisteredSessionIDs(); Session session = null; while (session == null) try { session = createSession(idgen.createSessionID(exclude)); } catch (DuplicateSessionIDException e) { exclude.add(e.getDuplicateID()); continue; } return session; }
public SessionLimitException(int limit, Throwable cause) { this(limit); initCause(cause); }
public NonReferenceableSessionException(Throwable cause) { initCause(cause); }
private void checkSessionLimit() throws SessionLimitException { if (maxSessions >= 0 && sessionsByID.size() >= maxSessions) throw new SessionLimitException( maxSessions, "Cannot create new session. Limit of " + maxSessions + " already raeached."); }
@Override public State setActive(boolean active) throws NonReferenceableSessionException { if (getSessionState() == State.ZOMBIE) throw new NonReferenceableSessionException(); else state = active ? State.ACTIVE : State.HALTED; return getSessionState(); }
protected synchronized void removeSession(Session session) { String id = session.getID(); Session s2 = sessionsByID.get(id); if (session == s2) sessionsByID.remove(id); }
protected void fireSessionCreated(Session session) { SessionEvent e = new SessionEvent(session, OperationType.CREATE); for (SessionListener l : listeners) l.sessionChanged(e); }
protected void fireScopeDetached(String scopeId) { for (SessionListener l : listeners) l.scopeDetached(this, scopeId); }
protected void fireScopeAppended(String scopeId) { for (SessionListener l : listeners) l.scopeAppended(this, scopeId); }
public SessionLimitException(int limit, Throwable cause) { this(limit); initCause(cause); }
public NonReferenceableSessionException(Throwable cause) { initCause(cause); }
private IRI getIRIforSession(Session session) { // Use the Stanbol-internal namespace, so that the whole configuration can be ported. return new IRI(_NS_STANBOL_INTERNAL + Session.shortName + "/" + session.getID()); }
protected void fireSessionDestroyed(Session session) { SessionEvent e = new SessionEvent(session, OperationType.KILL); for (SessionListener l : listeners) l.sessionChanged(e); }
protected void fireSessionCreated(Session session) { SessionEvent e = new SessionEvent(session, OperationType.CREATE); for (SessionListener l : listeners) l.sessionChanged(e); }