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 void
addPort
(ServerPort serverPort) Add a port to the Server's port registry.static void
addService
(Service service) Adds aServicePortService
to theServerPortRegistry
.static void
clear()
Clear the service port registry.static ServerPort
Returns theServerPort
associated with the given portId or null, none exist.static Set<ServerPort>
getPorts()
Returns all registeredServerPort
s.static Service
getService
(String serviceName) Returns theService
associated with the given service name or null, if none exist.Returns all registeredService
s.static void
removePort
(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 aServicePortService
to 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 theService
associated with the given service name or null, if none exist.- Parameters:
serviceName
- The service name.
-
getPort
Returns theServerPort
associated with the given portId or null, none exist.- Parameters:
portId
- The id of the server port.
-
getServices
Returns all registeredService
s. -
getPorts
Returns all registeredServerPort
s.- Returns:
-