import {Ice} from 'ice'; import {Glacier2} from '../Glacier2/Session'; import {IceGrid} from '../IceGrid/Exception'; declare module './IceGrid.ns' { namespace IceGrid { /** * A session object is used by IceGrid clients to allocate and * release objects. Client sessions are created either via the * {@link Registry} object or via the registry client SessionManager * object. * * @see Registry */ abstract class Session extends Ice.Object implements Glacier2.Session { /** * Destroy the session. This is called automatically when the router is destroyed. */ abstract destroy(current: Ice.Current): Ice.OperationResult; /** * Keep the session alive. Clients should call this operation * regularly to prevent the server from reaping the session. * * @see Registry#getSessionTimeout */ abstract keepAlive(current: Ice.Current): Ice.OperationResult; /** * Allocate an object. Depending on the allocation timeout, this * operation might hang until the object is available or until the * timeout is reached. * * @param id The identity of the object to allocate. * * @return The proxy of the allocated object. * * @throws ObjectNotRegisteredException Raised if the object with * the given identity is not registered with the registry. * * @throws AllocationException Raised if the object can't be * allocated. * * @see #setAllocationTimeout * @see #releaseObject */ abstract allocateObjectById( id: Ice.Identity, current: Ice.Current, ): Ice.OperationResult; /** * Allocate an object with the given type. Depending on the * allocation timeout, this operation can block until an object * becomes available or until the timeout is reached. * * @param type The type of the object. * * @return The proxy of the allocated object. * * @throws AllocationException Raised if the object could not be allocated. * * @see #setAllocationTimeout * @see #releaseObject */ abstract allocateObjectByType( type: string, current: Ice.Current, ): Ice.OperationResult; /** * Release an object that was allocated using allocateObjectById or * allocateObjectByType. * * @param id The identity of the object to release. * * @throws ObjectNotRegisteredException Raised if the object with * the given identity is not registered with the registry. * * @throws AllocationException Raised if the given object can't be * released. This might happen if the object isn't allocatable or * isn't allocated by the session. */ abstract releaseObject( id: Ice.Identity, current: Ice.Current, ): Ice.OperationResult; /** * Set the allocation timeout. If no objects are available for an * allocation request, a call to allocateObjectById or * allocateObjectByType will block for the duration of this * timeout. * * @param timeout The timeout in milliseconds. */ abstract setAllocationTimeout( timeout: number, current: Ice.Current, ): Ice.OperationResult; } /** * A session object is used by IceGrid clients to allocate and * release objects. Client sessions are created either via the * {@link Registry} object or via the registry client SessionManager * object. * * @see Registry */ class SessionPrx extends Ice.ObjectPrx implements Glacier2.SessionPrx { /** * Destroy the session. This is called automatically when the router is destroyed. */ destroy(ctx?: Ice.Context): Ice.AsyncResult; /** * Keep the session alive. Clients should call this operation * regularly to prevent the server from reaping the session. * * @see Registry#getSessionTimeout */ keepAlive(ctx?: Ice.Context): Ice.AsyncResult; /** * Allocate an object. Depending on the allocation timeout, this * operation might hang until the object is available or until the * timeout is reached. * * @param id The identity of the object to allocate. * * @return The proxy of the allocated object. * * @throws ObjectNotRegisteredException Raised if the object with * the given identity is not registered with the registry. * * @throws AllocationException Raised if the object can't be * allocated. * * @see #setAllocationTimeout * @see #releaseObject */ allocateObjectById( id: Ice.Identity, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Allocate an object with the given type. Depending on the * allocation timeout, this operation can block until an object * becomes available or until the timeout is reached. * * @param type The type of the object. * * @return The proxy of the allocated object. * * @throws AllocationException Raised if the object could not be allocated. * * @see #setAllocationTimeout * @see #releaseObject */ allocateObjectByType( type: string, ctx?: Ice.Context, ): Ice.AsyncResult; /** * Release an object that was allocated using allocateObjectById or * allocateObjectByType. * * @param id The identity of the object to release. * * @throws ObjectNotRegisteredException Raised if the object with * the given identity is not registered with the registry. * * @throws AllocationException Raised if the given object can't be * released. This might happen if the object isn't allocatable or * isn't allocated by the session. */ releaseObject(id: Ice.Identity, ctx?: Ice.Context): Ice.AsyncResult; /** * Set the allocation timeout. If no objects are available for an * allocation request, a call to allocateObjectById or * allocateObjectByType will block for the duration of this * timeout. * * @param timeout The timeout in milliseconds. */ setAllocationTimeout( timeout: number, ctx?: Ice.Context, ): Ice.AsyncResult; } } } export {IceGrid} from './IceGrid.ns';