Package org.pentaho.platform.settings
Class ServerPortRegistry
- java.lang.Object
-
- org.pentaho.platform.settings.ServerPortRegistry
-
public class ServerPortRegistry extends Object
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 aServerPort
object and register it withServerPortRegistry.addPort
. The physical port number can then be assigned withServerPort#assignPort()
.- Author:
- tkafalas
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
getPort(String portId)
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.static Set<Service>
getServices()
Returns all registeredService
s.static void
removePort(ServerPort serverPort)
Removes a port from the ServerPortRegistry and any Service it belongs to.
-
-
-
Method Detail
-
addPort
public static void addPort(ServerPort serverPort)
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
public static void addService(Service service)
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
public static void removePort(ServerPort serverPort)
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
public static Service getService(String serviceName)
Returns theService
associated with the given service name or null, if none exist.- Parameters:
serviceName
- The service name.
-
getPort
public static ServerPort getPort(String portId)
Returns theServerPort
associated with the given portId or null, none exist.- Parameters:
portId
- The id of the server port.
-
getPorts
public static Set<ServerPort> getPorts()
Returns all registeredServerPort
s.- Returns:
-
-