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.DispatcherServicegetDispatcherService()Returns the service a client can use to access methods regarding the dispatcher.NotificationServicegetNotificationService()Returns the service a client can use to access methods regarding user notifications.PeripheralDispatcherServicegetPeripheralDispatcherService()Returns the service a client can use to access methods regarding the peripheral dispatcher.PeripheralJobServicegetPeripheralJobService()Returns the service a client can use to access methods regarding peripheral jobs.PeripheralServicegetPeripheralService()Returns the service a client can use to access methods regarding peripherals.PlantModelServicegetPlantModelService()Returns the service a client can use to access methods regarding the plant model.QueryServicegetQueryService()Returns the service a client can use to access methods for generic queries.RouterServicegetRouterService()Returns the service a client can use to access methods regarding the router.SchedulerServicegetSchedulerService()Returns the service a client can use to access methods regarding the scheduler.ServiceListenergetServiceListener()Kernel.StategetState()Returns the current state of the kernel.TransportOrderServicegetTransportOrderService()Returns the service a client can use to access methods regarding transport orders and order sequences.VehicleServicegetVehicleService()Returns the service a client can use to access methods regarding vehicles.voidlogin(java.lang.String hostName, int port)Logs in with/establishes a connection to the remote kernel service portal.voidlogout()Logs out from/clears the connection to the remote kernel service portal.voidonServiceUnavailable()Notifies a listener that the service is unavailable, i.e.voidpublishEvent(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:ServiceListenerNotifies a listener that the service is unavailable, i.e. is not in a usable state.- Specified by:
onServiceUnavailablein interfaceServiceListener
-
login
public void login(@Nonnull java.lang.String hostName, int port) throws CredentialsException, ServiceUnavailableExceptionDescription copied from interface:KernelServicePortalLogs in with/establishes a connection to the remote kernel service portal.- Specified by:
loginin 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:
CredentialsExceptionServiceUnavailableException
-
logout
public void logout()Description copied from interface:KernelServicePortalLogs out from/clears the connection to the remote kernel service portal.- Specified by:
logoutin interfaceKernelServicePortal
-
getState
Description copied from interface:KernelServicePortalReturns the current state of the kernel.- Specified by:
getStatein interfaceKernelServicePortal- Returns:
- The current state of the kernel.
- Throws:
KernelRuntimeException- In case there is an exception executing this method.
-
fetchEvents
Description copied from interface:KernelServicePortalFetches events buffered for the client.- Specified by:
fetchEventsin 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:KernelServicePortalPublishes an event.- Specified by:
publishEventin interfaceKernelServicePortal- Parameters:
event- The event to be published.- Throws:
KernelRuntimeException- In case there is an exception executing this method.
-
getPlantModelService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding the plant model.- Specified by:
getPlantModelServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding the plant model.
-
getTransportOrderService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding transport orders and order sequences.- Specified by:
getTransportOrderServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding transport orders and order sequences.
-
getVehicleService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding vehicles.- Specified by:
getVehicleServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding vehicles.
-
getNotificationService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding user notifications.- Specified by:
getNotificationServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding user notifications.
-
getDispatcherService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding the dispatcher.- Specified by:
getDispatcherServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding the dispatcher.
-
getRouterService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding the router.- Specified by:
getRouterServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding the router.
-
getQueryService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods for generic queries.- Specified by:
getQueryServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods for generic queries.
-
getSchedulerService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding the scheduler.- Specified by:
getSchedulerServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding the scheduler.
-
getPeripheralService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding peripherals.- Specified by:
getPeripheralServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding peripherals.
-
getPeripheralJobService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding peripheral jobs.- Specified by:
getPeripheralJobServicein interfaceKernelServicePortal- Returns:
- The service a client can use to access methods regarding peripheral jobs.
-
getPeripheralDispatcherService
Description copied from interface:KernelServicePortalReturns the service a client can use to access methods regarding the peripheral dispatcher.- Specified by:
getPeripheralDispatcherServicein 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.
-