pom clean up and Remove unsed code
Change-Id: Ifdd44b91c92a2cb469e6d204d1e91e6f8e0a9f9e
Showing
5 changed files
with
8 additions
and
231 deletions
... | @@ -53,12 +53,6 @@ | ... | @@ -53,12 +53,6 @@ |
53 | 53 | ||
54 | <dependency> | 54 | <dependency> |
55 | <groupId>org.onosproject</groupId> | 55 | <groupId>org.onosproject</groupId> |
56 | - <artifactId>onlab-nio</artifactId> | ||
57 | - <version>${project.version}</version> | ||
58 | - </dependency> | ||
59 | - | ||
60 | - <dependency> | ||
61 | - <groupId>org.onosproject</groupId> | ||
62 | <artifactId>onlab-misc</artifactId> | 56 | <artifactId>onlab-misc</artifactId> |
63 | <version>${project.version}</version> | 57 | <version>${project.version}</version> |
64 | </dependency> | 58 | </dependency> |
... | @@ -75,15 +69,10 @@ | ... | @@ -75,15 +69,10 @@ |
75 | </dependency> | 69 | </dependency> |
76 | 70 | ||
77 | <dependency> | 71 | <dependency> |
78 | - <groupId>org.mapdb</groupId> | ||
79 | - <artifactId>mapdb</artifactId> | ||
80 | - <version>1.0.8</version> | ||
81 | - </dependency> | ||
82 | - | ||
83 | - <dependency> | ||
84 | <groupId>com.fasterxml.jackson.core</groupId> | 72 | <groupId>com.fasterxml.jackson.core</groupId> |
85 | <artifactId>jackson-databind</artifactId> | 73 | <artifactId>jackson-databind</artifactId> |
86 | </dependency> | 74 | </dependency> |
75 | + | ||
87 | <dependency> | 76 | <dependency> |
88 | <groupId>com.fasterxml.jackson.core</groupId> | 77 | <groupId>com.fasterxml.jackson.core</groupId> |
89 | <artifactId>jackson-annotations</artifactId> | 78 | <artifactId>jackson-annotations</artifactId> |
... | @@ -94,26 +83,23 @@ | ... | @@ -94,26 +83,23 @@ |
94 | <artifactId>guava-testlib</artifactId> | 83 | <artifactId>guava-testlib</artifactId> |
95 | <scope>test</scope> | 84 | <scope>test</scope> |
96 | </dependency> | 85 | </dependency> |
86 | + | ||
97 | <dependency> | 87 | <dependency> |
98 | <groupId>org.apache.commons</groupId> | 88 | <groupId>org.apache.commons</groupId> |
99 | <artifactId>commons-lang3</artifactId> | 89 | <artifactId>commons-lang3</artifactId> |
100 | </dependency> | 90 | </dependency> |
91 | + | ||
101 | <dependency> | 92 | <dependency> |
102 | <groupId>org.easymock</groupId> | 93 | <groupId>org.easymock</groupId> |
103 | <artifactId>easymock</artifactId> | 94 | <artifactId>easymock</artifactId> |
104 | <scope>test</scope> | 95 | <scope>test</scope> |
105 | </dependency> | 96 | </dependency> |
97 | + | ||
106 | <dependency> | 98 | <dependency> |
107 | <groupId>org.onosproject</groupId> | 99 | <groupId>org.onosproject</groupId> |
108 | <artifactId>onos-api</artifactId> | 100 | <artifactId>onos-api</artifactId> |
109 | <classifier>tests</classifier> | 101 | <classifier>tests</classifier> |
110 | <scope>test</scope> | 102 | <scope>test</scope> |
111 | </dependency> | 103 | </dependency> |
112 | - | ||
113 | - <!-- for shaded copycat --> | ||
114 | - <dependency> | ||
115 | - <groupId>org.onosproject</groupId> | ||
116 | - <artifactId>onlab-thirdparty</artifactId> | ||
117 | - </dependency> | ||
118 | </dependencies> | 104 | </dependencies> |
119 | </project> | 105 | </project> | ... | ... |
1 | -/* | ||
2 | - * Copyright 2015 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 | - */ | ||
16 | -package org.onosproject.store.cluster.messaging.impl; | ||
17 | - | ||
18 | -import org.apache.felix.scr.annotations.Activate; | ||
19 | -import org.apache.felix.scr.annotations.Deactivate; | ||
20 | -import org.apache.felix.scr.annotations.Reference; | ||
21 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
22 | -import org.apache.felix.scr.annotations.Service; | ||
23 | -import org.onlab.nio.service.IOLoopMessaging; | ||
24 | -import org.onosproject.cluster.ClusterMetadataService; | ||
25 | -import org.onosproject.cluster.ControllerNode; | ||
26 | -import org.onosproject.store.cluster.messaging.Endpoint; | ||
27 | -import org.slf4j.Logger; | ||
28 | -import org.slf4j.LoggerFactory; | ||
29 | - | ||
30 | -/** | ||
31 | - * IOLoop based MessagingService. | ||
32 | - */ | ||
33 | -//@Component(immediate = true, enabled = false) | ||
34 | -@Service | ||
35 | -public class IOLoopMessagingManager extends IOLoopMessaging { | ||
36 | - | ||
37 | - private final Logger log = LoggerFactory.getLogger(getClass()); | ||
38 | - | ||
39 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
40 | - protected ClusterMetadataService clusterMetadataService; | ||
41 | - | ||
42 | - @Activate | ||
43 | - public void activate() throws Exception { | ||
44 | - ControllerNode localNode = clusterMetadataService.getLocalNode(); | ||
45 | - super.start(new Endpoint(localNode.ip(), localNode.tcpPort())); | ||
46 | - log.info("Started"); | ||
47 | - } | ||
48 | - | ||
49 | - @Deactivate | ||
50 | - public void deactivate() throws Exception { | ||
51 | - super.stop(); | ||
52 | - log.info("Stopped"); | ||
53 | - } | ||
54 | -} |
... | @@ -37,30 +37,25 @@ | ... | @@ -37,30 +37,25 @@ |
37 | <groupId>org.onosproject</groupId> | 37 | <groupId>org.onosproject</groupId> |
38 | <artifactId>onos-api</artifactId> | 38 | <artifactId>onos-api</artifactId> |
39 | </dependency> | 39 | </dependency> |
40 | - | 40 | + |
41 | <dependency> | 41 | <dependency> |
42 | <groupId>org.onosproject</groupId> | 42 | <groupId>org.onosproject</groupId> |
43 | <artifactId>onos-core-common</artifactId> | 43 | <artifactId>onos-core-common</artifactId> |
44 | <version>${project.version}</version> | 44 | <version>${project.version}</version> |
45 | </dependency> | 45 | </dependency> |
46 | - | 46 | + |
47 | <dependency> | 47 | <dependency> |
48 | <groupId>org.onosproject</groupId> | 48 | <groupId>org.onosproject</groupId> |
49 | <artifactId>onos-core-serializers</artifactId> | 49 | <artifactId>onos-core-serializers</artifactId> |
50 | <version>${project.version}</version> | 50 | <version>${project.version}</version> |
51 | </dependency> | 51 | </dependency> |
52 | - | 52 | + |
53 | - <dependency> | ||
54 | - <groupId>org.mapdb</groupId> | ||
55 | - <artifactId>mapdb</artifactId> | ||
56 | - <version>1.0.8</version> | ||
57 | - </dependency> | ||
58 | - | ||
59 | <dependency> | 53 | <dependency> |
60 | <groupId>org.easymock</groupId> | 54 | <groupId>org.easymock</groupId> |
61 | <artifactId>easymock</artifactId> | 55 | <artifactId>easymock</artifactId> |
62 | <scope>test</scope> | 56 | <scope>test</scope> |
63 | </dependency> | 57 | </dependency> |
58 | + | ||
64 | <dependency> | 59 | <dependency> |
65 | <groupId>org.onosproject</groupId> | 60 | <groupId>org.onosproject</groupId> |
66 | <artifactId>onos-api</artifactId> | 61 | <artifactId>onos-api</artifactId> | ... | ... |
1 | -/* | ||
2 | - * Copyright 2015 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 | - */ | ||
16 | - | ||
17 | -package org.onosproject.store.primitives.impl; | ||
18 | - | ||
19 | -import org.mapdb.DB; | ||
20 | -import org.mapdb.DBMaker; | ||
21 | -import org.mapdb.Hasher; | ||
22 | -import org.mapdb.Serializer; | ||
23 | -import org.onosproject.store.serializers.KryoSerializer; | ||
24 | - | ||
25 | -import java.io.File; | ||
26 | -import java.util.Map; | ||
27 | -import java.util.concurrent.ExecutorService; | ||
28 | - | ||
29 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
30 | - | ||
31 | -/** | ||
32 | - * MapDB based implementation of a persistent store. | ||
33 | - */ | ||
34 | -class MapDbPersistentStore<K, V> implements PersistentStore<K, V> { | ||
35 | - | ||
36 | - private final ExecutorService executor; | ||
37 | - private final KryoSerializer serializer; | ||
38 | - | ||
39 | - private final DB database; | ||
40 | - | ||
41 | - private final Map<byte[], byte[]> items; | ||
42 | - | ||
43 | - /** | ||
44 | - * Creates a new MapDB based persistent store. | ||
45 | - * | ||
46 | - * @param filename filename of the database on disk | ||
47 | - * @param executor executor to use for tasks that write to the disk | ||
48 | - * @param serializer serializer for keys and values | ||
49 | - */ | ||
50 | - MapDbPersistentStore(String filename, ExecutorService executor, | ||
51 | - KryoSerializer serializer) { | ||
52 | - this.executor = checkNotNull(executor); | ||
53 | - this.serializer = checkNotNull(serializer); | ||
54 | - | ||
55 | - File databaseFile = new File(filename); | ||
56 | - | ||
57 | - database = DBMaker.newFileDB(databaseFile).make(); | ||
58 | - | ||
59 | - items = database.createHashMap("items") | ||
60 | - .keySerializer(Serializer.BYTE_ARRAY) | ||
61 | - .valueSerializer(Serializer.BYTE_ARRAY) | ||
62 | - .hasher(Hasher.BYTE_ARRAY) | ||
63 | - .makeOrGet(); | ||
64 | - } | ||
65 | - | ||
66 | - @Override | ||
67 | - public void readInto(Map<K, MapValue<V>> items) { | ||
68 | - this.items.forEach((keyBytes, valueBytes) -> | ||
69 | - items.put(serializer.decode(keyBytes), | ||
70 | - serializer.decode(valueBytes))); | ||
71 | - } | ||
72 | - | ||
73 | - @Override | ||
74 | - public void update(K key, MapValue<V> value) { | ||
75 | - executor.submit(() -> updateInternal(key, value)); | ||
76 | - } | ||
77 | - | ||
78 | - @Override | ||
79 | - public void remove(K key) { | ||
80 | - executor.submit(() -> removeInternal(key)); | ||
81 | - } | ||
82 | - | ||
83 | - private void updateInternal(K key, MapValue<V> newValue) { | ||
84 | - byte[] keyBytes = serializer.encode(key); | ||
85 | - | ||
86 | - items.compute(keyBytes, (k, existingBytes) -> { | ||
87 | - MapValue<V> existing = existingBytes == null ? null : | ||
88 | - serializer.decode(existingBytes); | ||
89 | - if (existing == null || newValue.isNewerThan(existing)) { | ||
90 | - return serializer.encode(newValue); | ||
91 | - } else { | ||
92 | - return existingBytes; | ||
93 | - } | ||
94 | - }); | ||
95 | - database.commit(); | ||
96 | - } | ||
97 | - | ||
98 | - private void removeInternal(K key) { | ||
99 | - byte[] keyBytes = serializer.encode(key); | ||
100 | - items.remove(keyBytes); | ||
101 | - database.commit(); | ||
102 | - } | ||
103 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -/* | ||
2 | - * Copyright 2015 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 | - */ | ||
16 | - | ||
17 | -package org.onosproject.store.primitives.impl; | ||
18 | - | ||
19 | -import java.util.Map; | ||
20 | - | ||
21 | -/** | ||
22 | - * A persistent store for an eventually consistent map. | ||
23 | - */ | ||
24 | -interface PersistentStore<K, V> { | ||
25 | - | ||
26 | - /** | ||
27 | - * Read the contents of the disk into the given maps. | ||
28 | - * | ||
29 | - * @param items items map | ||
30 | - */ | ||
31 | - void readInto(Map<K, MapValue<V>> items); | ||
32 | - | ||
33 | - /** | ||
34 | - * Updates a key,value pair in the persistent store. | ||
35 | - * | ||
36 | - * @param key the key | ||
37 | - * @param value the value | ||
38 | - */ | ||
39 | - void update(K key, MapValue<V> value); | ||
40 | - | ||
41 | - /** | ||
42 | - * Removes a key from persistent store. | ||
43 | - * | ||
44 | - * @param key the key to remove | ||
45 | - */ | ||
46 | - void remove(K key); | ||
47 | -} |
-
Please register or login to post a comment