/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/**
* Server based SessionOperationStrategy implementation.
*
* SessionOperations represent the available operations that can be performed on a Session,
* which are applicable under a number of situations. These situations correspond to the
* number of situations Sessions can find themselves in.
*
* This strategy covers the following:
*
* <b>local</b> - The Session is based on the current server and that server is responsible for
* processing the request.
*
* <b>remote</b> - The Session is based on a remote server which will service the request and
* respond with an appropriate response. This is performed by using a remote request and the
* PLL signalling system.
*
* <b>CTS</b> - The Session is a remote session, however the Site appears to be down. The request
* will be performed locally using the CTS instead.
*
* Between these strategies, the users Session should be available during fail-over of a Site.
*/
/**
* Guice initialised constructor.
*
* @param service Required for local server decisions.
* @param local Required strategy.
* @param remote Required strategy.
* @param cts Required strategy.
* @param store The store for session monitoring information.
* @param queryUtils Required for Server availability decisions.
* @param statelessSessionFactory Required for JWT checks.
* @param debug Required for logging.
*/
this.clientSide = clientSide;
this.queryUtils = queryUtils;
}
/**
* Based on the Session, determine the appropriate SessionOperations strategy to select.
*
* Local - For local Sessions which are hosted on the current Server.
* Remote - The Session is from a remote Site, and the Site is up.
* CTS - When cross talk is disabled, or if the Session is from a remote Site, which is down.
*
* @param session Non null Session to use.
* @return A non null SessionOperations implementation to use.
*/
if (isClientSide(session)) {
}
if (isLocalServer(session)) {
}
if (service.isSessionFailoverEnabled()) {
// If cross talk is reduced... by this point, we know the session is remote.
// We get CTS to do the legwork for us, knowing that CTSOperations will delegate
// to RemoteOperations.
//
if (service.isReducedCrossTalkEnabled()) {
}
// Remote Site which is known to be down
}
}
}
/**
* Fetches the Site for a Session Server ID, based on the results of WebtopNaming.
* @param session A non null Session which may or may not be part of a Site.
* @return Null if no Site ID was found, otherwise a non null Site ID.
*/
return serverID;
}
}
/**
* Indicates that the Site associated with the Session is up.
*
* @param siteId Site ID to test if it is up. May be null, in which case
* false will be returned.
* @return False if the Site ID is null, or if the Site was down.
* True if the Site was up.
*/
return false;
}
}
/**
* Tests if the Session should be considered local.
*
* @param session Non null Session.
* @return True if it is based on the current server.
*/
try {
} catch (SessionException e) {
throw new IllegalStateException(e);
}
}
}
/**
* Indicates that the Session belongs to a the local Site. That is, it is
* hosted on a Server within the current cluster.
*
* @param session Non null Session.
* @return True if the Session is considered local.
*/
}
/**
* Inline logging function.
* @param session Non null.
* @param op Non null operation selected.
* @param type
* @return {code op}, wrapped in a MonitoredOperations.
*/
private SessionOperations logAndWrap(Session session, SessionOperations op, SessionMonitorType type) {
if (debug.messageEnabled()) {
}
}
}