diff --git a/examples/config/example-default.xml b/examples/config/example-default.xml
deleted file mode 100644
index e6c359d..0000000
--- a/examples/config/example-default.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 127.0.0.1:47500..47509
-
-
-
-
-
-
-
-
diff --git a/examples/config/example-ignite.xml b/examples/config/example-ignite.xml
index d842a6d..e7adb54 100644
--- a/examples/config/example-ignite.xml
+++ b/examples/config/example-ignite.xml
@@ -22,18 +22,62 @@
-->
-
-
+ xmlns:util="http://www.springframework.org/schema/util"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util.xsd">
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 127.0.0.1:47500..47509
+
+
+
+
+
+
diff --git a/examples/config/portable/example-ignite-portable.xml b/examples/config/portable/example-ignite-portable.xml
deleted file mode 100644
index cde15ea..0000000
--- a/examples/config/portable/example-ignite-portable.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java b/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
deleted file mode 100644
index cb08b25..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Address.java
+++ /dev/null
@@ -1,72 +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.examples.portable;
-
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
-
-/**
- * Employee address.
- *
- * This class implements {@link PortableMarshalAware} only for example purposes,
- * in order to show how to customize serialization and deserialization of
- * portable objects.
- */
-public class Address implements PortableMarshalAware {
- /** Street. */
- private String street;
-
- /** ZIP code. */
- private int zip;
-
- /**
- * Required for portable deserialization.
- */
- public Address() {
- // No-op.
- }
-
- /**
- * @param street Street.
- * @param zip ZIP code.
- */
- public Address(String street, int zip) {
- this.street = street;
- this.zip = zip;
- }
-
- /** {@inheritDoc} */
- @Override public void writePortable(PortableWriter writer) throws PortableException {
- writer.writeString("street", street);
- writer.writeInt("zip", zip);
- }
-
- /** {@inheritDoc} */
- @Override public void readPortable(PortableReader reader) throws PortableException {
- street = reader.readString("street");
- zip = reader.readInt("zip");
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Address [street=" + street +
- ", zip=" + zip + ']';
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java b/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
deleted file mode 100644
index 9614168..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Employee.java
+++ /dev/null
@@ -1,93 +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.examples.portable;
-
-import java.util.Collection;
-
-/**
- * This class represents employee object.
- */
-public class Employee {
- /** Name. */
- private String name;
-
- /** Salary. */
- private long salary;
-
- /** Address. */
- private Address address;
-
- /** Departments. */
- private Collection departments;
-
- /**
- * Required for portable deserialization.
- */
- public Employee() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param salary Salary.
- * @param address Address.
- * @param departments Departments.
- */
- public Employee(String name, long salary, Address address, Collection departments) {
- this.name = name;
- this.salary = salary;
- this.address = address;
- this.departments = departments;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Salary.
- */
- public long salary() {
- return salary;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Departments.
- */
- public Collection departments() {
- return departments;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Employee [name=" + name +
- ", salary=" + salary +
- ", address=" + address +
- ", departments=" + departments + ']';
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java b/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
deleted file mode 100644
index f322167..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/EmployeeKey.java
+++ /dev/null
@@ -1,90 +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.examples.portable;
-
-/**
- * This class represents key for employee object.
- *
- * Used in query example to collocate employees
- * with their organizations.
- */
-public class EmployeeKey {
- /** ID. */
- private int id;
-
- /** Organization ID. */
- private int organizationId;
-
- /**
- * Required for portable deserialization.
- */
- public EmployeeKey() {
- // No-op.
- }
-
- /**
- * @param id ID.
- * @param organizationId Organization ID.
- */
- public EmployeeKey(int id, int organizationId) {
- this.id = id;
- this.organizationId = organizationId;
- }
-
- /**
- * @return ID.
- */
- public int id() {
- return id;
- }
-
- /**
- * @return Organization ID.
- */
- public int organizationId() {
- return organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- EmployeeKey key = (EmployeeKey)o;
-
- return id == key.id && organizationId == key.organizationId;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = id;
-
- res = 31 * res + organizationId;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "EmployeeKey [id=" + id +
- ", organizationId=" + organizationId + ']';
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java b/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
deleted file mode 100644
index 87a41f7..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/ExamplePortableNodeStartup.java
+++ /dev/null
@@ -1,36 +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.examples.portable;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-
-/**
- * Starts up an empty node with example configuration and portable marshaller enabled.
- */
-public class ExamplePortableNodeStartup {
- /**
- * Start up an empty node with example configuration and portable marshaller enabled.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If failed.
- */
- public static void main(String[] args) throws IgniteException {
- Ignition.start("examples/config/portable/example-ignite-portable.xml");
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java b/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
deleted file mode 100644
index f52cac1..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/Organization.java
+++ /dev/null
@@ -1,93 +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.examples.portable;
-
-import java.sql.Timestamp;
-
-/**
- * This class represents organization object.
- */
-public class Organization {
- /** Name. */
- private String name;
-
- /** Address. */
- private Address address;
-
- /** Type. */
- private OrganizationType type;
-
- /** Last update time. */
- private Timestamp lastUpdated;
-
- /**
- * Required for portable deserialization.
- */
- public Organization() {
- // No-op.
- }
-
- /**
- * @param name Name.
- * @param address Address.
- * @param type Type.
- * @param lastUpdated Last update time.
- */
- public Organization(String name, Address address, OrganizationType type, Timestamp lastUpdated) {
- this.name = name;
- this.address = address;
- this.type = type;
- this.lastUpdated = lastUpdated;
- }
-
- /**
- * @return Name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Address.
- */
- public Address address() {
- return address;
- }
-
- /**
- * @return Type.
- */
- public OrganizationType type() {
- return type;
- }
-
- /**
- * @return Last update time.
- */
- public Timestamp lastUpdated() {
- return lastUpdated;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Organization [name=" + name +
- ", address=" + address +
- ", type=" + type +
- ", lastUpdated=" + lastUpdated + ']';
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java b/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
deleted file mode 100644
index c753e2d..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/OrganizationType.java
+++ /dev/null
@@ -1,32 +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.examples.portable;
-
-/**
- * Organization type enum.
- */
-public enum OrganizationType {
- /** Non-profit organization. */
- NON_PROFIT,
-
- /** Private organization. */
- PRIVATE,
-
- /** Government organization. */
- GOVERNMENT
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
deleted file mode 100644
index 34d9cde..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientPortableTaskExecutionExample.java
+++ /dev/null
@@ -1,154 +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.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with task execution.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- *
- * The example executes map-reduce task that accepts collection of portable objects as an argument.
- * Since these objects are never deserialized on remote nodes, classes are not required on classpath
- * of these nodes.
- *
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- *
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class ComputeClientPortableTaskExecutionExample {
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects task execution example started.");
-
- if (ignite.cluster().forRemotes().nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote nodes to be started.");
- System.out.println(">>> Please start at least 1 remote node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- // Generate employees to calculate average salary for.
- Collection employees = employees();
-
- System.out.println();
- System.out.println(">>> Calculating average salary for employees:");
-
- for (Employee employee : employees)
- System.out.println(">>> " + employee);
-
- // Convert collection of employees to collection of portable objects.
- // This allows to send objects across nodes without requiring to have
- // Employee class on classpath of these nodes.
- Collection portables = ignite.portables().toPortable(employees);
-
- // Execute task and get average salary.
- Long avgSalary = ignite.compute(ignite.cluster().forRemotes()).execute(new ComputeClientTask(), portables);
-
- System.out.println();
- System.out.println(">>> Average salary for all employees: " + avgSalary);
- System.out.println();
- }
- }
-
- /**
- * Creates collection of employees.
- *
- * @return Collection of employees.
- */
- private static Collection employees() {
- Collection employees = new ArrayList<>();
-
- employees.add(new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- Arrays.asList("Human Resources", "Customer Service")
- ));
-
- employees.add(new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78205),
- Arrays.asList("Development", "QA")
- ));
-
- employees.add(new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- Arrays.asList("Logistics")
- ));
-
- employees.add(new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, Hornitos, CA", 95325),
- Arrays.asList("Development")
- ));
-
- employees.add(new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78758),
- Arrays.asList("Sales")
- ));
-
- employees.add(new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- Arrays.asList("Sales")
- ));
-
- employees.add(new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 12110),
- Arrays.asList("Development", "QA")
- ));
-
- employees.add(new Employee(
- "Jack Yang",
- 12900,
- new Address("4425 Parrish Avenue Smithsons Valley, TX", 78130),
- Arrays.asList("Sales")
- ));
-
- return employees;
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
deleted file mode 100644
index 0eee8c6..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/ComputeClientTask.java
+++ /dev/null
@@ -1,116 +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.examples.portable.computegrid;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.ignite.compute.ComputeJob;
-import org.apache.ignite.compute.ComputeJobAdapter;
-import org.apache.ignite.compute.ComputeJobResult;
-import org.apache.ignite.compute.ComputeTaskSplitAdapter;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.portable.PortableObject;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Task that is used for {@link ComputeClientPortableTaskExecutionExample} and
- * similar examples in .NET and C++.
- *
- * This task calculates average salary for provided collection of employees.
- * It splits the collection into batches of size {@code 3} and creates a job
- * for each batch. After all jobs are executed, there results are reduced to
- * get the average salary.
- */
-public class ComputeClientTask extends ComputeTaskSplitAdapter, Long> {
- /** {@inheritDoc} */
- @Override protected Collection extends ComputeJob> split(
- int gridSize,
- Collection arg
- ) {
- Collection jobs = new ArrayList<>();
-
- Collection employees = new ArrayList<>();
-
- // Split provided collection into batches and
- // create a job for each batch.
- for (PortableObject employee : arg) {
- employees.add(employee);
-
- if (employees.size() == 3) {
- jobs.add(new ComputeClientJob(employees));
-
- employees = new ArrayList<>(3);
- }
- }
-
- if (!employees.isEmpty())
- jobs.add(new ComputeClientJob(employees));
-
- return jobs;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Long reduce(List results) {
- long sum = 0;
- int cnt = 0;
-
- for (ComputeJobResult res : results) {
- IgniteBiTuple t = res.getData();
-
- sum += t.get1();
- cnt += t.get2();
- }
-
- return sum / cnt;
- }
-
- /**
- * Remote job for {@link ComputeClientTask}.
- */
- private static class ComputeClientJob extends ComputeJobAdapter {
- /** Collection of employees. */
- private final Collection employees;
-
- /**
- * @param employees Collection of employees.
- */
- private ComputeClientJob(Collection employees) {
- this.employees = employees;
- }
-
- /** {@inheritDoc} */
- @Nullable @Override public Object execute() {
- long sum = 0;
- int cnt = 0;
-
- for (PortableObject employee : employees) {
- System.out.println(">>> Processing employee: " + employee.field("name"));
-
- // Get salary from portable object. Note that object
- // doesn't need to be fully deserialized.
- long salary = employee.field("salary");
-
- sum += salary;
- cnt++;
- }
-
- return new IgniteBiTuple<>(sum, cnt);
- }
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
deleted file mode 100644
index 469128c..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/computegrid/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Demonstrates the usage of portable objects with task execution.
- */
-package org.apache.ignite.examples.portable.computegrid;
\ No newline at end of file
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
deleted file mode 100644
index 77c5d95..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortablePutGetExample.java
+++ /dev/null
@@ -1,230 +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.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with Ignite cache.
- * Specifically it shows that portable objects are simple Java POJOs and do not require any special treatment.
- *
- * The example executes several put-get operations on Ignite cache with portable values. Note that
- * it demonstrates how portable object can be retrieved in fully-deserialized form or in portable object
- * format using special cache projection.
- *
- * Remote nodes should always be started with special configuration file which
- * enables the portable marshaller: {@code 'ignite.{sh|bat} examples/config/portable/example-ignite-portable.xml'}.
- *
- * Alternatively you can run {@link ExamplePortableNodeStartup} in another JVM which will
- * start node with {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortablePutGetExample {
- /** Cache name. */
- private static final String CACHE_NAME = CacheClientPortablePutGetExample.class.getSimpleName();
-
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects cache put-get example started.");
-
- CacheConfiguration cfg = new CacheConfiguration<>();
-
- cfg.setCacheMode(CacheMode.PARTITIONED);
- cfg.setName(CACHE_NAME);
- cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
-
- try (IgniteCache cache = ignite.createCache(cfg)) {
- if (ignite.cluster().forDataNodes(cache.getName()).nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote cache node nodes to be started.");
- System.out.println(">>> Please start at least 1 remote cache node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- putGet(cache);
- putGetPortable(cache);
- putGetAll(cache);
- putGetAllPortable(cache);
-
- System.out.println();
- }
- finally {
- // Delete cache with its content completely.
- ignite.destroyCache(CACHE_NAME);
- }
- }
- }
-
- /**
- * Execute individual put and get.
- *
- * @param cache Cache.
- */
- private static void putGet(IgniteCache cache) {
- // Create new Organization portable object to store in cache.
- Organization org = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- // Put created data entry to cache.
- cache.put(1, org);
-
- // Get recently created organization as a strongly-typed fully de-serialized instance.
- Organization orgFromCache = cache.get(1);
-
- System.out.println();
- System.out.println(">>> Retrieved organization instance from cache: " + orgFromCache);
- }
-
- /**
- * Execute individual put and get, getting value in portable format, without de-serializing it.
- *
- * @param cache Cache.
- */
- private static void putGetPortable(IgniteCache cache) {
- // Create new Organization portable object to store in cache.
- Organization org = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- // Put created data entry to cache.
- cache.put(1, org);
-
- // Get cache that will get values as portable objects.
- IgniteCache portableCache = cache.withKeepPortable();
-
- // Get recently created organization as a portable object.
- PortableObject po = portableCache.get(1);
-
- // Get organization's name from portable object (note that
- // object doesn't need to be fully deserialized).
- String name = po.field("name");
-
- System.out.println();
- System.out.println(">>> Retrieved organization name from portable object: " + name);
- }
-
- /**
- * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations.
- *
- * @param cache Cache.
- */
- private static void putGetAll(IgniteCache cache) {
- // Create new Organization portable objects to store in cache.
- Organization org1 = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Organization org2 = new Organization(
- "Red Cross", // Name.
- new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
- OrganizationType.NON_PROFIT, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Map map = new HashMap<>();
-
- map.put(1, org1);
- map.put(2, org2);
-
- // Put created data entries to cache.
- cache.putAll(map);
-
- // Get recently created organizations as a strongly-typed fully de-serialized instances.
- Map mapFromCache = cache.getAll(map.keySet());
-
- System.out.println();
- System.out.println(">>> Retrieved organization instances from cache:");
-
- for (Organization org : mapFromCache.values())
- System.out.println(">>> " + org);
- }
-
- /**
- * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations,
- * getting values in portable format, without de-serializing it.
- *
- * @param cache Cache.
- */
- private static void putGetAllPortable(IgniteCache cache) {
- // Create new Organization portable objects to store in cache.
- Organization org1 = new Organization(
- "Microsoft", // Name.
- new Address("1096 Eddy Street, San Francisco, CA", 94109), // Address.
- OrganizationType.PRIVATE, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Organization org2 = new Organization(
- "Red Cross", // Name.
- new Address("184 Fidler Drive, San Antonio, TX", 78205), // Address.
- OrganizationType.NON_PROFIT, // Type.
- new Timestamp(System.currentTimeMillis())); // Last update time.
-
- Map map = new HashMap<>();
-
- map.put(1, org1);
- map.put(2, org2);
-
- // Put created data entries to cache.
- cache.putAll(map);
-
- // Get cache that will get values as portable objects.
- IgniteCache portableCache = cache.withKeepPortable();
-
- // Get recently created organizations as portable objects.
- Map poMap = portableCache.getAll(map.keySet());
-
- Collection names = new ArrayList<>();
-
- // Get organizations' names from portable objects (note that
- // objects don't need to be fully deserialized).
- for (PortableObject po : poMap.values())
- names.add(po.field("name"));
-
- System.out.println();
- System.out.println(">>> Retrieved organization names from portable objects: " + names);
- }
-}
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
deleted file mode 100644
index 3170864..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/CacheClientPortableQueryExample.java
+++ /dev/null
@@ -1,325 +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.examples.portable.datagrid;
-
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.CacheTypeMetadata;
-import org.apache.ignite.cache.query.QueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.TextQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.examples.portable.Address;
-import org.apache.ignite.examples.portable.Employee;
-import org.apache.ignite.examples.portable.EmployeeKey;
-import org.apache.ignite.examples.portable.ExamplePortableNodeStartup;
-import org.apache.ignite.examples.portable.Organization;
-import org.apache.ignite.examples.portable.OrganizationType;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * This example demonstrates use of portable objects with cache queries.
- * The example populates cache with sample data and runs several SQL and full text queries over this data.
- *
- * Remote nodes should always be started with {@link ExamplePortableNodeStartup} which starts a node with
- * {@code examples/config/portable/example-ignite-portable.xml} configuration.
- */
-public class CacheClientPortableQueryExample {
- /** Organization cache name. */
- private static final String ORGANIZATION_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
- + "Organizations";
-
- /** Employee cache name. */
- private static final String EMPLOYEE_CACHE_NAME = CacheClientPortableQueryExample.class.getSimpleName()
- + "Employees";
-
- /**
- * Executes example.
- *
- * @param args Command line arguments, none required.
- */
- public static void main(String[] args) {
- try (Ignite ignite = Ignition.start("examples/config/portable/example-ignite-portable.xml")) {
- System.out.println();
- System.out.println(">>> Portable objects cache query example started.");
-
- CacheConfiguration orgCacheCfg = new CacheConfiguration<>();
-
- orgCacheCfg.setCacheMode(CacheMode.PARTITIONED);
- orgCacheCfg.setName(ORGANIZATION_CACHE_NAME);
-
- orgCacheCfg.setTypeMetadata(Arrays.asList(createOrganizationTypeMetadata()));
-
- CacheConfiguration employeeCacheCfg = new CacheConfiguration<>();
-
- employeeCacheCfg.setCacheMode(CacheMode.PARTITIONED);
- employeeCacheCfg.setName(EMPLOYEE_CACHE_NAME);
-
- employeeCacheCfg.setTypeMetadata(Arrays.asList(createEmployeeTypeMetadata()));
-
- try (IgniteCache orgCache = ignite.createCache(orgCacheCfg);
- IgniteCache employeeCache = ignite.createCache(employeeCacheCfg)
- ) {
- if (ignite.cluster().forDataNodes(orgCache.getName()).nodes().isEmpty()) {
- System.out.println();
- System.out.println(">>> This example requires remote cache nodes to be started.");
- System.out.println(">>> Please start at least 1 remote cache node.");
- System.out.println(">>> Refer to example's javadoc for details on configuration.");
- System.out.println();
-
- return;
- }
-
- // Populate cache with sample data entries.
- populateCache(orgCache, employeeCache);
-
- // Get cache that will work with portable objects.
- IgniteCache portableCache = employeeCache.withKeepPortable();
-
- // Run SQL query example.
- sqlQuery(portableCache);
-
- // Run SQL query with join example.
- sqlJoinQuery(portableCache);
-
- // Run SQL fields query example.
- sqlFieldsQuery(portableCache);
-
- // Run full text query example.
- textQuery(portableCache);
-
- System.out.println();
- }
- finally {
- // Delete caches with their content completely.
- ignite.destroyCache(ORGANIZATION_CACHE_NAME);
- ignite.destroyCache(EMPLOYEE_CACHE_NAME);
- }
- }
- }
-
- /**
- * Create cache type metadata for {@link Employee}.
- *
- * @return Cache type metadata.
- */
- private static CacheTypeMetadata createEmployeeTypeMetadata() {
- CacheTypeMetadata employeeTypeMeta = new CacheTypeMetadata();
-
- employeeTypeMeta.setValueType(Employee.class);
-
- employeeTypeMeta.setKeyType(EmployeeKey.class);
-
- Map> ascFields = new HashMap<>();
-
- ascFields.put("name", String.class);
- ascFields.put("salary", Long.class);
- ascFields.put("address.zip", Integer.class);
- ascFields.put("organizationId", Integer.class);
-
- employeeTypeMeta.setAscendingFields(ascFields);
-
- employeeTypeMeta.setTextFields(Arrays.asList("address.street"));
-
- return employeeTypeMeta;
- }
-
- /**
- * Create cache type metadata for {@link Organization}.
- *
- * @return Cache type metadata.
- */
- private static CacheTypeMetadata createOrganizationTypeMetadata() {
- CacheTypeMetadata organizationTypeMeta = new CacheTypeMetadata();
-
- organizationTypeMeta.setValueType(Organization.class);
-
- organizationTypeMeta.setKeyType(Integer.class);
-
- Map> ascFields = new HashMap<>();
-
- ascFields.put("name", String.class);
-
- Map> queryFields = new HashMap<>();
-
- queryFields.put("address.street", String.class);
-
- organizationTypeMeta.setAscendingFields(ascFields);
-
- organizationTypeMeta.setQueryFields(queryFields);
-
- return organizationTypeMeta;
- }
-
- /**
- * Queries employees that have provided ZIP code in address.
- *
- * @param cache Ignite cache.
- */
- private static void sqlQuery(IgniteCache cache) {
- SqlQuery query = new SqlQuery<>(Employee.class, "zip = ?");
-
- int zip = 94109;
-
- QueryCursor> employees = cache.query(query.setArgs(zip));
-
- System.out.println();
- System.out.println(">>> Employees with zip " + zip + ':');
-
- for (Cache.Entry e : employees.getAll())
- System.out.println(">>> " + e.getValue().deserialize());
- }
-
- /**
- * Queries employees that work for organization with provided name.
- *
- * @param cache Ignite cache.
- */
- private static void sqlJoinQuery(IgniteCache cache) {
- SqlQuery query = new SqlQuery<>(Employee.class,
- "from Employee, \"" + ORGANIZATION_CACHE_NAME + "\".Organization as org " +
- "where Employee.organizationId = org._key and org.name = ?");
-
- String organizationName = "GridGain";
-
- QueryCursor> employees =
- cache.query(query.setArgs(organizationName));
-
- System.out.println();
- System.out.println(">>> Employees working for " + organizationName + ':');
-
- for (Cache.Entry e : employees.getAll())
- System.out.println(">>> " + e.getValue());
- }
-
- /**
- * Queries names and salaries for all employees.
- *
- * @param cache Ignite cache.
- */
- private static void sqlFieldsQuery(IgniteCache cache) {
- SqlFieldsQuery query = new SqlFieldsQuery("select name, salary from Employee");
-
- QueryCursor> employees = cache.query(query);
-
- System.out.println();
- System.out.println(">>> Employee names and their salaries:");
-
- for (List> row : employees.getAll())
- System.out.println(">>> [Name=" + row.get(0) + ", salary=" + row.get(1) + ']');
- }
-
- /**
- * Queries employees that live in Texas using full-text query API.
- *
- * @param cache Ignite cache.
- */
- private static void textQuery(IgniteCache cache) {
- TextQuery query = new TextQuery<>(Employee.class, "TX");
-
- QueryCursor> employees = cache.query(query);
-
- System.out.println();
- System.out.println(">>> Employees living in Texas:");
-
- for (Cache.Entry e : employees.getAll())
- System.out.println(">>> " + e.getValue().deserialize());
- }
-
- /**
- * Populates cache with data.
- *
- * @param orgCache Organization cache.
- * @param employeeCache Employee cache.
- */
- private static void populateCache(IgniteCache orgCache,
- IgniteCache employeeCache) {
- orgCache.put(1, new Organization(
- "GridGain",
- new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
- OrganizationType.PRIVATE,
- new Timestamp(System.currentTimeMillis())
- ));
-
- orgCache.put(2, new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.PRIVATE,
- new Timestamp(System.currentTimeMillis())
- ));
-
- employeeCache.put(new EmployeeKey(1, 1), new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- Arrays.asList("Human Resources", "Customer Service")
- ));
-
- employeeCache.put(new EmployeeKey(2, 1), new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78130),
- Arrays.asList("Development", "QA")
- ));
-
- employeeCache.put(new EmployeeKey(3, 1), new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- Arrays.asList("Logistics")
- ));
-
- employeeCache.put(new EmployeeKey(4, 2), new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, San Francisco, CA", 94109),
- Arrays.asList("Development")
- ));
-
- employeeCache.put(new EmployeeKey(5, 2), new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78130),
- Arrays.asList("Sales")
- ));
-
- employeeCache.put(new EmployeeKey(6, 2), new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- Arrays.asList("Sales")
- ));
-
- employeeCache.put(new EmployeeKey(7, 2), new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 12110),
- Arrays.asList("Development", "QA")
- ));
- }
-}
-
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
deleted file mode 100644
index b24f233..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/datagrid/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Demonstrates the usage of portable objects with cache.
- */
-package org.apache.ignite.examples.portable.datagrid;
\ No newline at end of file
diff --git a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java b/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
deleted file mode 100644
index 4301027..0000000
--- a/examples/src/main/java/org/apache/ignite/examples/portable/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains portable classes and examples.
- */
-package org.apache.ignite.examples.portable;
\ No newline at end of file
diff --git a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
deleted file mode 100644
index 6ea1484..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/CacheClientPortableExampleTest.java
+++ /dev/null
@@ -1,46 +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.examples;
-
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortablePutGetExample;
-import org.apache.ignite.examples.portable.datagrid.CacheClientPortableQueryExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class CacheClientPortableExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/portable/example-ignite-portable.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortablePutGetExample() throws Exception {
- CacheClientPortablePutGetExample.main(new String[] {});
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableQueryExample() throws Exception {
- CacheClientPortableQueryExample.main(new String[] {});
- }
-}
\ No newline at end of file
diff --git a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java b/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
deleted file mode 100644
index 2223aec..0000000
--- a/examples/src/test/java/org/apache/ignite/examples/ComputeClientPortableExampleTest.java
+++ /dev/null
@@ -1,37 +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.examples;
-
-import org.apache.ignite.examples.portable.computegrid.ComputeClientPortableTaskExecutionExample;
-import org.apache.ignite.testframework.junits.common.GridAbstractExamplesTest;
-
-/**
- *
- */
-public class ComputeClientPortableExampleTest extends GridAbstractExamplesTest {
- /** {@inheritDoc} */
- @Override protected String defaultConfig() {
- return "examples/config/portable/example-ignite-portable.xml";
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testPortableTaskExecutionExample() throws Exception {
- ComputeClientPortableTaskExecutionExample.main(new String[] {});
- }
-}
\ No newline at end of file
diff --git a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
index baa23fc..4669ae4 100644
--- a/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
+++ b/examples/src/test/java/org/apache/ignite/testsuites/IgniteExamplesSelfTestSuite.java
@@ -20,12 +20,10 @@ package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
import org.apache.ignite.examples.BasicExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.BasicExamplesSelfTest;
-import org.apache.ignite.examples.CacheClientPortableExampleTest;
import org.apache.ignite.examples.CacheExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.CacheExamplesSelfTest;
import org.apache.ignite.examples.CheckpointExamplesSelfTest;
import org.apache.ignite.examples.ClusterGroupExampleSelfTest;
-import org.apache.ignite.examples.ComputeClientPortableExampleTest;
import org.apache.ignite.examples.ContinuationExamplesMultiNodeSelfTest;
import org.apache.ignite.examples.ContinuationExamplesSelfTest;
import org.apache.ignite.examples.ContinuousMapperExamplesMultiNodeSelfTest;
@@ -95,10 +93,6 @@ public class IgniteExamplesSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(MonteCarloExamplesMultiNodeSelfTest.class));
suite.addTest(new TestSuite(HibernateL2CacheExampleMultiNodeSelfTest.class));
- // Portable.
- suite.addTest(new TestSuite(CacheClientPortableExampleTest.class));
- suite.addTest(new TestSuite(ComputeClientPortableExampleTest.class));
-
return suite;
}
}
\ No newline at end of file
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 2f0dde7..9162afe 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -34,13 +34,6 @@
1.4.0-SNAPSHOThttp://ignite.apache.org
-
-
- ignite-portables-test-repo
- file://${basedir}/src/test/portables/repo
-
-
-
apache-ignite
@@ -176,20 +169,6 @@
2.4test
-
-
- org.apache.ignite.portable
- test1
- 1.1
- test
-
-
-
- org.apache.ignite.portable
- test2
- 1.1
- test
-
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 62fd020..0afccd0 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -459,13 +459,6 @@ public interface Ignite extends AutoCloseable {
public T plugin(String name) throws PluginNotFoundException;
/**
- * Gets an instance of {@link IgnitePortables} interface.
- *
- * @return Instance of {@link IgnitePortables} interface.
- */
- public IgnitePortables portables();
-
- /**
* Closes {@code this} instance of grid. This method is identical to calling
* {@link G#stop(String, boolean) G.stop(gridName, true)}.
*
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index e0f9f55..e5abbb4 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -55,7 +55,7 @@ import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgniteFuture;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.mxbean.CacheMetricsMXBean;
import org.jetbrains.annotations.Nullable;
@@ -132,44 +132,6 @@ public interface IgniteCache extends javax.cache.Cache, IgniteAsyncS
public IgniteCache withNoRetries();
/**
- * Returns cache that will operate with portable objects.
- *
- * Cache returned by this method will not be forced to deserialize portable objects,
- * so keys and values will be returned from cache API methods without changes. Therefore,
- * signature of the cache can contain only following types:
- *
- *
org.apache.ignite.portable.PortableObject for portable classes
- *
All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
- *
Arrays of primitives (byte[], int[], ...)
- *
{@link String} and array of {@link String}s
- *
{@link UUID} and array of {@link UUID}s
- *
{@link Date} and array of {@link Date}s
- *
{@link Timestamp} and array of {@link Timestamp}s
- *
Enums and array of enums
- *
- * Maps, collections and array of objects (but objects inside
- * them will still be converted if they are portable)
- *
- *
- *
- * For example, if you use {@link Integer} as a key and {@code Value} class as a value
- * (which will be stored in portable format), you should acquire following projection
- * to avoid deserialization:
- *
- * IgniteCache prj = cache.withKeepPortable();
- *
- * // Value is not deserialized and returned in portable format.
- * PortableObject po = prj.get(1);
- *
- *
- * Note that this method makes sense only if cache is working in portable mode ({@link PortableMarshaller} is used).
- * If not, this method is no-op and will return current cache.
- *
- * @return New cache instance for portable objects.
- */
- public IgniteCache withKeepPortable();
-
- /**
* Executes {@link #localLoadCache(IgniteBiPredicate, Object...)} on all cache nodes.
*
* @param p Optional predicate (may be {@code null}). If provided, will be used to
diff --git a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
deleted file mode 100644
index ee0a4ec..0000000
--- a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
+++ /dev/null
@@ -1,370 +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;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import java.util.UUID;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Defines portable objects functionality. With portable objects you are able to:
- *
- *
Seamlessly interoperate between Java, .NET, and C++.
- *
Make any object portable with zero code change to your existing code.
- *
Nest portable objects within each other.
- *
Automatically handle {@code circular} or {@code null} references.
- *
Automatically convert collections and maps between Java, .NET, and C++.
- *
- * Optionally avoid deserialization of objects on the server side
- * (objects are stored in {@link PortableObject} format).
- *
- *
Avoid need to have concrete class definitions on the server side.
- *
Dynamically change structure of the classes without having to restart the cluster.
- *
Index into portable objects for querying purposes.
- *
- *
Working With Portables Directly
- * Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- *
- * To work with the portable format directly, user should create a special cache projection
- * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
- *
- * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use PortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- *
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- *
- * If we used, for example, one of the automatically handled portable types for a key, like integer,
- * and still wanted to work with binary portable format for values, then we would declare cache projection
- * as follows:
- *
- * Note that only portable classes are converted to {@link PortableObject} format. Following
- * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
- * object, and instances of these classes will be stored in cache without changes):
- *
- *
All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
- *
Arrays of primitives (byte[], int[], ...)
- *
{@link String} and array of {@link String}s
- *
{@link UUID} and array of {@link UUID}s
- *
{@link Date} and array of {@link Date}s
- *
{@link Timestamp} and array of {@link Timestamp}s
- *
Enums and array of enums
- *
- * Maps, collections and array of objects (but objects inside
- * them will still be converted if they are portable)
- *
- *
- *
Working With Maps and Collections
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- *
Building Portable Objects
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- *
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- *
- * NOTE: you don't need to convert typed objects to portable format before storing
- * them in cache, Ignite will do that automatically.
- *
Portable Metadata
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- *
Dynamic Structure Changes
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- *
Configuration
- * By default all your objects are considered as portables and no specific configuration is needed.
- * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
- * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
- * The only requirement Ignite imposes is that your object has an empty
- * constructor. Note, that since server side does not have to know the class definition,
- * you only need to list portable objects in configuration on the client side. However, if you
- * list them on the server side as well, then you get the ability to deserialize portable objects
- * into concrete types on the server as well as on the client.
- *
- * Here is an example of portable configuration (note that star (*) notation is supported):
- *
- * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
- * Do it in case if you need to override other configuration properties on per-type level, like
- * ID-mapper, or serializer.
- *
Custom Affinity Keys
- * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
- * storing objects in cache. For example, if you are caching {@code Employee} object with
- * {@code Organization}, and want to colocate employees with organization they work for,
- * so you can process them together, you need to specify an alternate affinity key.
- * With portable objects you would have to do it as following:
- *
- * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
- * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
- *
- * public class Address implements PortableMarshalAware {
- * private String street;
- * private int zip;
- *
- * // Empty constructor required for portable deserialization.
- * public Address() {}
- *
- * @Override public void writePortable(PortableWriter writer) throws PortableException {
- * writer.writeString("street", street);
- * writer.writeInt("zip", zip);
- * }
- *
- * @Override public void readPortable(PortableReader reader) throws PortableException {
- * street = reader.readString("street");
- * zip = reader.readInt("zip");
- * }
- * }
- *
- * Alternatively, if you cannot change class definitions, you can provide custom serialization
- * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
- * for a specific type via {@link PortableTypeConfiguration} instance.
- *
- * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
- *
- *
- * {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
- * It may be used to replace the de-serialized object by another one of your choice.
- *
- *
- * {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
- * allows the developer to provide a replacement object that will be serialized instead of the original one.
- *
- *
- *
- *
Custom ID Mappers
- * Ignite implementation uses name hash codes to generate IDs for class names or field names
- * internally. However, in cases when you want to provide your own ID mapping schema,
- * you can provide your own {@link PortableIdMapper} implementation.
- *
- * ID-mapper may be provided either globally in {@link PortableMarshaller},
- * or for a specific type via {@link PortableTypeConfiguration} instance.
- *
Query Indexing
- * Portable objects can be indexed for querying by specifying index fields in
- * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
- * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
- * like so:
- *
- */
-public interface IgnitePortables {
- /**
- * Gets type ID for given type name.
- *
- * @param typeName Type name.
- * @return Type ID.
- */
- public int typeId(String typeName);
-
- /**
- * Converts provided object to instance of {@link PortableObject}.
- *
- * @param obj Object to convert.
- * @return Converted object.
- * @throws PortableException In case of error.
- */
- public T toPortable(@Nullable Object obj) throws PortableException;
-
- /**
- * Creates new portable builder.
- *
- * @param typeId ID of the type.
- * @return Newly portable builder.
- */
- public PortableBuilder builder(int typeId);
-
- /**
- * Creates new portable builder.
- *
- * @param typeName Type name.
- * @return Newly portable builder.
- */
- public PortableBuilder builder(String typeName);
-
- /**
- * Creates portable builder initialized by existing portable object.
- *
- * @param portableObj Portable object to initialize builder.
- * @return Portable builder.
- */
- public PortableBuilder builder(PortableObject portableObj);
-
- /**
- * Gets metadata for provided class.
- *
- * @param cls Class.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(Class> cls) throws PortableException;
-
- /**
- * Gets metadata for provided class name.
- *
- * @param typeName Type name.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
-
- /**
- * Gets metadata for provided type ID.
- *
- * @param typeId Type ID.
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
-
- /**
- * Gets metadata for all known types.
- *
- * @return Metadata.
- * @throws PortableException In case of error.
- */
- public Collection metadata() throws PortableException;
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 9fb56bc..59058f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -163,10 +163,6 @@ public class CacheConfiguration extends MutableConfiguration {
/** Default size for onheap SQL row cache size. */
public static final int DFLT_SQL_ONHEAP_ROW_CACHE_SIZE = 10 * 1024;
- /** Default value for keep portable in store behavior .*/
- @SuppressWarnings({"UnnecessaryBoxing", "BooleanConstructorCall"})
- public static final Boolean DFLT_KEEP_PORTABLE_IN_STORE = new Boolean(true);
-
/** Cache name. */
private String name;
@@ -219,9 +215,6 @@ public class CacheConfiguration extends MutableConfiguration {
private Factory storeFactory;
/** */
- private Boolean keepPortableInStore = DFLT_KEEP_PORTABLE_IN_STORE;
-
- /** */
private boolean loadPrevVal = DFLT_LOAD_PREV_VAL;
/** Node group resolver. */
@@ -383,8 +376,6 @@ public class CacheConfiguration extends MutableConfiguration {
invalidate = cc.isInvalidate();
isReadThrough = cc.isReadThrough();
isWriteThrough = cc.isWriteThrough();
- keepPortableInStore = cc.isKeepPortableInStore() != null ? cc.isKeepPortableInStore() :
- DFLT_KEEP_PORTABLE_IN_STORE;
listenerConfigurations = cc.listenerConfigurations;
loadPrevVal = cc.isLoadPreviousValue();
longQryWarnTimeout = cc.getLongQueryWarningTimeout();
@@ -825,38 +816,6 @@ public class CacheConfiguration extends MutableConfiguration {
}
/**
- * Flag indicating that {@link CacheStore} implementation
- * is working with portable objects instead of Java objects.
- * Default value of this flag is {@link #DFLT_KEEP_PORTABLE_IN_STORE},
- * because this is recommended behavior from performance standpoint.
- *
- * If set to {@code false}, Ignite will deserialize keys and
- * values stored in portable format before they are passed
- * to cache store.
- *
- * Note that setting this flag to {@code false} can simplify
- * store implementation in some cases, but it can cause performance
- * degradation due to additional serializations and deserializations
- * of portable objects. You will also need to have key and value
- * classes on all nodes since portables will be deserialized when
- * store is called.
- *
- * @return Keep portables in store flag.
- */
- public Boolean isKeepPortableInStore() {
- return keepPortableInStore;
- }
-
- /**
- * Sets keep portables in store flag.
- *
- * @param keepPortableInStore Keep portables in store flag.
- */
- public void setKeepPortableInStore(boolean keepPortableInStore) {
- this.keepPortableInStore = keepPortableInStore;
- }
-
- /**
* Gets key topology resolver to provide mapping from keys to nodes.
*
* @return Key topology resolver to provide mapping from keys to nodes.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index e3859c5..9443f21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal;
import java.util.Collection;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.cluster.IgniteClusterEx;
import org.apache.ignite.internal.processors.cache.GridCacheUtilityKey;
@@ -140,4 +141,12 @@ public interface IgniteEx extends Ignite {
* @return Kernal context.
*/
public GridKernalContext context();
+
+
+ /**
+ * Gets an instance of {@link IgnitePortables} interface.
+ *
+ * @return Instance of {@link IgnitePortables} interface.
+ */
+ public IgnitePortables portables();
}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 9b615b1..abab1f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -64,7 +64,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.IgniteMessaging;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.IgniteQueue;
import org.apache.ignite.IgniteScheduler;
import org.apache.ignite.IgniteServices;
@@ -157,7 +157,7 @@ import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -203,7 +203,6 @@ import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MARSHALLER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_NODE_CONSISTENT_ID;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PHY_RAM;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PREFIX;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_RESTART_ENABLED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_REST_PORT_RANGE;
@@ -1270,9 +1269,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName());
add(ATTR_USER_NAME, System.getProperty("user.name"));
add(ATTR_GRID_NAME, gridName);
- add(ATTR_PORTABLE_PROTO_VER, cfg.getMarshaller() instanceof PortableMarshaller ?
- ((PortableMarshaller)cfg.getMarshaller()).getProtocolVersion().toString() :
- PortableMarshaller.DFLT_PORTABLE_PROTO_VER.toString());
add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled());
add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode());
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index 7be2af3..10b8df0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -135,13 +135,10 @@ public final class IgniteNodeAttributes {
/** Node consistent id. */
public static final String ATTR_NODE_CONSISTENT_ID = ATTR_PREFIX + ".consistent.id";
- /** Portable protocol version. */
- public static final String ATTR_PORTABLE_PROTO_VER = ATTR_PREFIX + ".portable.proto.ver";
-
/**
* Enforces singleton.
*/
private IgniteNodeAttributes() {
/* No-op. */
}
-}
\ No newline at end of file
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index bc4f756..3a09b2c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -125,7 +125,6 @@ import static org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PEER_CLASSLOADING;
-import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER;
import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_USER_NAME;
import static org.apache.ignite.internal.IgniteVersionUtils.VER;
import static org.apache.ignite.plugin.segmentation.SegmentationPolicy.NOOP;
@@ -982,8 +981,6 @@ public class GridDiscoveryManager extends GridManagerAdapter {
// Fetch local node attributes once.
String locPreferIpV4 = locNode.attribute("java.net.preferIPv4Stack");
- String locPortableProtoVer = locNode.attribute(ATTR_PORTABLE_PROTO_VER);
-
Object locMode = locNode.attribute(ATTR_DEPLOYMENT_MODE);
int locJvmMajVer = nodeJavaMajorVersion(locNode);
@@ -1033,13 +1030,6 @@ public class GridDiscoveryManager extends GridManagerAdapter {
", rmtId8=" + U.id8(n.id()) + ", rmtPeerClassLoading=" + rmtP2pEnabled +
", rmtAddrs=" + U.addressesAsString(n) + ']');
}
-
- String rmtPortableProtoVer = n.attribute(ATTR_PORTABLE_PROTO_VER);
-
- // In order to support backward compatibility skip the check for nodes that don't have this attribute.
- if (rmtPortableProtoVer != null && !F.eq(locPortableProtoVer, rmtPortableProtoVer))
- throw new IgniteCheckedException("Remote node has portable protocol version different from local " +
- "[locVersion=" + locPortableProtoVer + ", rmtVersion=" + rmtPortableProtoVer + ']');
}
if (log.isDebugEnabled())
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index c7a9e6f..4bc8545 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.portable;
import org.apache.ignite.internal.portable.streams.PortableInputStream;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
import org.jetbrains.annotations.Nullable;
/**
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 a2b4b74..e1b7324 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
@@ -40,11 +40,11 @@ import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
import org.jetbrains.annotations.Nullable;
import static java.lang.reflect.Modifier.isStatic;
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 165ad9a..2ee96b7 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
@@ -60,16 +60,16 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.marshaller.MarshallerContext;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetConfiguration;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableConfiguration;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetPortableTypeConfiguration;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
index ae5fbf0..05e7f20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataCollector.java
@@ -27,9 +27,9 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
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 e03d67f..fafafad 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.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
/**
* Portable meta data handler.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
index 1d26007..c0423eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableMetaDataImpl.java
@@ -27,13 +27,13 @@ import java.util.Map;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
index fe4b628..229c90f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
@@ -23,9 +23,9 @@ import java.util.IdentityHashMap;
import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
import org.apache.ignite.internal.util.typedef.internal.SB;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 47ff1ab..cb81efe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -34,9 +34,9 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index ba8ee83..e788422 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -30,9 +30,9 @@ import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import sun.misc.Unsafe;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
index e703f2f..e401142 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawReaderEx.java
@@ -17,8 +17,8 @@
package org.apache.ignite.internal.portable;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
index a59f157..43b7650 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableRawWriterEx.java
@@ -18,8 +18,8 @@
package org.apache.ignite.internal.portable;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
import org.jetbrains.annotations.Nullable;
/**
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 2d4a1c3..2537926 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.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 4ad125a..a101db5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -45,11 +45,11 @@ import org.apache.ignite.internal.util.GridEnumCache;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableReader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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 7259cc9..ccc1a5b 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
@@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ignite.internal.portable.builder.PortableLazyValue;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
index 3152c4b..1d5ca60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
@@ -18,12 +18,8 @@
package org.apache.ignite.internal.portable;
import java.io.IOException;
-import java.io.ObjectInputStream;
import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
@@ -32,14 +28,13 @@ import java.util.Date;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
import static java.nio.charset.StandardCharsets.UTF_8;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
new file mode 100644
index 0000000..56f3768
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/IgnitePortables.java
@@ -0,0 +1,362 @@
+/*
+ * 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.api;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import java.util.UUID;
+import org.apache.ignite.IgniteCache;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Defines portable objects functionality. With portable objects you are able to:
+ *
+ *
Seamlessly interoperate between Java, .NET, and C++.
+ *
Make any object portable with zero code change to your existing code.
+ *
Nest portable objects within each other.
+ *
Automatically handle {@code circular} or {@code null} references.
+ *
Automatically convert collections and maps between Java, .NET, and C++.
+ *
+ * Optionally avoid deserialization of objects on the server side
+ * (objects are stored in {@link PortableObject} format).
+ *
+ *
Avoid need to have concrete class definitions on the server side.
+ *
Dynamically change structure of the classes without having to restart the cluster.
+ *
Index into portable objects for querying purposes.
+ *
+ *
Working With Portables Directly
+ * Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ *
+ * To work with the portable format directly, user should create a special cache projection
+ * using {@link IgniteCache#withKeepPortable()} method and then retrieve individual fields as needed:
+ *
+ * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use PortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ *
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ *
+ * If we used, for example, one of the automatically handled portable types for a key, like integer,
+ * and still wanted to work with binary portable format for values, then we would declare cache projection
+ * as follows:
+ *
+ * Note that only portable classes are converted to {@link PortableObject} format. Following
+ * classes are never converted (e.g., {@link #toPortable(Object)} method will return original
+ * object, and instances of these classes will be stored in cache without changes):
+ *
+ *
All primitives (byte, int, ...) and there boxed versions (Byte, Integer, ...)
+ *
Arrays of primitives (byte[], int[], ...)
+ *
{@link String} and array of {@link String}s
+ *
{@link UUID} and array of {@link UUID}s
+ *
{@link Date} and array of {@link Date}s
+ *
{@link Timestamp} and array of {@link Timestamp}s
+ *
Enums and array of enums
+ *
+ * Maps, collections and array of objects (but objects inside
+ * them will still be converted if they are portable)
+ *
+ *
+ *
Working With Maps and Collections
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ *
Building Portable Objects
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ *
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ *
+ * NOTE: you don't need to convert typed objects to portable format before storing
+ * them in cache, Ignite will do that automatically.
+ *
Portable Metadata
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ *
Dynamic Structure Changes
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ *
Configuration
+ * By default all your objects are considered as portables and no specific configuration is needed.
+ * However, in some cases, like when an object is used by both Java and .Net, you may need to specify portable objects
+ * explicitly by calling {@link PortableMarshaller#setClassNames(Collection)}.
+ * The only requirement Ignite imposes is that your object has an empty
+ * constructor. Note, that since server side does not have to know the class definition,
+ * you only need to list portable objects in configuration on the client side. However, if you
+ * list them on the server side as well, then you get the ability to deserialize portable objects
+ * into concrete types on the server as well as on the client.
+ *
+ * Here is an example of portable configuration (note that star (*) notation is supported):
+ *
+ * You can also specify class name for a portable object via {@link PortableTypeConfiguration}.
+ * Do it in case if you need to override other configuration properties on per-type level, like
+ * ID-mapper, or serializer.
+ *
Custom Affinity Keys
+ * Often you need to specify an alternate key (not the cache key) for affinity routing whenever
+ * storing objects in cache. For example, if you are caching {@code Employee} object with
+ * {@code Organization}, and want to colocate employees with organization they work for,
+ * so you can process them together, you need to specify an alternate affinity key.
+ * With portable objects you would have to do it as following:
+ *
+ * Serialization and deserialization works out-of-the-box in Ignite. However, you can provide your own custom
+ * serialization logic by optionally implementing {@link PortableMarshalAware} interface, like so:
+ *
+ * public class Address implements PortableMarshalAware {
+ * private String street;
+ * private int zip;
+ *
+ * // Empty constructor required for portable deserialization.
+ * public Address() {}
+ *
+ * @Override public void writePortable(PortableWriter writer) throws PortableException {
+ * writer.writeString("street", street);
+ * writer.writeInt("zip", zip);
+ * }
+ *
+ * @Override public void readPortable(PortableReader reader) throws PortableException {
+ * street = reader.readString("street");
+ * zip = reader.readInt("zip");
+ * }
+ * }
+ *
+ * Alternatively, if you cannot change class definitions, you can provide custom serialization
+ * logic in {@link PortableSerializer} either globally in {@link PortableMarshaller} or
+ * for a specific type via {@link PortableTypeConfiguration} instance.
+ *
+ * Similar to java serialization you can use {@code writeReplace()} and {@code readResolve()} methods.
+ *
+ *
+ * {@code readResolve} is defined as follows: {@code ANY-ACCESS-MODIFIER Object readResolve()}.
+ * It may be used to replace the de-serialized object by another one of your choice.
+ *
+ *
+ * {@code writeReplace} is defined as follows: {@code ANY-ACCESS-MODIFIER Object writeReplace()}. This method
+ * allows the developer to provide a replacement object that will be serialized instead of the original one.
+ *
+ *
+ *
+ *
Custom ID Mappers
+ * Ignite implementation uses name hash codes to generate IDs for class names or field names
+ * internally. However, in cases when you want to provide your own ID mapping schema,
+ * you can provide your own {@link PortableIdMapper} implementation.
+ *
+ * ID-mapper may be provided either globally in {@link PortableMarshaller},
+ * or for a specific type via {@link PortableTypeConfiguration} instance.
+ *
Query Indexing
+ * Portable objects can be indexed for querying by specifying index fields in
+ * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific
+ * {@link org.apache.ignite.configuration.CacheConfiguration} instance,
+ * like so:
+ *
+ */
+public interface IgnitePortables {
+ /**
+ * Gets type ID for given type name.
+ *
+ * @param typeName Type name.
+ * @return Type ID.
+ */
+ public int typeId(String typeName);
+
+ /**
+ * Converts provided object to instance of {@link PortableObject}.
+ *
+ * @param obj Object to convert.
+ * @return Converted object.
+ * @throws PortableException In case of error.
+ */
+ public T toPortable(@Nullable Object obj) throws PortableException;
+
+ /**
+ * Creates new portable builder.
+ *
+ * @param typeId ID of the type.
+ * @return Newly portable builder.
+ */
+ public PortableBuilder builder(int typeId);
+
+ /**
+ * Creates new portable builder.
+ *
+ * @param typeName Type name.
+ * @return Newly portable builder.
+ */
+ public PortableBuilder builder(String typeName);
+
+ /**
+ * Creates portable builder initialized by existing portable object.
+ *
+ * @param portableObj Portable object to initialize builder.
+ * @return Portable builder.
+ */
+ public PortableBuilder builder(PortableObject portableObj);
+
+ /**
+ * Gets metadata for provided class.
+ *
+ * @param cls Class.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(Class> cls) throws PortableException;
+
+ /**
+ * Gets metadata for provided class name.
+ *
+ * @param typeName Type name.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(String typeName) throws PortableException;
+
+ /**
+ * Gets metadata for provided type ID.
+ *
+ * @param typeId Type ID.
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metadata(int typeId) throws PortableException;
+
+ /**
+ * Gets metadata for all known types.
+ *
+ * @return Metadata.
+ * @throws PortableException In case of error.
+ */
+ public Collection metadata() throws PortableException;
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
new file mode 100644
index 0000000..c819f46
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableBuilder.java
@@ -0,0 +1,136 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
+ *
+ * Here is an example of how a portable object can be built dynamically:
+ *
+ *
+ * If you need to modify nested portable object you can get builder for nested object using
+ * {@link #getField(String)}, changes made on nested builder will affect parent object,
+ * for example:
+ *
+ *
+ * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
+ * PortableBuilder addressBuilder = personBuilder.setField("address");
+ *
+ * addressBuilder.setField("city", "New York");
+ *
+ * personPortableObj = personBuilder.build();
+ *
+ * // Should be "New York".
+ * String city = personPortableObj.getField("address").getField("city");
+ *
+ *
+ * @see IgnitePortables#builder(int)
+ * @see IgnitePortables#builder(String)
+ * @see IgnitePortables#builder(PortableObject)
+ */
+public interface PortableBuilder {
+ /**
+ * Returns value assigned to the specified field.
+ * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
+ * which can be modified.
+ *
+ * Collections and maps returned from this method are modifiable.
+ *
+ * @param name Field name.
+ * @return Filed value.
+ */
+ public T getField(String name);
+
+ /**
+ * Sets field value.
+ *
+ * @param name Field name.
+ * @param val Field value (cannot be {@code null}).
+ * @see PortableObject#metaData()
+ */
+ public PortableBuilder setField(String name, Object val);
+
+ /**
+ * Sets field value with value type specification.
+ *
+ * Field type is needed for proper metadata update.
+ *
+ * @param name Field name.
+ * @param val Field value.
+ * @param type Field type.
+ * @see PortableObject#metaData()
+ */
+ public PortableBuilder setField(String name, @Nullable T val, Class super T> type);
+
+ /**
+ * Sets field value.
+ *
+ * This method should be used if field is portable object.
+ *
+ * @param name Field name.
+ * @param builder Builder for object field.
+ */
+ public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
+
+ /**
+ * Removes field from this builder.
+ *
+ * @param fieldName Field name.
+ * @return {@code this} instance for chaining.
+ */
+ public PortableBuilder removeField(String fieldName);
+
+ /**
+ * Sets hash code for resulting portable object returned by {@link #build()} method.
+ *
+ * If not set {@code 0} is used.
+ *
+ * @param hashCode Hash code.
+ * @return {@code this} instance for chaining.
+ */
+ public PortableBuilder hashCode(int hashCode);
+
+ /**
+ * Builds portable object.
+ *
+ * @return Portable object.
+ * @throws PortableException In case of error.
+ */
+ public PortableObject build() throws PortableException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
new file mode 100644
index 0000000..f230182
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableException.java
@@ -0,0 +1,57 @@
+/*
+ * 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.api;
+
+import org.apache.ignite.IgniteException;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating portable object serialization error.
+ */
+public class PortableException extends IgniteException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates portable exception with error message.
+ *
+ * @param msg Error message.
+ */
+ public PortableException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates portable exception with {@link Throwable} as a cause.
+ *
+ * @param cause Cause.
+ */
+ public PortableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates portable exception with error message and {@link Throwable} as a cause.
+ *
+ * @param msg Error message.
+ * @param cause Cause.
+ */
+ public PortableException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
new file mode 100644
index 0000000..1e20f8e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableIdMapper.java
@@ -0,0 +1,54 @@
+/*
+ * 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.api;
+
+/**
+ * Type and field ID mapper for portable objects. Ignite never writes full
+ * strings for field or type names. Instead, for performance reasons, Ignite
+ * writes integer hash codes for type and field names. It has been tested that
+ * hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide {@code PortableIdMapper} allows to override the automatically
+ * generated hash code IDs for the type and field names.
+ *
+ * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
+ * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
+ */
+public interface PortableIdMapper {
+ /**
+ * Gets type ID for provided class name.
+ *
+ * If {@code 0} is returned, hash code of class simple name will be used.
+ *
+ * @param clsName Class name.
+ * @return Type ID.
+ */
+ public int typeId(String clsName);
+
+ /**
+ * Gets ID for provided field.
+ *
+ * If {@code 0} is returned, hash code of field name will be used.
+ *
+ * @param typeId Type ID.
+ * @param fieldName Field name.
+ * @return Field ID.
+ */
+ public int fieldId(int typeId, String fieldName);
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
new file mode 100644
index 0000000..82e6697
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableInvalidClassException.java
@@ -0,0 +1,58 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Exception indicating that class needed for deserialization of portable object does not exist.
+ *
+ * Thrown from {@link PortableObject#deserialize()} method.
+ */
+public class PortableInvalidClassException extends PortableException {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Creates invalid class exception with error message.
+ *
+ * @param msg Error message.
+ */
+ public PortableInvalidClassException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates invalid class exception with {@link Throwable} as a cause.
+ *
+ * @param cause Cause.
+ */
+ public PortableInvalidClassException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates invalid class exception with error message and {@link Throwable} as a cause.
+ *
+ * @param msg Error message.
+ * @param cause Cause.
+ */
+ public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
+ super(msg, cause);
+ }
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
new file mode 100644
index 0000000..f304afb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshalAware.java
@@ -0,0 +1,48 @@
+/*
+ * 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.api;
+
+/**
+ * Interface that allows to implement custom serialization
+ * logic for portable objects. Portable objects are not required
+ * to implement this interface, in which case Ignite will automatically
+ * serialize portable objects using reflection.
+ *
+ * This interface, in a way, is analogous to {@link java.io.Externalizable}
+ * interface, which allows users to override default serialization logic,
+ * usually for performance reasons. The only difference here is that portable
+ * serialization is already very fast and implementing custom serialization
+ * logic for portables does not provide significant performance gains.
+ */
+public interface PortableMarshalAware {
+ /**
+ * Writes fields to provided writer.
+ *
+ * @param writer Portable object writer.
+ * @throws PortableException In case of error.
+ */
+ public void writePortable(PortableWriter writer) throws PortableException;
+
+ /**
+ * Reads fields from provided reader.
+ *
+ * @param reader Portable object reader.
+ * @throws PortableException In case of error.
+ */
+ public void readPortable(PortableReader reader) throws PortableException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
new file mode 100644
index 0000000..de0df8d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMarshaller.java
@@ -0,0 +1,358 @@
+/*
+ * 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.api;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.portable.GridPortableMarshaller;
+import org.apache.ignite.internal.portable.PortableContext;
+import org.apache.ignite.marshaller.AbstractMarshaller;
+import org.apache.ignite.marshaller.MarshallerContext;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableProtocolVersion;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
+ * in the portable format.
+ *
+ * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
+ *
+ *
Configuration
+ *
Mandatory
+ * This marshaller has no mandatory configuration parameters.
+ *
+ *
+ *
+ * For information about Spring framework visit www.springframework.org
+ */
+public class PortableMarshaller extends AbstractMarshaller {
+ /** Default portable protocol version. */
+ public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
+
+ /** Class names. */
+ private Collection clsNames;
+
+ /** ID mapper. */
+ private PortableIdMapper idMapper;
+
+ /** Serializer. */
+ private PortableSerializer serializer;
+
+ /** Types. */
+ private Collection typeCfgs;
+
+ /** Use timestamp flag. */
+ private boolean useTs = true;
+
+ /** Whether to convert string to bytes using UTF-8 encoding. */
+ private boolean convertString = true;
+
+ /** Meta data enabled flag. */
+ private boolean metaDataEnabled = true;
+
+ /** Keep deserialized flag. */
+ private boolean keepDeserialized = true;
+
+ /** Protocol version. */
+ private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
+
+ /** */
+ private GridPortableMarshaller impl;
+
+ /**
+ * Gets class names.
+ *
+ * @return Class names.
+ */
+ public Collection getClassNames() {
+ return clsNames;
+ }
+
+ /**
+ * Sets class names of portable objects explicitly.
+ *
+ * @param clsNames Class names.
+ */
+ public void setClassNames(Collection clsNames) {
+ this.clsNames = new ArrayList<>(clsNames.size());
+
+ for (String clsName : clsNames)
+ this.clsNames.add(clsName.trim());
+ }
+
+ /**
+ * Gets ID mapper.
+ *
+ * @return ID mapper.
+ */
+ public PortableIdMapper getIdMapper() {
+ return idMapper;
+ }
+
+ /**
+ * Sets ID mapper.
+ *
+ * @param idMapper ID mapper.
+ */
+ public void setIdMapper(PortableIdMapper idMapper) {
+ this.idMapper = idMapper;
+ }
+
+ /**
+ * Gets serializer.
+ *
+ * @return Serializer.
+ */
+ public PortableSerializer getSerializer() {
+ return serializer;
+ }
+
+ /**
+ * Sets serializer.
+ *
+ * @param serializer Serializer.
+ */
+ public void setSerializer(PortableSerializer serializer) {
+ this.serializer = serializer;
+ }
+
+ /**
+ * Gets types configuration.
+ *
+ * @return Types configuration.
+ */
+ public Collection getTypeConfigurations() {
+ return typeCfgs;
+ }
+
+ /**
+ * Sets type configurations.
+ *
+ * @param typeCfgs Type configurations.
+ */
+ public void setTypeConfigurations(Collection typeCfgs) {
+ this.typeCfgs = typeCfgs;
+ }
+
+ /**
+ * If {@code true} then date values converted to {@link Timestamp} on deserialization.
+ *
+ * Default value is {@code true}.
+ *
+ * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public boolean isUseTimestamp() {
+ return useTs;
+ }
+
+ /**
+ * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public void setUseTimestamp(boolean useTs) {
+ this.useTs = useTs;
+ }
+
+ /**
+ * Gets strings must be converted to or from bytes using UTF-8 encoding.
+ *
+ * Default value is {@code true}.
+ *
+ * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+ */
+ public boolean isConvertStringToBytes() {
+ return convertString;
+ }
+
+ /**
+ * Sets strings must be converted to or from bytes using UTF-8 encoding.
+ *
+ * Default value is {@code true}.
+ *
+ * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
+ */
+ public void setConvertStringToBytes(boolean convertString) {
+ this.convertString = convertString;
+ }
+
+ /**
+ * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
+ * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
+ *
+ * Default value if {@code true}.
+ *
+ * @return Whether meta data is collected.
+ */
+ public boolean isMetaDataEnabled() {
+ return metaDataEnabled;
+ }
+
+ /**
+ * @param metaDataEnabled Whether meta data is collected.
+ */
+ public void setMetaDataEnabled(boolean metaDataEnabled) {
+ this.metaDataEnabled = metaDataEnabled;
+ }
+
+ /**
+ * If {@code true}, {@link PortableObject} will cache deserialized instance after
+ * {@link PortableObject#deserialize()} is called. All consequent calls of this
+ * method on the same instance of {@link PortableObject} will return that cached
+ * value without actually deserializing portable object. If you need to override this
+ * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
+ * method.
+ *
+ * Default value if {@code true}.
+ *
+ * @return Whether deserialized value is kept.
+ */
+ public boolean isKeepDeserialized() {
+ return keepDeserialized;
+ }
+
+ /**
+ * @param keepDeserialized Whether deserialized value is kept.
+ */
+ public void setKeepDeserialized(boolean keepDeserialized) {
+ this.keepDeserialized = keepDeserialized;
+ }
+
+ /**
+ * Gets portable protocol version.
+ *
+ * @param ctx Portable context.
+ */
+ private void setPortableContext(PortableContext ctx) {
+ ctx.configure(this);
+
+ impl = new GridPortableMarshaller(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
+ return impl.marshal(obj, 0);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
+ byte[] arr = marshal(obj);
+
+ try {
+ out.write(arr);
+ }
+ catch (IOException e) {
+ throw new PortableException("Failed to marshal the object: " + obj, e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+ return impl.deserialize(bytes, clsLdr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ byte[] arr = new byte[4096];
+ int cnt;
+
+ // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
+ // returns number of bytes remaining.
+ try {
+ while ((cnt = in.read(arr)) != -1)
+ buffer.write(arr, 0, cnt);
+
+ buffer.flush();
+
+ return impl.deserialize(buffer.toByteArray(), clsLdr);
+ }
+ catch (IOException e) {
+ throw new PortableException("Failed to unmarshal the object from InputStream", e);
+ }
+ }
+}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
new file mode 100644
index 0000000..a90bdca
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableMetadata.java
@@ -0,0 +1,60 @@
+/*
+ * 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.api;
+
+import java.util.Collection;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable type meta data. Metadata for portable types can be accessed from any of the
+ * {@link IgnitePortables#metadata(String)} methods.
+ * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableMetadata {
+ /**
+ * Gets portable type name.
+ *
+ * @return Portable type name.
+ */
+ public String typeName();
+
+ /**
+ * Gets collection of all field names for this portable type.
+ *
+ * @return Collection of all field names for this portable type.
+ */
+ public Collection fields();
+
+ /**
+ * Gets name of the field type for a given field.
+ *
+ * @param fieldName Field name.
+ * @return Field type name.
+ */
+ @Nullable public String fieldTypeName(String fieldName);
+
+ /**
+ * Portable objects can optionally specify custom key-affinity mapping in the
+ * configuration. This method returns the name of the field which should be
+ * used for the key-affinity mapping.
+ *
+ * @return Affinity key field name.
+ */
+ @Nullable public String affinityKeyFieldName();
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
new file mode 100644
index 0000000..ec965c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableObject.java
@@ -0,0 +1,152 @@
+/*
+ * 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.api;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.TreeMap;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Wrapper for portable object in portable binary format. Once an object is defined as portable,
+ * Ignite will always store it in memory in the portable (i.e. binary) format.
+ * User can choose to work either with the portable format or with the deserialized form
+ * (assuming that class definitions are present in the classpath).
+ *
+ * NOTE: user does not need to (and should not) implement this interface directly.
+ *
+ * To work with the portable format directly, user should create a cache projection
+ * over {@code PortableObject} class and then retrieve individual fields as needed:
+ *
+ * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
+ *
+ * // Convert instance of MyKey to portable format.
+ * // We could also use GridPortableBuilder to create the key in portable format directly.
+ * PortableObject key = grid.portables().toPortable(new MyKey());
+ *
+ * PortableObject val = prj.get(key);
+ *
+ * String field = val.field("myFieldName");
+ *
+ * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
+ * typed objects at all times. In this case we do incur the deserialization cost. However, if
+ * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
+ * and will cache the deserialized object, so it does not have to be deserialized again:
+ *
+ * All maps and collections in the portable objects are serialized automatically. When working
+ * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
+ * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
+ * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
+ * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
+ * in C#, etc.
+ *
Dynamic Structure Changes
+ * Since objects are always cached in the portable binary format, server does not need to
+ * be aware of the class definitions. Moreover, if class definitions are not present or not
+ * used on the server, then clients can continuously change the structure of the portable
+ * objects without having to restart the cluster. For example, if one client stores a
+ * certain class with fields A and B, and another client stores the same class with
+ * fields B and C, then the server-side portable object will have the fields A, B, and C.
+ * As the structure of a portable object changes, the new fields become available for SQL queries
+ * automatically.
+ *
Building Portable Objects
+ * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
+ *
+ * For the cases when class definition is present
+ * in the class path, it is also possible to populate a standard POJO and then
+ * convert it to portable format, like so:
+ *
+ * Even though Ignite portable protocol only works with hash codes for type and field names
+ * to achieve better performance, Ignite provides metadata for all portable types which
+ * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
+ * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
+ * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
+ */
+public interface PortableObject extends Serializable, Cloneable {
+ /**
+ * Gets portable object type ID.
+ *
+ * @return Type ID.
+ */
+ public int typeId();
+
+ /**
+ * Gets meta data for this portable object.
+ *
+ * @return Meta data.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public PortableMetadata metaData() throws PortableException;
+
+ /**
+ * Gets field value.
+ *
+ * @param fieldName Field name.
+ * @return Field value.
+ * @throws PortableException In case of any other error.
+ */
+ @Nullable public F field(String fieldName) throws PortableException;
+
+ /**
+ * Checks whether field is set.
+ *
+ * @param fieldName Field name.
+ * @return {@code true} if field is set.
+ */
+ public boolean hasField(String fieldName);
+
+ /**
+ * Gets fully deserialized instance of portable object.
+ *
+ * @return Fully deserialized instance of portable object.
+ * @throws PortableInvalidClassException If class doesn't exist.
+ * @throws PortableException In case of any other error.
+ */
+ @Nullable public T deserialize() throws PortableException;
+
+ /**
+ * Copies this portable object.
+ *
+ * @return Copy of this portable object.
+ */
+ public PortableObject clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
new file mode 100644
index 0000000..741c2a5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableProtocolVersion.java
@@ -0,0 +1,41 @@
+/*
+ * 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.api;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Portable protocol version.
+ */
+public enum PortableProtocolVersion {
+ /** Ignite 1.4.0 release. */
+ VER_1_4_0;
+
+ /** Enumerated values. */
+ private static final PortableProtocolVersion[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
new file mode 100644
index 0000000..c12aa1a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawReader.java
@@ -0,0 +1,234 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
+ * making the format even more compact. However, if the raw reader is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawReader {
+ /**
+ * @return Byte value.
+ * @throws PortableException In case of error.
+ */
+ public byte readByte() throws PortableException;
+
+ /**
+ * @return Short value.
+ * @throws PortableException In case of error.
+ */
+ public short readShort() throws PortableException;
+
+ /**
+ * @return Integer value.
+ * @throws PortableException In case of error.
+ */
+ public int readInt() throws PortableException;
+
+ /**
+ * @return Long value.
+ * @throws PortableException In case of error.
+ */
+ public long readLong() throws PortableException;
+
+ /**
+ * @return Float value.
+ * @throws PortableException In case of error.
+ */
+ public float readFloat() throws PortableException;
+
+ /**
+ * @return Double value.
+ * @throws PortableException In case of error.
+ */
+ public double readDouble() throws PortableException;
+
+ /**
+ * @return Char value.
+ * @throws PortableException In case of error.
+ */
+ public char readChar() throws PortableException;
+
+ /**
+ * @return Boolean value.
+ * @throws PortableException In case of error.
+ */
+ public boolean readBoolean() throws PortableException;
+
+ /**
+ * @return Decimal value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal readDecimal() throws PortableException;
+
+ /**
+ * @return String value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String readString() throws PortableException;
+
+ /**
+ * @return UUID.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID readUuid() throws PortableException;
+
+ /**
+ * @return Date.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date readDate() throws PortableException;
+
+ /**
+ * @return Timestamp.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Timestamp readTimestamp() throws PortableException;
+
+ /**
+ * @return Object.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public T readObject() throws PortableException;
+
+ /**
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public byte[] readByteArray() throws PortableException;
+
+ /**
+ * @return Short array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public short[] readShortArray() throws PortableException;
+
+ /**
+ * @return Integer array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public int[] readIntArray() throws PortableException;
+
+ /**
+ * @return Long array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public long[] readLongArray() throws PortableException;
+
+ /**
+ * @return Float array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public float[] readFloatArray() throws PortableException;
+
+ /**
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public double[] readDoubleArray() throws PortableException;
+
+ /**
+ * @return Char array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public char[] readCharArray() throws PortableException;
+
+ /**
+ * @return Boolean array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public boolean[] readBooleanArray() throws PortableException;
+
+ /**
+ * @return Decimal array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
+
+ /**
+ * @return String array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String[] readStringArray() throws PortableException;
+
+ /**
+ * @return UUID array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID[] readUuidArray() throws PortableException;
+
+ /**
+ * @return Date array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date[] readDateArray() throws PortableException;
+
+ /**
+ * @return Object array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Object[] readObjectArray() throws PortableException;
+
+ /**
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Collection readCollection() throws PortableException;
+
+ /**
+ * @param colCls Collection class.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Collection readCollection(Class extends Collection> colCls)
+ throws PortableException;
+
+ /**
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Map readMap() throws PortableException;
+
+ /**
+ * @param mapCls Map class.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Map readMap(Class extends Map> mapCls) throws PortableException;
+
+ /**
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public > T readEnum() throws PortableException;
+
+ /**
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public > T[] readEnumArray() throws PortableException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
new file mode 100644
index 0000000..91f0e3b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableRawWriter.java
@@ -0,0 +1,219 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
+ * making the format even more compact. However, if the raw writer is used,
+ * dynamic structure changes to the portable objects are not supported.
+ */
+public interface PortableRawWriter {
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByte(byte val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShort(short val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeInt(int val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLong(long val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloat(float val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDouble(double val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeChar(char val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBoolean(boolean val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeString(@Nullable String val) throws PortableException;
+
+ /**
+ * @param val UUID to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuid(@Nullable UUID val) throws PortableException;
+
+ /**
+ * @param val Date to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDate(@Nullable Date val) throws PortableException;
+
+ /**
+ * @param val Timestamp to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
+
+ /**
+ * @param obj Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObject(@Nullable Object obj) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByteArray(@Nullable byte[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShortArray(@Nullable short[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeIntArray(@Nullable int[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLongArray(@Nullable long[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloatArray(@Nullable float[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDoubleArray(@Nullable double[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCharArray(@Nullable char[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeStringArray(@Nullable String[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDateArray(@Nullable Date[] val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObjectArray(@Nullable Object[] val) throws PortableException;
+
+ /**
+ * @param col Collection to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCollection(@Nullable Collection col) throws PortableException;
+
+ /**
+ * @param map Map to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeMap(@Nullable Map map) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public > void writeEnum(T val) throws PortableException;
+
+ /**
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public > void writeEnumArray(T[] val) throws PortableException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
new file mode 100644
index 0000000..ca322e7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableReader.java
@@ -0,0 +1,284 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Reader for portable objects used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ *
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableReader {
+ /**
+ * @param fieldName Field name.
+ * @return Byte value.
+ * @throws PortableException In case of error.
+ */
+ public byte readByte(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Short value.
+ * @throws PortableException In case of error.
+ */
+ public short readShort(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Integer value.
+ * @throws PortableException In case of error.
+ */
+ public int readInt(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Long value.
+ * @throws PortableException In case of error.
+ */
+ public long readLong(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @throws PortableException In case of error.
+ * @return Float value.
+ */
+ public float readFloat(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Double value.
+ * @throws PortableException In case of error.
+ */
+ public double readDouble(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Char value.
+ * @throws PortableException In case of error.
+ */
+ public char readChar(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Boolean value.
+ * @throws PortableException In case of error.
+ */
+ public boolean readBoolean(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Decimal value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return String value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String readString(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return UUID.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID readUuid(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Date.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date readDate(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Timestamp.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Object.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public T readObject(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Short array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public short[] readShortArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Integer array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public int[] readIntArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Long array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public long[] readLongArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Float array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Byte array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Char array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public char[] readCharArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Boolean array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Decimal array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return String array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public String[] readStringArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return UUID array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Date array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Object array.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Collection readCollection(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param colCls Collection class.
+ * @return Collection.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Collection readCollection(String fieldName, Class extends Collection> colCls)
+ throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Map readMap(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param mapCls Map class.
+ * @return Map.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public Map readMap(String fieldName, Class extends Map> mapCls)
+ throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public > T readEnum(String fieldName) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @return Value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable public > T[] readEnumArray(String fieldName) throws PortableException;
+
+ /**
+ * Gets raw reader. Raw reader does not use field name hash codes, therefore,
+ * making the format even more compact. However, if the raw reader is used,
+ * dynamic structure changes to the portable objects are not supported.
+ *
+ * @return Raw reader.
+ */
+ public PortableRawReader rawReader();
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
new file mode 100644
index 0000000..b9e835f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableSerializer.java
@@ -0,0 +1,47 @@
+/*
+ * 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.api;
+
+/**
+ * Interface that allows to implement custom serialization logic for portable objects.
+ * Can be used instead of {@link PortableMarshalAware} in case if the class
+ * cannot be changed directly.
+ *
+ * Portable serializer can be configured for all portable objects via
+ * {@link PortableMarshaller#getSerializer()} method, or for a specific
+ * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
+ */
+public interface PortableSerializer {
+ /**
+ * Writes fields to provided writer.
+ *
+ * @param obj Empty object.
+ * @param writer Portable object writer.
+ * @throws PortableException In case of error.
+ */
+ public void writePortable(Object obj, PortableWriter writer) throws PortableException;
+
+ /**
+ * Reads fields from provided reader.
+ *
+ * @param obj Empty object
+ * @param reader Portable object reader.
+ * @throws PortableException In case of error.
+ */
+ public void readPortable(Object obj, PortableReader reader) throws PortableException;
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
new file mode 100644
index 0000000..80a043e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableTypeConfiguration.java
@@ -0,0 +1,195 @@
+/*
+ * 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.api;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Defines configuration properties for a specific portable type. Providing per-type
+ * configuration is optional, as it is generally enough, and also optional, to provide global portable
+ * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
+ * However, this class allows you to change configuration properties for a specific
+ * portable type without affecting configuration for other portable types.
+ *
+ * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
+ */
+public class PortableTypeConfiguration {
+ /** Class name. */
+ private String clsName;
+
+ /** ID mapper. */
+ private PortableIdMapper idMapper;
+
+ /** Serializer. */
+ private PortableSerializer serializer;
+
+ /** Use timestamp flag. */
+ private Boolean useTs;
+
+ /** Meta data enabled flag. */
+ private Boolean metaDataEnabled;
+
+ /** Keep deserialized flag. */
+ private Boolean keepDeserialized;
+
+ /** Affinity key field name. */
+ private String affKeyFieldName;
+
+ /**
+ */
+ public PortableTypeConfiguration() {
+ // No-op.
+ }
+
+ /**
+ * @param clsName Class name.
+ */
+ public PortableTypeConfiguration(String clsName) {
+ this.clsName = clsName;
+ }
+
+ /**
+ * Gets type name.
+ *
+ * @return Type name.
+ */
+ public String getClassName() {
+ return clsName;
+ }
+
+ /**
+ * Sets type name.
+ *
+ * @param clsName Type name.
+ */
+ public void setClassName(String clsName) {
+ this.clsName = clsName;
+ }
+
+ /**
+ * Gets ID mapper.
+ *
+ * @return ID mapper.
+ */
+ public PortableIdMapper getIdMapper() {
+ return idMapper;
+ }
+
+ /**
+ * Sets ID mapper.
+ *
+ * @param idMapper ID mapper.
+ */
+ public void setIdMapper(PortableIdMapper idMapper) {
+ this.idMapper = idMapper;
+ }
+
+ /**
+ * Gets serializer.
+ *
+ * @return Serializer.
+ */
+ public PortableSerializer getSerializer() {
+ return serializer;
+ }
+
+ /**
+ * Sets serializer.
+ *
+ * @param serializer Serializer.
+ */
+ public void setSerializer(PortableSerializer serializer) {
+ this.serializer = serializer;
+ }
+
+ /**
+ * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
+ *
+ * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public Boolean isUseTimestamp() {
+ return useTs;
+ }
+
+ /**
+ * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
+ */
+ public void setUseTimestamp(Boolean useTs) {
+ this.useTs = useTs;
+ }
+
+ /**
+ * Defines whether meta data is collected for this type. If provided, this value will override
+ * {@link PortableMarshaller#isMetaDataEnabled()} property.
+ *
+ * @return Whether meta data is collected.
+ */
+ public Boolean isMetaDataEnabled() {
+ return metaDataEnabled;
+ }
+
+ /**
+ * @param metaDataEnabled Whether meta data is collected.
+ */
+ public void setMetaDataEnabled(Boolean metaDataEnabled) {
+ this.metaDataEnabled = metaDataEnabled;
+ }
+
+ /**
+ * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
+ * this value will override {@link PortableMarshaller#isKeepDeserialized()}
+ * property.
+ *
+ * @return Whether deserialized value is kept.
+ */
+ public Boolean isKeepDeserialized() {
+ return keepDeserialized;
+ }
+
+ /**
+ * @param keepDeserialized Whether deserialized value is kept.
+ */
+ public void setKeepDeserialized(Boolean keepDeserialized) {
+ this.keepDeserialized = keepDeserialized;
+ }
+
+ /**
+ * Gets affinity key field name.
+ *
+ * @return Affinity key field name.
+ */
+ public String getAffinityKeyFieldName() {
+ return affKeyFieldName;
+ }
+
+ /**
+ * Sets affinity key field name.
+ *
+ * @param affKeyFieldName Affinity key field name.
+ */
+ public void setAffinityKeyFieldName(String affKeyFieldName) {
+ this.affKeyFieldName = affKeyFieldName;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PortableTypeConfiguration.class, this, super.toString());
+ }
+}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
new file mode 100644
index 0000000..8af04a3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/api/PortableWriter.java
@@ -0,0 +1,266 @@
+/*
+ * 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.api;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Writer for portable object used in {@link PortableMarshalAware} implementations.
+ * Useful for the cases when user wants a fine-grained control over serialization.
+ *
+ * Note that Ignite never writes full strings for field or type names. Instead,
+ * for performance reasons, Ignite writes integer hash codes for type and field names.
+ * It has been tested that hash code conflicts for the type names or the field names
+ * within the same type are virtually non-existent and, to gain performance, it is safe
+ * to work with hash codes. For the cases when hash codes for different types or fields
+ * actually do collide, Ignite provides {@link PortableIdMapper} which
+ * allows to override the automatically generated hash code IDs for the type and field names.
+ */
+public interface PortableWriter {
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByte(String fieldName, byte val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShort(String fieldName, short val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeInt(String fieldName, int val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLong(String fieldName, long val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloat(String fieldName, float val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDouble(String fieldName, double val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeChar(String fieldName, char val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBoolean(String fieldName, boolean val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeString(String fieldName, @Nullable String val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val UUID to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Date to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Timestamp to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param obj Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param col Collection to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeCollection(String fieldName, @Nullable Collection col) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param map Map to write.
+ * @throws PortableException In case of error.
+ */
+ public void writeMap(String fieldName, @Nullable Map map) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public > void writeEnum(String fieldName, T val) throws PortableException;
+
+ /**
+ * @param fieldName Field name.
+ * @param val Value to write.
+ * @throws PortableException In case of error.
+ */
+ public > void writeEnumArray(String fieldName, T[] val) throws PortableException;
+
+ /**
+ * Gets raw writer. Raw writer does not write field name hash codes, therefore,
+ * making the format even more compact. However, if the raw writer is used,
+ * dynamic structure changes to the portable objects are not supported.
+ *
+ * @return Raw writer.
+ */
+ public PortableRawWriter rawWriter();
+}
\ No newline at end of file
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 1472d56..8673b70 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
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index b2e4c0d..96d10a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -25,17 +25,13 @@ import java.util.Set;
import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
import org.apache.ignite.internal.util.GridArgumentCheck;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.apache.ignite.internal.portable.*;
-import org.apache.ignite.internal.processors.cache.portable.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.portable.*;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.CLS_NAME_POS;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.DFLT_HDR_LEN;
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 45355d7..e93f860 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
@@ -28,7 +28,7 @@ import org.apache.ignite.internal.portable.PortablePrimitives;
import org.apache.ignite.internal.portable.PortableReaderExImpl;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.ignite.internal.portable.GridPortableMarshaller.NULL;
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 2d9c961..6fe8875 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
@@ -21,8 +21,8 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableObjectEx;
import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.apache.ignite.internal.util.*;
-import org.apache.ignite.portable.*;
import java.util.*;
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 d864a6e..15c52e0 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
@@ -20,8 +20,8 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
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 1126a3c..96f4944 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
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
/**
*
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 8743fbe..300c4ad 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
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.portable.builder;
import org.apache.ignite.internal.portable.PortableObjectImpl;
import org.apache.ignite.internal.portable.PortableObjectOffheapImpl;
import org.apache.ignite.internal.portable.PortableWriterExImpl;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
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 107b02e..80f91be 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.portable.PortableException;
+import org.apache.ignite.internal.portable.api.PortableException;
/**
* Portable abstract input stream.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 75d4c43..59bb5f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -115,7 +115,7 @@ import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
import org.apache.ignite.spi.IgniteNodeValidationResult;
import org.jetbrains.annotations.Nullable;
@@ -1063,12 +1063,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CacheConfiguration cfg = cacheCtx.config();
- // Intentionally compare Boolean references using '!=' below to check if the flag has been explicitly set.
- if (cfg.isKeepPortableInStore() && cfg.isKeepPortableInStore() != CacheConfiguration.DFLT_KEEP_PORTABLE_IN_STORE
- && !(ctx.config().getMarshaller() instanceof PortableMarshaller))
- U.warn(log, "CacheConfiguration.isKeepPortableInStore() configuration property will be ignored because " +
- "PortableMarshaller is not used");
-
// Start managers.
for (GridCacheManager mgr : F.view(cacheCtx.managers(), F.notContains(dhtExcludes(cacheCtx))))
mgr.start(cacheCtx);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index ce0cdd7..cc6c19a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -311,11 +311,6 @@ public class IgniteCacheProxy extends AsyncSupportAdapter IgniteCache withKeepPortable() {
- return keepPortable();
- }
-
- /** {@inheritDoc} */
@Override public IgniteCache withNoRetries() {
GridCacheGateway gate = this.gate;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
index 23edd9e..0dbf71d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheDefaultPortableAffinityKeyMapper.java
@@ -21,7 +21,7 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
index 2e0d37d..d064601 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableContext.java
@@ -27,7 +27,7 @@ import org.apache.ignite.internal.portable.PortableUtils;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
index fcd73d2..7f6512b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessor.java
@@ -20,11 +20,11 @@ package org.apache.ignite.internal.processors.cache.portable;
import java.util.Collection;
import java.util.Map;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
index 1be5aea..4cab3db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectPortableProcessorImpl.java
@@ -39,7 +39,7 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -80,11 +80,11 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import sun.misc.Unsafe;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
index 5ed6505..40c3b70 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/IgnitePortablesImpl.java
@@ -18,13 +18,13 @@
package org.apache.ignite.internal.processors.cache.portable;
import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
index f7f5f4e..ef7dc9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/CacheOsStoreManager.java
@@ -23,7 +23,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.platform.PlatformProcessor;
import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
/**
* Default store manager implementation.
@@ -82,6 +82,6 @@ public class CacheOsStoreManager extends GridCacheStoreManagerAdapter {
/** {@inheritDoc} */
@Override public boolean configuredConvertPortable() {
- return !(ctx.config().getMarshaller() instanceof PortableMarshaller && cfg.isKeepPortableInStore());
+ return true;
}
}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
index fac69fb..423b5e7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.processors.platform.PlatformConfiguration;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import java.util.ArrayList;
import java.util.List;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
index a9b6022..92028b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableConfiguration.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
index d7f1ab1..a307860 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetPortableTypeConfiguration.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.processors.platform.dotnet;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.jetbrains.annotations.Nullable;
/**
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
deleted file mode 100644
index bfc34cd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ /dev/null
@@ -1,358 +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.marshaller.portable;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.portable.GridPortableMarshaller;
-import org.apache.ignite.internal.portable.PortableContext;
-import org.apache.ignite.marshaller.AbstractMarshaller;
-import org.apache.ignite.marshaller.MarshallerContext;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableProtocolVersion;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link org.apache.ignite.marshaller.Marshaller} that lets to serialize and deserialize all objects
- * in the portable format.
- *
- * {@code PortableMarshaller} is tested only on Java HotSpot VM on other VMs it could yield unexpected results.
- *
- *
Configuration
- *
Mandatory
- * This marshaller has no mandatory configuration parameters.
- *
- *
- *
- * For information about Spring framework visit www.springframework.org
- */
-public class PortableMarshaller extends AbstractMarshaller {
- /** Default portable protocol version. */
- public static final PortableProtocolVersion DFLT_PORTABLE_PROTO_VER = PortableProtocolVersion.VER_1_4_0;
-
- /** Class names. */
- private Collection clsNames;
-
- /** ID mapper. */
- private PortableIdMapper idMapper;
-
- /** Serializer. */
- private PortableSerializer serializer;
-
- /** Types. */
- private Collection typeCfgs;
-
- /** Use timestamp flag. */
- private boolean useTs = true;
-
- /** Whether to convert string to bytes using UTF-8 encoding. */
- private boolean convertString = true;
-
- /** Meta data enabled flag. */
- private boolean metaDataEnabled = true;
-
- /** Keep deserialized flag. */
- private boolean keepDeserialized = true;
-
- /** Protocol version. */
- private PortableProtocolVersion protoVer = DFLT_PORTABLE_PROTO_VER;
-
- /** */
- private GridPortableMarshaller impl;
-
- /**
- * Gets class names.
- *
- * @return Class names.
- */
- public Collection getClassNames() {
- return clsNames;
- }
-
- /**
- * Sets class names of portable objects explicitly.
- *
- * @param clsNames Class names.
- */
- public void setClassNames(Collection clsNames) {
- this.clsNames = new ArrayList<>(clsNames.size());
-
- for (String clsName : clsNames)
- this.clsNames.add(clsName.trim());
- }
-
- /**
- * Gets ID mapper.
- *
- * @return ID mapper.
- */
- public PortableIdMapper getIdMapper() {
- return idMapper;
- }
-
- /**
- * Sets ID mapper.
- *
- * @param idMapper ID mapper.
- */
- public void setIdMapper(PortableIdMapper idMapper) {
- this.idMapper = idMapper;
- }
-
- /**
- * Gets serializer.
- *
- * @return Serializer.
- */
- public PortableSerializer getSerializer() {
- return serializer;
- }
-
- /**
- * Sets serializer.
- *
- * @param serializer Serializer.
- */
- public void setSerializer(PortableSerializer serializer) {
- this.serializer = serializer;
- }
-
- /**
- * Gets types configuration.
- *
- * @return Types configuration.
- */
- public Collection getTypeConfigurations() {
- return typeCfgs;
- }
-
- /**
- * Sets type configurations.
- *
- * @param typeCfgs Type configurations.
- */
- public void setTypeConfigurations(Collection typeCfgs) {
- this.typeCfgs = typeCfgs;
- }
-
- /**
- * If {@code true} then date values converted to {@link Timestamp} on deserialization.
- *
- * Default value is {@code true}.
- *
- * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public boolean isUseTimestamp() {
- return useTs;
- }
-
- /**
- * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public void setUseTimestamp(boolean useTs) {
- this.useTs = useTs;
- }
-
- /**
- * Gets strings must be converted to or from bytes using UTF-8 encoding.
- *
- * Default value is {@code true}.
- *
- * @return Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public boolean isConvertStringToBytes() {
- return convertString;
- }
-
- /**
- * Sets strings must be converted to or from bytes using UTF-8 encoding.
- *
- * Default value is {@code true}.
- *
- * @param convertString Flag indicating whether string must be converted to byte array using UTF-8 encoding.
- */
- public void setConvertStringToBytes(boolean convertString) {
- this.convertString = convertString;
- }
-
- /**
- * If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
- * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
- *
- * Default value if {@code true}.
- *
- * @return Whether meta data is collected.
- */
- public boolean isMetaDataEnabled() {
- return metaDataEnabled;
- }
-
- /**
- * @param metaDataEnabled Whether meta data is collected.
- */
- public void setMetaDataEnabled(boolean metaDataEnabled) {
- this.metaDataEnabled = metaDataEnabled;
- }
-
- /**
- * If {@code true}, {@link PortableObject} will cache deserialized instance after
- * {@link PortableObject#deserialize()} is called. All consequent calls of this
- * method on the same instance of {@link PortableObject} will return that cached
- * value without actually deserializing portable object. If you need to override this
- * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
- * method.
- *
- * Default value if {@code true}.
- *
- * @return Whether deserialized value is kept.
- */
- public boolean isKeepDeserialized() {
- return keepDeserialized;
- }
-
- /**
- * @param keepDeserialized Whether deserialized value is kept.
- */
- public void setKeepDeserialized(boolean keepDeserialized) {
- this.keepDeserialized = keepDeserialized;
- }
-
- /**
- * Gets portable protocol version.
- *
- * @param ctx Portable context.
- */
- private void setPortableContext(PortableContext ctx) {
- ctx.configure(this);
-
- impl = new GridPortableMarshaller(ctx);
- }
-
- /** {@inheritDoc} */
- @Override public byte[] marshal(@Nullable Object obj) throws IgniteCheckedException {
- return impl.marshal(obj, 0);
- }
-
- /** {@inheritDoc} */
- @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
- byte[] arr = marshal(obj);
-
- try {
- out.write(arr);
- }
- catch (IOException e) {
- throw new PortableException("Failed to marshal the object: " + obj, e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
- return impl.deserialize(bytes, clsLdr);
- }
-
- /** {@inheritDoc} */
- @Override public T unmarshal(InputStream in, @Nullable ClassLoader clsLdr) throws IgniteCheckedException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
- byte[] arr = new byte[4096];
- int cnt;
-
- // we have to fully read the InputStream because GridPortableMarshaller requires support of a method that
- // returns number of bytes remaining.
- try {
- while ((cnt = in.read(arr)) != -1)
- buffer.write(arr, 0, cnt);
-
- buffer.flush();
-
- return impl.deserialize(buffer.toByteArray(), clsLdr);
- }
- catch (IOException e) {
- throw new PortableException("Failed to unmarshal the object from InputStream", e);
- }
- }
-}
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
deleted file mode 100644
index 90cc5e6..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-
-/**
- *
- * Contains portable marshaller API classes.
- */
-package org.apache.ignite.marshaller.portable;
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
deleted file mode 100644
index 377fcdc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
+++ /dev/null
@@ -1,137 +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.portable;
-
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
- *
- * Here is an example of how a portable object can be built dynamically:
- *
- *
- * If you need to modify nested portable object you can get builder for nested object using
- * {@link #getField(String)}, changes made on nested builder will affect parent object,
- * for example:
- *
- *
- * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
- * PortableBuilder addressBuilder = personBuilder.setField("address");
- *
- * addressBuilder.setField("city", "New York");
- *
- * personPortableObj = personBuilder.build();
- *
- * // Should be "New York".
- * String city = personPortableObj.getField("address").getField("city");
- *
- *
- * @see IgnitePortables#builder(int)
- * @see IgnitePortables#builder(String)
- * @see IgnitePortables#builder(PortableObject)
- */
-public interface PortableBuilder {
- /**
- * Returns value assigned to the specified field.
- * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
- * which can be modified.
- *
- * Collections and maps returned from this method are modifiable.
- *
- * @param name Field name.
- * @return Filed value.
- */
- public T getField(String name);
-
- /**
- * Sets field value.
- *
- * @param name Field name.
- * @param val Field value (cannot be {@code null}).
- * @see PortableObject#metaData()
- */
- public PortableBuilder setField(String name, Object val);
-
- /**
- * Sets field value with value type specification.
- *
- * Field type is needed for proper metadata update.
- *
- * @param name Field name.
- * @param val Field value.
- * @param type Field type.
- * @see PortableObject#metaData()
- */
- public PortableBuilder setField(String name, @Nullable T val, Class super T> type);
-
- /**
- * Sets field value.
- *
- * This method should be used if field is portable object.
- *
- * @param name Field name.
- * @param builder Builder for object field.
- */
- public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
-
- /**
- * Removes field from this builder.
- *
- * @param fieldName Field name.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder removeField(String fieldName);
-
- /**
- * Sets hash code for resulting portable object returned by {@link #build()} method.
- *
- * If not set {@code 0} is used.
- *
- * @param hashCode Hash code.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder hashCode(int hashCode);
-
- /**
- * Builds portable object.
- *
- * @return Portable object.
- * @throws PortableException In case of error.
- */
- public PortableObject build() throws PortableException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
deleted file mode 100644
index 0f8d78b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
+++ /dev/null
@@ -1,57 +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.portable;
-
-import org.apache.ignite.IgniteException;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating portable object serialization error.
- */
-public class PortableException extends IgniteException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates portable exception with error message.
- *
- * @param msg Error message.
- */
- public PortableException(String msg) {
- super(msg);
- }
-
- /**
- * Creates portable exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates portable exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
deleted file mode 100644
index 368e415..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
+++ /dev/null
@@ -1,56 +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.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Type and field ID mapper for portable objects. Ignite never writes full
- * strings for field or type names. Instead, for performance reasons, Ignite
- * writes integer hash codes for type and field names. It has been tested that
- * hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide {@code PortableIdMapper} allows to override the automatically
- * generated hash code IDs for the type and field names.
- *
- * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
- * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
- */
-public interface PortableIdMapper {
- /**
- * Gets type ID for provided class name.
- *
- * If {@code 0} is returned, hash code of class simple name will be used.
- *
- * @param clsName Class name.
- * @return Type ID.
- */
- public int typeId(String clsName);
-
- /**
- * Gets ID for provided field.
- *
- * If {@code 0} is returned, hash code of field name will be used.
- *
- * @param typeId Type ID.
- * @param fieldName Field name.
- * @return Field ID.
- */
- public int fieldId(int typeId, String fieldName);
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
deleted file mode 100644
index 0098ec3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
+++ /dev/null
@@ -1,58 +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.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating that class needed for deserialization of portable object does not exist.
- *
- * Thrown from {@link PortableObject#deserialize()} method.
- */
-public class PortableInvalidClassException extends PortableException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates invalid class exception with error message.
- *
- * @param msg Error message.
- */
- public PortableInvalidClassException(String msg) {
- super(msg);
- }
-
- /**
- * Creates invalid class exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableInvalidClassException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates invalid class exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
deleted file mode 100644
index 4270885..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
+++ /dev/null
@@ -1,48 +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.portable;
-
-/**
- * Interface that allows to implement custom serialization
- * logic for portable objects. Portable objects are not required
- * to implement this interface, in which case Ignite will automatically
- * serialize portable objects using reflection.
- *
- * This interface, in a way, is analogous to {@link java.io.Externalizable}
- * interface, which allows users to override default serialization logic,
- * usually for performance reasons. The only difference here is that portable
- * serialization is already very fast and implementing custom serialization
- * logic for portables does not provide significant performance gains.
- */
-public interface PortableMarshalAware {
- /**
- * Writes fields to provided writer.
- *
- * @param writer Portable object writer.
- * @throws PortableException In case of error.
- */
- public void writePortable(PortableWriter writer) throws PortableException;
-
- /**
- * Reads fields from provided reader.
- *
- * @param reader Portable object reader.
- * @throws PortableException In case of error.
- */
- public void readPortable(PortableReader reader) throws PortableException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
deleted file mode 100644
index 4ea808b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
+++ /dev/null
@@ -1,61 +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.portable;
-
-import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable type meta data. Metadata for portable types can be accessed from any of the
- * {@link IgnitePortables#metadata(String)} methods.
- * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableMetadata {
- /**
- * Gets portable type name.
- *
- * @return Portable type name.
- */
- public String typeName();
-
- /**
- * Gets collection of all field names for this portable type.
- *
- * @return Collection of all field names for this portable type.
- */
- public Collection fields();
-
- /**
- * Gets name of the field type for a given field.
- *
- * @param fieldName Field name.
- * @return Field type name.
- */
- @Nullable public String fieldTypeName(String fieldName);
-
- /**
- * Portable objects can optionally specify custom key-affinity mapping in the
- * configuration. This method returns the name of the field which should be
- * used for the key-affinity mapping.
- *
- * @return Affinity key field name.
- */
- @Nullable public String affinityKeyFieldName();
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
deleted file mode 100644
index 66b8f76..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
+++ /dev/null
@@ -1,154 +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.portable;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.TreeMap;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Wrapper for portable object in portable binary format. Once an object is defined as portable,
- * Ignite will always store it in memory in the portable (i.e. binary) format.
- * User can choose to work either with the portable format or with the deserialized form
- * (assuming that class definitions are present in the classpath).
- *
- * NOTE: user does not need to (and should not) implement this interface directly.
- *
- * To work with the portable format directly, user should create a cache projection
- * over {@code PortableObject} class and then retrieve individual fields as needed:
- *
- * IgniteCache<PortableObject, PortableObject> prj = cache.withKeepPortable();
- *
- * // Convert instance of MyKey to portable format.
- * // We could also use GridPortableBuilder to create the key in portable format directly.
- * PortableObject key = grid.portables().toPortable(new MyKey());
- *
- * PortableObject val = prj.get(key);
- *
- * String field = val.field("myFieldName");
- *
- * Alternatively, if we have class definitions in the classpath, we may choose to work with deserialized
- * typed objects at all times. In this case we do incur the deserialization cost. However, if
- * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then Ignite will only deserialize on the first access
- * and will cache the deserialized object, so it does not have to be deserialized again:
- *
- * All maps and collections in the portable objects are serialized automatically. When working
- * with different platforms, e.g. C++ or .NET, Ignite will automatically pick the most
- * adequate collection or map in either language. For example, {@link ArrayList} in Java will become
- * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in C#, {@link HashMap}
- * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes {@code SortedDictionary}
- * in C#, etc.
- *
Dynamic Structure Changes
- * Since objects are always cached in the portable binary format, server does not need to
- * be aware of the class definitions. Moreover, if class definitions are not present or not
- * used on the server, then clients can continuously change the structure of the portable
- * objects without having to restart the cluster. For example, if one client stores a
- * certain class with fields A and B, and another client stores the same class with
- * fields B and C, then the server-side portable object will have the fields A, B, and C.
- * As the structure of a portable object changes, the new fields become available for SQL queries
- * automatically.
- *
Building Portable Objects
- * Ignite comes with {@link PortableBuilder} which allows to build portable objects dynamically:
- *
- * For the cases when class definition is present
- * in the class path, it is also possible to populate a standard POJO and then
- * convert it to portable format, like so:
- *
- * Even though Ignite portable protocol only works with hash codes for type and field names
- * to achieve better performance, Ignite provides metadata for all portable types which
- * can be queried ar runtime via any of the {@link IgnitePortables#metadata(Class)}
- * methods. Having metadata also allows for proper formatting of {@code PortableObject.toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableObject extends Serializable, Cloneable {
- /**
- * Gets portable object type ID.
- *
- * @return Type ID.
- */
- public int typeId();
-
- /**
- * Gets meta data for this portable object.
- *
- * @return Meta data.
- * @throws PortableException In case of error.
- */
- @Nullable public PortableMetadata metaData() throws PortableException;
-
- /**
- * Gets field value.
- *
- * @param fieldName Field name.
- * @return Field value.
- * @throws PortableException In case of any other error.
- */
- @Nullable public F field(String fieldName) throws PortableException;
-
- /**
- * Checks whether field is set.
- *
- * @param fieldName Field name.
- * @return {@code true} if field is set.
- */
- public boolean hasField(String fieldName);
-
- /**
- * Gets fully deserialized instance of portable object.
- *
- * @return Fully deserialized instance of portable object.
- * @throws PortableInvalidClassException If class doesn't exist.
- * @throws PortableException In case of any other error.
- */
- @Nullable public T deserialize() throws PortableException;
-
- /**
- * Copies this portable object.
- *
- * @return Copy of this portable object.
- */
- public PortableObject clone() throws CloneNotSupportedException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
deleted file mode 100644
index 9189b28..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableProtocolVersion.java
+++ /dev/null
@@ -1,41 +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.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable protocol version.
- */
-public enum PortableProtocolVersion {
- /** Ignite 1.4.0 release. */
- VER_1_4_0;
-
- /** Enumerated values. */
- private static final PortableProtocolVersion[] VALS = values();
-
- /**
- * Efficiently gets enumerated value from its ordinal.
- *
- * @param ord Ordinal value.
- * @return Enumerated value or {@code null} if ordinal out of range.
- */
- @Nullable public static PortableProtocolVersion fromOrdinal(int ord) {
- return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
- }
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
deleted file mode 100644
index 3bae2e1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawReader.java
+++ /dev/null
@@ -1,234 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw reader for portable objects. Raw reader does not use field name hash codes, therefore,
- * making the format even more compact. However, if the raw reader is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawReader {
- /**
- * @return Byte value.
- * @throws PortableException In case of error.
- */
- public byte readByte() throws PortableException;
-
- /**
- * @return Short value.
- * @throws PortableException In case of error.
- */
- public short readShort() throws PortableException;
-
- /**
- * @return Integer value.
- * @throws PortableException In case of error.
- */
- public int readInt() throws PortableException;
-
- /**
- * @return Long value.
- * @throws PortableException In case of error.
- */
- public long readLong() throws PortableException;
-
- /**
- * @return Float value.
- * @throws PortableException In case of error.
- */
- public float readFloat() throws PortableException;
-
- /**
- * @return Double value.
- * @throws PortableException In case of error.
- */
- public double readDouble() throws PortableException;
-
- /**
- * @return Char value.
- * @throws PortableException In case of error.
- */
- public char readChar() throws PortableException;
-
- /**
- * @return Boolean value.
- * @throws PortableException In case of error.
- */
- public boolean readBoolean() throws PortableException;
-
- /**
- * @return Decimal value.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal readDecimal() throws PortableException;
-
- /**
- * @return String value.
- * @throws PortableException In case of error.
- */
- @Nullable public String readString() throws PortableException;
-
- /**
- * @return UUID.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID readUuid() throws PortableException;
-
- /**
- * @return Date.
- * @throws PortableException In case of error.
- */
- @Nullable public Date readDate() throws PortableException;
-
- /**
- * @return Timestamp.
- * @throws PortableException In case of error.
- */
- @Nullable public Timestamp readTimestamp() throws PortableException;
-
- /**
- * @return Object.
- * @throws PortableException In case of error.
- */
- @Nullable public T readObject() throws PortableException;
-
- /**
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public byte[] readByteArray() throws PortableException;
-
- /**
- * @return Short array.
- * @throws PortableException In case of error.
- */
- @Nullable public short[] readShortArray() throws PortableException;
-
- /**
- * @return Integer array.
- * @throws PortableException In case of error.
- */
- @Nullable public int[] readIntArray() throws PortableException;
-
- /**
- * @return Long array.
- * @throws PortableException In case of error.
- */
- @Nullable public long[] readLongArray() throws PortableException;
-
- /**
- * @return Float array.
- * @throws PortableException In case of error.
- */
- @Nullable public float[] readFloatArray() throws PortableException;
-
- /**
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public double[] readDoubleArray() throws PortableException;
-
- /**
- * @return Char array.
- * @throws PortableException In case of error.
- */
- @Nullable public char[] readCharArray() throws PortableException;
-
- /**
- * @return Boolean array.
- * @throws PortableException In case of error.
- */
- @Nullable public boolean[] readBooleanArray() throws PortableException;
-
- /**
- * @return Decimal array.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal[] readDecimalArray() throws PortableException;
-
- /**
- * @return String array.
- * @throws PortableException In case of error.
- */
- @Nullable public String[] readStringArray() throws PortableException;
-
- /**
- * @return UUID array.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID[] readUuidArray() throws PortableException;
-
- /**
- * @return Date array.
- * @throws PortableException In case of error.
- */
- @Nullable public Date[] readDateArray() throws PortableException;
-
- /**
- * @return Object array.
- * @throws PortableException In case of error.
- */
- @Nullable public Object[] readObjectArray() throws PortableException;
-
- /**
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public Collection readCollection() throws PortableException;
-
- /**
- * @param colCls Collection class.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public Collection readCollection(Class extends Collection> colCls)
- throws PortableException;
-
- /**
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public Map readMap() throws PortableException;
-
- /**
- * @param mapCls Map class.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public Map readMap(Class extends Map> mapCls) throws PortableException;
-
- /**
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public > T readEnum() throws PortableException;
-
- /**
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public > T[] readEnumArray() throws PortableException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
deleted file mode 100644
index 53f4f92..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableRawWriter.java
+++ /dev/null
@@ -1,219 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Raw writer for portable object. Raw writer does not write field name hash codes, therefore,
- * making the format even more compact. However, if the raw writer is used,
- * dynamic structure changes to the portable objects are not supported.
- */
-public interface PortableRawWriter {
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByte(byte val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShort(short val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeInt(int val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLong(long val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloat(float val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDouble(double val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeChar(char val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBoolean(boolean val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimal(@Nullable BigDecimal val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeString(@Nullable String val) throws PortableException;
-
- /**
- * @param val UUID to write.
- * @throws PortableException In case of error.
- */
- public void writeUuid(@Nullable UUID val) throws PortableException;
-
- /**
- * @param val Date to write.
- * @throws PortableException In case of error.
- */
- public void writeDate(@Nullable Date val) throws PortableException;
-
- /**
- * @param val Timestamp to write.
- * @throws PortableException In case of error.
- */
- public void writeTimestamp(@Nullable Timestamp val) throws PortableException;
-
- /**
- * @param obj Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObject(@Nullable Object obj) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByteArray(@Nullable byte[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShortArray(@Nullable short[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeIntArray(@Nullable int[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLongArray(@Nullable long[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloatArray(@Nullable float[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDoubleArray(@Nullable double[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeCharArray(@Nullable char[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBooleanArray(@Nullable boolean[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimalArray(@Nullable BigDecimal[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeStringArray(@Nullable String[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeUuidArray(@Nullable UUID[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDateArray(@Nullable Date[] val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObjectArray(@Nullable Object[] val) throws PortableException;
-
- /**
- * @param col Collection to write.
- * @throws PortableException In case of error.
- */
- public void writeCollection(@Nullable Collection col) throws PortableException;
-
- /**
- * @param map Map to write.
- * @throws PortableException In case of error.
- */
- public void writeMap(@Nullable Map map) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public > void writeEnum(T val) throws PortableException;
-
- /**
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public > void writeEnumArray(T[] val) throws PortableException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
deleted file mode 100644
index 58f078d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableReader.java
+++ /dev/null
@@ -1,284 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Reader for portable objects used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- *
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableReader {
- /**
- * @param fieldName Field name.
- * @return Byte value.
- * @throws PortableException In case of error.
- */
- public byte readByte(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Short value.
- * @throws PortableException In case of error.
- */
- public short readShort(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Integer value.
- * @throws PortableException In case of error.
- */
- public int readInt(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Long value.
- * @throws PortableException In case of error.
- */
- public long readLong(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @throws PortableException In case of error.
- * @return Float value.
- */
- public float readFloat(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Double value.
- * @throws PortableException In case of error.
- */
- public double readDouble(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Char value.
- * @throws PortableException In case of error.
- */
- public char readChar(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Boolean value.
- * @throws PortableException In case of error.
- */
- public boolean readBoolean(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Decimal value.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal readDecimal(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return String value.
- * @throws PortableException In case of error.
- */
- @Nullable public String readString(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return UUID.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID readUuid(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Date.
- * @throws PortableException In case of error.
- */
- @Nullable public Date readDate(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Timestamp.
- * @throws PortableException In case of error.
- */
- @Nullable public Timestamp readTimestamp(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Object.
- * @throws PortableException In case of error.
- */
- @Nullable public T readObject(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public byte[] readByteArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Short array.
- * @throws PortableException In case of error.
- */
- @Nullable public short[] readShortArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Integer array.
- * @throws PortableException In case of error.
- */
- @Nullable public int[] readIntArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Long array.
- * @throws PortableException In case of error.
- */
- @Nullable public long[] readLongArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Float array.
- * @throws PortableException In case of error.
- */
- @Nullable public float[] readFloatArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Byte array.
- * @throws PortableException In case of error.
- */
- @Nullable public double[] readDoubleArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Char array.
- * @throws PortableException In case of error.
- */
- @Nullable public char[] readCharArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Boolean array.
- * @throws PortableException In case of error.
- */
- @Nullable public boolean[] readBooleanArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Decimal array.
- * @throws PortableException In case of error.
- */
- @Nullable public BigDecimal[] readDecimalArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return String array.
- * @throws PortableException In case of error.
- */
- @Nullable public String[] readStringArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return UUID array.
- * @throws PortableException In case of error.
- */
- @Nullable public UUID[] readUuidArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Date array.
- * @throws PortableException In case of error.
- */
- @Nullable public Date[] readDateArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Object array.
- * @throws PortableException In case of error.
- */
- @Nullable public Object[] readObjectArray(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public Collection readCollection(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param colCls Collection class.
- * @return Collection.
- * @throws PortableException In case of error.
- */
- @Nullable public Collection readCollection(String fieldName, Class extends Collection> colCls)
- throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public Map readMap(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param mapCls Map class.
- * @return Map.
- * @throws PortableException In case of error.
- */
- @Nullable public Map readMap(String fieldName, Class extends Map> mapCls)
- throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public > T readEnum(String fieldName) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @return Value.
- * @throws PortableException In case of error.
- */
- @Nullable public > T[] readEnumArray(String fieldName) throws PortableException;
-
- /**
- * Gets raw reader. Raw reader does not use field name hash codes, therefore,
- * making the format even more compact. However, if the raw reader is used,
- * dynamic structure changes to the portable objects are not supported.
- *
- * @return Raw reader.
- */
- public PortableRawReader rawReader();
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
deleted file mode 100644
index 90ee562..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableSerializer.java
+++ /dev/null
@@ -1,49 +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.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Interface that allows to implement custom serialization logic for portable objects.
- * Can be used instead of {@link PortableMarshalAware} in case if the class
- * cannot be changed directly.
- *
- * Portable serializer can be configured for all portable objects via
- * {@link PortableMarshaller#getSerializer()} method, or for a specific
- * portable type via {@link PortableTypeConfiguration#getSerializer()} method.
- */
-public interface PortableSerializer {
- /**
- * Writes fields to provided writer.
- *
- * @param obj Empty object.
- * @param writer Portable object writer.
- * @throws PortableException In case of error.
- */
- public void writePortable(Object obj, PortableWriter writer) throws PortableException;
-
- /**
- * Reads fields from provided reader.
- *
- * @param obj Empty object
- * @param reader Portable object reader.
- * @throws PortableException In case of error.
- */
- public void readPortable(Object obj, PortableReader reader) throws PortableException;
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
deleted file mode 100644
index 5e6e09d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
+++ /dev/null
@@ -1,196 +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.portable;
-
-import java.sql.Timestamp;
-import java.util.Collection;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Defines configuration properties for a specific portable type. Providing per-type
- * configuration is optional, as it is generally enough, and also optional, to provide global portable
- * configuration using {@link PortableMarshaller#setClassNames(Collection)}.
- * However, this class allows you to change configuration properties for a specific
- * portable type without affecting configuration for other portable types.
- *
- * Per-type portable configuration can be specified in {@link PortableMarshaller#getTypeConfigurations()} method.
- */
-public class PortableTypeConfiguration {
- /** Class name. */
- private String clsName;
-
- /** ID mapper. */
- private PortableIdMapper idMapper;
-
- /** Serializer. */
- private PortableSerializer serializer;
-
- /** Use timestamp flag. */
- private Boolean useTs;
-
- /** Meta data enabled flag. */
- private Boolean metaDataEnabled;
-
- /** Keep deserialized flag. */
- private Boolean keepDeserialized;
-
- /** Affinity key field name. */
- private String affKeyFieldName;
-
- /**
- */
- public PortableTypeConfiguration() {
- // No-op.
- }
-
- /**
- * @param clsName Class name.
- */
- public PortableTypeConfiguration(String clsName) {
- this.clsName = clsName;
- }
-
- /**
- * Gets type name.
- *
- * @return Type name.
- */
- public String getClassName() {
- return clsName;
- }
-
- /**
- * Sets type name.
- *
- * @param clsName Type name.
- */
- public void setClassName(String clsName) {
- this.clsName = clsName;
- }
-
- /**
- * Gets ID mapper.
- *
- * @return ID mapper.
- */
- public PortableIdMapper getIdMapper() {
- return idMapper;
- }
-
- /**
- * Sets ID mapper.
- *
- * @param idMapper ID mapper.
- */
- public void setIdMapper(PortableIdMapper idMapper) {
- this.idMapper = idMapper;
- }
-
- /**
- * Gets serializer.
- *
- * @return Serializer.
- */
- public PortableSerializer getSerializer() {
- return serializer;
- }
-
- /**
- * Sets serializer.
- *
- * @param serializer Serializer.
- */
- public void setSerializer(PortableSerializer serializer) {
- this.serializer = serializer;
- }
-
- /**
- * If {@code true} then date values converted to {@link Timestamp} during unmarshalling.
- *
- * @return Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public Boolean isUseTimestamp() {
- return useTs;
- }
-
- /**
- * @param useTs Flag indicating whether date values converted to {@link Timestamp} during unmarshalling.
- */
- public void setUseTimestamp(Boolean useTs) {
- this.useTs = useTs;
- }
-
- /**
- * Defines whether meta data is collected for this type. If provided, this value will override
- * {@link PortableMarshaller#isMetaDataEnabled()} property.
- *
- * @return Whether meta data is collected.
- */
- public Boolean isMetaDataEnabled() {
- return metaDataEnabled;
- }
-
- /**
- * @param metaDataEnabled Whether meta data is collected.
- */
- public void setMetaDataEnabled(Boolean metaDataEnabled) {
- this.metaDataEnabled = metaDataEnabled;
- }
-
- /**
- * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
- * this value will override {@link PortableMarshaller#isKeepDeserialized()}
- * property.
- *
- * @return Whether deserialized value is kept.
- */
- public Boolean isKeepDeserialized() {
- return keepDeserialized;
- }
-
- /**
- * @param keepDeserialized Whether deserialized value is kept.
- */
- public void setKeepDeserialized(Boolean keepDeserialized) {
- this.keepDeserialized = keepDeserialized;
- }
-
- /**
- * Gets affinity key field name.
- *
- * @return Affinity key field name.
- */
- public String getAffinityKeyFieldName() {
- return affKeyFieldName;
- }
-
- /**
- * Sets affinity key field name.
- *
- * @param affKeyFieldName Affinity key field name.
- */
- public void setAffinityKeyFieldName(String affKeyFieldName) {
- this.affKeyFieldName = affKeyFieldName;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PortableTypeConfiguration.class, this, super.toString());
- }
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
deleted file mode 100644
index 0d7160f..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableWriter.java
+++ /dev/null
@@ -1,266 +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.portable;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Writer for portable object used in {@link PortableMarshalAware} implementations.
- * Useful for the cases when user wants a fine-grained control over serialization.
- *
- * Note that Ignite never writes full strings for field or type names. Instead,
- * for performance reasons, Ignite writes integer hash codes for type and field names.
- * It has been tested that hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide, Ignite provides {@link PortableIdMapper} which
- * allows to override the automatically generated hash code IDs for the type and field names.
- */
-public interface PortableWriter {
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByte(String fieldName, byte val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShort(String fieldName, short val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeInt(String fieldName, int val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLong(String fieldName, long val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloat(String fieldName, float val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDouble(String fieldName, double val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeChar(String fieldName, char val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBoolean(String fieldName, boolean val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimal(String fieldName, @Nullable BigDecimal val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeString(String fieldName, @Nullable String val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val UUID to write.
- * @throws PortableException In case of error.
- */
- public void writeUuid(String fieldName, @Nullable UUID val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Date to write.
- * @throws PortableException In case of error.
- */
- public void writeDate(String fieldName, @Nullable Date val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Timestamp to write.
- * @throws PortableException In case of error.
- */
- public void writeTimestamp(String fieldName, @Nullable Timestamp val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param obj Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObject(String fieldName, @Nullable Object obj) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeByteArray(String fieldName, @Nullable byte[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeShortArray(String fieldName, @Nullable short[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeIntArray(String fieldName, @Nullable int[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeLongArray(String fieldName, @Nullable long[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeFloatArray(String fieldName, @Nullable float[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDoubleArray(String fieldName, @Nullable double[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeCharArray(String fieldName, @Nullable char[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeBooleanArray(String fieldName, @Nullable boolean[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDecimalArray(String fieldName, @Nullable BigDecimal[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeStringArray(String fieldName, @Nullable String[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeUuidArray(String fieldName, @Nullable UUID[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeDateArray(String fieldName, @Nullable Date[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public void writeObjectArray(String fieldName, @Nullable Object[] val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param col Collection to write.
- * @throws PortableException In case of error.
- */
- public void writeCollection(String fieldName, @Nullable Collection col) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param map Map to write.
- * @throws PortableException In case of error.
- */
- public void writeMap(String fieldName, @Nullable Map map) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public > void writeEnum(String fieldName, T val) throws PortableException;
-
- /**
- * @param fieldName Field name.
- * @param val Value to write.
- * @throws PortableException In case of error.
- */
- public > void writeEnumArray(String fieldName, T[] val) throws PortableException;
-
- /**
- * Gets raw writer. Raw writer does not write field name hash codes, therefore,
- * making the format even more compact. However, if the raw writer is used,
- * dynamic structure changes to the portable objects are not supported.
- *
- * @return Raw writer.
- */
- public PortableRawWriter rawWriter();
-}
\ No newline at end of file
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java b/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
deleted file mode 100644
index 0105b15..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-
-/**
- *
- * Contains portable objects API classes.
- */
-package org.apache.ignite.portable;
\ No newline at end of file
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 70c32e5..36ac156 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1572,10 +1572,10 @@ org.apache.ignite.plugin.security.SecuritySubject
org.apache.ignite.plugin.security.SecuritySubjectType
org.apache.ignite.plugin.segmentation.SegmentationPolicy
org.apache.ignite.plugin.segmentation.SegmentationResolver
-org.apache.ignite.portable.PortableException
-org.apache.ignite.portable.PortableInvalidClassException
-org.apache.ignite.portable.PortableObject
-org.apache.ignite.portable.PortableProtocolVersion
+org.apache.ignite.internal.portable.api.PortableException
+org.apache.ignite.internal.portable.api.PortableInvalidClassException
+org.apache.ignite.internal.portable.api.PortableObject
+org.apache.ignite.internal.portable.api.PortableProtocolVersion
org.apache.ignite.services.Service
org.apache.ignite.services.ServiceConfiguration
org.apache.ignite.services.ServiceContext
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index 82da10f..dc73cff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -159,51 +159,6 @@ public abstract class GridDiscoveryManagerAttributesSelfTest extends GridCommonA
}
/**
- * @throws Exception If failed.
- */
- public void testDifferentPortableProtocolVersions() throws Exception {
- startGridWithPortableProtocolVer("VER_99_99_99");
-
- try {
- startGrid(1);
-
- fail();
- }
- catch (IgniteCheckedException e) {
- if (!e.getCause().getMessage().startsWith("Remote node has portable protocol version different from local"))
- throw e;
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testNullPortableProtocolVersion() throws Exception {
- startGridWithPortableProtocolVer(null);
-
- // Must not fail in order to preserve backward compatibility with the nodes that don't have this property yet.
- startGrid(1);
- }
-
- /**
- * @throws Exception If failed.
- */
- private void startGridWithPortableProtocolVer(String ver) throws Exception {
- Ignite ignite = startGrid(0);
-
- ClusterNode clusterNode = ignite.cluster().localNode();
-
- Field f = clusterNode.getClass().getDeclaredField("attrs");
- f.setAccessible(true);
-
- Map attrs = new HashMap<>((Map)f.get(clusterNode));
-
- attrs.put(IgniteNodeAttributes.ATTR_PORTABLE_PROTO_VER, ver);
-
- f.set(clusterNode, attrs);
- }
-
- /**
* @param preferIpV4 {@code java.net.preferIPv4Stack} system property value.
* @throws Exception If failed.
*/
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
index 59084db..36b43f6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableAffinityKeySelfTest.java
@@ -31,8 +31,8 @@ import org.apache.ignite.internal.processors.cache.CacheObjectContext;
import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteRunnable;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
index 61ec714..6b9751a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderAdditionalSelfTest.java
@@ -36,7 +36,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.portable.builder.PortableBuilderEnum;
@@ -45,10 +45,10 @@ import org.apache.ignite.internal.portable.mutabletest.GridPortableMarshalerAwar
import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
import org.apache.ignite.internal.processors.cache.portable.IgnitePortablesImpl;
import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Assert;
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
index 7f23c1f..bceec9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableBuilderSelfTest.java
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.TestObjectAllTypes;
@@ -37,12 +37,12 @@ import org.apache.ignite.internal.portable.mutabletest.GridPortableTestClasses.T
import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import sun.misc.Unsafe;
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
index bd9612c..71a11b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerCtxDisabledSelfTest.java
@@ -25,12 +25,12 @@ import java.util.Arrays;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.MarshallerContextAdapter;
import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
index 21fc81c..dc16c94 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
@@ -49,20 +49,20 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableInvalidClassException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableInvalidClassException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableSerializer;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.jsr166.ConcurrentHashMap8;
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
index 05df23b..825d678 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
@@ -17,15 +17,15 @@
package org.apache.ignite.internal.portable;
import java.util.Arrays;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableBuilder;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
index fa3c9a7..bec70cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataSelfTest.java
@@ -22,17 +22,17 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
-import org.apache.ignite.IgnitePortables;
+import org.apache.ignite.internal.portable.api.IgnitePortables;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
index 349f152..25ff7d0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableWildcardsSelfTest.java
@@ -21,10 +21,10 @@ import java.util.Arrays;
import java.util.Map;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.internal.portable.api.PortableMarshaller;
+import org.apache.ignite.internal.portable.api.PortableIdMapper;
+import org.apache.ignite.internal.portable.api.PortableMetadata;
+import org.apache.ignite.internal.portable.api.PortableTypeConfiguration;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
index 3244331..53d84a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableMarshalerAwareTestClass.java
@@ -18,12 +18,12 @@
package org.apache.ignite.internal.portable.mutabletest;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableRawReader;
-import org.apache.ignite.portable.PortableRawWriter;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.internal.portable.api.PortableException;
+import org.apache.ignite.internal.portable.api.PortableMarshalAware;
+import org.apache.ignite.internal.portable.api.PortableRawReader;
+import org.apache.ignite.internal.portable.api.PortableRawWriter;
+import org.apache.ignite.internal.portable.api.PortableReader;
+import org.apache.ignite.internal.portable.api.PortableWriter;
import org.apache.ignite.testframework.GridTestUtils;
/**
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
index e49514b..13f51ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/mutabletest/GridPortableTestClasses.java
@@ -31,7 +31,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.UUID;
import org.apache.ignite.internal.util.lang.GridMapEntry;
-import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.internal.portable.api.PortableObject;
/**
*
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
deleted file mode 100644
index 1ba3d4d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/GridCacheClientNodePortableMetadataMultinodeTest.java
+++ /dev/null
@@ -1,295 +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.processors.cache.portable;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.util.lang.GridAbsPredicate;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableMetadata;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.eclipse.jetty.util.ConcurrentHashSet;
-
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- *
- */
-public class GridCacheClientNodePortableMetadataMultinodeTest extends GridCommonAbstractTest {
- /** */
- protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private boolean client;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- cfg.setPeerClassLoadingEnabled(false);
-
- ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true);
-
- cfg.setMarshaller(new PortableMarshaller());
-
- CacheConfiguration ccfg = new CacheConfiguration();
-
- ccfg.setWriteSynchronizationMode(FULL_SYNC);
-
- cfg.setCacheConfiguration(ccfg);
-
- cfg.setClientMode(client);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- super.afterTest();
-
- stopAllGrids();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testClientMetadataInitialization() throws Exception {
- startGrids(2);
-
- final AtomicBoolean stop = new AtomicBoolean();
-
- final ConcurrentHashSet allTypes = new ConcurrentHashSet<>();
-
- IgniteInternalFuture> fut;
-
- try {
- // Update portable metadata concurrently with client nodes start.
- fut = GridTestUtils.runMultiThreadedAsync(new Callable