Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 75C8A1849B for ; Tue, 10 Nov 2015 12:22:23 +0000 (UTC) Received: (qmail 73030 invoked by uid 500); 10 Nov 2015 12:22:23 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 72995 invoked by uid 500); 10 Nov 2015 12:22:23 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 72986 invoked by uid 99); 10 Nov 2015 12:22:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Nov 2015 12:22:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2D10DDFC77; Tue, 10 Nov 2015 12:22:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: IGNITE-1847: Refactoring metadata handlers. Date: Tue, 10 Nov 2015 12:22:23 +0000 (UTC) Repository: ignite Updated Branches: refs/heads/ignite-1847 b2fd7bfd4 -> b68d2588d IGNITE-1847: Refactoring metadata handlers. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b68d2588 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b68d2588 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b68d2588 Branch: refs/heads/ignite-1847 Commit: b68d2588dea11f698ccf3c8cc68cfe6e901fd0db Parents: b2fd7bf Author: vozerov-gridgain Authored: Tue Nov 10 15:23:01 2015 +0300 Committer: vozerov-gridgain Committed: Tue Nov 10 15:23:01 2015 +0300 ---------------------------------------------------------------------- .../portable/BinaryMetadataCollector.java | 254 +++++++++++++++++++ .../portable/BinaryMetadataCollector2.java | 254 ------------------- .../portable/BinaryMetadataHandler.java | 44 ++++ .../portable/BinaryMetadataHandler2.java | 44 ---- .../portable/BinaryNoopMetadataHandler.java | 2 +- .../portable/PortableClassDescriptor.java | 2 +- .../internal/portable/PortableContext.java | 4 +- .../CacheObjectBinaryProcessorImpl.java | 4 +- .../portable/TestCachingMetadataHandler.java | 2 +- 9 files changed, 305 insertions(+), 305 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java new file mode 100644 index 0000000..67e1a0d --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector.java @@ -0,0 +1,254 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.ignite.internal.portable; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.BinaryRawWriter; +import org.apache.ignite.binary.BinaryWriter; +import org.jetbrains.annotations.Nullable; + +/** + * Writer for meta data collection. + */ +class BinaryMetadataCollector implements BinaryWriter { + /** */ + private final Map meta = new HashMap<>(); + + /** */ + private final String typeName; + + /** + * @param typeName Type name. + */ + BinaryMetadataCollector(String typeName) { + this.typeName = typeName; + } + + /** + * @return Field meta data. + */ + Map meta() { + return meta; + } + + /** {@inheritDoc} */ + @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.BYTE); + } + + /** {@inheritDoc} */ + @Override public void writeShort(String fieldName, short val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.SHORT); + } + + /** {@inheritDoc} */ + @Override public void writeInt(String fieldName, int val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.INT); + } + + /** {@inheritDoc} */ + @Override public void writeLong(String fieldName, long val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.LONG); + } + + /** {@inheritDoc} */ + @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.FLOAT); + } + + /** {@inheritDoc} */ + @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DOUBLE); + } + + /** {@inheritDoc} */ + @Override public void writeChar(String fieldName, char val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.CHAR); + } + + /** {@inheritDoc} */ + @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.BOOLEAN); + } + + /** {@inheritDoc} */ + @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DECIMAL); + } + + /** {@inheritDoc} */ + @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.STRING); + } + + /** {@inheritDoc} */ + @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.UUID); + } + + /** {@inheritDoc} */ + @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DATE); + } + + /** {@inheritDoc} */ + @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP); + } + + /** {@inheritDoc} */ + @Override public > void writeEnum(String fieldName, T val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.ENUM); + } + + /** {@inheritDoc} */ + @Override public > void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.OBJECT); + } + + /** {@inheritDoc} */ + @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.INT_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.LONG_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.STRING_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.UUID_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.DATE_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR); + } + + /** {@inheritDoc} */ + @Override public void writeCollection(String fieldName, @Nullable Collection col) + throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.COL); + } + + /** {@inheritDoc} */ + @Override public void writeMap(String fieldName, @Nullable Map map) throws BinaryObjectException { + add(fieldName, PortableClassDescriptor.Mode.MAP); + } + + /** {@inheritDoc} */ + @Override public BinaryRawWriter rawWriter() { + return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(), + new Class[] { BinaryRawWriterEx.class }, + new InvocationHandler() { + @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable { + return null; + } + }); + } + + /** + * @param name Field name. + * @param mode Field mode. + * @throws BinaryObjectException In case of error. + */ + private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException { + assert name != null; + + int fieldTypeId = mode.typeId(); + + Integer oldFieldTypeId = meta.put(name, fieldTypeId); + + if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) { + throw new BinaryObjectException( + "Field is written twice with different types [" + + "typeName=" + typeName + + ", fieldName=" + name + + ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) + + ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) + + ']' + ); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java deleted file mode 100644 index 701c619..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataCollector2.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.ignite.internal.portable; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.math.BigDecimal; -import java.sql.Timestamp; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinaryRawWriter; -import org.apache.ignite.binary.BinaryWriter; -import org.jetbrains.annotations.Nullable; - -/** - * Writer for meta data collection. - */ -class BinaryMetadataCollector2 implements BinaryWriter { - /** */ - private final Map meta = new HashMap<>(); - - /** */ - private final String typeName; - - /** - * @param typeName Type name. - */ - BinaryMetadataCollector2(String typeName) { - this.typeName = typeName; - } - - /** - * @return Field meta data. - */ - Map meta() { - return meta; - } - - /** {@inheritDoc} */ - @Override public void writeByte(String fieldName, byte val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.BYTE); - } - - /** {@inheritDoc} */ - @Override public void writeShort(String fieldName, short val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.SHORT); - } - - /** {@inheritDoc} */ - @Override public void writeInt(String fieldName, int val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.INT); - } - - /** {@inheritDoc} */ - @Override public void writeLong(String fieldName, long val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.LONG); - } - - /** {@inheritDoc} */ - @Override public void writeFloat(String fieldName, float val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.FLOAT); - } - - /** {@inheritDoc} */ - @Override public void writeDouble(String fieldName, double val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DOUBLE); - } - - /** {@inheritDoc} */ - @Override public void writeChar(String fieldName, char val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.CHAR); - } - - /** {@inheritDoc} */ - @Override public void writeBoolean(String fieldName, boolean val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.BOOLEAN); - } - - /** {@inheritDoc} */ - @Override public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DECIMAL); - } - - /** {@inheritDoc} */ - @Override public void writeString(String fieldName, @Nullable String val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.STRING); - } - - /** {@inheritDoc} */ - @Override public void writeUuid(String fieldName, @Nullable UUID val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.UUID); - } - - /** {@inheritDoc} */ - @Override public void writeDate(String fieldName, @Nullable Date val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DATE); - } - - /** {@inheritDoc} */ - @Override public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP); - } - - /** {@inheritDoc} */ - @Override public > void writeEnum(String fieldName, T val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.ENUM); - } - - /** {@inheritDoc} */ - @Override public > void writeEnumArray(String fieldName, T[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.ENUM_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeObject(String fieldName, @Nullable Object obj) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.OBJECT); - } - - /** {@inheritDoc} */ - @Override public void writeByteArray(String fieldName, @Nullable byte[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.BYTE_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeShortArray(String fieldName, @Nullable short[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.SHORT_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeIntArray(String fieldName, @Nullable int[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.INT_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeLongArray(String fieldName, @Nullable long[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.LONG_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeFloatArray(String fieldName, @Nullable float[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.FLOAT_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeDoubleArray(String fieldName, @Nullable double[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DOUBLE_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeCharArray(String fieldName, @Nullable char[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.CHAR_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.BOOLEAN_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DECIMAL_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeStringArray(String fieldName, @Nullable String[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.STRING_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.UUID_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeDateArray(String fieldName, @Nullable Date[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.DATE_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeTimestampArray(String fieldName, @Nullable Timestamp[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.TIMESTAMP_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeObjectArray(String fieldName, @Nullable Object[] val) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.OBJECT_ARR); - } - - /** {@inheritDoc} */ - @Override public void writeCollection(String fieldName, @Nullable Collection col) - throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.COL); - } - - /** {@inheritDoc} */ - @Override public void writeMap(String fieldName, @Nullable Map map) throws BinaryObjectException { - add(fieldName, PortableClassDescriptor.Mode.MAP); - } - - /** {@inheritDoc} */ - @Override public BinaryRawWriter rawWriter() { - return (BinaryRawWriter)Proxy.newProxyInstance(getClass().getClassLoader(), - new Class[] { BinaryRawWriterEx.class }, - new InvocationHandler() { - @Override public Object invoke(Object proxy, Method mtd, Object[] args) throws Throwable { - return null; - } - }); - } - - /** - * @param name Field name. - * @param mode Field mode. - * @throws BinaryObjectException In case of error. - */ - private void add(String name, PortableClassDescriptor.Mode mode) throws BinaryObjectException { - assert name != null; - - int fieldTypeId = mode.typeId(); - - Integer oldFieldTypeId = meta.put(name, fieldTypeId); - - if (oldFieldTypeId != null && !oldFieldTypeId.equals(fieldTypeId)) { - throw new BinaryObjectException( - "Field is written twice with different types [" + - "typeName=" + typeName + - ", fieldName=" + name + - ", fieldTypeName1=" + PortableUtils.fieldTypeName(oldFieldTypeId) + - ", fieldTypeName2=" + PortableUtils.fieldTypeName(fieldTypeId) + - ']' - ); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java new file mode 100644 index 0000000..add8c2d --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.ignite.internal.portable; + +import org.apache.ignite.binary.BinaryObjectException; +import org.apache.ignite.binary.BinaryType; + +/** + * Portable meta data handler. + */ +public interface BinaryMetadataHandler { + /** + * Adds meta data. + * + * @param typeId Type ID. + * @param meta Meta data. + * @throws org.apache.ignite.binary.BinaryObjectException In case of error. + */ + public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException; + + /** + * Gets meta data for provided type ID. + * + * @param typeId Type ID. + * @return Meta data. + * @throws org.apache.ignite.binary.BinaryObjectException In case of error. + */ + public BinaryType metadata(int typeId) throws BinaryObjectException; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler2.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler2.java deleted file mode 100644 index 6e078a1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetadataHandler2.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.ignite.internal.portable; - -import org.apache.ignite.binary.BinaryObjectException; -import org.apache.ignite.binary.BinaryType; - -/** - * Portable meta data handler. - */ -public interface BinaryMetadataHandler2 { - /** - * Adds meta data. - * - * @param typeId Type ID. - * @param meta Meta data. - * @throws org.apache.ignite.binary.BinaryObjectException In case of error. - */ - public void addMeta(int typeId, BinaryType meta) throws BinaryObjectException; - - /** - * Gets meta data for provided type ID. - * - * @param typeId Type ID. - * @return Meta data. - * @throws org.apache.ignite.binary.BinaryObjectException In case of error. - */ - public BinaryType metadata(int typeId) throws BinaryObjectException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java index fd0c912..c4fc5e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryNoopMetadataHandler.java @@ -23,7 +23,7 @@ import org.apache.ignite.binary.BinaryType; /** * No-op metadata handler. */ -public class BinaryNoopMetadataHandler implements BinaryMetadataHandler2 { +public class BinaryNoopMetadataHandler implements BinaryMetadataHandler { /** Cached singleton instance. */ private static final BinaryNoopMetadataHandler INSTANCE = new BinaryNoopMetadataHandler(); http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java index 6fdc6b9..eda5de8 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java @@ -546,7 +546,7 @@ public class PortableClassDescriptor { if (obj.getClass() != BinaryMetadata.class && ctx.isMetaDataChanged(typeId, writer.metaDataHashSum())) { - BinaryMetadataCollector2 metaCollector = new BinaryMetadataCollector2(typeName); + BinaryMetadataCollector metaCollector = new BinaryMetadataCollector(typeName); if (serializer != null) serializer.writeBinary(obj, metaCollector); http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java index 8af0630..8b3b18d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java @@ -134,7 +134,7 @@ public class PortableContext implements Externalizable { private final Map typeMappers = new ConcurrentHashMap8<>(0); /** */ - private BinaryMetadataHandler2 metaHnd; + private BinaryMetadataHandler metaHnd; /** */ private MarshallerContext marshCtx; @@ -165,7 +165,7 @@ public class PortableContext implements Externalizable { * @param metaHnd Meta data handler. * @param igniteCfg Ignite configuration. */ - public PortableContext(BinaryMetadataHandler2 metaHnd, IgniteConfiguration igniteCfg) { + public PortableContext(BinaryMetadataHandler metaHnd, IgniteConfiguration igniteCfg) { assert metaHnd != null; assert igniteCfg != null; http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java index f8634b7..5e794d9 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java @@ -36,7 +36,7 @@ import org.apache.ignite.internal.portable.BinaryObjectOffheapImpl; import org.apache.ignite.internal.portable.BinaryTypeImpl; import org.apache.ignite.internal.portable.GridPortableMarshaller; import org.apache.ignite.internal.portable.PortableContext; -import org.apache.ignite.internal.portable.BinaryMetadataHandler2; +import org.apache.ignite.internal.portable.BinaryMetadataHandler; import org.apache.ignite.internal.portable.PortableUtils; import org.apache.ignite.internal.portable.builder.BinaryObjectBuilderImpl; import org.apache.ignite.internal.portable.streams.PortableInputStream; @@ -159,7 +159,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm /** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { if (marsh instanceof PortableMarshaller) { - BinaryMetadataHandler2 metaHnd = new BinaryMetadataHandler2() { + BinaryMetadataHandler metaHnd = new BinaryMetadataHandler() { @Override public void addMeta(int typeId, BinaryType newMeta) throws BinaryObjectException { assert newMeta != null; assert newMeta instanceof BinaryTypeImpl; http://git-wip-us.apache.org/repos/asf/ignite/blob/b68d2588/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java index cf31c68..e49ebf3 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/TestCachingMetadataHandler.java @@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * Test metadata handler. */ -public class TestCachingMetadataHandler implements BinaryMetadataHandler2 { +public class TestCachingMetadataHandler implements BinaryMetadataHandler { /** Cached metadatas. */ private final ConcurrentHashMap metas = new ConcurrentHashMap<>();