2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.dom.broker
11 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier
13 import java.util.concurrent.ConcurrentMap
14 import java.util.concurrent.ConcurrentHashMap
15 import static com.google.common.base.Preconditions.*;
16 import org.opendaylight.controller.sal.core.api.data.DataProviderService
17 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService.MountProvisionListener
18 import org.opendaylight.yangtools.concepts.util.ListenerRegistry
20 class MountPointManagerImpl implements MountProvisionService {
23 DataProviderService dataBroker;
25 val ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create()
27 ConcurrentMap<InstanceIdentifier,MountPointImpl> mounts = new ConcurrentHashMap();
29 override createMountPoint(InstanceIdentifier path) {
30 checkState(!mounts.containsKey(path),"Mount already created");
31 val mount = new MountPointImpl(path);
32 registerMountPoint(mount);
33 mounts.put(path,mount);
34 notifyMountCreated(path);
38 def notifyMountCreated(InstanceIdentifier identifier) {
39 for(listener : listeners) {
40 listener.instance.onMountPointCreated(identifier);
44 def registerMountPoint(MountPointImpl impl) {
45 //dataBroker?.registerConfigurationReader(impl.mountPath,impl.readWrapper);
46 //dataBroker?.registerOperationalReader(impl.mountPath,impl.readWrapper);
50 override registerProvisionListener(MountProvisionListener listener) {
51 listeners.register(listener)
55 override createOrGetMountPoint(InstanceIdentifier path) {
56 val mount = mounts.get(path);
58 return createMountPoint(path)
64 override getMountPoint(InstanceIdentifier path) {