Package org.opentcs.access.rmi.services
Class RemoteKernelServicePortalProxy
java.lang.Object
org.opentcs.access.rmi.services.RemoteKernelServicePortalProxy
- All Implemented Interfaces:
KernelServicePortal
,ServiceListener
public class RemoteKernelServicePortalProxy extends java.lang.Object implements KernelServicePortal, ServiceListener
The default implementation for the
KernelServicePortal
.-
Constructor Summary
Constructors Constructor Description RemoteKernelServicePortalProxy(java.lang.String userName, java.lang.String password, SocketFactoryProvider socketFactoryProvider, java.util.function.Predicate<java.lang.Object> eventFilter)
Creates a new instance. -
Method Summary
Modifier and Type Method Description java.util.List<java.lang.Object>
fetchEvents(long timeout)
Fetches events buffered for the client.DispatcherService
getDispatcherService()
Returns the service a client can use to access methods regarding the dispatcher.NotificationService
getNotificationService()
Returns the service a client can use to access methods regarding user notifications.PeripheralDispatcherService
getPeripheralDispatcherService()
Returns the service a client can use to access methods regarding the peripheral dispatcher.PeripheralJobService
getPeripheralJobService()
Returns the service a client can use to access methods regarding peripheral jobs.PeripheralService
getPeripheralService()
Returns the service a client can use to access methods regarding peripherals.PlantModelService
getPlantModelService()
Returns the service a client can use to access methods regarding the plant model.QueryService
getQueryService()
Returns the service a client can use to access methods for generic queries.RouterService
getRouterService()
Returns the service a client can use to access methods regarding the router.SchedulerService
getSchedulerService()
Deprecated.ServiceListener
getServiceListener()
Kernel.State
getState()
Returns the current state of the kernel.TransportOrderService
getTransportOrderService()
Returns the service a client can use to access methods regarding transport orders and order sequences.VehicleService
getVehicleService()
Returns the service a client can use to access methods regarding vehicles.void
login(java.lang.String hostName, int port)
Logs in with/establishes a connection to the remote kernel service portal.void
logout()
Logs out from/clears the connection to the remote kernel service portal.void
onServiceUnavailable()
Notifies a listener that the service is unavailable, i.e.void
publishEvent(java.lang.Object event)
Publishes an event.org.opentcs.access.rmi.services.AbstractRemoteServiceProxy<R>
setServiceListener(ServiceListener serviceListener)
Sets the listener that is interested in updates of this service.
-
Constructor Details
-
RemoteKernelServicePortalProxy
public RemoteKernelServicePortalProxy(@Nonnull java.lang.String userName, @Nonnull java.lang.String password, @Nonnull SocketFactoryProvider socketFactoryProvider, @Nonnull java.util.function.Predicate<java.lang.Object> eventFilter)Creates a new instance.- Parameters:
userName
- The user name used with the remote portal.password
- The password used with the remote portal.socketFactoryProvider
- Provides socket factories used for RMI.eventFilter
- The event filter to be applied to events on the server side.
-
-
Method Details
-
getServiceListener
-
onServiceUnavailable
public void onServiceUnavailable()Description copied from interface:ServiceListener
Notifies a listener that the service is unavailable, i.e. is not in a usable state.- Specified by:
onServiceUnavailable
in interfaceServiceListener
-
login
public void login(@Nonnull java.lang.String hostName, int port) throws CredentialsException, ServiceUnavailableExceptionDescription copied from interface:KernelServicePortal
Logs in with/establishes a connection to the remote kernel service portal.- Specified by:
login
in interfaceKernelServicePortal
- Parameters:
hostName
- The host on which the remote portal is running.port
- The port at which we can reach the remote RMI registry.- Throws:
CredentialsException
ServiceUnavailableException
-
logout
public void logout()Description copied from interface:KernelServicePortal
Logs out from/clears the connection to the remote kernel service portal.- Specified by:
logout
in interfaceKernelServicePortal
-
getState
Description copied from interface:KernelServicePortal
Returns the current state of the kernel.- Specified by:
getState
in interfaceKernelServicePortal
- Returns:
- The current state of the kernel.
- Throws:
KernelRuntimeException
- In case there is an exception executing this method.
-
fetchEvents
Description copied from interface:KernelServicePortal
Fetches events buffered for the client.- Specified by:
fetchEvents
in interfaceKernelServicePortal
- Parameters:
timeout
- A timeout (in ms) for which to wait for events to arrive.- Returns:
- A list of events (in the order they arrived).
- Throws:
KernelRuntimeException
- In case there is an exception executing this method.
-
publishEvent
Description copied from interface:KernelServicePortal
Publishes an event.- Specified by:
publishEvent
in interfaceKernelServicePortal
- Parameters:
event
- The event to be published.- Throws:
KernelRuntimeException
- In case there is an exception executing this method.
-
getPlantModelService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding the plant model.- Specified by:
getPlantModelService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding the plant model.
-
getTransportOrderService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding transport orders and order sequences.- Specified by:
getTransportOrderService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding transport orders and order sequences.
-
getVehicleService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding vehicles.- Specified by:
getVehicleService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding vehicles.
-
getNotificationService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding user notifications.- Specified by:
getNotificationService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding user notifications.
-
getDispatcherService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding the dispatcher.- Specified by:
getDispatcherService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding the dispatcher.
-
getRouterService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding the router.- Specified by:
getRouterService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding the router.
-
getQueryService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods for generic queries.- Specified by:
getQueryService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods for generic queries.
-
getSchedulerService
Deprecated.Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding the scheduler.- Specified by:
getSchedulerService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding the scheduler.
-
getPeripheralService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding peripherals.- Specified by:
getPeripheralService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding peripherals.
-
getPeripheralJobService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding peripheral jobs.- Specified by:
getPeripheralJobService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding peripheral jobs.
-
getPeripheralDispatcherService
Description copied from interface:KernelServicePortal
Returns the service a client can use to access methods regarding the peripheral dispatcher.- Specified by:
getPeripheralDispatcherService
in interfaceKernelServicePortal
- Returns:
- The service a client can use to access methods regarding the peripheral dispatcher.
-
setServiceListener
public org.opentcs.access.rmi.services.AbstractRemoteServiceProxy<R> setServiceListener(ServiceListener serviceListener)Sets the listener that is interested in updates of this service.- Parameters:
serviceListener
- The service listener.- Returns:
- This remote service proxy.
-