1 package org.opendaylight.controller.sal.dom.broker
4 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
5 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
6 import java.util.concurrent.ConcurrentMap
7 import java.util.concurrent.ConcurrentHashMap
8 import static com.google.common.base.Preconditions.*;
9 import org.opendaylight.controller.sal.core.api.data.DataProviderService
10 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener
11 import org.opendaylight.yangtools.concepts.util.ListenerRegistry
13 class MountPointManagerImpl implements MountProvisionService {
16 DataProviderService dataBroker;
18 val ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create()
20 ConcurrentMap<InstanceIdentifier,MountPointImpl> mounts = new ConcurrentHashMap();
22 override createMountPoint(InstanceIdentifier path) {
23 checkState(!mounts.containsKey(path),"Mount already created");
24 val mount = new MountPointImpl(path);
25 registerMountPoint(mount);
26 mounts.put(path,mount);
27 notifyMountCreated(path);
31 def notifyMountCreated(InstanceIdentifier identifier) {
32 for(listener : listeners) {
33 listener.instance.onMountPointCreated(identifier);
37 def registerMountPoint(MountPointImpl impl) {
38 dataBroker?.registerConfigurationReader(impl.mountPath,impl.readWrapper);
39 dataBroker?.registerOperationalReader(impl.mountPath,impl.readWrapper);
43 override registerProvisionListener(MountProvisionListener listener) {
44 listeners.register(listener)
48 override createOrGetMountPoint(InstanceIdentifier path) {
49 val mount = mounts.get(path);
51 return createMountPoint(path)
57 override getMountPoint(InstanceIdentifier path) {