org.opentcs.access.rmi.services.RemoteTCSObjectServiceProxy Maven / Gradle / Ivy
/**
* Copyright (c) The openTCS Authors.
*
* This program is free software and subject to the MIT license. (For details,
* see the licensing information (LICENSE.txt) you should have received with
* this copy of the software.)
*/
package org.opentcs.access.rmi.services;
import java.rmi.RemoteException;
import java.util.Set;
import java.util.function.Predicate;
import org.opentcs.access.KernelRuntimeException;
import org.opentcs.components.kernel.services.TCSObjectService;
import org.opentcs.data.ObjectHistory;
import org.opentcs.data.ObjectUnknownException;
import org.opentcs.data.TCSObject;
import org.opentcs.data.TCSObjectReference;
/**
* The default implementation of the tcs object service.
* Delegates method invocations to the corresponding remote service.
*
* @author Martin Grzenia (Fraunhofer IML)
* @param The remote service's type.
*/
abstract class RemoteTCSObjectServiceProxy
extends AbstractRemoteServiceProxy
implements TCSObjectService {
@Override
public > T fetchObject(Class clazz, TCSObjectReference ref)
throws KernelRuntimeException {
checkServiceAvailability();
try {
return getRemoteService().fetchObject(getClientId(), clazz, ref);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
@Override
public > T fetchObject(Class clazz, String name)
throws KernelRuntimeException {
checkServiceAvailability();
try {
return getRemoteService().fetchObject(getClientId(), clazz, name);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
@Override
public > Set fetchObjects(Class clazz)
throws KernelRuntimeException {
checkServiceAvailability();
try {
return getRemoteService().fetchObjects(getClientId(), clazz);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
@Override
public > Set fetchObjects(Class clazz,
Predicate super T> predicate)
throws KernelRuntimeException {
checkServiceAvailability();
try {
return getRemoteService().fetchObjects(getClientId(), clazz, predicate);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
@Override
public void updateObjectProperty(TCSObjectReference> ref, String key, String value)
throws ObjectUnknownException, KernelRuntimeException {
checkServiceAvailability();
try {
getRemoteService().updateObjectProperty(getClientId(), ref, key, value);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
@Override
public void appendObjectHistoryEntry(TCSObjectReference> ref, ObjectHistory.Entry entry)
throws ObjectUnknownException, KernelRuntimeException {
checkServiceAvailability();
try {
getRemoteService().appendObjectHistoryEntry(getClientId(), ref, entry);
}
catch (RemoteException ex) {
throw findSuitableExceptionFor(ex);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy