Remove atomix.utils.serializer.serializers 23/104723/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:20:00 +0000 (14:20 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 2 Mar 2023 13:20:43 +0000 (14:20 +0100)
This entire package is only used by Namespace, which in turn is unused.
Remove it to reduce clutter.

JIRA: CONTROLLER-2072
Change-Id: I162e4c6d783d49cb4a209706e193e6d8dc0a0638
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/atomix/storage/pom.xml
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespaces.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ArraysAsListSerializer.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableListSerializer.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableMapSerializer.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableSetSerializer.java [deleted file]
third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/package-info.java [deleted file]

index 110a87e18ed4fb7d931d13c923c0c447f7f1e383..f9a52794707bd5df4d7e00eac114c553ad4500c0 100644 (file)
           <instructions>
             <Export-Package>
               io.atomix.storage.journal.*,
-              io.atomix.utils.serializer.*,
+              io.atomix.utils.serializer,
               com.esotericsoftware.kryo.*;version=4.0.2
             </Export-Package>
             <Import-Package>
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespaces.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/Namespaces.java
deleted file mode 100644 (file)
index f2daecd..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * 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 io.atomix.utils.serializer;
-
-import com.google.common.collect.HashMultiset;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multisets;
-import com.google.common.collect.Sets;
-import io.atomix.utils.serializer.serializers.ArraysAsListSerializer;
-import io.atomix.utils.serializer.serializers.ImmutableListSerializer;
-import io.atomix.utils.serializer.serializers.ImmutableMapSerializer;
-import io.atomix.utils.serializer.serializers.ImmutableSetSerializer;
-
-import java.time.Duration;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.Optional;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-public final class Namespaces {
-  public static final int BASIC_MAX_SIZE = 50;
-  public static final Namespace BASIC = Namespace.builder()
-      .nextId(Namespace.FLOATING_ID)
-      .register(byte[].class)
-      .register(AtomicBoolean.class)
-      .register(AtomicInteger.class)
-      .register(AtomicLong.class)
-      .register(new ImmutableListSerializer(),
-          ImmutableList.class,
-          ImmutableList.of(1).getClass(),
-          ImmutableList.of(1, 2).getClass(),
-          ImmutableList.of(1, 2, 3).subList(1, 3).getClass())
-      .register(new ImmutableSetSerializer(),
-          ImmutableSet.class,
-          ImmutableSet.of().getClass(),
-          ImmutableSet.of(1).getClass(),
-          ImmutableSet.of(1, 2).getClass())
-      .register(new ImmutableMapSerializer(),
-          ImmutableMap.class,
-          ImmutableMap.of().getClass(),
-          ImmutableMap.of("a", 1).getClass(),
-          ImmutableMap.of("R", 2, "D", 2).getClass())
-      .register(Collections.unmodifiableSet(Collections.emptySet()).getClass())
-      .register(HashMap.class)
-      .register(ConcurrentHashMap.class)
-      .register(CopyOnWriteArraySet.class)
-      .register(
-          ArrayList.class,
-          LinkedList.class,
-          HashSet.class,
-          LinkedHashSet.class,
-          ArrayDeque.class
-      )
-      .register(HashMultiset.class)
-      .register(Multisets.immutableEntry("", 0).getClass())
-      .register(Sets.class)
-      .register(Maps.immutableEntry("a", "b").getClass())
-      .register(new ArraysAsListSerializer(), Arrays.asList().getClass())
-      .register(Collections.singletonList(1).getClass())
-      .register(Duration.class)
-      .register(Collections.emptySet().getClass())
-      .register(Optional.class)
-      .register(Collections.emptyList().getClass())
-      .register(Collections.singleton(Object.class).getClass())
-      .register(Properties.class)
-      .register(int[].class)
-      .register(long[].class)
-      .register(short[].class)
-      .register(double[].class)
-      .register(float[].class)
-      .register(char[].class)
-      .register(String[].class)
-      .register(boolean[].class)
-      .register(Object[].class)
-      .build("BASIC");
-
-  /**
-   * Kryo registration Id for user custom registration.
-   */
-  public static final int BEGIN_USER_CUSTOM_ID = 500;
-
-  // not to be instantiated
-  private Namespaces() {
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ArraysAsListSerializer.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ArraysAsListSerializer.java
deleted file mode 100644 (file)
index 9e8dbd6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * 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 io.atomix.utils.serializer.serializers;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Kryo Serializer for {@link java.util.Arrays#asList(Object...)}.
- */
-public final class ArraysAsListSerializer extends Serializer<List<?>> {
-
-  @Override
-  public void write(Kryo kryo, Output output, List<?> object) {
-    output.writeInt(object.size(), true);
-    for (Object elm : object) {
-      kryo.writeClassAndObject(output, elm);
-    }
-  }
-
-  @Override
-  public List<?> read(Kryo kryo, Input input, Class<List<?>> type) {
-    final int size = input.readInt(true);
-    List<Object> list = new ArrayList<>(size);
-    for (int i = 0; i < size; ++i) {
-      list.add(kryo.readClassAndObject(input));
-    }
-    return list;
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableListSerializer.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableListSerializer.java
deleted file mode 100644 (file)
index 3853ef6..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * 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 io.atomix.utils.serializer.serializers;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import com.google.common.collect.ImmutableList;
-
-/**
- * Creates {@link ImmutableList} serializer instance.
- */
-public class ImmutableListSerializer extends Serializer<ImmutableList<?>> {
-
-  /**
-   * Creates {@link ImmutableList} serializer instance.
-   */
-  public ImmutableListSerializer() {
-    // non-null, immutable
-    super(false, true);
-  }
-
-  @Override
-  public void write(Kryo kryo, Output output, ImmutableList<?> object) {
-    output.writeInt(object.size());
-    for (Object e : object) {
-      kryo.writeClassAndObject(output, e);
-    }
-  }
-
-  @Override
-  public ImmutableList<?> read(Kryo kryo, Input input,
-      Class<ImmutableList<?>> type) {
-    final int size = input.readInt();
-    switch (size) {
-      case 0:
-        return ImmutableList.of();
-      case 1:
-        return ImmutableList.of(kryo.readClassAndObject(input));
-      default:
-        Object[] elms = new Object[size];
-        for (int i = 0; i < size; ++i) {
-          elms[i] = kryo.readClassAndObject(input);
-        }
-        return ImmutableList.copyOf(elms);
-    }
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableMapSerializer.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableMapSerializer.java
deleted file mode 100644 (file)
index f3b9ce5..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * 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 io.atomix.utils.serializer.serializers;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-
-import java.util.Map.Entry;
-
-/**
- * Kryo Serializer for {@link ImmutableMap}.
- */
-public class ImmutableMapSerializer extends Serializer<ImmutableMap<?, ?>> {
-
-  /**
-   * Creates {@link ImmutableMap} serializer instance.
-   */
-  public ImmutableMapSerializer() {
-    // non-null, immutable
-    super(false, true);
-  }
-
-  @Override
-  public void write(Kryo kryo, Output output, ImmutableMap<?, ?> object) {
-    output.writeInt(object.size());
-    for (Entry<?, ?> e : object.entrySet()) {
-      kryo.writeClassAndObject(output, e.getKey());
-      kryo.writeClassAndObject(output, e.getValue());
-    }
-  }
-
-  @Override
-  public ImmutableMap<?, ?> read(Kryo kryo, Input input,
-      Class<ImmutableMap<?, ?>> type) {
-    final int size = input.readInt();
-    switch (size) {
-      case 0:
-        return ImmutableMap.of();
-      case 1:
-        return ImmutableMap.of(kryo.readClassAndObject(input),
-            kryo.readClassAndObject(input));
-
-      default:
-        Builder<Object, Object> builder = ImmutableMap.builder();
-        for (int i = 0; i < size; ++i) {
-          builder.put(kryo.readClassAndObject(input),
-              kryo.readClassAndObject(input));
-        }
-        return builder.build();
-    }
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableSetSerializer.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/ImmutableSetSerializer.java
deleted file mode 100644 (file)
index 6887c54..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2014-present Open Networking Foundation
- *
- * 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 io.atomix.utils.serializer.serializers;
-
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.Serializer;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Kryo Serializer for {@link ImmutableSet}.
- */
-public class ImmutableSetSerializer extends Serializer<ImmutableSet<?>> {
-
-  /**
-   * Creates {@link ImmutableSet} serializer instance.
-   */
-  public ImmutableSetSerializer() {
-    // non-null, immutable
-    super(false, true);
-  }
-
-  @Override
-  public void write(Kryo kryo, Output output, ImmutableSet<?> object) {
-    output.writeInt(object.size());
-    for (Object e : object) {
-      kryo.writeClassAndObject(output, e);
-    }
-  }
-
-  @Override
-  public ImmutableSet<?> read(Kryo kryo, Input input,
-      Class<ImmutableSet<?>> type) {
-    final int size = input.readInt();
-    switch (size) {
-      case 0:
-        return ImmutableSet.of();
-      case 1:
-        return ImmutableSet.of(kryo.readClassAndObject(input));
-      default:
-        Object[] elms = new Object[size];
-        for (int i = 0; i < size; ++i) {
-          elms[i] = kryo.readClassAndObject(input);
-        }
-        return ImmutableSet.copyOf(elms);
-    }
-  }
-}
diff --git a/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/package-info.java b/third-party/atomix/storage/src/main/java/io/atomix/utils/serializer/serializers/package-info.java
deleted file mode 100644 (file)
index c6f3150..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2019-present Open Networking Foundation
- *
- * 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.
- */
-
-/**
- * Common serializer implementations.
- */
-package io.atomix.utils.serializer.serializers;