blob: 8d21e601362353341e0343ac8f2bcc2b50d2a8f0 [file] [log] [blame]
Sithara Punnassery112ed822016-10-24 14:55:19 -07001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.store.primitives.impl;
17
18import org.onosproject.store.primitives.DistributedPrimitiveCreator;
19import org.onosproject.store.service.AsyncDocumentTree;
20import org.onosproject.store.service.DocumentTreeBuilder;
21
22/**
23 * Default {@link AsyncDocumentTree} builder.
24 *
25 * @param <V> type for document tree value
26 */
27public class DefaultDocumentTreeBuilder<V> extends DocumentTreeBuilder<V> {
28
29 private final DistributedPrimitiveCreator primitiveCreator;
30
31 public DefaultDocumentTreeBuilder(DistributedPrimitiveCreator primitiveCreator) {
32 this.primitiveCreator = primitiveCreator;
33 }
34
35 @Override
36 public AsyncDocumentTree<V> buildDocumentTree() {
37 return primitiveCreator.newAsyncDocumentTree(name(), serializer());
38 }
39
40 //TODO
41 /*
42 public ConsistentDocumentTree<V> build() {
43 return buildDocumentTree().asDocumentTree();
44 }
45 }*/
46 //writing a dummy implementation till we have ConsistentDocumentTree.
47 @Deprecated
48 @Override
49 public AsyncDocumentTree<V> build() {
Jordan Halterman2bf177c2017-06-29 01:49:08 -070050 return primitiveCreator.newAsyncDocumentTree(name(), serializer());
Sithara Punnassery112ed822016-10-24 14:55:19 -070051 }
52}