2 * Copyright (c) 2014, 2015 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
9 package org.opendaylight.controller.md.sal.dom.broker.spi.mount;
11 import com.google.common.base.Optional;
12 import com.google.common.collect.ClassToInstanceMap;
13 import com.google.common.collect.ImmutableClassToInstanceMap;
14 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
15 import org.opendaylight.controller.md.sal.dom.api.DOMService;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 public final class SimpleDOMMountPoint implements DOMMountPoint {
21 private final YangInstanceIdentifier identifier;
22 private final ClassToInstanceMap<DOMService> services;
23 private final SchemaContext schemaContext;
25 public static SimpleDOMMountPoint create(final YangInstanceIdentifier identifier,
26 final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
27 return new SimpleDOMMountPoint(identifier, services, ctx);
30 private SimpleDOMMountPoint(final YangInstanceIdentifier identifier,
31 final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) {
32 this.identifier = identifier;
33 this.services = ImmutableClassToInstanceMap.copyOf(services);
34 this.schemaContext = ctx;
38 public YangInstanceIdentifier getIdentifier() {
43 public SchemaContext getSchemaContext() {
48 public <T extends DOMService> Optional<T> getService(final Class<T> cls) {
49 return Optional.fromNullable(services.getInstance(cls));