}
@SuppressWarnings("unchecked") //$NON-NLS-1$
private void exportObject(Class cInterface, Object objImplementation, String instanceId) throws LipeRMIException {
if (!cInterface.isAssignableFrom(objImplementation.getClass()))
throw new LipeRMIException(String.format("Class %s is not assignable from %s", objImplementation.getClass().getName(), cInterface.getName())); //$NON-NLS-1$
for (RemoteInstance remoteInstance : exportedObjects.keySet()) {
if ((remoteInstance.getInstanceId() == instanceId || (remoteInstance.getInstanceId() != null && remoteInstance.getInstanceId().equals(instanceId))) && remoteInstance.getClassName().equals(cInterface.getName())) {
throw new LipeRMIException(String.format("Class %s already has a implementation class", cInterface.getName())); //$NON-NLS-1$
}
}
RemoteInstance remoteInstance = new RemoteInstance(instanceId, cInterface.getName());
exportedObjects.put(remoteInstance, objImplementation);