Merge "Added Inventory Reader for SwitchManager"
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / sal / dom / broker / MountPointManagerImpl.xtend
1 package org.opendaylight.controller.sal.dom.broker
2
3
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
10 class MountPointManagerImpl implements MountProvisionService {
11     
12     ConcurrentMap<InstanceIdentifier,MountPointImpl> mounts = new ConcurrentHashMap();
13     
14     override createMountPoint(InstanceIdentifier path) {
15         checkState(!mounts.containsKey(path),"Mount already created");
16         val mount = new MountPointImpl(path);
17         mounts.put(path,mount);
18     }
19     
20     
21     override createOrGetMountPoint(InstanceIdentifier path) {
22         val mount = mounts.get(path);
23         if(mount === null) {
24             return createMountPoint(path)
25         }
26         return mount;
27     }
28     
29     
30     override getMountPoint(InstanceIdentifier path) {
31         mounts.get(path);
32     }
33     
34     
35 }