com.envision.energy.eos.sdk.AssetServiceImpl Maven / Gradle / Ivy
package com.envision.energy.eos.sdk;
import com.envision.energy.eos.exception.SubscribeException;
import com.google.common.collect.Lists;
import java.util.Collection;
/**
* @author zhensheng.cai
*/
public class AssetServiceImpl implements IAssetService {
@Override
public void subscribe(IAssetHandler handler, int subscribeType, Collection ancestors, Collection cimTypes) throws NullPointerException, SubscribeException {
if(ancestors.isEmpty() && cimTypes.isEmpty()){
throw new SubscribeException("forbidden subscribe data: both ancestors and types empty");
}
ProxyManager.INSTANCE.getAssetProxy().subscribe(handler, subscribeType,ancestors, cimTypes);
}
@Override
public void unsubscribe() throws SubscribeException {
ProxyManager.INSTANCE.getAssetProxy().unsubscribe();
}
@Override
public void unsubscribe(IAssetHandler handler) throws SubscribeException {
ProxyManager.INSTANCE.getAssetProxy().unsubscribe(handler);
}
@Override
public void shutdown() {
ProxyManager.INSTANCE.getAssetProxy().shutdown();
}
@Override
public void subscribeAncestors(IAssetHandler handler, int subscribeType, Collection ancestors)
throws NullPointerException, SubscribeException {
ProxyManager.INSTANCE.getAssetProxy().subscribe(handler, subscribeType, ancestors, Lists.newArrayList());
}
@Override
public void subscribeTypes(IAssetHandler handler, int subscribeType, Collection types)
throws NullPointerException, SubscribeException {
ProxyManager.INSTANCE.getAssetProxy().subscribe(handler, subscribeType, Lists.newArrayList(), types);
}
}