Class AbstractServer<S extends AbstractServer<S>>
java.lang.Object
ch.nolix.system.application.main.AbstractServer<S>
- Type Parameters:
S- is the type of aAbstractServer.
- All Implemented Interfaces:
IApplicationManager<IApplication<?,?>>, ISecuriyModeHolder, Closeable, CloseStateRequestable, GroupCloseable, Clearable, EmptinessRequestable, IServer<S>, AutoCloseable
- Direct Known Subclasses:
LocalServer, Server, SslServer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal SaddApplication(IApplication<?, ?> application) Adds the given application to the currentIServer.final SaddApplicationWithNameAddendum(Application<?, ?> 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 newApplicationwith 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 newApplicationwith the given name, initialSessionClass and a void context to the currentAbstractServer.final <C extends AbstractBackendClient<C,U>, U>
SaddDefaultApplication(Application<C, U> defaultApplication) Adds the given defaultApplication to the currentAbstractServer.final <T extends AbstractSession<C,U>, C extends AbstractBackendClient<C, U>, U>
SaddDefaultApplicationWithNameAndInitialSessionClassAndContext(String applicationName, Class<T> initialSessionClass, U applicationService) Adds a new defaultApplicationwith 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 newApplicationwith the given name, initialSessionClass and a void context as defaultApplicationthe currentAbstractServer.final voidclear()Removes the elements of the currentClearable.final booleanfinal booleanfinal Application<?, ?> getStoredApplicationByInstanceName(String instanceName) final Application<?, ?> getStoredApplicationByUrlInstanceName(String urlInstanceName) final IContainer<? extends IApplication<?, ?>> final ICloseControllerfinal Application<?, ?> final booleanfinal booleanisEmpty()final voidLets the currentGroupCloseablenote a close.final voidremoveApplicationWithInstanceName(String instanceName) Removes theIApplicationwith the given instanceName from the currentIServer.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 CloseStateRequestable
isOpenMethods inherited from interface EmptinessRequestable
containsAnyMethods inherited from interface GroupCloseable
close, createCloseDependencyTo, isClosedMethods inherited from interface ISecuriyModeHolder
getSecurityMode
-
Constructor Details
-
AbstractServer
public AbstractServer()
-
-
Method Details
-
addApplication
Adds the given application to the currentIServer.- Specified by:
addApplicationin interfaceIServer<S extends AbstractServer<S>>- Parameters:
application-- Returns:
- the current
IServer.
-
addApplicationWithNameAddendum
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 null.RuntimeException- if the given application belongs already to aAbstractServer.RuntimeException- if the given instanceName is nullRuntimeException- if the given instanceName is blank.RuntimeException- if the currentAbstractServercontains already aApplicationwith 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 newApplicationwith the given instanceName, initialSessionClass and applicationService to the currentAbstractServer.- Type Parameters:
T- is the type of the given initialSessionClass.C- is the type of theAbstractBackendClientof the given initialSessionClass.U- is the type of the given applicationService.- Parameters:
applicationName-initialSessionClass-applicationService-- Returns:
- the current
AbstractServer. - Throws:
RuntimeException- if the given instanceName is null.RuntimeException- if the given instanceName is blank.RuntimeException- if the currentAbstractServercontains already aApplicationwith the given instanceName.RuntimeException- 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 newApplicationwith the given name, initialSessionClass and a void context to the currentAbstractServer.- Type Parameters:
T- is the type of the given initialSessionClass.C- is the type of theAbstractBackendClientof the given initialSessionClass.- Parameters:
name-initialSessionClass-- Returns:
- the current
AbstractServer. - Throws:
RuntimeException- if the given name is null.RuntimeException- if the given name is blank.RuntimeException- if the currentAbstractServercontains already aApplicationwith an instanceName that equals the given name.RuntimeException- if the given initialSessionClass is null.
-
addDefaultApplication
public final <C extends AbstractBackendClient<C,U>, U> S addDefaultApplication(Application<C, U> defaultApplication) Adds the given defaultApplication to the currentAbstractServer. A defaultApplicationtakes allAbstractClients that do not have a target.- Type Parameters:
C- is the type of theAbstractBackendClientof the given defaultApplication.U- is the type of the context of the given defaultApplication.- Parameters:
defaultApplication-- Returns:
- the current
AbstractServer. - Throws:
RuntimeException- if the given defaultApplication is null.
-
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 defaultApplicationwith the given name, initialSessionClass and applicationService to the currentAbstractServer.- Type Parameters:
T- is the type of the given initialSessionClass.C- is the type of theAbstractBackendClientof the given initialSessionClass.U- is the type of the given applicationService.- Parameters:
applicationName-initialSessionClass-applicationService-- Returns:
- the current
AbstractServer. - Throws:
RuntimeException- if the given instanceName is null.RuntimeException- if the given instanceName is blank.RuntimeException- if the currentAbstractServercontains already a defaultApplication.RuntimeException- if the currentAbstractServercontains already aApplicationwith the given instanceName.RuntimeException- 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 newApplicationwith the given name, initialSessionClass and a void context as defaultApplicationthe currentAbstractServer.- Type Parameters:
T- is the type of the given initialSessionClass.C- is the type of theAbstractBackendClientof the given initialSessionClass.- Parameters:
name-initialSessionClass-- Returns:
- the current
AbstractServer. - Throws:
RuntimeException- if the given name is null.RuntimeException- if the given name is blank.RuntimeException- if the currentAbstractServercontains already aApplicationwith an instanceName that equals the given name.RuntimeException- if the given initialSessionClass is null.
-
clear
-
containsDefaultApplication
public final boolean containsDefaultApplication()- Returns:
- true if the current
AbstractServercontains a defaultApplication, false otherwise.
-
containsApplicationWithName
- Parameters:
name-- Returns:
- true if the current
AbstractServercontains aApplicationwith the given name, false otherwise.
-
getStoredApplicationByInstanceName
- Parameters:
instanceName-- Returns:
- the
Applicationwith the given instanceName from the currentAbstractServer. - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain aApplicationwith the given instanceName.
-
getStoredApplicationByUrlInstanceName
- Parameters:
urlInstanceName-- Returns:
- the
Applicationwith the given urlInstanceName from the currentAbstractServer. - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain aApplicationwith the given urlInstanceName.
-
getStoredApplications
- Specified by:
getStoredApplicationsin interfaceIApplicationManager<S extends AbstractServer<S>>- Returns:
- the applications of the current
IApplicationManager.
-
getStoredCloseController
- Specified by:
getStoredCloseControllerin interfaceGroupCloseable- Returns:
- the
ICloseControllerof the currentGroupCloseable.
-
getStoredDefaultApplication
- Returns:
- the default
Applicationof the currentAbstractServer. - Throws:
ArgumentDoesNotHaveAttributeException- if the currentAbstractServerdoes not contain a defaultApplication.
-
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 theIApplicationwith the given instanceName from the currentIServer.- Specified by:
removeApplicationWithInstanceNamein interfaceIServer<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 defaultApplication.ArgumentDoesNotHaveAttributeException- if the given client has a target and the currentAbstractServerdoes not contain aApplicationwith a name that equals the given target.
-