Package org.pentaho.platform.settings
Class ServerPortRegistry
java.lang.Object
org.pentaho.platform.settings.ServerPortRegistry
This class holds a collection of of all server ports that are formally registered to the platform. To get an open
port for the platform, create a
ServerPort object and register it with ServerPortRegistry.addPort.
The physical port number can then be assigned with ServerPort#assignPort().- Author:
- tkafalas
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPort(ServerPort serverPort) Add a port to the Server's port registry.static voidaddService(Service service) Adds aServicePortServiceto theServerPortRegistry.static voidclear()Clear the service port registry.static ServerPortReturns theServerPortassociated with the given portId or null, none exist.static Set<ServerPort>getPorts()Returns all registeredServerPorts.static ServicegetService(String serviceName) Returns theServiceassociated with the given service name or null, if none exist.Returns all registeredServices.static voidremovePort(ServerPort serverPort) Removes a port from the ServerPortRegistry and any Service it belongs to.
-
Method Details
-
addPort
Add a port to the Server's port registry. To ensure that no other server instance on this host uses the same port, the port should be opened when karaf starts, or, if karaf has started, the socket should be opened immediately after calling this method.- Parameters:
serverPort-
-
addService
Adds aServicePortServiceto theServerPortRegistry. ServerPorts can be grouped by Service- Parameters:
service- The Service to register. Once registered, ServerPorts can be associated with this Service.
-
removePort
Removes a port from the ServerPortRegistry and any Service it belongs to.- Parameters:
serverPort-
-
clear
public static void clear()Clear the service port registry. Should only be called if resources have been closed. -
getService
Returns theServiceassociated with the given service name or null, if none exist.- Parameters:
serviceName- The service name.
-
getPort
Returns theServerPortassociated with the given portId or null, none exist.- Parameters:
portId- The id of the server port.
-
getServices
Returns all registeredServices. -
getPorts
Returns all registeredServerPorts.- Returns:
-