diff options
author | CNlucius <lukai1@huawei.com> | 2016-09-13 11:40:12 +0800 |
---|---|---|
committer | CNlucius <lukai1@huawei.com> | 2016-09-13 11:41:53 +0800 |
commit | b731e2f1dd0972409b136aebc7b463dd72c9cfad (patch) | |
tree | 5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom | |
parent | ee93993458266114c29271a481ef9ce7ce621b2a (diff) |
ONOSFW-171
O/S-SFC-ONOS scenario documentation
Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom')
5 files changed, 0 insertions, 214 deletions
diff --git a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/ClusterMessageSerializer.java b/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/ClusterMessageSerializer.java deleted file mode 100644 index 76bf7984..00000000 --- a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/ClusterMessageSerializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.store.serializers.custom; - -import org.onosproject.cluster.NodeId; -import org.onosproject.store.cluster.messaging.ClusterMessage; -import org.onosproject.store.cluster.messaging.MessageSubject; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; - -public final class ClusterMessageSerializer extends Serializer<ClusterMessage> { - - /** - * Creates a serializer for {@link ClusterMessage}. - */ - public ClusterMessageSerializer() { - // does not accept null - super(false); - } - - @Override - public void write(Kryo kryo, Output output, ClusterMessage message) { - kryo.writeClassAndObject(output, message.sender()); - kryo.writeClassAndObject(output, message.subject()); - output.writeInt(message.payload().length); - output.writeBytes(message.payload()); - } - - @Override - public ClusterMessage read(Kryo kryo, Input input, - Class<ClusterMessage> type) { - NodeId sender = (NodeId) kryo.readClassAndObject(input); - MessageSubject subject = (MessageSubject) kryo.readClassAndObject(input); - int payloadSize = input.readInt(); - byte[] payload = input.readBytes(payloadSize); - return new ClusterMessage(sender, subject, payload); - } -} diff --git a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/DistributedStoreSerializers.java b/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/DistributedStoreSerializers.java deleted file mode 100644 index 5465b9b4..00000000 --- a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/DistributedStoreSerializers.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.store.serializers.custom; - -import org.onosproject.store.impl.MastershipBasedTimestamp; -import org.onosproject.store.impl.Timestamped; -import org.onosproject.store.service.WallClockTimestamp; -import org.onosproject.store.serializers.KryoNamespaces; -import org.onlab.util.KryoNamespace; - -public final class DistributedStoreSerializers { - - - public static final int STORE_CUSTOM_BEGIN = KryoNamespaces.BEGIN_USER_CUSTOM_ID + 10; - - /** - * KryoNamespace which can serialize ON.lab misc classes. - */ - public static final KryoNamespace STORE_COMMON = KryoNamespace.newBuilder() - .register(KryoNamespaces.API) - .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID) - .register(Timestamped.class) - .register(new MastershipBasedTimestampSerializer(), MastershipBasedTimestamp.class) - .register(WallClockTimestamp.class) - .build(); - - // avoid instantiation - private DistributedStoreSerializers() {} -} diff --git a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MastershipBasedTimestampSerializer.java b/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MastershipBasedTimestampSerializer.java deleted file mode 100644 index eb1b2b55..00000000 --- a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MastershipBasedTimestampSerializer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014-2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.store.serializers.custom; - -import org.onosproject.store.impl.MastershipBasedTimestamp; - -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; - -// To be used if Timestamp ever needs to cross bundle boundary. -/** - * Kryo Serializer for {@link MastershipBasedTimestamp}. - */ -public class MastershipBasedTimestampSerializer extends Serializer<MastershipBasedTimestamp> { - - /** - * Creates a serializer for {@link MastershipBasedTimestamp}. - */ - public MastershipBasedTimestampSerializer() { - // non-null, immutable - super(false, true); - } - - @Override - public void write(Kryo kryo, Output output, MastershipBasedTimestamp object) { - output.writeLong(object.termNumber()); - output.writeLong(object.sequenceNumber()); - } - - @Override - public MastershipBasedTimestamp read(Kryo kryo, Input input, Class<MastershipBasedTimestamp> type) { - final long term = input.readLong(); - final long sequence = input.readLong(); - return new MastershipBasedTimestamp(term, sequence); - } -} diff --git a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MessageSubjectSerializer.java b/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MessageSubjectSerializer.java deleted file mode 100644 index 7ddee1b9..00000000 --- a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/MessageSubjectSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.store.serializers.custom; - -import org.onosproject.store.cluster.messaging.MessageSubject; - -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; - -public final class MessageSubjectSerializer extends Serializer<MessageSubject> { - - /** - * Creates a serializer for {@link MessageSubject}. - */ - public MessageSubjectSerializer() { - // non-null, immutable - super(false, true); - } - - - @Override - public void write(Kryo kryo, Output output, MessageSubject object) { - output.writeString(object.value()); - } - - @Override - public MessageSubject read(Kryo kryo, Input input, - Class<MessageSubject> type) { - return new MessageSubject(input.readString()); - } -} diff --git a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/package-info.java b/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/package-info.java deleted file mode 100644 index 5cd4bee6..00000000 --- a/framework/src/onos/core/store/dist/src/main/java/org/onosproject/store/serializers/custom/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2014 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Cluster messaging and distributed store serializers. - */ -//FIXME what is the right name for this package? -//FIXME can this be moved to onos-core-serializers? -package org.onosproject.store.serializers.custom; |