Class AbstractServer<S extends AbstractServer<S>>
java.lang.Object
ch.nolix.base.net.clientserver.AbstractServer<S>
- Type Parameters:
S- the type of aAbstractServer.
- All Implemented Interfaces:
Clearable, EmptinessRequestable, Server<S>, SecurityModeHolder, ApplicationManager<Application<?,?>>, Closeable, GroupCloseable, OpennessRequestable, AutoCloseable
- Direct Known Subclasses:
LocalServer, Server, SslServer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal SaddApplication(Application<?, ?> application) Adds the given application to the currentServer.final SaddApplicationWithNameAddendum(AbstractApplication<?, ?> application, String nameAddendum) Adds the given application with the given instanceName to the currentAbstractServer.final <T extends AbstractSession<C,U>, C extends AbstractBackendClient<C, U>, U>
SaddApplicationWithNameAndInitialSessionClassAndContext(String applicationName, Class<T> initialSessionClass, U applicationService) Adds a newAbstractApplicationwith the given instanceName, initialSessionClass and applicationService to the currentAbstractServer.final <T extends AbstractSession<C,Object>, C extends AbstractBackendClient<C, Object>>
SaddApplicationWithNameAndInitialSessionClassAndVoidContext(String name, Class<T> initialSessionClass) Adds a newAbstractApplicationwith the given name, initialSessionClass and a void context to the currentAbstractServer.<C extends BackendClient<T>, T>
SaddDefaultApplication(Application<C, T> defaultApplication) Adds the given defaultApplication to the currentServer.final <T extends AbstractSession<C,U>, C extends AbstractBackendClient<C, U>, U>
SaddDefaultApplicationWithNameAndInitialSessionClassAndContext(String applicationName, Class<T> initialSessionClass, U applicationService) Adds a new defaultAbstractApplicationwith the given name, initialSessionClass and applicationService to the currentAbstractServer.final <T extends AbstractSession<C,Object>, C extends AbstractBackendClient<C, Object>>
SaddDefaultApplicationWithNameAndInitialSessionClassAndVoidContext(String name, Class<T> initialSessionClass) Adds a newAbstractApplicationwith the given name, initialSessionClass and a void context as defaultAbstractApplicationthe currentAbstractServer.final voidclear()Removes the elements of the currentClearable.final booleanfinal booleanfinal AbstractApplication<?, ?> getStoredApplicationByInstanceName(String instanceName) final AbstractApplication<?, ?> getStoredApplicationByUrlInstanceName(String urlInstanceName) final ExtendedIterable<? extends Application<?, ?>> final ICloseControllerfinal AbstractApplication<?, ?> final booleanfinal booleanisEmpty()final voidLets the currentGroupCloseablenote a close.final voidremoveApplicationWithInstanceName(String instanceName) Removes theApplicationwith the given instanceName from the currentServer.final voidtakeClient(AbstractBackendClient<?, ?> client) Lets the currentAbstractServertake the given client.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EmptinessRequestable
containsAnyMethods inherited from interface GroupCloseable
close, createCloseDependencyTo, isClosedMethods inherited from interface OpennessRequestable
isOpenMethods inherited from interface SecurityModeHolder
getSecurityMode
-
Constructor Details
-
AbstractServer
public AbstractServer()
-
-
Method Details
-
addApplication
Adds the given application to the currentServer.- Specified by:
addApplicationin interfaceServer<S extends AbstractServer<S>>- Parameters:
application-- Returns:
- the current
Server
-
addApplicationWithNameAddendum
public final S addApplicationWithNameAddendum(AbstractApplication<?, ?> application, String nameAddendum) Adds the given application with the given instanceName to the currentAbstractServer.- Parameters:
application-nameAddendum-- Returns:
- the current
AbstractServer - Throws:
RuntimeException- if the given application is nullRuntimeException- if the given application belongs already to aAbstractServerRuntimeException- if the given instanceName is nullRuntimeException- if the given instanceName is blankRuntimeException- if the currentAbstractServercontains already aAbstractApplicationwith the given instanceName.
-
addApplicationWithNameAndInitialSessionClassAndContext
public final <T extends AbstractSession<C,U>, C extends AbstractBackendClient<C, S addApplicationWithNameAndInitialSessionClassAndContextU>, U> (String applicationName, Class<T> initialSessionClass, U applicationService) Adds a newAbstractApplicationwith the given instanceName, initialSessionClass and applicationService to the currentAbstractServer.- Type Parameters:
T- the type of the given initialSessionClassC- the type of theAbstractBackendClientof the given initialSessionClassU- the type of the given applicationService- Parameters:
applicationName-initialSessionClass-applicationService-- Returns:
- the current
AbstractServer - Throws:
RuntimeException- if the given instanceName is nullRuntimeException- if the given instanceName is blankRuntimeException- if the currentAbstractServercontains already aAbstractApplicationwith the given instanceNameRuntimeException- if the given initialSessionClass is null
-
addApplicationWithNameAndInitialSessionClassAndVoidContext
public final <T extends AbstractSession<C,Object>, C extends AbstractBackendClient<C, S addApplicationWithNameAndInitialSessionClassAndVoidContextObject>> (String name, Class<T> initialSessionClass) Adds a newAbstractApplicationwith the given name, initialSessionClass and a void context to the currentAbstractServer.- Type Parameters:
T- the type of the given initialSessionClassC- the type of theAbstractBackendClientof the given initialSessionClass- Parameters:
name-initialSessionClass-- Returns:
- the current
AbstractServer - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the currentAbstractServercontains already aAbstractApplicationwith an instanceName that equals the given nameRuntimeException- if the given initialSessionClass is null
-
addDefaultApplication
Adds the given defaultApplication to the currentServer.- Specified by:
addDefaultApplicationin interfaceServer<S extends AbstractServer<S>>- Type Parameters:
C- the type of theBackendClientof the given defaultApplicationT- the type of the application context of the given defaultApplication- Parameters:
defaultApplication-- Returns:
- the current
Server
-
addDefaultApplicationWithNameAndInitialSessionClassAndContext
public final <T extends AbstractSession<C,U>, C extends AbstractBackendClient<C, S addDefaultApplicationWithNameAndInitialSessionClassAndContextU>, U> (String applicationName, Class<T> initialSessionClass, U applicationService) Adds a new defaultAbstractApplicationwith the given name, initialSessionClass and applicationService to the currentAbstractServer.- Type Parameters:
T- the type of the given initialSessionClassC- the type of theAbstractBackendClientof the given initialSessionClassU- the type of the given applicationService- Parameters:
applicationName-initialSessionClass-applicationService-- Returns:
- the current
AbstractServer - Throws:
RuntimeException- if the given instanceName is nullRuntimeException- if the given instanceName is blankRuntimeException- if the currentAbstractServercontains already a defaultAbstractApplicationRuntimeException- if the currentAbstractServercontains already aAbstractApplicationwith the given instanceNameRuntimeException- if the given initialSessionClass is null
-
addDefaultApplicationWithNameAndInitialSessionClassAndVoidContext
public final <T extends AbstractSession<C,Object>, C extends AbstractBackendClient<C, S addDefaultApplicationWithNameAndInitialSessionClassAndVoidContextObject>> (String name, Class<T> initialSessionClass) Adds a newAbstractApplicationwith the given name, initialSessionClass and a void context as defaultAbstractApplicationthe currentAbstractServer.- Type Parameters:
T- the type of the given initialSessionClassC- the type of theAbstractBackendClientof the given initialSessionClass- Parameters:
name-initialSessionClass-- Returns:
- the current
AbstractServer - Throws:
RuntimeException- if the given name is nullRuntimeException- if the given name is blankRuntimeException- if the currentAbstractServercontains already aAbstractApplicationwith an instanceName that equals the given nameRuntimeException- if the given initialSessionClass is null
-
clear
-
containsDefaultApplication
public final boolean containsDefaultApplication()- Returns:
- true if the current
AbstractServercontains a defaultAbstractApplication, false otherwise
-
containsApplicationWithName
- Parameters:
name-- Returns:
- true if the current
AbstractServercontains aAbstractApplicationwith the given name, false otherwise
-
getStoredApplicationByInstanceName
- Parameters:
instanceName-- Returns:
- the
AbstractApplicationwith the given instanceName from the currentAbstractServer - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain aAbstractApplicationwith the given instanceName.
-
getStoredApplicationByUrlInstanceName
- Parameters:
urlInstanceName-- Returns:
- the
AbstractApplicationwith the given urlInstanceName from the currentAbstractServer - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain aAbstractApplicationwith the given urlInstanceName.
-
getStoredApplications
- Specified by:
getStoredApplicationsin interfaceApplicationManager<S extends AbstractServer<S>>- Returns:
- the applications of the current
ApplicationManager
-
getStoredCloseController
- Specified by:
getStoredCloseControllerin interfaceGroupCloseable- Returns:
- the
ICloseControllerof the currentGroupCloseable.
-
getStoredDefaultApplication
- Returns:
- the default
AbstractApplicationof the currentAbstractServer - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain a defaultAbstractApplication.
-
isEmpty
public final boolean isEmpty()- Specified by:
isEmptyin interfaceEmptinessRequestable- Returns:
- true if
EmptinessRequestabledoes not contain an element, false otherwise
-
hasClientConnected
public final boolean hasClientConnected()- Returns:
- true if the current
AbstractServerhas aAbstractClientconnected, false otherwise
-
noteClose
public final void noteClose()Lets the currentGroupCloseablenote a close.- Specified by:
noteClosein interfaceGroupCloseable
-
removeApplicationWithInstanceName
Removes theApplicationwith the given instanceName from the currentServer.- Specified by:
removeApplicationWithInstanceNamein interfaceServer<S extends AbstractServer<S>>- Parameters:
instanceName-
-
takeClient
Lets the currentAbstractServertake the given client.- Parameters:
client-- Throws:
ArgumentDoesNotHaveAttributeException- if the given client does not have a target and the currentAbstractServerdoes not contain a defaultAbstractApplicationArgumentDoesNotHaveAttributeException- if the given client has a target and the currentAbstractServerdoes not contain aAbstractApplicationwith a name that equals the given target.
-