ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [21/29] ignite git commit: IGNITE-950 - Renaming.
Date Mon, 02 Nov 2015 17:22:09 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFieldImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFieldImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFieldImpl.java
deleted file mode 100644
index 26626aa..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFieldImpl.java
+++ /dev/null
@@ -1,82 +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.igniteobject.IgniteObject;
-import org.apache.ignite.portable.PortableField;
-
-/**
- * Implementation of portable field descriptor.
- */
-public class PortableFieldImpl implements PortableField {
-    /** Well-known object schemas. */
-    private final PortableSchemaRegistry schemas;
-
-    /** Pre-calculated field ID. */
-    private final int fieldId;
-
-    /**
-     * Constructor.
-     *
-     * @param schemas Schemas.
-     * @param fieldId Field ID.
-     */
-    public PortableFieldImpl(PortableSchemaRegistry schemas, int fieldId) {
-        this.schemas = schemas;
-        this.fieldId = fieldId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean exists(IgniteObject obj) {
-        IgniteObjectEx obj0 = (IgniteObjectEx)obj;
-
-        return fieldOffset(obj0) != 0;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public <T> T value(IgniteObject obj) {
-        IgniteObjectEx obj0 = (IgniteObjectEx)obj;
-
-        int offset = fieldOffset(obj0);
-
-        return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
-    }
-
-    /**
-     * Get relative field offset.
-     *
-     * @param obj Object.
-     * @return Field offset.
-     */
-    private int fieldOffset(IgniteObjectEx obj) {
-        int schemaId = obj.schemaId();
-
-        PortableSchema schema = schemas.schema(schemaId);
-
-        if (schema == null) {
-            schema = obj.createSchema();
-
-            schemas.addSchema(schemaId, schema);
-        }
-
-        assert schema != null;
-
-        return schema.offset(fieldId);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
index 1db7fb2..f9f72d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataHandler.java
@@ -17,8 +17,8 @@
 
 package org.apache.ignite.internal.portable;
 
-import org.apache.ignite.igniteobject.IgniteObjectException;
-import org.apache.ignite.igniteobject.IgniteObjectMetadata;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryTypeMetadata;
 
 /**
  * Portable meta data handler.
@@ -29,16 +29,16 @@ public interface PortableMetaDataHandler {
      *
      * @param typeId Type ID.
      * @param meta Meta data.
-     * @throws org.apache.ignite.igniteobject.IgniteObjectException In case of error.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
-    public void addMeta(int typeId, IgniteObjectMetadata meta) throws IgniteObjectException;
+    public void addMeta(int typeId, BinaryTypeMetadata meta) throws BinaryObjectException;
 
     /**
      * Gets meta data for provided type ID.
      *
      * @param typeId Type ID.
      * @return Meta data.
-     * @throws org.apache.ignite.igniteobject.IgniteObjectException In case of error.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
-    public IgniteObjectMetadata metadata(int typeId) throws IgniteObjectException;
+    public BinaryTypeMetadata metadata(int typeId) throws BinaryObjectException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
index cfe7efe..869f81d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderContext.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.jetbrains.annotations.Nullable;
 
@@ -32,7 +32,7 @@ class PortableReaderContext {
     private Object oHandles;
 
     /** */
-    private Map<Integer, IgniteObject> poHandles;
+    private Map<Integer, BinaryObject> poHandles;
 
     /**
      * @param handle Handle.
@@ -62,7 +62,7 @@ class PortableReaderContext {
      * @param handle Handle.
      * @param po Portable object.
      */
-    void setPortableHandler(int handle, IgniteObject po) {
+    void setPortableHandler(int handle, BinaryObject po) {
         assert po != null;
 
         if (poHandles == null)
@@ -94,7 +94,7 @@ class PortableReaderContext {
      * @param handle Handle.
      * @return Object.
      */
-    @Nullable IgniteObject getPortableByHandle(int handle) {
+    @Nullable BinaryObject getPortableByHandle(int handle) {
         return poHandles != null ? poHandles.get(handle) : null;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 7a636d7..72a3fe4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -21,8 +21,8 @@ import org.apache.ignite.internal.portable.builder.PortableLazyValue;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.igniteobject.IgniteObjectException;
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryObject;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentHashMap8;
 
@@ -121,7 +121,7 @@ public class PortableUtils {
      * @param writer Writer.
      * @param userType User type flag.
      */
-    public static void writeFlags(IgniteObjectWriterExImpl writer, boolean userType) {
+    public static void writeFlags(BinaryWriterExImpl writer, boolean userType) {
         short val = 0;
 
         if (userType)
@@ -243,7 +243,7 @@ public class PortableUtils {
      * @param writer W
      * @param val Value.
      */
-    public static void writePlainObject(IgniteObjectWriterExImpl writer, Object val) {
+    public static void writePlainObject(BinaryWriterExImpl writer, Object val) {
         Byte flag = PLAIN_CLASS_TO_FLAG.get(val.getClass());
 
         if (flag == null)
@@ -494,7 +494,7 @@ public class PortableUtils {
     public static boolean isPortableType(Class<?> cls) {
         assert cls != null;
 
-        return IgniteObject.class.isAssignableFrom(cls) ||
+        return BinaryObject.class.isAssignableFrom(cls) ||
             PORTABLE_CLS.contains(cls) ||
             cls.isEnum() ||
             (cls.isArray() && cls.getComponentType().isEnum());
@@ -543,7 +543,7 @@ public class PortableUtils {
      */
     public static void checkProtocolVersion(byte protoVer) {
         if (PROTO_VER != protoVer)
-            throw new IgniteObjectException("Unsupported protocol version: " + protoVer);
+            throw new BinaryObjectException("Unsupported protocol version: " + protoVer);
     }
 
     /**
@@ -556,7 +556,7 @@ public class PortableUtils {
      * @param clsName Class name (optional).
      * @return Position where length should be written.
      */
-    public static int writeHeader(IgniteObjectWriterExImpl writer, boolean usrTyp, int typeId, int hashCode,
+    public static int writeHeader(BinaryWriterExImpl writer, boolean usrTyp, int typeId, int hashCode,
         @Nullable String clsName) {
         writer.doWriteByte(GridPortableMarshaller.OBJ);
         writer.doWriteByte(GridPortableMarshaller.PROTO_VER);

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
new file mode 100644
index 0000000..721134e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -0,0 +1,551 @@
+/*
+ * 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.builder;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.binary.BinaryObjectBuilder;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
+import org.apache.ignite.binary.BinaryTypeMetadata;
+import org.apache.ignite.internal.portable.BinaryObjectImpl;
+import org.apache.ignite.internal.portable.BinaryObjectOffheapImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.internal.portable.PortableUtils;
+import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
+import org.apache.ignite.internal.util.GridArgumentCheck;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.HASH_CODE_POS;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.PROTO_VER_POS;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.TYPE_ID_POS;
+import static org.apache.ignite.internal.portable.GridPortableMarshaller.UNREGISTERED_TYPE_ID;
+
+/**
+ *
+ */
+public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
+    /** */
+    private static final Object REMOVED_FIELD_MARKER = new Object();
+
+    /** */
+    private final PortableContext ctx;
+
+    /** */
+    private final int typeId;
+
+    /** May be null. */
+    private String typeName;
+
+    /** May be null. */
+    private String clsNameToWrite;
+
+    /** */
+    private boolean registeredType = true;
+
+    /** */
+    private Map<String, Object> assignedVals;
+
+    /** */
+    private Map<Integer, Object> readCache;
+
+    /** Position of object in source array, or -1 if object is not created from PortableObject. */
+    private final int start;
+
+    /** Total header length */
+    private final int hdrLen;
+
+    /**
+     * Context of PortableObject reading process. Or {@code null} if object is not created from PortableObject.
+     */
+    private final PortableBuilderReader reader;
+
+    /** */
+    private int hashCode;
+
+    /**
+     * @param clsName Class name.
+     * @param ctx Portable context.
+     */
+    public BinaryObjectBuilderImpl(PortableContext ctx, String clsName) {
+        this(ctx, ctx.typeId(clsName), PortableContext.typeName(clsName));
+    }
+
+    /**
+     * @param typeId Type ID.
+     * @param ctx Portable context.
+     */
+    public BinaryObjectBuilderImpl(PortableContext ctx, int typeId) {
+        this(ctx, typeId, null);
+    }
+
+    /**
+     * @param typeName Type name.
+     * @param ctx Context.
+     * @param typeId Type id.
+     */
+    public BinaryObjectBuilderImpl(PortableContext ctx, int typeId, String typeName) {
+        this.typeId = typeId;
+        this.typeName = typeName;
+        this.ctx = ctx;
+
+        start = -1;
+        reader = null;
+        hdrLen = DFLT_HDR_LEN;
+
+        readCache = Collections.emptyMap();
+    }
+
+    /**
+     * @param obj Object to wrap.
+     */
+    public BinaryObjectBuilderImpl(BinaryObjectImpl obj) {
+        this(new PortableBuilderReader(obj), obj.start());
+
+        reader.registerObject(this);
+    }
+
+    /**
+     * @param reader ctx
+     * @param start Start.
+     */
+    BinaryObjectBuilderImpl(PortableBuilderReader reader, int start) {
+        this.reader = reader;
+        this.start = start;
+
+        byte ver = reader.readBytePositioned(start + PROTO_VER_POS);
+
+        PortableUtils.checkProtocolVersion(ver);
+
+        int typeId = reader.readIntPositioned(start + TYPE_ID_POS);
+        ctx = reader.portableContext();
+        hashCode = reader.readIntPositioned(start + HASH_CODE_POS);
+
+        if (typeId == UNREGISTERED_TYPE_ID) {
+            int mark = reader.position();
+
+            reader.position(start + DFLT_HDR_LEN);
+
+            clsNameToWrite = reader.readString();
+
+            Class cls;
+
+            try {
+                // TODO: IGNITE-1272 - Is class loader needed here?
+                cls = U.forName(clsNameToWrite, null);
+            }
+            catch (ClassNotFoundException e) {
+                throw new BinaryInvalidTypeException("Failed to load the class: " + clsNameToWrite, e);
+            }
+
+            this.typeId = ctx.descriptorForClass(cls).typeId();
+
+            registeredType = false;
+
+            hdrLen = reader.position() - mark;
+
+            reader.position(mark);
+        }
+        else {
+            this.typeId = typeId;
+            hdrLen = DFLT_HDR_LEN;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryObject build() {
+        try (BinaryWriterExImpl writer = new BinaryWriterExImpl(ctx, typeId, false)) {
+
+            PortableBuilderSerializer serializationCtx = new PortableBuilderSerializer();
+
+            serializationCtx.registerObjectWriting(this, 0);
+
+            serializeTo(writer, serializationCtx);
+
+            byte[] arr = writer.array();
+
+            return new BinaryObjectImpl(ctx, arr, 0);
+        }
+    }
+
+    /**
+     * @param writer Writer.
+     * @param serializer Serializer.
+     */
+    void serializeTo(BinaryWriterExImpl writer, PortableBuilderSerializer serializer) {
+        PortableUtils.writeHeader(writer,
+            true,
+            registeredType ? typeId : UNREGISTERED_TYPE_ID,
+            hashCode,
+            registeredType ? null : clsNameToWrite);
+
+        Set<Integer> remainsFlds = null;
+
+        if (reader != null) {
+            Map<Integer, Object> assignedFldsById;
+
+            if (assignedVals != null) {
+                assignedFldsById = U.newHashMap(assignedVals.size());
+
+                for (Map.Entry<String, Object> entry : assignedVals.entrySet()) {
+                    int fldId = ctx.fieldId(typeId, entry.getKey());
+
+                    assignedFldsById.put(fldId, entry.getValue());
+                }
+
+                remainsFlds = assignedFldsById.keySet();
+            }
+            else
+                assignedFldsById = Collections.emptyMap();
+
+            // Get footer details.
+            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader, start);
+
+            int footerPos = footer.get1();
+            int footerEnd = footer.get2();
+
+            // Get raw position.
+            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
+
+            // Position reader on data.
+            reader.position(start + hdrLen);
+
+            while (reader.position() < rawPos) {
+                int fieldId = reader.readIntPositioned(footerPos);
+                int fieldLen = fieldPositionAndLength(footerPos, footerEnd, rawPos).get2();
+
+                footerPos += 8;
+
+                if (assignedFldsById.containsKey(fieldId)) {
+                    Object assignedVal = assignedFldsById.remove(fieldId);
+
+                    reader.skip(fieldLen);
+
+                    if (assignedVal != REMOVED_FIELD_MARKER) {
+                        writer.writeFieldId(fieldId);
+
+                        serializer.writeValue(writer, assignedVal);
+                    }
+                }
+                else {
+                    int type = fieldLen != 0 ? reader.readByte(0) : 0;
+
+                    if (fieldLen != 0 && !PortableUtils.isPlainArrayType(type) && PortableUtils.isPlainType(type)) {
+                        writer.writeFieldId(fieldId);
+                        writer.write(reader.array(), reader.position(), fieldLen);
+
+                        reader.skip(fieldLen);
+                    }
+                    else {
+                        writer.writeFieldId(fieldId);
+
+                        Object val;
+
+                        if (fieldLen == 0)
+                            val = null;
+                        else if (readCache == null) {
+                            int savedPos = reader.position();
+
+                            val = reader.parseValue();
+
+                            assert reader.position() == savedPos + fieldLen;
+                        }
+                        else {
+                            val = readCache.get(fieldId);
+
+                            reader.skip(fieldLen);
+                        }
+
+                        serializer.writeValue(writer, val);
+                    }
+                }
+            }
+        }
+
+        if (assignedVals != null && (remainsFlds == null || !remainsFlds.isEmpty())) {
+            boolean metadataEnabled = ctx.isMetaDataEnabled(typeId);
+
+            BinaryTypeMetadata metadata = null;
+
+            if (metadataEnabled)
+                metadata = ctx.metaData(typeId);
+
+            Map<String, String> newFldsMetadata = null;
+
+            for (Map.Entry<String, Object> entry : assignedVals.entrySet()) {
+                Object val = entry.getValue();
+
+                if (val == REMOVED_FIELD_MARKER)
+                    continue;
+
+                String name = entry.getKey();
+
+                int fldId = ctx.fieldId(typeId, name);
+
+                if (remainsFlds != null && !remainsFlds.contains(fldId))
+                    continue;
+
+                writer.writeFieldId(fldId);
+
+                serializer.writeValue(writer, val);
+
+                if (metadataEnabled) {
+                    String oldFldTypeName = metadata == null ? null : metadata.fieldTypeName(name);
+
+                    String newFldTypeName;
+
+                    if (val instanceof PortableValueWithType)
+                        newFldTypeName = ((PortableValueWithType)val).typeName();
+                    else {
+                        byte type = PortableUtils.typeByClass(val.getClass());
+
+                        newFldTypeName = CacheObjectPortableProcessorImpl.fieldTypeName(type);
+                    }
+
+                    if (oldFldTypeName == null) {
+                        // It's a new field, we have to add it to metadata.
+
+                        if (newFldsMetadata == null)
+                            newFldsMetadata = new HashMap<>();
+
+                        newFldsMetadata.put(name, newFldTypeName);
+                    }
+                    else {
+                        if (!"Object".equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName)) {
+                            throw new BinaryObjectException(
+                                "Wrong value has been set [" +
+                                    "typeName=" + (typeName == null ? metadata.typeName() : typeName) +
+                                    ", fieldName=" + name +
+                                    ", fieldType=" + oldFldTypeName +
+                                    ", assignedValueType=" + newFldTypeName +
+                                    ", assignedValue=" + (((PortableValueWithType)val).value()) + ']'
+                            );
+                        }
+                    }
+                }
+            }
+
+            if (newFldsMetadata != null) {
+                String typeName = this.typeName;
+
+                if (typeName == null)
+                    typeName = metadata.typeName();
+
+                ctx.updateMetaData(typeId, typeName, newFldsMetadata);
+            }
+        }
+
+        if (reader != null) {
+            // Write raw data if any.
+            int rawOff = PortableUtils.rawOffsetAbsolute(reader, start);
+            int footerStart = PortableUtils.footerStartAbsolute(reader, start);
+
+            if (rawOff < footerStart) {
+                writer.rawWriter();
+
+                writer.write(reader.array(), rawOff, footerStart - rawOff);
+            }
+
+            // Shift reader to the end of the object.
+            reader.position(start + PortableUtils.length(reader, start));
+        }
+
+        writer.postWrite(true);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryObjectBuilderImpl hashCode(int hashCode) {
+        this.hashCode = hashCode;
+
+        return this;
+    }
+
+    /**
+     * Get field position and length.
+     *
+     * @param footerPos Field position inside the footer (absolute).
+     * @param footerEnd Footer end (absolute).
+     * @param rawPos Raw data position (absolute).
+     * @return Tuple with field position and length.
+     */
+    private IgniteBiTuple<Integer, Integer> fieldPositionAndLength(int footerPos, int footerEnd, int rawPos) {
+        int fieldOffset = reader.readIntPositioned(footerPos + 4);
+        int fieldPos = start + fieldOffset;
+
+        // Get field length.
+        int fieldLen;
+
+        if (footerPos + 8 == footerEnd)
+            // This is the last field, compare to raw offset.
+            fieldLen = rawPos - fieldPos;
+        else {
+            // Field is somewhere in the middle, get difference with the next offset.
+            int nextFieldOffset = reader.readIntPositioned(footerPos + 8 + 4);
+
+            fieldLen = nextFieldOffset - fieldOffset;
+        }
+
+        return F.t(fieldPos, fieldLen);
+    }
+
+    /**
+     * Initialize read cache if needed.
+     */
+    private void ensureReadCacheInit() {
+        if (readCache == null) {
+            Map<Integer, Object> readCache = new HashMap<>();
+
+            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader, start);
+
+            int footerPos = footer.get1();
+            int footerEnd = footer.get2();
+
+            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
+
+            while (footerPos < footerEnd) {
+                int fieldId = reader.readIntPositioned(footerPos);
+
+                IgniteBiTuple<Integer, Integer> posAndLen = fieldPositionAndLength(footerPos, footerEnd, rawPos);
+
+                Object val = reader.getValueQuickly(posAndLen.get1(), posAndLen.get2());
+
+                readCache.put(fieldId, val);
+
+                // Shift current footer position.
+                footerPos += 8;
+            }
+
+            this.readCache = readCache;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T getField(String name) {
+        Object val;
+
+        if (assignedVals != null && assignedVals.containsKey(name)) {
+            val = assignedVals.get(name);
+
+            if (val == REMOVED_FIELD_MARKER)
+                return null;
+        }
+        else {
+            ensureReadCacheInit();
+
+            int fldId = ctx.fieldId(typeId, name);
+
+            val = readCache.get(fldId);
+        }
+
+        return (T)PortableUtils.unwrapLazy(val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryObjectBuilder setField(String name, Object val) {
+        GridArgumentCheck.notNull(val, name);
+
+        if (assignedVals == null)
+            assignedVals = new LinkedHashMap<>();
+
+        Object oldVal = assignedVals.put(name, val);
+
+        if (oldVal instanceof PortableValueWithType) {
+            ((PortableValueWithType)oldVal).value(val);
+
+            assignedVals.put(name, oldVal);
+        }
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public <T> BinaryObjectBuilder setField(String name, @Nullable T val, Class<? super T> type) {
+        if (assignedVals == null)
+            assignedVals = new LinkedHashMap<>();
+
+        //int fldId = ctx.fieldId(typeId, fldName);
+
+        assignedVals.put(name, new PortableValueWithType(PortableUtils.typeByClass(type), val));
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public BinaryObjectBuilder setField(String name, @Nullable BinaryObjectBuilder builder) {
+        if (builder == null)
+            return setField(name, null, Object.class);
+        else
+            return setField(name, (Object)builder);
+    }
+
+    /**
+     * Removes field from portable object.
+     *
+     * @param name Field name.
+     * @return {@code this} instance for chaining.
+     */
+    @Override public BinaryObjectBuilderImpl removeField(String name) {
+        if (assignedVals == null)
+            assignedVals = new LinkedHashMap<>();
+
+        assignedVals.put(name, REMOVED_FIELD_MARKER);
+
+        return this;
+    }
+
+    /**
+     * Creates builder initialized by specified portable object.
+     *
+     * @param obj Portable object to initialize builder.
+     * @return New builder.
+     */
+    public static BinaryObjectBuilderImpl wrap(BinaryObject obj) {
+        BinaryObjectImpl heapObj;
+
+        if (obj instanceof BinaryObjectOffheapImpl)
+            heapObj = (BinaryObjectImpl)((BinaryObjectOffheapImpl)obj).heapCopy();
+        else
+            heapObj = (BinaryObjectImpl)obj;
+
+        return new BinaryObjectBuilderImpl(heapObj);
+    }
+
+    /**
+     * @return Object start position in source array.
+     */
+    int start() {
+        return start;
+    }
+
+    /**
+     * @return Object type id.
+     */
+    public int typeId() {
+        return typeId;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/IgniteObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/IgniteObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/IgniteObjectBuilderImpl.java
deleted file mode 100644
index 2783f8a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/IgniteObjectBuilderImpl.java
+++ /dev/null
@@ -1,551 +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.builder;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.igniteobject.IgniteObject;
-import org.apache.ignite.igniteobject.IgniteObjectBuilder;
-import org.apache.ignite.igniteobject.IgniteObjectException;
-import org.apache.ignite.igniteobject.IgniteObjectInvalidClassException;
-import org.apache.ignite.igniteobject.IgniteObjectMetadata;
-import org.apache.ignite.internal.portable.IgniteObjectImpl;
-import org.apache.ignite.internal.portable.IgniteObjectOffheapImpl;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.internal.portable.PortableUtils;
-import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
-import org.apache.ignite.internal.util.GridArgumentCheck;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.HASH_CODE_POS;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.PROTO_VER_POS;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.TYPE_ID_POS;
-import static org.apache.ignite.internal.portable.GridPortableMarshaller.UNREGISTERED_TYPE_ID;
-
-/**
- *
- */
-public class IgniteObjectBuilderImpl implements IgniteObjectBuilder {
-    /** */
-    private static final Object REMOVED_FIELD_MARKER = new Object();
-
-    /** */
-    private final PortableContext ctx;
-
-    /** */
-    private final int typeId;
-
-    /** May be null. */
-    private String typeName;
-
-    /** May be null. */
-    private String clsNameToWrite;
-
-    /** */
-    private boolean registeredType = true;
-
-    /** */
-    private Map<String, Object> assignedVals;
-
-    /** */
-    private Map<Integer, Object> readCache;
-
-    /** Position of object in source array, or -1 if object is not created from PortableObject. */
-    private final int start;
-
-    /** Total header length */
-    private final int hdrLen;
-
-    /**
-     * Context of PortableObject reading process. Or {@code null} if object is not created from PortableObject.
-     */
-    private final PortableBuilderReader reader;
-
-    /** */
-    private int hashCode;
-
-    /**
-     * @param clsName Class name.
-     * @param ctx Portable context.
-     */
-    public IgniteObjectBuilderImpl(PortableContext ctx, String clsName) {
-        this(ctx, ctx.typeId(clsName), PortableContext.typeName(clsName));
-    }
-
-    /**
-     * @param typeId Type ID.
-     * @param ctx Portable context.
-     */
-    public IgniteObjectBuilderImpl(PortableContext ctx, int typeId) {
-        this(ctx, typeId, null);
-    }
-
-    /**
-     * @param typeName Type name.
-     * @param ctx Context.
-     * @param typeId Type id.
-     */
-    public IgniteObjectBuilderImpl(PortableContext ctx, int typeId, String typeName) {
-        this.typeId = typeId;
-        this.typeName = typeName;
-        this.ctx = ctx;
-
-        start = -1;
-        reader = null;
-        hdrLen = DFLT_HDR_LEN;
-
-        readCache = Collections.emptyMap();
-    }
-
-    /**
-     * @param obj Object to wrap.
-     */
-    public IgniteObjectBuilderImpl(IgniteObjectImpl obj) {
-        this(new PortableBuilderReader(obj), obj.start());
-
-        reader.registerObject(this);
-    }
-
-    /**
-     * @param reader ctx
-     * @param start Start.
-     */
-    IgniteObjectBuilderImpl(PortableBuilderReader reader, int start) {
-        this.reader = reader;
-        this.start = start;
-
-        byte ver = reader.readBytePositioned(start + PROTO_VER_POS);
-
-        PortableUtils.checkProtocolVersion(ver);
-
-        int typeId = reader.readIntPositioned(start + TYPE_ID_POS);
-        ctx = reader.portableContext();
-        hashCode = reader.readIntPositioned(start + HASH_CODE_POS);
-
-        if (typeId == UNREGISTERED_TYPE_ID) {
-            int mark = reader.position();
-
-            reader.position(start + DFLT_HDR_LEN);
-
-            clsNameToWrite = reader.readString();
-
-            Class cls;
-
-            try {
-                // TODO: IGNITE-1272 - Is class loader needed here?
-                cls = U.forName(clsNameToWrite, null);
-            }
-            catch (ClassNotFoundException e) {
-                throw new IgniteObjectInvalidClassException("Failed to load the class: " + clsNameToWrite, e);
-            }
-
-            this.typeId = ctx.descriptorForClass(cls).typeId();
-
-            registeredType = false;
-
-            hdrLen = reader.position() - mark;
-
-            reader.position(mark);
-        }
-        else {
-            this.typeId = typeId;
-            hdrLen = DFLT_HDR_LEN;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteObject build() {
-        try (IgniteObjectWriterExImpl writer = new IgniteObjectWriterExImpl(ctx, typeId, false)) {
-
-            PortableBuilderSerializer serializationCtx = new PortableBuilderSerializer();
-
-            serializationCtx.registerObjectWriting(this, 0);
-
-            serializeTo(writer, serializationCtx);
-
-            byte[] arr = writer.array();
-
-            return new IgniteObjectImpl(ctx, arr, 0);
-        }
-    }
-
-    /**
-     * @param writer Writer.
-     * @param serializer Serializer.
-     */
-    void serializeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer serializer) {
-        PortableUtils.writeHeader(writer,
-            true,
-            registeredType ? typeId : UNREGISTERED_TYPE_ID,
-            hashCode,
-            registeredType ? null : clsNameToWrite);
-
-        Set<Integer> remainsFlds = null;
-
-        if (reader != null) {
-            Map<Integer, Object> assignedFldsById;
-
-            if (assignedVals != null) {
-                assignedFldsById = U.newHashMap(assignedVals.size());
-
-                for (Map.Entry<String, Object> entry : assignedVals.entrySet()) {
-                    int fldId = ctx.fieldId(typeId, entry.getKey());
-
-                    assignedFldsById.put(fldId, entry.getValue());
-                }
-
-                remainsFlds = assignedFldsById.keySet();
-            }
-            else
-                assignedFldsById = Collections.emptyMap();
-
-            // Get footer details.
-            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader, start);
-
-            int footerPos = footer.get1();
-            int footerEnd = footer.get2();
-
-            // Get raw position.
-            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
-
-            // Position reader on data.
-            reader.position(start + hdrLen);
-
-            while (reader.position() < rawPos) {
-                int fieldId = reader.readIntPositioned(footerPos);
-                int fieldLen = fieldPositionAndLength(footerPos, footerEnd, rawPos).get2();
-
-                footerPos += 8;
-
-                if (assignedFldsById.containsKey(fieldId)) {
-                    Object assignedVal = assignedFldsById.remove(fieldId);
-
-                    reader.skip(fieldLen);
-
-                    if (assignedVal != REMOVED_FIELD_MARKER) {
-                        writer.writeFieldId(fieldId);
-
-                        serializer.writeValue(writer, assignedVal);
-                    }
-                }
-                else {
-                    int type = fieldLen != 0 ? reader.readByte(0) : 0;
-
-                    if (fieldLen != 0 && !PortableUtils.isPlainArrayType(type) && PortableUtils.isPlainType(type)) {
-                        writer.writeFieldId(fieldId);
-                        writer.write(reader.array(), reader.position(), fieldLen);
-
-                        reader.skip(fieldLen);
-                    }
-                    else {
-                        writer.writeFieldId(fieldId);
-
-                        Object val;
-
-                        if (fieldLen == 0)
-                            val = null;
-                        else if (readCache == null) {
-                            int savedPos = reader.position();
-
-                            val = reader.parseValue();
-
-                            assert reader.position() == savedPos + fieldLen;
-                        }
-                        else {
-                            val = readCache.get(fieldId);
-
-                            reader.skip(fieldLen);
-                        }
-
-                        serializer.writeValue(writer, val);
-                    }
-                }
-            }
-        }
-
-        if (assignedVals != null && (remainsFlds == null || !remainsFlds.isEmpty())) {
-            boolean metadataEnabled = ctx.isMetaDataEnabled(typeId);
-
-            IgniteObjectMetadata metadata = null;
-
-            if (metadataEnabled)
-                metadata = ctx.metaData(typeId);
-
-            Map<String, String> newFldsMetadata = null;
-
-            for (Map.Entry<String, Object> entry : assignedVals.entrySet()) {
-                Object val = entry.getValue();
-
-                if (val == REMOVED_FIELD_MARKER)
-                    continue;
-
-                String name = entry.getKey();
-
-                int fldId = ctx.fieldId(typeId, name);
-
-                if (remainsFlds != null && !remainsFlds.contains(fldId))
-                    continue;
-
-                writer.writeFieldId(fldId);
-
-                serializer.writeValue(writer, val);
-
-                if (metadataEnabled) {
-                    String oldFldTypeName = metadata == null ? null : metadata.fieldTypeName(name);
-
-                    String newFldTypeName;
-
-                    if (val instanceof PortableValueWithType)
-                        newFldTypeName = ((PortableValueWithType)val).typeName();
-                    else {
-                        byte type = PortableUtils.typeByClass(val.getClass());
-
-                        newFldTypeName = CacheObjectPortableProcessorImpl.fieldTypeName(type);
-                    }
-
-                    if (oldFldTypeName == null) {
-                        // It's a new field, we have to add it to metadata.
-
-                        if (newFldsMetadata == null)
-                            newFldsMetadata = new HashMap<>();
-
-                        newFldsMetadata.put(name, newFldTypeName);
-                    }
-                    else {
-                        if (!"Object".equals(oldFldTypeName) && !oldFldTypeName.equals(newFldTypeName)) {
-                            throw new IgniteObjectException(
-                                "Wrong value has been set [" +
-                                    "typeName=" + (typeName == null ? metadata.typeName() : typeName) +
-                                    ", fieldName=" + name +
-                                    ", fieldType=" + oldFldTypeName +
-                                    ", assignedValueType=" + newFldTypeName +
-                                    ", assignedValue=" + (((PortableValueWithType)val).value()) + ']'
-                            );
-                        }
-                    }
-                }
-            }
-
-            if (newFldsMetadata != null) {
-                String typeName = this.typeName;
-
-                if (typeName == null)
-                    typeName = metadata.typeName();
-
-                ctx.updateMetaData(typeId, typeName, newFldsMetadata);
-            }
-        }
-
-        if (reader != null) {
-            // Write raw data if any.
-            int rawOff = PortableUtils.rawOffsetAbsolute(reader, start);
-            int footerStart = PortableUtils.footerStartAbsolute(reader, start);
-
-            if (rawOff < footerStart) {
-                writer.rawWriter();
-
-                writer.write(reader.array(), rawOff, footerStart - rawOff);
-            }
-
-            // Shift reader to the end of the object.
-            reader.position(start + PortableUtils.length(reader, start));
-        }
-
-        writer.postWrite(true);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteObjectBuilderImpl hashCode(int hashCode) {
-        this.hashCode = hashCode;
-
-        return this;
-    }
-
-    /**
-     * Get field position and length.
-     *
-     * @param footerPos Field position inside the footer (absolute).
-     * @param footerEnd Footer end (absolute).
-     * @param rawPos Raw data position (absolute).
-     * @return Tuple with field position and length.
-     */
-    private IgniteBiTuple<Integer, Integer> fieldPositionAndLength(int footerPos, int footerEnd, int rawPos) {
-        int fieldOffset = reader.readIntPositioned(footerPos + 4);
-        int fieldPos = start + fieldOffset;
-
-        // Get field length.
-        int fieldLen;
-
-        if (footerPos + 8 == footerEnd)
-            // This is the last field, compare to raw offset.
-            fieldLen = rawPos - fieldPos;
-        else {
-            // Field is somewhere in the middle, get difference with the next offset.
-            int nextFieldOffset = reader.readIntPositioned(footerPos + 8 + 4);
-
-            fieldLen = nextFieldOffset - fieldOffset;
-        }
-
-        return F.t(fieldPos, fieldLen);
-    }
-
-    /**
-     * Initialize read cache if needed.
-     */
-    private void ensureReadCacheInit() {
-        if (readCache == null) {
-            Map<Integer, Object> readCache = new HashMap<>();
-
-            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader, start);
-
-            int footerPos = footer.get1();
-            int footerEnd = footer.get2();
-
-            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
-
-            while (footerPos < footerEnd) {
-                int fieldId = reader.readIntPositioned(footerPos);
-
-                IgniteBiTuple<Integer, Integer> posAndLen = fieldPositionAndLength(footerPos, footerEnd, rawPos);
-
-                Object val = reader.getValueQuickly(posAndLen.get1(), posAndLen.get2());
-
-                readCache.put(fieldId, val);
-
-                // Shift current footer position.
-                footerPos += 8;
-            }
-
-            this.readCache = readCache;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("unchecked")
-    @Override public <T> T getField(String name) {
-        Object val;
-
-        if (assignedVals != null && assignedVals.containsKey(name)) {
-            val = assignedVals.get(name);
-
-            if (val == REMOVED_FIELD_MARKER)
-                return null;
-        }
-        else {
-            ensureReadCacheInit();
-
-            int fldId = ctx.fieldId(typeId, name);
-
-            val = readCache.get(fldId);
-        }
-
-        return (T)PortableUtils.unwrapLazy(val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteObjectBuilder setField(String name, Object val) {
-        GridArgumentCheck.notNull(val, name);
-
-        if (assignedVals == null)
-            assignedVals = new LinkedHashMap<>();
-
-        Object oldVal = assignedVals.put(name, val);
-
-        if (oldVal instanceof PortableValueWithType) {
-            ((PortableValueWithType)oldVal).value(val);
-
-            assignedVals.put(name, oldVal);
-        }
-
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public <T> IgniteObjectBuilder setField(String name, @Nullable T val, Class<? super T> type) {
-        if (assignedVals == null)
-            assignedVals = new LinkedHashMap<>();
-
-        //int fldId = ctx.fieldId(typeId, fldName);
-
-        assignedVals.put(name, new PortableValueWithType(PortableUtils.typeByClass(type), val));
-
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteObjectBuilder setField(String name, @Nullable IgniteObjectBuilder builder) {
-        if (builder == null)
-            return setField(name, null, Object.class);
-        else
-            return setField(name, (Object)builder);
-    }
-
-    /**
-     * Removes field from portable object.
-     *
-     * @param name Field name.
-     * @return {@code this} instance for chaining.
-     */
-    @Override public IgniteObjectBuilderImpl removeField(String name) {
-        if (assignedVals == null)
-            assignedVals = new LinkedHashMap<>();
-
-        assignedVals.put(name, REMOVED_FIELD_MARKER);
-
-        return this;
-    }
-
-    /**
-     * Creates builder initialized by specified portable object.
-     *
-     * @param obj Portable object to initialize builder.
-     * @return New builder.
-     */
-    public static IgniteObjectBuilderImpl wrap(IgniteObject obj) {
-        IgniteObjectImpl heapObj;
-
-        if (obj instanceof IgniteObjectOffheapImpl)
-            heapObj = (IgniteObjectImpl)((IgniteObjectOffheapImpl)obj).heapCopy();
-        else
-            heapObj = (IgniteObjectImpl)obj;
-
-        return new IgniteObjectBuilderImpl(heapObj);
-    }
-
-    /**
-     * @return Object start position in source array.
-     */
-    int start() {
-        return start;
-    }
-
-    /**
-     * @return Object type id.
-     */
-    public int typeId() {
-        return typeId;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
index a97d8e7..9eb77b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderEnum.java
@@ -18,9 +18,9 @@
 package org.apache.ignite.internal.portable.builder;
 
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.igniteobject.IgniteObjectInvalidClassException;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 
 /**
  *
@@ -61,7 +61,7 @@ public class PortableBuilderEnum implements PortableBuilderSerializationAware {
                 cls = U.forName(reader.readString(), null);
             }
             catch (ClassNotFoundException e) {
-                throw new IgniteObjectInvalidClassException("Failed to load the class: " + clsName, e);
+                throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
             this.typeId = reader.portableContext().descriptorForClass(cls).typeId();
@@ -82,7 +82,7 @@ public class PortableBuilderEnum implements PortableBuilderSerializationAware {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         writer.writeByte(GridPortableMarshaller.ENUM);
 
         if (typeId == GridPortableMarshaller.UNREGISTERED_TYPE_ID) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index abea3c0..d2a3ac2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -24,12 +24,12 @@ import java.util.Map;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableContext;
 import org.apache.ignite.internal.portable.PortablePositionReadable;
-import org.apache.ignite.internal.portable.IgniteObjectImpl;
+import org.apache.ignite.internal.portable.BinaryObjectImpl;
 import org.apache.ignite.internal.portable.PortablePrimitives;
-import org.apache.ignite.internal.portable.IgniteObjectReaderExImpl;
+import org.apache.ignite.internal.portable.BinaryReaderExImpl;
 import org.apache.ignite.internal.portable.PortableUtils;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
-import org.apache.ignite.igniteobject.IgniteObjectException;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
+import org.apache.ignite.binary.BinaryObjectException;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
@@ -40,13 +40,13 @@ import static org.apache.ignite.internal.portable.GridPortableMarshaller.STRING;
  */
 public class PortableBuilderReader implements PortablePositionReadable {
     /** */
-    private final Map<Integer, IgniteObjectBuilderImpl> objMap = new HashMap<>();
+    private final Map<Integer, BinaryObjectBuilderImpl> objMap = new HashMap<>();
 
     /** */
     private final PortableContext ctx;
 
     /** */
-    private final IgniteObjectReaderExImpl reader;
+    private final BinaryReaderExImpl reader;
 
     /** */
     private byte[] arr;
@@ -57,13 +57,13 @@ public class PortableBuilderReader implements PortablePositionReadable {
     /**
      * @param objImpl Portable object
      */
-    PortableBuilderReader(IgniteObjectImpl objImpl) {
+    PortableBuilderReader(BinaryObjectImpl objImpl) {
         ctx = objImpl.context();
         arr = objImpl.array();
         pos = objImpl.start();
 
         // TODO: IGNITE-1272 - Is class loader needed here?
-        reader = new IgniteObjectReaderExImpl(portableContext(), arr, pos, null);
+        reader = new BinaryReaderExImpl(portableContext(), arr, pos, null);
     }
 
     /**
@@ -76,7 +76,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
     /**
      * @param obj Mutable portable object.
      */
-    public void registerObject(IgniteObjectBuilderImpl obj) {
+    public void registerObject(BinaryObjectBuilderImpl obj) {
         objMap.put(obj.start(), obj);
     }
 
@@ -170,7 +170,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
             return null;
 
         if (flag != STRING)
-            throw new IgniteObjectException("Failed to deserialize String.");
+            throw new BinaryObjectException("Failed to deserialize String.");
 
         boolean convert = readBoolean();
         int len = readInt();
@@ -338,7 +338,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
                 break;
 
             default:
-                throw new IgniteObjectException("Invalid flag value: " + type);
+                throw new BinaryObjectException("Invalid flag value: " + type);
         }
 
         pos += len;
@@ -359,10 +359,10 @@ public class PortableBuilderReader implements PortablePositionReadable {
             case GridPortableMarshaller.HANDLE: {
                 int objStart = pos - readIntPositioned(pos + 1);
 
-                IgniteObjectBuilderImpl res = objMap.get(objStart);
+                BinaryObjectBuilderImpl res = objMap.get(objStart);
 
                 if (res == null) {
-                    res = new IgniteObjectBuilderImpl(this, objStart);
+                    res = new BinaryObjectBuilderImpl(this, objStart);
 
                     objMap.put(objStart, res);
                 }
@@ -371,10 +371,10 @@ public class PortableBuilderReader implements PortablePositionReadable {
             }
 
             case GridPortableMarshaller.OBJ: {
-                IgniteObjectBuilderImpl res = objMap.get(pos);
+                BinaryObjectBuilderImpl res = objMap.get(pos);
 
                 if (res == null) {
-                    res = new IgniteObjectBuilderImpl(this, pos);
+                    res = new BinaryObjectBuilderImpl(this, pos);
 
                     objMap.put(pos, res);
                 }
@@ -455,13 +455,13 @@ public class PortableBuilderReader implements PortablePositionReadable {
 
                 int start = readIntPositioned(pos + 4 + size);
 
-                IgniteObjectImpl portableObj = new IgniteObjectImpl(ctx, arr, pos + 4 + start);
+                BinaryObjectImpl portableObj = new BinaryObjectImpl(ctx, arr, pos + 4 + start);
 
                 return new PortablePlainPortableObject(portableObj);
             }
 
             default:
-                throw new IgniteObjectException("Invalid flag value: " + type);
+                throw new BinaryObjectException("Invalid flag value: " + type);
         }
     }
 
@@ -484,10 +484,10 @@ public class PortableBuilderReader implements PortablePositionReadable {
             case GridPortableMarshaller.HANDLE: {
                 int objStart = pos - 1 - readInt();
 
-                IgniteObjectBuilderImpl res = objMap.get(objStart);
+                BinaryObjectBuilderImpl res = objMap.get(objStart);
 
                 if (res == null) {
-                    res = new IgniteObjectBuilderImpl(this, objStart);
+                    res = new BinaryObjectBuilderImpl(this, objStart);
 
                     objMap.put(objStart, res);
                 }
@@ -498,10 +498,10 @@ public class PortableBuilderReader implements PortablePositionReadable {
             case GridPortableMarshaller.OBJ: {
                 pos--;
 
-                IgniteObjectBuilderImpl res = objMap.get(pos);
+                BinaryObjectBuilderImpl res = objMap.get(pos);
 
                 if (res == null) {
-                    res = new IgniteObjectBuilderImpl(this, pos);
+                    res = new BinaryObjectBuilderImpl(this, pos);
 
                     objMap.put(pos, res);
                 }
@@ -633,7 +633,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
                     if (flag == GridPortableMarshaller.NULL) continue;
 
                     if (flag != GridPortableMarshaller.DATE)
-                        throw new IgniteObjectException("Invalid flag value: " + flag);
+                        throw new BinaryObjectException("Invalid flag value: " + flag);
 
                     long time = PortablePrimitives.readLong(arr, pos);
 
@@ -657,7 +657,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
                         continue;
 
                     if (flag != GridPortableMarshaller.TIMESTAMP)
-                        throw new IgniteObjectException("Invalid flag value: " + flag);
+                        throw new BinaryObjectException("Invalid flag value: " + flag);
 
                     long time = PortablePrimitives.readLong(arr, pos);
 
@@ -719,7 +719,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
                         return new PortableLazySet(this, size);
                 }
 
-                throw new IgniteObjectException("Unknown collection type: " + colType);
+                throw new BinaryObjectException("Unknown collection type: " + colType);
             }
 
             case GridPortableMarshaller.MAP:
@@ -741,14 +741,14 @@ public class PortableBuilderReader implements PortablePositionReadable {
 
                 int start = readInt();
 
-                IgniteObjectImpl portableObj = new IgniteObjectImpl(ctx, arr,
+                BinaryObjectImpl portableObj = new BinaryObjectImpl(ctx, arr,
                     pos - 4 - size + start);
 
                 return new PortablePlainPortableObject(portableObj);
             }
 
             default:
-                throw new IgniteObjectException("Invalid flag value: " + type);
+                throw new BinaryObjectException("Invalid flag value: " + type);
         }
 
         PortableAbstractLazyValue res;
@@ -794,7 +794,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
     /**
      * @return Reader.
      */
-    IgniteObjectReaderExImpl reader() {
+    BinaryReaderExImpl reader() {
         return reader;
     }
 
@@ -829,7 +829,7 @@ public class PortableBuilderReader implements PortablePositionReadable {
         }
 
         /** {@inheritDoc} */
-        @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+        @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
             ctx.writeValue(writer, wrappedCollection());
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializationAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializationAware.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializationAware.java
index 54e9150..a750f6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializationAware.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializationAware.java
@@ -27,5 +27,5 @@ interface PortableBuilderSerializationAware {
      * @param writer Writer.
      * @param ctx Context.
      */
-    public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx);
+    public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx);
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
index fae7f77..0e8eaa4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderSerializer.java
@@ -17,11 +17,11 @@
 
 package org.apache.ignite.internal.portable.builder;
 
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.IgniteObjectEx;
+import org.apache.ignite.internal.portable.BinaryObjectEx;
 import org.apache.ignite.internal.portable.PortableUtils;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.*;
 
 import java.util.*;
@@ -31,16 +31,16 @@ import java.util.*;
  */
 class PortableBuilderSerializer {
     /** */
-    private final Map<IgniteObjectBuilderImpl, Integer> objToPos = new IdentityHashMap<>();
+    private final Map<BinaryObjectBuilderImpl, Integer> objToPos = new IdentityHashMap<>();
 
     /** */
-    private Map<IgniteObject, IgniteObjectBuilderImpl> portableObjToWrapper;
+    private Map<BinaryObject, BinaryObjectBuilderImpl> portableObjToWrapper;
 
     /**
      * @param obj Mutable object.
      * @param posInResArr Object position in the array.
      */
-    public void registerObjectWriting(IgniteObjectBuilderImpl obj, int posInResArr) {
+    public void registerObjectWriting(BinaryObjectBuilderImpl obj, int posInResArr) {
         objToPos.put(obj, posInResArr);
     }
 
@@ -48,7 +48,7 @@ class PortableBuilderSerializer {
      * @param writer Writer.
      * @param val Value.
      */
-    public void writeValue(IgniteObjectWriterExImpl writer, Object val) {
+    public void writeValue(BinaryWriterExImpl writer, Object val) {
         if (val == null) {
             writer.writeByte(GridPortableMarshaller.NULL);
 
@@ -61,23 +61,23 @@ class PortableBuilderSerializer {
             return;
         }
 
-        if (val instanceof IgniteObjectEx) {
+        if (val instanceof BinaryObjectEx) {
             if (portableObjToWrapper == null)
                 portableObjToWrapper = new IdentityHashMap<>();
 
-            IgniteObjectBuilderImpl wrapper = portableObjToWrapper.get(val);
+            BinaryObjectBuilderImpl wrapper = portableObjToWrapper.get(val);
 
             if (wrapper == null) {
-                wrapper = IgniteObjectBuilderImpl.wrap((IgniteObject)val);
+                wrapper = BinaryObjectBuilderImpl.wrap((BinaryObject)val);
 
-                portableObjToWrapper.put((IgniteObject)val, wrapper);
+                portableObjToWrapper.put((BinaryObject)val, wrapper);
             }
 
             val = wrapper;
         }
 
-        if (val instanceof IgniteObjectBuilderImpl) {
-            IgniteObjectBuilderImpl obj = (IgniteObjectBuilderImpl)val;
+        if (val instanceof BinaryObjectBuilderImpl) {
+            BinaryObjectBuilderImpl obj = (BinaryObjectBuilderImpl)val;
 
             Integer posInResArr = objToPos.get(obj);
 
@@ -186,7 +186,7 @@ class PortableBuilderSerializer {
      * @param arr The array.
      * @param compTypeId Component type ID.
      */
-    public void writeArray(IgniteObjectWriterExImpl writer, byte elementType, Object[] arr, int compTypeId) {
+    public void writeArray(BinaryWriterExImpl writer, byte elementType, Object[] arr, int compTypeId) {
         writer.writeByte(elementType);
         writer.writeInt(compTypeId);
         writer.writeInt(arr.length);
@@ -201,7 +201,7 @@ class PortableBuilderSerializer {
      * @param arr The array.
      * @param clsName Component class name.
      */
-    public void writeArray(IgniteObjectWriterExImpl writer, byte elementType, Object[] arr, String clsName) {
+    public void writeArray(BinaryWriterExImpl writer, byte elementType, Object[] arr, String clsName) {
         writer.writeByte(elementType);
         writer.writeInt(GridPortableMarshaller.UNREGISTERED_TYPE_ID);
         writer.writeString(clsName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
index 62c4eb1..1e2ebc9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableEnumArrayLazyValue.java
@@ -18,10 +18,10 @@
 package org.apache.ignite.internal.portable.builder;
 
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.igniteobject.IgniteObjectException;
-import org.apache.ignite.igniteobject.IgniteObjectInvalidClassException;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 
 /**
  *
@@ -54,7 +54,7 @@ class PortableEnumArrayLazyValue extends PortableAbstractLazyValue {
                 cls = U.forName(reader.readString(), null);
             }
             catch (ClassNotFoundException e) {
-                throw new IgniteObjectInvalidClassException("Failed to load the class: " + clsName, e);
+                throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
             compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
@@ -90,7 +90,7 @@ class PortableEnumArrayLazyValue extends PortableAbstractLazyValue {
                 continue;
 
             if (flag != GridPortableMarshaller.ENUM)
-                throw new IgniteObjectException("Invalid flag value: " + flag);
+                throw new BinaryObjectException("Invalid flag value: " + flag);
 
             res[i] = new PortableBuilderEnum(reader);
         }
@@ -99,7 +99,7 @@ class PortableEnumArrayLazyValue extends PortableAbstractLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (val != null) {
             if (clsName != null)
                 ctx.writeArray(writer, GridPortableMarshaller.ENUM_ARR, (Object[])val, clsName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyArrayList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyArrayList.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyArrayList.java
index 02e116b..29bbe85 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyArrayList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyArrayList.java
@@ -131,7 +131,7 @@ class PortableLazyArrayList extends AbstractList<Object> implements PortableBuil
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (delegate == null) {
             int size = reader.readIntPositioned(off + 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyLinkedList.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyLinkedList.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyLinkedList.java
index 65f7dbc..3271aaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyLinkedList.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyLinkedList.java
@@ -188,7 +188,7 @@ class PortableLazyLinkedList extends AbstractList<Object> implements PortableBui
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (delegate == null) {
             int size = reader.readIntPositioned(off + 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMap.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMap.java
index 67fabde..32d4f44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMap.java
@@ -85,7 +85,7 @@ class PortableLazyMap extends AbstractMap<Object, Object> implements PortableBui
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (delegate == null) {
             int size = reader.readIntPositioned(off + 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java
index 8ce4cc1..5ebb223 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazyMapEntry.java
@@ -59,7 +59,7 @@ class PortableLazyMapEntry implements Map.Entry<Object, Object>, PortableBuilder
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         writer.writeByte(GridPortableMarshaller.MAP_ENTRY);
 
         ctx.writeValue(writer, key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazySet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazySet.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazySet.java
index 9e37868..7e62aa4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazySet.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableLazySet.java
@@ -21,7 +21,7 @@ import java.util.Collection;
 import java.util.Set;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableUtils;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
@@ -47,7 +47,7 @@ class PortableLazySet extends PortableAbstractLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (val == null) {
             int size = reader.readIntPositioned(off + 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableModifiableLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableModifiableLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableModifiableLazyValue.java
index 92bd4b4..2b439c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableModifiableLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableModifiableLazyValue.java
@@ -43,7 +43,7 @@ public class PortableModifiableLazyValue extends PortableAbstractLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (val == null)
             writer.write(reader.array(), valOff, len);
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
index b7f2820..6634eea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableObjectArrayLazyValue.java
@@ -18,9 +18,9 @@
 package org.apache.ignite.internal.portable.builder;
 
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.igniteobject.IgniteObjectInvalidClassException;
+import org.apache.ignite.binary.BinaryInvalidTypeException;
 
 /**
  *
@@ -53,7 +53,7 @@ class PortableObjectArrayLazyValue extends PortableAbstractLazyValue {
                 cls = U.forName(reader.readString(), null);
             }
             catch (ClassNotFoundException e) {
-                throw new IgniteObjectInvalidClassException("Failed to load the class: " + clsName, e);
+                throw new BinaryInvalidTypeException("Failed to load the class: " + clsName, e);
             }
 
             compTypeId = reader.portableContext().descriptorForClass(cls).typeId();
@@ -82,7 +82,7 @@ class PortableObjectArrayLazyValue extends PortableAbstractLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (clsName == null)
             ctx.writeArray(writer, GridPortableMarshaller.OBJ_ARR, lazyValsArr, compTypeId);
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainLazyValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainLazyValue.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainLazyValue.java
index a51820a..14c182b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainLazyValue.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainLazyValue.java
@@ -43,7 +43,7 @@ class PortablePlainLazyValue extends PortableAbstractLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         writer.write(reader.array(), valOff, len);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
index 5bbe3ca..1512b44 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortablePlainPortableObject.java
@@ -17,22 +17,22 @@
 
 package org.apache.ignite.internal.portable.builder;
 
-import org.apache.ignite.internal.portable.IgniteObjectImpl;
-import org.apache.ignite.internal.portable.IgniteObjectOffheapImpl;
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.internal.portable.BinaryObjectImpl;
+import org.apache.ignite.internal.portable.BinaryObjectOffheapImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
+import org.apache.ignite.binary.BinaryObject;
 
 /**
  *
  */
 public class PortablePlainPortableObject implements PortableLazyValue {
     /** */
-    private final IgniteObject portableObj;
+    private final BinaryObject portableObj;
 
     /**
      * @param portableObj Portable object.
      */
-    public PortablePlainPortableObject(IgniteObject portableObj) {
+    public PortablePlainPortableObject(BinaryObject portableObj) {
         this.portableObj = portableObj;
     }
 
@@ -42,12 +42,12 @@ public class PortablePlainPortableObject implements PortableLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
-        IgniteObject val = portableObj;
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
+        BinaryObject val = portableObj;
 
-        if (val instanceof IgniteObjectOffheapImpl)
-            val = ((IgniteObjectOffheapImpl)val).heapCopy();
+        if (val instanceof BinaryObjectOffheapImpl)
+            val = ((BinaryObjectOffheapImpl)val).heapCopy();
 
-        writer.doWritePortableObject((IgniteObjectImpl)val);
+        writer.doWritePortableObject((BinaryObjectImpl)val);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
index 21d25c3..5a5844a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableValueWithType.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.portable.builder;
 
-import org.apache.ignite.internal.portable.IgniteObjectWriterExImpl;
+import org.apache.ignite.internal.portable.BinaryWriterExImpl;
 import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
 import org.apache.ignite.internal.util.typedef.internal.S;
 
@@ -41,7 +41,7 @@ class PortableValueWithType implements PortableLazyValue {
     }
 
     /** {@inheritDoc} */
-    @Override public void writeTo(IgniteObjectWriterExImpl writer, PortableBuilderSerializer ctx) {
+    @Override public void writeTo(BinaryWriterExImpl writer, PortableBuilderSerializer ctx) {
         if (val instanceof PortableBuilderSerializationAware)
             ((PortableBuilderSerializationAware)val).writeTo(writer, ctx);
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
index ea04c94..2c4864e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/streams/PortableAbstractInputStream.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.portable.streams;
 
-import org.apache.ignite.igniteobject.IgniteObjectException;
+import org.apache.ignite.binary.BinaryObjectException;
 
 /**
  * Portable abstract input stream.
@@ -288,7 +288,7 @@ public abstract class PortableAbstractInputStream extends PortableAbstractStream
     /** {@inheritDoc} */
     @Override public void position(int pos) {
         if (remaining() + this.pos < pos)
-            throw new IgniteObjectException("Position is out of bounds: " + pos);
+            throw new BinaryObjectException("Position is out of bounds: " + pos);
         else
             this.pos = pos;
     }
@@ -305,7 +305,7 @@ public abstract class PortableAbstractInputStream extends PortableAbstractStream
      */
     protected void ensureEnoughData(int cnt) {
         if (remaining() < cnt)
-            throw new IgniteObjectException("Not enough data to read the value [position=" + pos +
+            throw new BinaryObjectException("Not enough data to read the value [position=" + pos +
                 ", requiredBytes=" + cnt + ", remainingBytes=" + remaining() + ']');
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index 63aea7b..4f0a970 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -33,7 +33,7 @@ import org.apache.ignite.cache.affinity.AffinityFunction;
 import org.apache.ignite.cache.affinity.AffinityKeyMapper;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.events.DiscoveryEvent;
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.internal.GridNodeOrderComparator;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.CacheObject;
@@ -369,7 +369,7 @@ public class GridAffinityAssignmentCache {
      * @return Affinity key.
      */
     private Object affinityKey(Object key) {
-        if (key instanceof CacheObject && !(key instanceof IgniteObject))
+        if (key instanceof CacheObject && !(key instanceof BinaryObject))
             key = ((CacheObject)key).value(ctx.cacheObjectContext(), false);
 
         return (key instanceof GridCacheInternal ? ctx.defaultAffMapper() : affMapper).affinityKey(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/20f5b9cd/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
index 6c82585..90306b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
@@ -38,7 +38,7 @@ import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
-import org.apache.ignite.igniteobject.IgniteObject;
+import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
@@ -498,7 +498,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException In case of error.
      */
     private <K> ClusterNode primary(AffinityInfo aff, K key) throws IgniteCheckedException {
-        if (key instanceof CacheObject && !(key instanceof IgniteObject))
+        if (key instanceof CacheObject && !(key instanceof BinaryObject))
             key = ((CacheObject)key).value(aff.cacheObjCtx, false);
 
         int part = aff.affFunc.partition(aff.mapper.affinityKey(key));
@@ -517,7 +517,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Primary and backup nodes.
      */
     private <K> List<ClusterNode> primaryAndBackups(AffinityInfo aff, K key) {
-        if (key instanceof CacheObject && !(key instanceof IgniteObject))
+        if (key instanceof CacheObject && !(key instanceof BinaryObject))
             key = ((CacheObject) key).value(aff.cacheObjCtx, false);
 
         int part = aff.affFunc.partition(aff.mapper.affinityKey(key));


Mime
View raw message