You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/04/11 10:05:50 UTC
[01/22] ignite git commit: IGNITE-3531: Renamed
IgniteFileSystem.format() to clear().
Repository: ignite
Updated Branches:
refs/heads/ignite-3477-master a68045f0d -> 2210635ae
IGNITE-3531: Renamed IgniteFileSystem.format() to clear().
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0ccb8569
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0ccb8569
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0ccb8569
Branch: refs/heads/ignite-3477-master
Commit: 0ccb8569bd3f7b4bbcdb435612867a6723d4a506
Parents: b465301
Author: devozerov <vo...@gridgain.com>
Authored: Thu Apr 6 14:02:09 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Apr 6 14:02:09 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/IgniteFileSystem.java | 26 ++++++--------------
.../internal/processors/igfs/IgfsAsyncImpl.java | 8 +++---
.../internal/processors/igfs/IgfsImpl.java | 10 ++++----
.../visor/igfs/VisorIgfsFormatTask.java | 2 +-
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 2 +-
.../igfs/IgfsFragmentizerAbstractSelfTest.java | 2 +-
.../ignite/igfs/IgfsFragmentizerSelfTest.java | 2 +-
...faultIgfsSecondaryFileSystemTestAdapter.java | 2 +-
.../igfs/IgfsAbstractBaseSelfTest.java | 2 +-
.../processors/igfs/IgfsAbstractSelfTest.java | 4 +--
...sCachePerBlockLruEvictionPolicySelfTest.java | 2 +-
.../igfs/IgfsMetaManagerSelfTest.java | 2 +-
.../processors/igfs/IgfsMetricsSelfTest.java | 2 +-
.../internal/processors/igfs/IgfsMock.java | 4 +--
.../processors/igfs/IgfsProcessorSelfTest.java | 8 +++---
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../processors/igfs/IgfsTaskSelfTest.java | 2 +-
.../IgfsAbstractRecordResolverSelfTest.java | 2 +-
.../impl/HadoopTaskExecutionSelfTest.java | 2 +-
...opClientProtocolMultipleServersSelfTest.java | 2 +-
.../client/HadoopClientProtocolSelfTest.java | 2 +-
.../hadoop/impl/igfs/IgfsEventsTestSuite.java | 2 +-
22 files changed, 41 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
index 78c86dc..0100c7b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -31,7 +31,6 @@ import org.apache.ignite.igfs.IgfsPathSummary;
import org.apache.ignite.igfs.mapreduce.IgfsRecordResolver;
import org.apache.ignite.igfs.mapreduce.IgfsTask;
import org.apache.ignite.lang.IgniteAsyncSupport;
-import org.apache.ignite.lang.IgniteAsyncSupported;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
import org.jetbrains.annotations.Nullable;
@@ -266,28 +265,23 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
public long size(IgfsPath path) throws IgniteException;
/**
- * Formats the file system removing all existing entries from it.
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ * Formats the file system removing all existing entries from it, but not removing anything in secondary
+ * file system (if any).
*
- * @throws IgniteException In case format has failed.
+ * @throws IgniteException In case clear failed.
*/
- @IgniteAsyncSupported
- public void format() throws IgniteException;
+ public void clear() throws IgniteException;
/**
- * Asynchronously formats the file system removing all existing entries from it.
- * <p>
+ * Formats the file system removing all existing entries from it, but not removing anything in secondary
+ * file system (if any).
*
- * @return a Future representing pending completion of the format operation.
- * @throws IgniteException In case format has failed.
+ * @return Future representing pending completion of the clear operation.
*/
- public IgniteFuture<Void> formatAsync() throws IgniteException;
+ public IgniteFuture<Void> clearAsync() throws IgniteException;
/**
* Executes IGFS task.
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
*
* @param task Task to execute.
* @param rslvr Optional resolver to control split boundaries.
@@ -296,7 +290,6 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
* @return Task result.
* @throws IgniteException If execution failed.
*/
- @IgniteAsyncSupported
public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
@@ -331,7 +324,6 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
* @return Task result.
* @throws IgniteException If execution failed.
*/
- @IgniteAsyncSupported
public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
throws IgniteException;
@@ -367,7 +359,6 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
* @return Task result.
* @throws IgniteException If execution failed.
*/
- @IgniteAsyncSupported
public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
@@ -401,7 +392,6 @@ public interface IgniteFileSystem extends IgniteAsyncSupport {
* @return Task result.
* @throws IgniteException If execution failed.
*/
- @IgniteAsyncSupported
public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
@Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
long maxRangeLen, @Nullable T arg) throws IgniteException;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
index b5289a3..528c18f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
@@ -58,9 +58,9 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
- @Override public void format() {
+ @Override public void clear() {
try {
- saveOrGet(igfs.formatAsync0());
+ saveOrGet(igfs.clearAsync0());
}
catch (IgniteCheckedException e) {
throw U.convertException(e);
@@ -68,8 +68,8 @@ public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> impleme
}
/** {@inheritDoc} */
- @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
- return igfs.formatAsync();
+ @Override public IgniteFuture<Void> clearAsync() throws IgniteException {
+ return igfs.clearAsync();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 18506cd..6ffa202 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -1404,7 +1404,7 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
- @Override public void format() {
+ @Override public void clear() {
try {
IgniteUuid id = meta.format();
@@ -1432,8 +1432,8 @@ public final class IgfsImpl implements IgfsEx {
}
/** {@inheritDoc} */
- @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
- return (IgniteFuture<Void>)createFuture(formatAsync0());
+ @Override public IgniteFuture<Void> clearAsync() throws IgniteException {
+ return (IgniteFuture<Void>)createFuture(clearAsync0());
}
/**
@@ -1441,7 +1441,7 @@ public final class IgfsImpl implements IgfsEx {
*
* @return Future.
*/
- IgniteInternalFuture<?> formatAsync0() {
+ IgniteInternalFuture<?> clearAsync0() {
GridFutureAdapter<?> fut = new GridFutureAdapter<>();
Thread t = new Thread(new FormatRunnable(fut), "igfs-format-" + cfg.getName() + "-" +
@@ -1871,7 +1871,7 @@ public final class IgfsImpl implements IgfsEx {
IgfsException err = null;
try {
- format();
+ clear();
}
catch (Throwable err0) {
err = IgfsUtils.toIgfsException(err0);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
index e2b1c6e..3a9f683 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsFormatTask.java
@@ -54,7 +54,7 @@ public class VisorIgfsFormatTask extends VisorOneNodeTask<String, Void> {
/** {@inheritDoc} */
@Override protected Void run(String igfsName) {
try {
- ignite.fileSystem(igfsName).format();
+ ignite.fileSystem(igfsName).clear();
}
catch (IllegalArgumentException iae) {
throw new IgniteException("Failed to format IGFS: " + igfsName, iae);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
index 3bbb3f9..5593493 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsEventsAbstractSelfTest.java
@@ -176,7 +176,7 @@ public abstract class IgfsEventsAbstractSelfTest extends GridCommonAbstractTest
// Clean up file system.
if (igfs != null)
- igfs.format();
+ igfs.clear();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerAbstractSelfTest.java
index 91d5d5c..a409ece 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerAbstractSelfTest.java
@@ -156,6 +156,6 @@ public class IgfsFragmentizerAbstractSelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- grid(0).fileSystem("igfs").format();
+ grid(0).fileSystem("igfs").clear();
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerSelfTest.java
index 5149493..b95fc9c 100644
--- a/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/igfs/IgfsFragmentizerSelfTest.java
@@ -237,7 +237,7 @@ public class IgfsFragmentizerSelfTest extends IgfsFragmentizerAbstractSelfTest {
U.sleep(200);
}
- igfs.format();
+ igfs.clear();
GridTestUtils.retryAssert(log, 50, 100, new CA() {
@Override public void apply() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/DefaultIgfsSecondaryFileSystemTestAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/DefaultIgfsSecondaryFileSystemTestAdapter.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/DefaultIgfsSecondaryFileSystemTestAdapter.java
index 7fe587d..93e0827 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/DefaultIgfsSecondaryFileSystemTestAdapter.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/DefaultIgfsSecondaryFileSystemTestAdapter.java
@@ -59,7 +59,7 @@ public class DefaultIgfsSecondaryFileSystemTestAdapter implements IgfsSecondaryF
/** {@inheritDoc} */
@Override public void format() throws IOException {
- igfsEx.format();
+ igfsEx.clear();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
index 38d6c7b..6a2af15 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
@@ -990,7 +990,7 @@ public abstract class IgfsAbstractBaseSelfTest extends IgfsCommonAbstractTest {
}
// Clear igfs.
- igfs.format();
+ igfs.clear();
int prevDifferentSize = Integer.MAX_VALUE; // Previous different size.
int constCnt = 0, totalCnt = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
index 0e776b1..5d3b062 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
@@ -693,7 +693,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest {
assert dataCache.size(new CachePeekMode[] {CachePeekMode.ALL}) > 0;
- igfs.format();
+ igfs.clear();
// Ensure format is not propagated to the secondary file system.
if (dual) {
@@ -756,7 +756,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsAbstractBaseSelfTest {
private void checkRootPropertyUpdate(String prop, String setVal, String expGetVal) throws Exception {
igfs.update(IgfsPath.ROOT, Collections.singletonMap(prop, setVal));
- igfs.format();
+ igfs.clear();
IgfsFile file = igfs.info(IgfsPath.ROOT);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java
index 32e7e17..ddddeca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java
@@ -211,7 +211,7 @@ public class IgfsCachePerBlockLruEvictionPolicySelfTest extends IgfsCommonAbstra
@Override protected void afterTest() throws Exception {
try {
// Cleanup.
- igfsPrimary.format();
+ igfsPrimary.clear();
while (!dataCache.isEmpty())
U.sleep(100);
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index cf1f37d..f77c1d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -117,7 +117,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- mgr.igfsCtx.igfs().format();
+ mgr.igfsCtx.igfs().clear();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java
index 1ff0c00..76398f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetricsSelfTest.java
@@ -346,7 +346,7 @@ public class IgfsMetricsSelfTest extends IgfsCommonAbstractTest {
assertEquals(0, m.filesOpenedForRead());
assertEquals(0, m.filesOpenedForWrite());
- fs.format();
+ fs.clear();
m = fs.metrics();
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
index 1217005..833ab4c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMock.java
@@ -261,12 +261,12 @@ public class IgfsMock implements IgfsEx {
}
/** {@inheritDoc} */
- @Override public void format() throws IgniteException {
+ @Override public void clear() throws IgniteException {
throwUnsupported();
}
/** {@inheritDoc} */
- @Override public IgniteFuture<Void> formatAsync() throws IgniteException {
+ @Override public IgniteFuture<Void> clearAsync() throws IgniteException {
throwUnsupported();
return null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
index 2fb2b84..375478f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
@@ -101,7 +101,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
@Override protected void afterTest() throws Exception {
super.afterTest();
- igfs.format();
+ igfs.clear();
}
/** {@inheritDoc} */
@@ -595,7 +595,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
assertEquals(text, read("/b"));
// Cleanup.
- igfs.format();
+ igfs.clear();
assertTrue(F.isEmpty(igfs.listPaths(root)));
}
@@ -772,7 +772,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
create(filePath, false, "Some text.");
- igfs.format();
+ igfs.clear();
assert !igfs.exists(path(dirPath));
assert !igfs.exists(path(filePath));
@@ -798,7 +798,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
* @throws Exception If failed.
*/
public void testFormatEmpty() throws Exception {
- igfs.format();
+ igfs.clear();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
index cc1b53b..0e749f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
@@ -108,7 +108,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest {
fs = grid(0).fileSystem("igfs");
// Cleanup FS.
- fs.format();
+ fs.clear();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
index 36c99dc..fcc8fd7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
@@ -100,7 +100,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- igfs.format();
+ igfs.clear();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
index b8e1e3b..bd3d7a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
@@ -103,7 +103,7 @@ public class IgfsAbstractRecordResolverSelfTest extends GridCommonAbstractTest {
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- igfs.format();
+ igfs.clear();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
index feb5a1f..f25d78a 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopTaskExecutionSelfTest.java
@@ -96,7 +96,7 @@ public class HadoopTaskExecutionSelfTest extends HadoopAbstractSelfTest {
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- grid(0).fileSystem(igfsName).format();
+ grid(0).fileSystem(igfsName).clear();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
index abc3701..7767ec1 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolMultipleServersSelfTest.java
@@ -97,7 +97,7 @@ public class HadoopClientProtocolMultipleServersSelfTest extends HadoopAbstractS
private void beforeJob() throws Exception {
IgniteFileSystem igfs = grid(0).fileSystem(HadoopAbstractSelfTest.igfsName);
- igfs.format();
+ igfs.clear();
igfs.mkdirs(new IgfsPath(PATH_INPUT));
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
index b3ff3e4..7241506 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/client/HadoopClientProtocolSelfTest.java
@@ -129,7 +129,7 @@ public class HadoopClientProtocolSelfTest extends HadoopAbstractSelfTest {
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
- grid(0).fileSystem(HadoopAbstractSelfTest.igfsName).format();
+ grid(0).fileSystem(HadoopAbstractSelfTest.igfsName).clear();
setupLockFile.delete();
mapLockFile.delete();
http://git-wip-us.apache.org/repos/asf/ignite/blob/0ccb8569/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgfsEventsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgfsEventsTestSuite.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgfsEventsTestSuite.java
index 2395338..6934587 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgfsEventsTestSuite.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/igfs/IgfsEventsTestSuite.java
@@ -175,7 +175,7 @@ public class IgfsEventsTestSuite extends TestSuite {
super.afterTest();
// Clean up secondary file system.
- igfsSec.format();
+ igfsSec.clear();
}
/**
[06/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
deleted file mode 100644
index fc481f0..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ignite-type-metadata.xml
+++ /dev/null
@@ -1,666 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- XML generated by Apache Ignite Schema Import utility: 08/18/2016
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:util="http://www.springframework.org/schema/util"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- 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">
- <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
- <property name="types">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="PUBLIC"/>
- <property name="databaseTable" value="OBJECTS"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.ObjectsKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Objects"/>
- <property name="keyFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="java.lang.Boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="java.lang.Byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="java.lang.Short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="INTCOL"/>
- <property name="javaFieldType" value="java.lang.Integer"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="java.lang.Long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="java.lang.Float"/>
- <property name="javaFieldName" value="floatcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL"/>
- <property name="javaFieldType" value="java.lang.Double"/>
- <property name="javaFieldName" value="doublecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL2"/>
- <property name="javaFieldType" value="java.lang.Double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="PUBLIC"/>
- <property name="databaseTable" value="PRIMITIVES"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.PrimitivesKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Primitives"/>
- <property name="keyFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="INTCOL"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="float"/>
- <property name="javaFieldName" value="floatcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL2"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="databaseSchema" value="TESTSCHEMA"/>
- <property name="databaseTable" value="TST"/>
- <property name="keyType" value="org.apache.ignite.schema.test.model.TstKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Tst"/>
- <property name="keyFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- </list>
- </property>
- <property name="valueFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="PK"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="pk"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BOOLEAN"/>
- </property>
- <property name="databaseFieldName" value="BOOLCOL"/>
- <property name="javaFieldType" value="boolean"/>
- <property name="javaFieldName" value="boolcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TINYINT"/>
- </property>
- <property name="databaseFieldName" value="BYTECOL"/>
- <property name="javaFieldType" value="byte"/>
- <property name="javaFieldName" value="bytecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.SMALLINT"/>
- </property>
- <property name="databaseFieldName" value="SHORTCOL"/>
- <property name="javaFieldType" value="short"/>
- <property name="javaFieldName" value="shortcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="INTCOL"/>
- <property name="javaFieldType" value="int"/>
- <property name="javaFieldName" value="intcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.BIGINT"/>
- </property>
- <property name="databaseFieldName" value="LONGCOL"/>
- <property name="javaFieldType" value="long"/>
- <property name="javaFieldName" value="longcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.REAL"/>
- </property>
- <property name="databaseFieldName" value="FLOATCOL"/>
- <property name="javaFieldType" value="float"/>
- <property name="javaFieldName" value="floatcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="DOUBLECOL2"/>
- <property name="javaFieldType" value="double"/>
- <property name="javaFieldName" value="doublecol2"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DECIMAL"/>
- </property>
- <property name="databaseFieldName" value="BIGDECIMALCOL"/>
- <property name="javaFieldType" value="java.math.BigDecimal"/>
- <property name="javaFieldName" value="bigdecimalcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="STRCOL"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="strcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.DATE"/>
- </property>
- <property name="databaseFieldName" value="DATECOL"/>
- <property name="javaFieldType" value="java.sql.Date"/>
- <property name="javaFieldName" value="datecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIME"/>
- </property>
- <property name="databaseFieldName" value="TIMECOL"/>
- <property name="javaFieldType" value="java.sql.Time"/>
- <property name="javaFieldName" value="timecol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.TIMESTAMP"/>
- </property>
- <property name="databaseFieldName" value="TSCOL"/>
- <property name="javaFieldType" value="java.sql.Timestamp"/>
- <property name="javaFieldName" value="tscol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARBINARY"/>
- </property>
- <property name="databaseFieldName" value="ARRCOL"/>
- <property name="javaFieldType" value="java.lang.Object"/>
- <property name="javaFieldName" value="arrcol"/>
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType">
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="FIELD_WITH_ALIAS"/>
- <property name="javaFieldType" value="java.lang.String"/>
- <property name="javaFieldName" value="fieldWithAlias"/>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.ObjectsKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Objects"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_C"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_1"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_2"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="false"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.PrimitivesKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Primitives"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_D"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryEntity">
- <property name="keyType" value="org.apache.ignite.schema.test.model.TstKey"/>
- <property name="valueType" value="org.apache.ignite.schema.test.model.Tst"/>
- <property name="fields">
- <util:map map-class="java.util.LinkedHashMap">
- <entry key="pk" value="java.lang.Integer"/>
- <entry key="boolcol" value="java.lang.Boolean"/>
- <entry key="bytecol" value="java.lang.Byte"/>
- <entry key="shortcol" value="java.lang.Short"/>
- <entry key="intcol" value="java.lang.Integer"/>
- <entry key="longcol" value="java.lang.Long"/>
- <entry key="floatcol" value="java.lang.Float"/>
- <entry key="doublecol" value="java.lang.Double"/>
- <entry key="doublecol2" value="java.lang.Double"/>
- <entry key="bigdecimalcol" value="java.math.BigDecimal"/>
- <entry key="strcol" value="java.lang.String"/>
- <entry key="datecol" value="java.sql.Date"/>
- <entry key="timecol" value="java.sql.Time"/>
- <entry key="tscol" value="java.sql.Timestamp"/>
- <entry key="arrcol" value="java.lang.Object"/>
- <entry key="fieldWithAlias" value="java.lang.String"/>
- </util:map>
- </property>
- <property name="aliases">
- <map>
- <entry key="fieldWithAlias" value="FIELD_WITH_ALIAS"/>
- </map>
- </property>
- <property name="indexes">
- <list>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="PRIMARY_KEY_1"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="pk" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_3"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="true"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.QueryIndex">
- <property name="name" value="IDX_4"/>
- <property name="indexType">
- <util:constant static-field="org.apache.ignite.cache.QueryIndexType.SORTED"/>
- </property>
- <property name="fields">
- <map>
- <entry key="intcol" value="true"/>
- <entry key="longcol" value="false"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
deleted file mode 100644
index a550bfc..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/parser/DbMetadataParserTest.java
+++ /dev/null
@@ -1,134 +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.schema.test.parser;
-
-import java.math.BigDecimal;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.test.AbstractSchemaImportTest;
-
-/**
- * Tests for metadata parsing.
- */
-public class DbMetadataParserTest extends AbstractSchemaImportTest {
- /**
- * Check that field is correspond to expected.
- *
- * @param field Field descriptor.
- * @param name Expected field name.
- * @param primitive Expected field primitive type.
- * @param cls Expected field type.
- */
- private void checkField(PojoField field, String name, boolean primitive, Class<?> cls) {
- assertEquals("Name of field should be " + name, name, field.javaName());
-
- assertEquals("Type of field should be " + cls.getName(), cls.getName(), field.javaTypeName());
-
- assertEquals("Field primitive should be " + primitive, primitive, field.primitive());
- }
-
- /**
- * Check that type is correspond to expected.
- *
- * @param type Type descriptor.
- */
- private void checkType(PojoDescriptor type) {
- assertFalse("Type key class name should be defined", type.keyClassName().isEmpty());
-
- assertFalse("Type value class name should be defined", type.valueClassName().isEmpty());
-
- Collection<PojoField> keyFields = type.keyFields();
-
- assertEquals("Key type should have 1 field", 1, keyFields.size());
-
- checkField(keyFields.iterator().next(), "pk", true, int.class);
-
- List<PojoField> fields = type.fields();
-
- assertEquals("Value type should have 15 fields", 16, fields.size());
-
- Iterator<PojoField> fieldsIt = fields.iterator();
-
- checkField(fieldsIt.next(), "pk", true, int.class);
-
- if ("Objects".equals(type.valueClassName())) {
- checkField(fieldsIt.next(), "boolcol", false, Boolean.class);
- checkField(fieldsIt.next(), "bytecol", false, Byte.class);
- checkField(fieldsIt.next(), "shortcol", false, Short.class);
- checkField(fieldsIt.next(), "intcol", false, Integer.class);
- checkField(fieldsIt.next(), "longcol", false, Long.class);
- checkField(fieldsIt.next(), "floatcol", false, Float.class);
- checkField(fieldsIt.next(), "doublecol", false, Double.class);
- checkField(fieldsIt.next(), "doublecol2", false, Double.class);
- }
- else {
- checkField(fieldsIt.next(), "boolcol", true, boolean.class);
- checkField(fieldsIt.next(), "bytecol", true, byte.class);
- checkField(fieldsIt.next(), "shortcol", true, short.class);
- checkField(fieldsIt.next(), "intcol", true, int.class);
- checkField(fieldsIt.next(), "longcol", true, long.class);
- checkField(fieldsIt.next(), "floatcol", true, float.class);
- checkField(fieldsIt.next(), "doublecol", true, double.class);
- checkField(fieldsIt.next(), "doublecol2", true, double.class);
- }
-
- checkField(fieldsIt.next(), "bigdecimalcol", false, BigDecimal.class);
- checkField(fieldsIt.next(), "strcol", false, String.class);
- checkField(fieldsIt.next(), "datecol", false, Date.class);
- checkField(fieldsIt.next(), "timecol", false, Time.class);
- checkField(fieldsIt.next(), "tscol", false, Timestamp.class);
- checkField(fieldsIt.next(), "arrcol", false, Object.class);
- }
-
- /**
- * Check that type has not null full db name.
- *
- * @param type Type to check.
- */
- private void checkSchemaHasFullDbName(PojoDescriptor type) {
- assertNotNull("The DB schema should have a non-null fullDbName", type.fullDbName());
- }
-
- /**
- * Test that metadata generated correctly.
- */
- public void testCheckMetadata() {
- assertEquals("Metadata should contain 5 elements", 5, all.size());
-
- Iterator<PojoDescriptor> it = all.iterator();
-
- PojoDescriptor schema = it.next();
-
- assertTrue("First element is schema description. Its class name should be empty",
- schema.valueClassName().isEmpty());
-
- checkType(it.next());
-
- checkType(it.next());
-
- checkSchemaHasFullDbName(it.next());
-
- checkType(it.next());
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
deleted file mode 100644
index ca769c8..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/testsuites/IgniteSchemaImportTestSuite.java
+++ /dev/null
@@ -1,42 +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.schema.test.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.schema.test.generator.CodeGeneratorTest;
-import org.apache.ignite.schema.test.generator.XmlGeneratorTest;
-import org.apache.ignite.schema.test.parser.DbMetadataParserTest;
-
-/**
- * Ignite Schema Import Utility Tests.
- */
-public class IgniteSchemaImportTestSuite {
- /**
- * @return Test suite.
- * @throws Exception Thrown in case of the failure.
- */
- public static TestSuite suite() throws Exception {
- TestSuite suite = new TestSuite("Ignite Apache Schema Import Utility Test Suite");
-
- suite.addTestSuite(CodeGeneratorTest.class);
- suite.addTestSuite(XmlGeneratorTest.class);
- suite.addTestSuite(DbMetadataParserTest.class);
-
- return suite;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/pom.xml
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/pom.xml b/modules/web-console/web-agent/pom.xml
index a2ead7d..530aef6 100644
--- a/modules/web-console/web-agent/pom.xml
+++ b/modules/web-console/web-agent/pom.xml
@@ -66,18 +66,6 @@
<dependency>
<groupId>org.apache.ignite</groupId>
- <artifactId>ignite-schema-import-db</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.gridgain</groupId>
- <artifactId>ignite-shmem</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
new file mode 100644
index 0000000..723ee25
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbColumn.java
@@ -0,0 +1,88 @@
+/*
+ * 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.console.agent.db;
+
+/**
+ * Database table column.
+ */
+public class DbColumn {
+ /** Column name. */
+ private final String name;
+
+ /** Column JDBC type. */
+ private final int type;
+
+ /** Is this column belongs to primary key. */
+ private final boolean key;
+
+ /** Is {@code NULL} allowed for column in database. */
+ private final boolean nullable;
+
+ /** Whether column unsigned. */
+ private final boolean unsigned;
+
+ /**
+ * @param name Column name.
+ * @param type Column JDBC type.
+ * @param key {@code true} if this column belongs to primary key.
+ * @param nullable {@code true} if {@code NULL } allowed for column in database.
+ * @param unsigned {@code true} if column is unsigned.
+ */
+ public DbColumn(String name, int type, boolean key, boolean nullable, boolean unsigned) {
+ this.name = name;
+ this.type = type;
+ this.key = key;
+ this.nullable = nullable;
+ this.unsigned = unsigned;
+ }
+
+ /**
+ * @return Column name.
+ */
+ public String name() {
+ return name;
+ }
+
+ /**
+ * @return Column JDBC type.
+ */
+ public int type() {
+ return type;
+ }
+
+ /**
+ * @return {@code true} if this column belongs to primary key.
+ */
+ public boolean key() {
+ return key;
+ }
+
+ /**
+ * @return {@code true} if {@code NULL } allowed for column in database.
+ */
+ public boolean nullable() {
+ return nullable;
+ }
+
+ /**
+ * @return {@code true} if column is unsigned.
+ */
+ public boolean unsigned() {
+ return unsigned;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
new file mode 100644
index 0000000..9aa0321
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbMetadataReader.java
@@ -0,0 +1,142 @@
+/*
+ * 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.console.agent.db;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.ignite.console.agent.db.dialect.DB2MetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.DatabaseMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.JdbcMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.MySQLMetadataDialect;
+import org.apache.ignite.console.agent.db.dialect.OracleMetadataDialect;
+import org.apache.log4j.Logger;
+
+/**
+ * Singleton to extract database metadata.
+ */
+public class DbMetadataReader {
+ /** Logger. */
+ private static final Logger log = Logger.getLogger(DbMetadataReader.class.getName());
+
+ /** */
+ private final Map<String, Driver> drivers = new HashMap<>();
+
+ /**
+ * Get specified dialect object for selected database.
+ *
+ * @param conn Connection to database.
+ * @return Specific dialect object.
+ */
+ private DatabaseMetadataDialect dialect(Connection conn) {
+ try {
+ String dbProductName = conn.getMetaData().getDatabaseProductName();
+
+ if ("Oracle".equals(dbProductName))
+ return new OracleMetadataDialect();
+
+ if (dbProductName.startsWith("DB2/"))
+ return new DB2MetadataDialect();
+
+ if ("MySQL".equals(dbProductName))
+ return new MySQLMetadataDialect();
+
+ return new JdbcMetadataDialect();
+ }
+ catch (SQLException e) {
+ log.error("Failed to resolve dialect (JdbcMetaDataDialect will be used.", e);
+
+ return new JdbcMetadataDialect();
+ }
+ }
+
+ /**
+ * Get list of schemas from database.
+ *
+ * @param conn Connection to database.
+ * @return List of schema names.
+ * @throws SQLException If schemas loading failed.
+ */
+ public Collection<String> schemas(Connection conn) throws SQLException {
+ return dialect(conn).schemas(conn);
+ }
+
+ /**
+ * Extract DB metadata.
+ *
+ * @param conn Connection.
+ * @param schemas List of database schemas to process. In case of empty list all schemas will be processed.
+ * @param tblsOnly Tables only flag.
+ */
+ public Collection<DbTable> metadata(Connection conn, List<String> schemas, boolean tblsOnly) throws SQLException {
+ return dialect(conn).tables(conn, schemas, tblsOnly);
+ }
+
+ /**
+ * Connect to database.
+ *
+ * @param jdbcDrvJarPath Path to JDBC driver.
+ * @param jdbcDrvCls JDBC class name.
+ * @param jdbcUrl JDBC connection URL.
+ * @param jdbcInfo Connection properties.
+ * @return Connection to database.
+ * @throws SQLException if connection failed.
+ */
+ public Connection connect(String jdbcDrvJarPath, String jdbcDrvCls, String jdbcUrl, Properties jdbcInfo)
+ throws SQLException {
+ Driver drv = drivers.get(jdbcDrvCls);
+
+ if (drv == null) {
+ if (jdbcDrvJarPath.isEmpty())
+ throw new IllegalStateException("Driver jar file name is not specified.");
+
+ File drvJar = new File(jdbcDrvJarPath);
+
+ if (!drvJar.exists())
+ throw new IllegalStateException("Driver jar file is not found.");
+
+ try {
+ URL u = new URL("jar:" + drvJar.toURI() + "!/");
+
+ URLClassLoader ucl = URLClassLoader.newInstance(new URL[] {u});
+
+ drv = (Driver)Class.forName(jdbcDrvCls, true, ucl).newInstance();
+
+ drivers.put(jdbcDrvCls, drv);
+ }
+ catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ Connection conn = drv.connect(jdbcUrl, jdbcInfo);
+
+ if (conn == null)
+ throw new IllegalStateException("Connection was not established (JDBC driver returned null value).");
+
+ return conn;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
new file mode 100644
index 0000000..b74cfe5
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/DbTable.java
@@ -0,0 +1,82 @@
+/*
+ * 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.console.agent.db;
+
+import org.apache.ignite.cache.QueryIndex;
+
+import java.util.Collection;
+
+/**
+ * Database table.
+ */
+public class DbTable {
+ /** Schema name. */
+ private final String schema;
+
+ /** Table name. */
+ private final String tbl;
+
+ /** Columns. */
+ private final Collection<DbColumn> cols;
+
+ /** Indexes. */
+ private final Collection<QueryIndex> idxs;
+
+ /**
+ * Default columns.
+ *
+ * @param schema Schema name.
+ * @param tbl Table name.
+ * @param cols Columns.
+ * @param idxs Indexes;
+ */
+ public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex> idxs) {
+ this.schema = schema;
+ this.tbl = tbl;
+ this.cols = cols;
+ this.idxs = idxs;
+ }
+
+ /**
+ * @return Schema name.
+ */
+ public String schema() {
+ return schema;
+ }
+
+ /**
+ * @return Table name.
+ */
+ public String table() {
+ return tbl;
+ }
+
+ /**
+ * @return Columns.
+ */
+ public Collection<DbColumn> columns() {
+ return cols;
+ }
+
+ /**
+ * @return Indexes.
+ */
+ public Collection<QueryIndex> indexes() {
+ return idxs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
new file mode 100644
index 0000000..2f41a8c
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DB2MetadataDialect.java
@@ -0,0 +1,33 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * DB2 specific metadata dialect.
+ */
+public class DB2MetadataDialect extends JdbcMetadataDialect {
+ /** {@inheritDoc} */
+ @Override public Set<String> systemSchemas() {
+ return new HashSet<>(Arrays.asList("SYSIBM", "SYSCAT", "SYSSTAT", "SYSTOOLS", "SYSFUN", "SYSIBMADM",
+ "SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
new file mode 100644
index 0000000..674bda5
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/DatabaseMetadataDialect.java
@@ -0,0 +1,102 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.console.agent.db.DbColumn;
+import org.apache.ignite.console.agent.db.DbTable;
+
+/**
+ * Base class for database metadata dialect.
+ */
+public abstract class DatabaseMetadataDialect {
+ /**
+ * Gets schemas from database.
+ *
+ * @param conn Database connection.
+ * @return Collection of schema descriptors.
+ * @throws SQLException If failed to get schemas.
+ */
+ public abstract Collection<String> schemas(Connection conn) throws SQLException;
+
+ /**
+ * Gets tables from database.
+ *
+ * @param conn Database connection.
+ * @param schemas Collection of schema names to load.
+ * @param tblsOnly If {@code true} then gets only tables otherwise gets tables and views.
+ * @return Collection of table descriptors.
+ * @throws SQLException If failed to get tables.
+ */
+ public abstract Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
+ throws SQLException;
+
+ /**
+ * @return Collection of database system schemas.
+ */
+ public Set<String> systemSchemas() {
+ return Collections.singleton("INFORMATION_SCHEMA");
+ }
+
+ /**
+ * @return Collection of unsigned type names.
+ * @throws SQLException If failed to get unsigned type names.
+ */
+ public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
+ return Collections.emptySet();
+ }
+
+ /**
+ * Create table descriptor.
+ *
+ * @param schema Schema name.
+ * @param tbl Table name.
+ * @param cols Table columns.
+ * @param idxs Table indexes.
+ * @return New {@code DbTable} instance.
+ */
+ protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex>idxs) {
+ return new DbTable(schema, tbl, cols, idxs);
+ }
+
+ /**
+ * Create index descriptor.
+ *
+ * @param idxName Index name.
+ * @return New initialized {@code QueryIndex} instance.
+ */
+ protected QueryIndex index(String idxName) {
+ QueryIndex idx = new QueryIndex();
+
+ idx.setName(idxName);
+ idx.setIndexType(QueryIndexType.SORTED);
+ idx.setFields(new LinkedHashMap<String, Boolean>());
+
+ return idx;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
new file mode 100644
index 0000000..dcfd9c0
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
@@ -0,0 +1,199 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.console.agent.db.DbColumn;
+import org.apache.ignite.console.agent.db.DbTable;
+
+/**
+ * Metadata dialect that uses standard JDBC for reading metadata.
+ */
+public class JdbcMetadataDialect extends DatabaseMetadataDialect {
+ /** */
+ private static final String[] TABLES_ONLY = {"TABLE"};
+
+ /** */
+ private static final String[] TABLES_AND_VIEWS = {"TABLE", "VIEW"};
+
+ /** Schema catalog index. */
+ private static final int TBL_CATALOG_IDX = 1;
+
+ /** Schema name index. */
+ private static final int TBL_SCHEMA_IDX = 2;
+
+ /** Table name index. */
+ private static final int TBL_NAME_IDX = 3;
+
+ /** Primary key column name index. */
+ private static final int PK_COL_NAME_IDX = 4;
+
+ /** Column name index. */
+ private static final int COL_NAME_IDX = 4;
+
+ /** Column data type index. */
+ private static final int COL_DATA_TYPE_IDX = 5;
+
+ /** Column type name index. */
+ private static final int COL_TYPE_NAME_IDX = 6;
+
+ /** Column nullable index. */
+ private static final int COL_NULLABLE_IDX = 11;
+
+ /** Index name index. */
+ private static final int IDX_NAME_IDX = 6;
+
+ /** Index column name index. */
+ private static final int IDX_COL_NAME_IDX = 9;
+
+ /** Index column descend index. */
+ private static final int IDX_ASC_OR_DESC_IDX = 10;
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> schemas(Connection conn) throws SQLException {
+ Collection<String> schemas = new ArrayList<>();
+
+ ResultSet rs = conn.getMetaData().getSchemas();
+
+ Set<String> sys = systemSchemas();
+
+ while(rs.next()) {
+ String schema = rs.getString(1);
+
+ // Skip system schemas.
+ if (sys.contains(schema))
+ continue;
+
+ schemas.add(schema);
+ }
+
+ return schemas;
+ }
+
+ /**
+ * @return If {@code true} use catalogs for table division.
+ */
+ protected boolean useCatalog() {
+ return false;
+ }
+
+ /**
+ * @return If {@code true} use schemas for table division.
+ */
+ protected boolean useSchema() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
+ throws SQLException {
+ DatabaseMetaData dbMeta = conn.getMetaData();
+
+ Set<String> sys = systemSchemas();
+
+ Collection<String> unsignedTypes = unsignedTypes(dbMeta);
+
+ if (schemas.isEmpty())
+ schemas.add(null);
+
+ Collection<DbTable> tbls = new ArrayList<>();
+
+ for (String toSchema: schemas) {
+ try (ResultSet tblsRs = dbMeta.getTables(useCatalog() ? toSchema : null, useSchema() ? toSchema : null, "%",
+ tblsOnly ? TABLES_ONLY : TABLES_AND_VIEWS)) {
+ while (tblsRs.next()) {
+ String tblCatalog = tblsRs.getString(TBL_CATALOG_IDX);
+ String tblSchema = tblsRs.getString(TBL_SCHEMA_IDX);
+ String tblName = tblsRs.getString(TBL_NAME_IDX);
+
+ // In case of MySql we should use catalog.
+ String schema = tblSchema != null ? tblSchema : tblCatalog;
+
+ // Skip system schemas.
+ if (sys.contains(schema))
+ continue;
+
+ Collection<String> pkCols = new HashSet<>();
+
+ try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
+ while (pkRs.next())
+ pkCols.add(pkRs.getString(PK_COL_NAME_IDX));
+ }
+
+ Collection<DbColumn> cols = new ArrayList<>();
+
+ try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) {
+ while (colsRs.next()) {
+ String colName = colsRs.getString(COL_NAME_IDX);
+
+ cols.add(new DbColumn(
+ colName,
+ colsRs.getInt(COL_DATA_TYPE_IDX),
+ pkCols.contains(colName),
+ colsRs.getInt(COL_NULLABLE_IDX) == DatabaseMetaData.columnNullable,
+ unsignedTypes.contains(colsRs.getString(COL_TYPE_NAME_IDX))));
+ }
+ }
+
+ Map<String, QueryIndex> idxs = new LinkedHashMap<>();
+
+ try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) {
+ while (idxRs.next()) {
+ String idxName = idxRs.getString(IDX_NAME_IDX);
+
+ String colName = idxRs.getString(IDX_COL_NAME_IDX);
+
+ if (idxName == null || colName == null)
+ continue;
+
+ QueryIndex idx = idxs.get(idxName);
+
+ if (idx == null) {
+ idx = index(idxName);
+
+ idxs.put(idxName, idx);
+ }
+
+ String askOrDesc = idxRs.getString(IDX_ASC_OR_DESC_IDX);
+
+ Boolean asc = askOrDesc == null || "A".equals(askOrDesc);
+
+ idx.getFields().put(colName, asc);
+ }
+ }
+
+ tbls.add(table(schema, tblName, cols, idxs.values()));
+ }
+ }
+ }
+
+ return tbls;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
new file mode 100644
index 0000000..4adeeb3
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
@@ -0,0 +1,82 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * MySQL specific metadata dialect.
+ */
+public class MySQLMetadataDialect extends JdbcMetadataDialect {
+ /** Type name index. */
+ private static final int TYPE_NAME_IDX = 1;
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> schemas(Connection conn) throws SQLException {
+ Collection<String> schemas = new ArrayList<>();
+
+ ResultSet rs = conn.getMetaData().getCatalogs();
+
+ Set<String> sys = systemSchemas();
+
+ while(rs.next()) {
+ String schema = rs.getString(1);
+
+ // Skip system schemas.
+ if (sys.contains(schema))
+ continue;
+
+ schemas.add(schema);
+ }
+
+ return schemas;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean useCatalog() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean useSchema() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
+ Set<String> unsignedTypes = new HashSet<>();
+
+ try (ResultSet typeRs = dbMeta.getTypeInfo()) {
+ while (typeRs.next()) {
+ String typeName = typeRs.getString(TYPE_NAME_IDX);
+
+ if (typeName.contains("UNSIGNED"))
+ unsignedTypes.add(typeName);
+ }
+ }
+
+ return unsignedTypes;
+ }
+}
[21/22] ignite git commit: IGNITE-4847: Upgrade log4j2 to version
2.8.1
Posted by pt...@apache.org.
IGNITE-4847: Upgrade log4j2 to version 2.8.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/edfa353e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/edfa353e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/edfa353e
Branch: refs/heads/ignite-3477-master
Commit: edfa353eba7c87c802df9e32678cb253549949b3
Parents: b99c198
Author: Michael Griggs <en...@gmail.com>
Authored: Mon Apr 10 12:39:49 2017 -0700
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Apr 10 12:39:49 2017 -0700
----------------------------------------------------------------------
modules/log4j2/pom.xml | 4 ++--
.../ignite/logger/log4j2/Log4J2Logger.java | 23 +++++++++++++++-----
2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/edfa353e/modules/log4j2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/log4j2/pom.xml b/modules/log4j2/pom.xml
index 5b0e989..5c6e7c4 100644
--- a/modules/log4j2/pom.xml
+++ b/modules/log4j2/pom.xml
@@ -52,13 +52,13 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
- <version>2.3</version>
+ <version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
- <version>2.3</version>
+ <version>2.8.1</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ignite/blob/edfa353e/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
----------------------------------------------------------------------
diff --git a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
index ffe8e1b..dff3179 100644
--- a/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
+++ b/modules/log4j2/src/main/java/org/apache/ignite/logger/log4j2/Log4J2Logger.java
@@ -353,18 +353,31 @@ public class Log4J2Logger implements IgniteLogger, LoggerNodeIdAware {
Configuration cfg = ctx.getConfiguration();
- PatternLayout layout = PatternLayout.createLayout("[%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n", null, null,
- Charset.defaultCharset(), false, false, null, null);
+ PatternLayout.Builder builder = PatternLayout.newBuilder();
+
+ builder
+ .withPattern("%d{ABSOLUTE}][%-5p][%t][%c{1}] %m%n")
+ .withCharset(Charset.defaultCharset())
+ .withAlwaysWriteExceptions(false)
+ .withNoConsoleNoAnsi(false);
+
+ PatternLayout layout = builder.build();
+
+ ConsoleAppender.Builder consoleAppenderBuilder = ConsoleAppender.newBuilder();
+
+ consoleAppenderBuilder
+ .withName(CONSOLE_APPENDER)
+ .withLayout(layout);
+
+ ConsoleAppender consoleApp = consoleAppenderBuilder.build();
- final Appender consoleApp = ConsoleAppender.createAppender(layout, null, null, CONSOLE_APPENDER, null, null);
consoleApp.start();
AppenderRef ref = AppenderRef.createAppenderRef(CONSOLE_APPENDER, Level.TRACE, null);
AppenderRef[] refs = {ref};
- LoggerConfig logCfg = LoggerConfig.createLogger("false", Level.INFO, LogManager.ROOT_LOGGER_NAME, "",
- refs, null, null, null);
+ LoggerConfig logCfg = LoggerConfig.createLogger(false, Level.INFO, LogManager.ROOT_LOGGER_NAME, "", refs, null, null, null);
logCfg.addAppender(consoleApp, null, null);
cfg.addAppender(consoleApp);
[08/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/MessageBox.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
deleted file mode 100644
index 83aaa61..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/MessageBox.java
+++ /dev/null
@@ -1,274 +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.schema.ui;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.geometry.Pos;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.ScrollBar;
-import javafx.scene.control.TextArea;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Priority;
-import javafx.stage.Modality;
-import javafx.stage.Stage;
-import javafx.stage.StageStyle;
-
-import static org.apache.ignite.schema.ui.Controls.borderPane;
-import static org.apache.ignite.schema.ui.Controls.button;
-import static org.apache.ignite.schema.ui.Controls.checkBox;
-import static org.apache.ignite.schema.ui.Controls.hBox;
-import static org.apache.ignite.schema.ui.Controls.imageView;
-import static org.apache.ignite.schema.ui.Controls.paneEx;
-import static org.apache.ignite.schema.ui.Controls.scene;
-
-/**
- * Message box functionality.
- */
-public class MessageBox extends ModalDialog {
- /** Logger. */
- private static final Logger log = Logger.getLogger(MessageBox.class.getName());
-
- /** Message box type. */
- private enum MessageType {
- /** Information. */
- INFO,
- /** Warning. */
- WARN,
- /** Error. */
- ERROR,
- /** Confirm. */
- CONFIRM,
- /** Confirm with cancel option. */
- CANCELLABLE_CONFIRM
- }
-
- /** Message box type. */
- public enum Result {
- /** Return value if YES is chosen. */
- YES,
- /** Return value if YES_TO_ALL is chosen. */
- YES_TO_ALL,
- /** Return value if NO is chosen. */
- NO,
- /** Return value if NO_TO_ALL is chosen. */
- NO_TO_ALL,
- /** Return value if CANCEL is chosen. */
- CANCEL
- }
-
- /** Dialog result. */
- private Result res = Result.CANCEL;
-
- /**
- * Create message box.
- *
- * @param owner Owner window.
- * @param type Message box type.
- * @param msg Message to show.
- * @param applyToAll {@code true} if "Apply to all" check box should be displayed.
- */
- private MessageBox(Stage owner, MessageType type, String msg, final boolean applyToAll) {
- super(owner, 480, 180);
-
- String title;
- String iconFile;
-
- switch (type) {
- case WARN:
- title = "Warning";
- iconFile = "sign_warning";
- break;
-
- case ERROR:
- title = "Error";
- iconFile = "error";
- break;
-
- case CONFIRM:
- case CANCELLABLE_CONFIRM:
- title = "Confirmation";
- iconFile = "question";
- break;
-
- default:
- title = "Information";
- iconFile = "information";
- break;
- }
-
- setTitle(title);
- initStyle(StageStyle.UTILITY);
- initModality(Modality.APPLICATION_MODAL);
- initOwner(owner);
- setResizable(false);
-
- GridPaneEx contentPnl = paneEx(10, 10, 0, 10);
-
- contentPnl.addColumn();
- contentPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
-
- contentPnl.add(hBox(0, true, imageView(iconFile, 48)));
-
- final TextArea ta = new TextArea(msg);
- ta.setEditable(false);
- ta.setWrapText(true);
- ta.setFocusTraversable(false);
-
- contentPnl.add(ta);
-
- // Workaround for vertical scrollbar.
- if (msg.length() < 100 && msg.split("\r\n|\r|\n").length < 4)
- showingProperty().addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- if (newVal) {
- ScrollBar scrollBar = (ScrollBar)ta.lookup(".scroll-bar:vertical");
-
- if (scrollBar != null)
- scrollBar.setDisable(true);
- }
- }
- });
-
- final CheckBox applyToAllCh = checkBox("Apply to all", "", false);
-
- if (applyToAll) {
- contentPnl.skip(1);
- contentPnl.add(applyToAllCh);
- }
-
- HBox btns = hBox(10, true);
- btns.setAlignment(Pos.CENTER);
-
- if (MessageType.CONFIRM == type || MessageType.CANCELLABLE_CONFIRM == type) {
- res = Result.NO;
-
- btns.getChildren().addAll(
- button("Yes", "Approve the request", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- res = applyToAll && applyToAllCh.isSelected() ? Result.YES_TO_ALL : Result.YES;
-
- close();
- }
- }),
- button("No", "Reject the request", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- res = applyToAll && applyToAllCh.isSelected() ? Result.NO_TO_ALL : Result.NO;
-
- close();
- }
- }));
-
- if (MessageType.CANCELLABLE_CONFIRM == type)
- btns.getChildren().addAll(
- button("Cancel", "Cancel the request", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- res = Result.CANCEL;
-
- close();
- }
- }));
- }
- else
- btns.getChildren().add(button("OK", "Close dialog", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent e) {
- close();
- }
- }));
-
- setScene(scene(borderPane(null, contentPnl, btns, null, null)));
- }
-
- /**
- * Show message in modal dialog.
- *
- * @param owner Owner window.
- * @param type Message box type.
- * @param msg Message to show.
- * @param applyToAll {@code true} if "Apply to all" check box should be displayed.
- * @return Option selected by the user.
- */
- private static Result showDialog(Stage owner, MessageType type, String msg, boolean applyToAll) {
- MessageBox dlg = new MessageBox(owner, type, msg, applyToAll);
-
- dlg.showModal();
-
- return dlg.res;
- }
-
- /**
- * Show confirmation dialog.
- *
- * @param owner Owner window.
- * @param msg Message to show.
- * @return {@code true} If user confirm.
- */
- public static boolean confirmDialog(Stage owner, String msg) {
- return showDialog(owner, MessageType.CONFIRM, msg, false) == Result.YES;
- }
-
- /**
- * Show confirmation dialog.
- *
- * @param owner Owner window.
- * @param msg Message to show.
- * @return User confirmation result.
- */
- public static Result applyToAllChoiceDialog(Stage owner, String msg) {
- return showDialog(owner, MessageType.CANCELLABLE_CONFIRM, msg, true);
- }
-
- /**
- * Show information dialog.
- *
- * @param owner Owner window.
- * @param msg Message to show.
- */
- public static void informationDialog(Stage owner, String msg) {
- showDialog(owner, MessageType.INFO, msg, false);
- }
-
- /**
- * Show warning dialog.
- *
- * @param owner Owner window.
- * @param msg Message to show.
- */
- public static void warningDialog(Stage owner, String msg) {
- showDialog(owner, MessageType.WARN, msg, false);
- }
-
- /**
- * Show error dialog.
- *
- * @param owner Owner window.
- * @param msg Error message to show.
- * @param e Optional exception to show.
- */
- public static void errorDialog(Stage owner, String msg, Throwable e) {
- log.log(Level.SEVERE, msg, e);
-
- String exMsg = e != null ? (e.getMessage() != null ? e.getMessage() : e.getClass().getName()) : null;
-
- showDialog(owner, MessageType.ERROR, exMsg != null ? msg + "\n" + exMsg : msg, false);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java
deleted file mode 100644
index a1e34a1..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ModalDialog.java
+++ /dev/null
@@ -1,50 +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.schema.ui;
-
-import javafx.stage.Stage;
-
-/**
- * Abstract base modal dialog.
- */
-public abstract class ModalDialog extends Stage {
- /** Owner window. */
- protected final Stage owner;
-
- /**
- * @param owner Owner window.
- * @param width Window width.
- * @param height Window height.
- */
- protected ModalDialog(Stage owner, int width, int height) {
- this.owner = owner;
-
- setWidth(width);
- setHeight(height);
- }
-
- /**
- * Show modal dialog.
- */
- protected void showModal() {
- setX(owner.getX() + owner.getWidth() / 2 - getWidth() / 2);
- setY(owner.getY() + owner.getHeight() / 2 - getHeight() / 2);
-
- showAndWait();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
deleted file mode 100644
index 6305341..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
+++ /dev/null
@@ -1,2115 +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.schema.ui;
-
-import java.awt.Desktop;
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Field;
-import java.nio.charset.Charset;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import javafx.concurrent.Task;
-import javafx.embed.swing.SwingFXUtils;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.geometry.Insets;
-import javafx.geometry.Pos;
-import javafx.geometry.VPos;
-import javafx.scene.Node;
-import javafx.scene.control.Button;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.ComboBox;
-import javafx.scene.control.Label;
-import javafx.scene.control.ListView;
-import javafx.scene.control.PasswordField;
-import javafx.scene.control.ProgressIndicator;
-import javafx.scene.control.TableCell;
-import javafx.scene.control.TableColumn;
-import javafx.scene.control.TableRow;
-import javafx.scene.control.TableView;
-import javafx.scene.control.TextField;
-import javafx.scene.control.TitledPane;
-import javafx.scene.layout.BorderPane;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Pane;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.StackPane;
-import javafx.stage.DirectoryChooser;
-import javafx.stage.FileChooser;
-import javafx.stage.Screen;
-import javafx.stage.Stage;
-import javafx.util.Callback;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.schema.generator.CodeGenerator;
-import org.apache.ignite.schema.generator.XmlGenerator;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.model.SchemaDescriptor;
-import org.apache.ignite.schema.parser.DatabaseMetadataParser;
-import org.apache.ignite.schema.parser.DbMetadataReader;
-
-/**
- * Schema Import utility application.
- */
-@SuppressWarnings("UnnecessaryFullyQualifiedName")
-public class SchemaImportApp extends Application {
- /** Logger. */
- private static final Logger log = Logger.getLogger(SchemaImportApp.class.getName());
-
- /** */
- private static final String PREF_WINDOW_X = "window.x";
-
- /** */
- private static final String PREF_WINDOW_Y = "window.y";
-
- /** */
- private static final String PREF_WINDOW_WIDTH = "window.width";
-
- /** */
- private static final String PREF_WINDOW_HEIGHT = "window.height";
-
- /** */
- private static final String PREF_JDBC_DB_PRESET = "jdbc.db.preset";
-
- /** */
- private static final String PREF_JDBC_DRIVER_JAR = "jdbc.driver.jar";
-
- /** */
- private static final String PREF_JDBC_DRIVER_CLASS = "jdbc.driver.class";
-
- /** */
- private static final String PREF_JDBC_URL = "jdbc.url";
-
- /** */
- private static final String PREF_JDBC_USER = "jdbc.user";
-
- /** */
- private static final String PREF_OUT_FOLDER = "out.folder";
-
- /** */
- private static final String PREF_POJO_PACKAGE = "pojo.package";
-
- /** */
- private static final String PREF_POJO_INCLUDE = "pojo.include";
-
- /** */
- private static final String PREF_POJO_CONSTRUCTOR = "pojo.constructor";
-
- /** */
- private static final String PREF_GENERATE_ALIASES = "sql.aliases";
-
- /** */
- private static final String PREF_XML_SINGLE = "xml.single";
-
- /** */
- private static final String PREF_NAMING_PATTERN = "naming.pattern";
-
- /** */
- private static final String PREF_NAMING_REPLACE = "naming.replace";
-
- /** Empty POJO fields model. */
- private static final ObservableList<PojoField> NO_FIELDS = FXCollections.emptyObservableList();
-
- /** Ability to use xdg-open utility flag. */
- private static final boolean HAS_XDG_OPEN = U.isUnix() && new File("/usr/bin/xdg-open").canExecute();
-
- /** Default presets for popular databases. */
- private final Preset[] presets = {
- new Preset("h2", "H2 Database", "h2.jar", "org.h2.Driver", "jdbc:h2:[database]", "sa"),
- new Preset("db2", "DB2", "db2jcc4.jar", "com.ibm.db2.jcc.DB2Driver", "jdbc:db2://[host]:[port]/[database]",
- "db2admin"),
- new Preset("oracle", "Oracle", "ojdbc6.jar", "oracle.jdbc.OracleDriver",
- "jdbc:oracle:thin:@[host]:[port]:[database]", "system"),
- new Preset("mysql", "MySQL", "mysql-connector-java-5-bin.jar", "com.mysql.jdbc.Driver",
- "jdbc:mysql://[host]:[port]/[database]", "root"),
- new Preset("mssql", "Microsoft SQL Server", "sqljdbc41.jar", "com.microsoft.sqlserver.jdbc.SQLServerDriver",
- "jdbc:sqlserver://[host]:[port][;databaseName=database]", "sa"),
- new Preset("postgresql", "PostgreSQL", "postgresql-9.3.jdbc4.jar", "org.postgresql.Driver",
- "jdbc:postgresql://[host]:[port]/[database]", "sa"),
- new Preset("custom", "Custom server...", "custom-jdbc.jar", "org.custom.Driver", "jdbc:custom", "sa")
- };
-
- /** */
- private Stage owner;
-
- /** */
- private BorderPane rootPane;
-
- /** Header pane. */
- private BorderPane hdrPane;
-
- /** */
- private HBox dbIcon;
-
- /** */
- private HBox genIcon;
-
- /** */
- private Label titleLb;
-
- /** */
- private Label subTitleLb;
-
- /** */
- private Button prevBtn;
-
- /** */
- private Button nextBtn;
-
- /** */
- private ComboBox<Preset> rdbmsCb;
-
- /** */
- private TextField jdbcDrvJarTf;
-
- /** */
- private TextField jdbcDrvClsTf;
-
- /** */
- private TextField jdbcUrlTf;
-
- /** */
- private TextField userTf;
-
- /** */
- private PasswordField pwdTf;
-
- /** */
- private ComboBox<String> parseCb;
-
- /** */
- private ListView<SchemaDescriptor> schemaLst;
-
- /** */
- private GridPaneEx connPnl;
-
- /** */
- private StackPane connLayerPnl;
-
- /** */
- private TableView<PojoDescriptor> pojosTbl;
-
- /** */
- private TableView<PojoField> fieldsTbl;
-
- /** */
- private Node curTbl;
-
- /** */
- private TextField outFolderTf;
-
- /** */
- private TextField pkgTf;
-
- /** */
- private CheckBox pojoConstructorCh;
-
- /** */
- private CheckBox generateAliasesCh;
-
- /** */
- private CheckBox pojoIncludeKeysCh;
-
- /** */
- private CheckBox xmlSingleFileCh;
-
- /** */
- private TextField regexTf;
-
- /** */
- private TextField replaceTf;
-
- /** */
- private GridPaneEx genPnl;
-
- /** */
- private StackPane genLayerPnl;
-
- /** */
- private ProgressIndicator pi;
-
- /** */
- private ObservableList<SchemaDescriptor> schemas = FXCollections.emptyObservableList();
-
- /** List with POJOs descriptors. */
- private ObservableList<PojoDescriptor> pojos = FXCollections.emptyObservableList();
-
- /** Currently selected POJO. */
- private PojoDescriptor curPojo;
-
- /** Application preferences. */
- private final Properties prefs = new Properties();
-
- /** File path for storing on local file system. */
- private final File prefsFile = new File(System.getProperty("user.home"), ".ignite-schema-import");
-
- /** */
- private final ExecutorService exec = Executors.newSingleThreadExecutor(new ThreadFactory() {
- /** {@inheritDoc} */
- @Override public Thread newThread(Runnable r) {
- Thread t = new Thread(r, "ignite-schema-import-worker");
-
- t.setDaemon(true);
-
- return t;
- }
- });
-
- /**
- * Schema Import utility launcher.
- *
- * @param args Command line arguments passed to the application.
- */
- public static void main(String[] args) {
- // Workaround for JavaFX ugly text AA.
- System.setProperty("prism.lcdtext", "false");
- System.setProperty("prism.text", "t2k");
-
- // Workaround for AWT + JavaFX: we should initialize AWT before JavaFX.
- java.awt.Toolkit.getDefaultToolkit();
-
- // Workaround for JavaFX + Mac OS dock icon.
- if (System.getProperty("os.name").toLowerCase().contains("mac os")) {
- System.setProperty("javafx.macosx.embedded", "true");
-
- try {
- Class<?> appCls = Class.forName("com.apple.eawt.Application");
-
- Object osxApp = appCls.getDeclaredMethod("getApplication").invoke(null);
-
- appCls.getDeclaredMethod("setDockIconImage", java.awt.Image.class)
- .invoke(osxApp, SwingFXUtils.fromFXImage(Controls.image("ignite", 128), null));
- }
- catch (Exception ignore) {
- // No-op.
- }
-
- // Workaround for JDK 7/JavaFX 2 application on Mac OSX El Capitan.
- try {
- Class<?> fontFinderCls = Class.forName("com.sun.t2k.MacFontFinder");
-
- Field psNameToPathMap = fontFinderCls.getDeclaredField("psNameToPathMap");
-
- psNameToPathMap.setAccessible(true);
- psNameToPathMap.set(null, new HashMap<String, String>());
- }
- catch (Exception ignore) {
- // No-op.
- }
- }
-
- launch(args);
- }
-
- /**
- * Lock UI before start long task.
- *
- * @param layer Stack pane to add progress indicator.
- * @param controls Controls to disable.
- */
- private void lockUI(StackPane layer, Node... controls) {
- for (Node control : controls)
- control.setDisable(true);
-
- layer.getChildren().add(pi);
- }
-
- /**
- * Unlock UI after long task finished.
- *
- * @param layer Stack pane to remove progress indicator.
- * @param controls Controls to enable.
- */
- private void unlockUI(StackPane layer, Node... controls) {
- for (Node control : controls)
- control.setDisable(false);
-
- layer.getChildren().remove(pi);
- }
-
- /**
- * Perceptual delay to avoid UI flickering.
- *
- * @param started Time when background progress started.
- */
- private void perceptualDelay(long started) {
- long delta = System.currentTimeMillis() - started;
-
- if (delta < 500)
- try {
- Thread.sleep(500 - delta);
- }
- catch (InterruptedException ignored) {
- Thread.currentThread().interrupt();
- }
- }
-
- /**
- * Open connection to database.
- *
- * @return Connection to database.
- * @throws SQLException If connection failed.
- */
- private Connection connect() throws SQLException {
- final String jdbcDrvJarPath = jdbcDrvJarTf.getText().trim();
-
- final String jdbcDrvCls = jdbcDrvClsTf.getText();
-
- final String jdbcUrl = jdbcUrlTf.getText();
-
- String user = userTf.getText().trim();
-
- String pwd = pwdTf.getText().trim();
-
- final Properties jdbcInfo = new Properties();
-
- if (!user.isEmpty())
- jdbcInfo.put("user", user);
-
- if (!pwd.isEmpty())
- jdbcInfo.put("password", pwd);
-
- return DbMetadataReader.getInstance().connect(jdbcDrvJarPath, jdbcDrvCls, jdbcUrl, jdbcInfo);
- }
-
- /**
- * Fill tree with database metadata.
- */
- private void fill() {
- final List<String> selSchemas = new ArrayList<>();
-
- for (SchemaDescriptor schema: schemas)
- if (schema.selected().getValue())
- selSchemas.add(schema.schema());
-
- if (selSchemas.isEmpty())
- if (!MessageBox.confirmDialog(owner, "No schemas selected.\nExtract tables for all available schemas?"))
- return;
-
- lockUI(connLayerPnl, connPnl, nextBtn);
-
- final String jdbcUrl = jdbcUrlTf.getText();
-
- final boolean tblsOnly = parseCb.getSelectionModel().getSelectedIndex() == 0;
-
- Runnable task = new Task<Void>() {
- /** {@inheritDoc} */
- @Override protected Void call() throws Exception {
- long started = System.currentTimeMillis();
-
- try (Connection conn = connect()) {
- pojos = DatabaseMetadataParser.parse(conn, selSchemas, tblsOnly);
- }
-
- perceptualDelay(started);
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected void succeeded() {
- try {
- super.succeeded();
-
- pojosTbl.setItems(pojos);
-
- if (pojos.isEmpty()) {
- MessageBox.warningDialog(owner, "No tables found in database. Recheck JDBC URL.\n" +
- "JDBC URL: " + jdbcUrl);
-
- return;
- }
- else
- pojosTbl.getSelectionModel().clearAndSelect(0);
-
- curTbl = pojosTbl;
-
- pojosTbl.requestFocus();
-
- hdrPane.setLeft(genIcon);
-
- titleLb.setText("Generate XML And POJOs");
- subTitleLb.setText(jdbcUrlTf.getText());
-
- rootPane.setCenter(genLayerPnl);
-
- prevBtn.setDisable(false);
- nextBtn.setText("Generate");
- Controls.tooltip(nextBtn, "Generate XML and POJO files");
- }
- finally {
- unlockUI(connLayerPnl, connPnl, nextBtn);
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void cancelled() {
- super.cancelled();
-
- unlockUI(connLayerPnl, connPnl, nextBtn);
- }
-
- /** {@inheritDoc} */
- @Override protected void failed() {
- super.succeeded();
-
- unlockUI(connLayerPnl, connPnl, nextBtn);
-
- MessageBox.errorDialog(owner, "Failed to get tables list from database.", getException());
- }
- };
-
- exec.submit(task);
- }
-
- /**
- * Load schemas list from database.
- */
- private void loadSchemas() {
- lockUI(connLayerPnl, connPnl, nextBtn);
-
- final String jdbcUrl = jdbcUrlTf.getText();
-
- Runnable task = new Task<Void>() {
- /** {@inheritDoc} */
- @Override protected Void call() throws Exception {
- long started = System.currentTimeMillis();
-
- try (Connection conn = connect()) {
- schemas = DatabaseMetadataParser.schemas(conn);
- }
-
- perceptualDelay(started);
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected void succeeded() {
- try {
- super.succeeded();
-
- schemaLst.setItems(schemas);
-
- if (schemas.isEmpty()) {
- MessageBox.warningDialog(owner, "No schemas found in database. Recheck JDBC URL.\n" +
- "JDBC URL: " + jdbcUrl);
-
- return;
- }
-
- nextBtn.setDisable(false);
- }
- finally {
- unlockUI(connLayerPnl, connPnl, nextBtn);
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void cancelled() {
- super.cancelled();
-
- unlockUI(connLayerPnl, connPnl, nextBtn);
- }
-
- /** {@inheritDoc} */
- @Override protected void failed() {
- super.succeeded();
-
- unlockUI(connLayerPnl, connPnl, nextBtn);
-
- MessageBox.errorDialog(owner, "Failed to get schemas list from database.", getException());
- }
- };
-
- exec.submit(task);
- }
-
- /**
- * Generate XML and POJOs.
- */
- private void generate() {
- final Collection<PojoDescriptor> selPojos = checkedPojos();
-
- if (selPojos.isEmpty()) {
- MessageBox.warningDialog(owner, "Please select tables to generate XML and POJOs files!");
-
- return;
- }
-
- if (!checkInput(outFolderTf, true, "Output folder should not be empty!"))
- return;
-
- lockUI(genLayerPnl, genPnl, prevBtn, nextBtn);
-
- final String outFolder = outFolderTf.getText();
-
- final String pkg = pkgTf.getText();
-
- final File destFolder = new File(outFolder);
-
- final boolean constructor = pojoConstructorCh.isSelected();
-
- final boolean includeKeys = pojoIncludeKeysCh.isSelected();
-
- final boolean generateAliases = generateAliasesCh.isSelected();
-
- final boolean singleXml = xmlSingleFileCh.isSelected();
-
- Runnable task = new Task<Void>() {
- /**
- * @param pojo POJO descriptor to check.
- * @param selected Selected flag.
- * @param msg Message to show in case of check failed.
- */
- private void checkEmpty(final PojoDescriptor pojo, boolean selected, String msg) {
- if (!selected) {
- Platform.runLater(new Runnable() {
- @Override public void run() {
- TableView.TableViewSelectionModel<PojoDescriptor> selMdl = pojosTbl.getSelectionModel();
-
- selMdl.clearSelection();
- selMdl.select(pojo);
- pojosTbl.scrollTo(selMdl.getSelectedIndex());
- }
- });
-
- throw new IllegalStateException(msg + pojo.table());
- }
- }
-
- /** {@inheritDoc} */
- @Override protected Void call() throws Exception {
- long started = System.currentTimeMillis();
-
- if (!destFolder.exists() && !destFolder.mkdirs())
- throw new IOException("Failed to create output folder: " + destFolder);
-
- Collection<PojoDescriptor> all = new ArrayList<>();
-
- ConfirmCallable askOverwrite = new ConfirmCallable(owner, "File already exists: %s\nOverwrite?");
-
- // Generate XML and POJO.
- for (PojoDescriptor pojo : selPojos) {
- if (pojo.checked()) {
- checkEmpty(pojo, pojo.hasFields(), "No fields selected for type: ");
- checkEmpty(pojo, pojo.hasKeyFields(), "No key fields selected for type: ");
- checkEmpty(pojo, pojo.hasValueFields(includeKeys), "No value fields selected for type: ");
-
- all.add(pojo);
- }
- }
-
- for (PojoDescriptor pojo : all) {
- if (!singleXml)
- XmlGenerator.generate(pkg, pojo, includeKeys, generateAliases,
- new File(destFolder, pojo.table() + ".xml"), askOverwrite);
-
- CodeGenerator.pojos(pojo, outFolder, pkg, constructor, includeKeys, askOverwrite);
- }
-
- if (singleXml)
- XmlGenerator.generate(pkg, all, includeKeys, generateAliases,
- new File(outFolder, "ignite-type-metadata.xml"), askOverwrite);
-
- CodeGenerator.snippet(all, pkg, includeKeys, generateAliases, outFolder, askOverwrite);
-
- perceptualDelay(started);
-
- return null;
- }
-
- /**
- * Running of command with reading of first printed line.
- *
- * @param cmdLine Process to run.
- * @return First printed by command line.
- */
- private String execAndReadLine(Process cmdLine) {
- InputStream stream = cmdLine.getInputStream();
- Charset cs = Charset.defaultCharset();
-
- try(BufferedReader reader = new BufferedReader(
- cs == null ? new InputStreamReader(stream) : new InputStreamReader(stream, cs))) {
- return reader.readLine();
- }
- catch (IOException ignored){
- return null;
- }
- }
-
- /**
- * Start specified command in separate process.
- *
- * @param commands Executable file and command parameters in array.
- * @return Process instance for run command.
- */
- private Process startProcess(List<String> commands) throws IOException {
- ProcessBuilder builder = new ProcessBuilder(commands);
-
- Map<String, String> environment = builder.environment();
-
- environment.clear();
-
- environment.putAll(System.getenv());
-
- return builder.start();
- }
-
- /**
- * Convert specified command parameters to system specific parameters.
- *
- * @param cmd Path to executable file.
- * @param parameters Params for created process.
- * @return List of converted system specific parameters.
- */
- private List<String> toCommandLine(String cmd, String... parameters) {
- boolean isWin = U.isWindows();
-
- List<String> params = new ArrayList<>(parameters.length + 1);
-
- params.add(cmd.replace('/', File.separatorChar).replace('\\', File.separatorChar));
-
- for (String parameter: parameters) {
- if (isWin) {
- if (parameter.contains("\"")) params.add(parameter.replace("\"", "\\\""));
- else if (parameter.isEmpty()) params.add("\"\"");
- else params.add(parameter);
- }
- else
- params.add(parameter);
- }
-
- return params;
- }
-
- /**
- * Create process for run specified command.
- *
- * @param execPath Path to executable file.
- * @param params Params for created process.
- * @return Process instance for run command.
- */
- private Process createProcess(String execPath, String... params) throws IOException {
- if (F.isEmpty(execPath))
- throw new IllegalArgumentException("Executable not specified");
-
- return startProcess(toCommandLine(execPath, params));
- }
-
- /**
- * Compare two version strings.
- *
- * @param v1 Version string 1.
- * @param v2 Version string 2.
- * @return The value 0 if the argument version is equal to this version.
- * A value less than 0 if this version is less than the version argument.
- * A value greater than 0 if this version is greater than the version argument.
- */
- private int compareVersionNumbers(String v1, String v2) {
- if (v1 == null && v2 == null)
- return 0;
-
- if (v1 == null)
- return -1;
-
- if (v2 == null)
- return 1;
-
- String[] part1 = v1.split("[._-]");
- String[] part2 = v2.split("[._-]");
-
- int idx = 0;
-
- while (idx < part1.length && idx < part2.length) {
- String p1 = part1[idx];
- String p2 = part2[idx];
-
- int cmp = p1.matches("\\d+") && p2.matches("\\d+") ? Integer.valueOf(p1).compareTo(Integer.valueOf(p2)) :
- part1[idx].compareTo(part2[idx]);
-
- if (cmp != 0)
- return cmp;
-
- idx += 1;
- }
-
- if (part1.length == part2.length)
- return 0;
- else {
- boolean left = part1.length > idx;
- String[] parts = left ? part1 : part2;
-
- while (idx < parts.length) {
- String p = parts[idx];
-
- int cmp = p.matches("\\d+") ? Integer.valueOf(p).compareTo(0) : 1;
-
- if (cmp != 0) return left ? cmp : -cmp;
-
- idx += 1;
- }
-
- return 0;
- }
- }
-
- /**
- * Check that system has Nautilus.
- *
- * @return {@code True} when Nautilus is installed or {@code false} otherwise.
- * @throws IOException If failed to detect Nautilus.
- */
- private boolean canUseNautilus() throws IOException {
- if (U.isUnix() || new File("/usr/bin/xdg-mime").canExecute() || new File("/usr/bin/nautilus").canExecute()) {
- String appName = execAndReadLine(createProcess("xdg-mime", "query", "default", "inode/directory"));
-
- if (appName == null || !appName.matches("nautilus.*\\.desktop"))
- return false;
- else {
- String ver = execAndReadLine(createProcess("nautilus", "--version"));
-
- if (ver != null) {
- Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(ver);
-
- return m.find() && compareVersionNumbers(m.group(1), "3") >= 0;
- }
- else
- return false;
- }
- }
- else
- return false;
- }
-
- /**
- * Open specified folder with selection of specified file in system file manager.
- *
- * @param dir Opened folder.
- */
- private void openFolder(File dir) throws IOException {
- if (U.isWindows())
- Runtime.getRuntime().exec("explorer /root," + dir.getAbsolutePath());
- else if (U.isMacOs())
- createProcess("open", dir.getAbsolutePath());
- else if (canUseNautilus())
- createProcess("nautilus", dir.getAbsolutePath());
- else {
- String path = dir.getAbsolutePath();
-
- if (HAS_XDG_OPEN)
- createProcess("/usr/bin/xdg-open", path);
- else if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN))
- Desktop.getDesktop().open(new File(path));
- else
- MessageBox.warningDialog(owner, "This action isn't supported on the current platform" +
- ((U.isLinux() || U.isUnix() || U.isSolaris()) ?
- ".\nTo fix this issue you should install library libgnome2-0." : ""));
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void succeeded() {
- super.succeeded();
-
- unlockUI(genLayerPnl, genPnl, prevBtn, nextBtn);
-
- if (MessageBox.confirmDialog(owner, "Generation complete!\n\n" +
- "Reveal output folder in system default file browser?"))
- try {
- openFolder(destFolder);
- }
- catch (Exception e) {
- MessageBox.errorDialog(owner, "Failed to open folder with results.", e);
- }
- }
-
- /** {@inheritDoc} */
- @Override protected void cancelled() {
- super.cancelled();
-
- unlockUI(genLayerPnl, genPnl, prevBtn, nextBtn);
-
- MessageBox.warningDialog(owner, "Generation canceled.");
- }
-
- /** {@inheritDoc} */
- @Override protected void failed() {
- super.succeeded();
-
- unlockUI(genLayerPnl, genPnl, prevBtn, nextBtn);
-
- MessageBox.errorDialog(owner, "Generation failed.", getException());
- }
- };
-
- exec.submit(task);
- }
-
- /**
- * @return Header pane with title label.
- */
- private BorderPane createHeaderPane() {
- dbIcon = Controls.hBox(0, true, Controls.imageView("data_connection", 48));
- genIcon = Controls.hBox(0, true, Controls.imageView("text_tree", 48));
-
- titleLb = Controls.label("");
- titleLb.setId("banner");
-
- subTitleLb = Controls.label("");
-
- BorderPane bp = Controls.borderPane(null, Controls.vBox(5, titleLb, subTitleLb), null, dbIcon,
- Controls.hBox(0, true, Controls.imageView("ignite", 48)));
- bp.setId("banner");
-
- return bp;
- }
-
- /**
- * @return Panel with control buttons.
- */
- private Pane createButtonsPane() {
- prevBtn = Controls.button("Prev", "Go to \"Database connection\" page", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- prev();
- }
- });
-
- nextBtn = Controls.button("Next", "Go to \"POJO and XML generation\" page", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- next();
- }
- });
-
- return Controls.buttonsPane(Pos.BOTTOM_RIGHT, true, prevBtn, nextBtn);
- }
-
- /**
- * @return {@code true} if some changes were made to fields metadata.
- */
- private boolean changed() {
- for (PojoDescriptor pojo : pojos)
- if (pojo.changed())
- return true;
-
- return false;
- }
-
- /**
- * Go to "Connect To Database" panel.
- */
- private void prev() {
- if (changed() && !MessageBox.confirmDialog(owner, "Are you sure you want to return to previous page?\n" +
- "This will discard all your changes."))
- return;
-
- hdrPane.setLeft(dbIcon);
-
- titleLb.setText("Connect To Database");
- subTitleLb.setText("Specify database connection properties...");
-
- rootPane.setCenter(connLayerPnl);
-
- prevBtn.setDisable(true);
- nextBtn.setText("Next");
- Controls.tooltip(nextBtn, "Go to \"XML and POJO generation\" page");
- }
-
- /**
- * Check that text field is non empty.
- *
- * @param tf Text field check.
- * @param trim If {@code true} then
- * @param msg Warning message.
- * @return {@code true} If text field is empty.
- */
- private boolean checkInput(TextField tf, boolean trim, String msg) {
- String s = tf.getText();
-
- s = trim ? s.trim() : s;
-
- if (s.isEmpty()) {
- tf.requestFocus();
-
- MessageBox.warningDialog(owner, msg);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Go to "Generate XML And POJOs" panel or generate XML and POJOs.
- */
- private void next() {
- if (rootPane.getCenter() == connLayerPnl) {
- if (checkInput(jdbcDrvJarTf, true, "Path to JDBC driver is not specified!") &&
- checkInput(jdbcDrvClsTf, true, "JDBC driver class name is not specified!") &&
- checkInput(jdbcUrlTf, true, "JDBC URL connection string is not specified!") &&
- checkInput(userTf, true, "User name is not specified!"))
- fill();
- }
- else
- generate();
- }
-
- /**
- * Create connection pane with controls.
- *
- * @return Pane with connection controls.
- */
- private Pane createConnectionPane() {
- connPnl = Controls.paneEx(10, 10, 0, 10);
-
- connPnl.addColumn();
- connPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- connPnl.addColumn(35, 35, 35, Priority.NEVER);
-
- connPnl.addRows(9);
- connPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
-
- connPnl.add(Controls.text("This utility is designed to automatically generate configuration XML files and" +
- " POJO classes from database schema information.", 550), 3);
-
- connPnl.wrap();
-
- GridPaneEx presetPnl = Controls.paneEx(0, 0, 0, 0);
- presetPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- presetPnl.addColumn();
-
- rdbmsCb = presetPnl.add(Controls.comboBox("Select database server to get predefined settings", presets));
-
- presetPnl.add(Controls.button("Save preset", "Save current settings in preferences", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- Preset preset = rdbmsCb.getSelectionModel().getSelectedItem();
-
- savePreset(preset);
- }
- }));
-
- connPnl.add(Controls.label("DB Preset:"));
- connPnl.add(presetPnl, 2);
-
- jdbcDrvJarTf = connPnl.addLabeled("Driver JAR:", Controls.textField("Path to driver jar"));
-
- connPnl.add(Controls.button("...", "Select JDBC driver jar or zip", new EventHandler<ActionEvent>() {
- /** {@inheritDoc} */
- @Override public void handle(ActionEvent evt) {
- FileChooser fc = new FileChooser();
-
- try {
- File jarFolder = new File(jdbcDrvJarTf.getText()).getParentFile();
-
- if (jarFolder.exists())
- fc.setInitialDirectory(jarFolder);
- }
- catch (Exception ignored) {
- // No-op.
- }
-
- jdbcDrvJarTf.getText();
-
- fc.getExtensionFilters().addAll(
- new FileChooser.ExtensionFilter("JDBC Drivers (*.jar)", "*.jar"),
- new FileChooser.ExtensionFilter("ZIP archives (*.zip)", "*.zip"));
-
- File drvJar = fc.showOpenDialog(owner);
-
- if (drvJar != null)
- jdbcDrvJarTf.setText(drvJar.getAbsolutePath());
- }
- }));
-
- jdbcDrvClsTf = connPnl.addLabeled("JDBC Driver:", Controls.textField("Enter class name for JDBC driver"), 2);
-
- jdbcUrlTf = connPnl.addLabeled("JDBC URL:", Controls.textField("JDBC URL of the database connection string"), 2);
-
- rdbmsCb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Preset>() {
- @Override public void changed(ObservableValue<? extends Preset> val, Preset oldVal, Preset newVal) {
- jdbcDrvJarTf.setText(newVal.jar);
- jdbcDrvClsTf.setText(newVal.drv);
- jdbcUrlTf.setText(newVal.url);
- userTf.setText(newVal.user);
- }
- });
-
- userTf = connPnl.addLabeled("User:", Controls.textField("User name"), 2);
-
- pwdTf = connPnl.addLabeled("Password:", Controls.passwordField("User password"), 2);
-
- parseCb = connPnl.addLabeled("Parse:", Controls.comboBox("Type of tables to parse", "Tables only", "Tables and Views"), 2);
-
- GridPaneEx schemaPnl = Controls.paneEx(5, 5, 5, 5);
- schemaPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- schemaPnl.addColumn();
-
- schemaLst = schemaPnl.add(Controls.list("Select schemas to load", new SchemaCell()));
-
- schemaPnl.wrap();
-
- schemaPnl.add(Controls.button("Load schemas", "Load schemas for specified database", new EventHandler<ActionEvent>() {
- /** {@inheritDoc} */
- @Override public void handle(ActionEvent evt) {
- loadSchemas();
- }
- }));
-
- TitledPane titledPnl = connPnl.add(Controls.titledPane("Schemas", schemaPnl, false), 3);
-
- titledPnl.setExpanded(true);
-
- GridPaneEx.setValignment(titledPnl, VPos.TOP);
-
- connLayerPnl = Controls.stackPane(connPnl);
-
- return connLayerPnl;
- }
-
- /**
- * Check if new class name is unique.
- *
- * @param pojo Current edited POJO.
- * @param newVal New value for class name.
- * @param key {@code true} if key class name is checked.
- * @return {@code true} if class name is valid.
- */
- private boolean checkClassNameUnique(PojoDescriptor pojo, String newVal, boolean key) {
- for (PojoDescriptor otherPojo : pojos)
- if (pojo != otherPojo) {
- String otherKeyCls = otherPojo.keyClassName();
- String otherValCls = otherPojo.valueClassName();
-
- if (newVal.equals(otherKeyCls) || newVal.equals(otherValCls)) {
- MessageBox.warningDialog(owner, (key ? "Key" : "Value") + " class name must be unique!");
-
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Check if new class name is valid.
- *
- * @param pojo Current edited POJO.
- * @param newVal New value for class name.
- * @param key {@code true} if key class name is checked.
- * @return {@code true} if class name is valid.
- */
- private boolean checkClassName(PojoDescriptor pojo, String newVal, boolean key) {
- if (newVal.trim().isEmpty()) {
- MessageBox.warningDialog(owner, (key ? "Key" : "Value") + " class name must be non empty!");
-
- return false;
- }
-
- if (key) {
- if (newVal.equals(pojo.valueClassName())) {
- MessageBox.warningDialog(owner, "Key class name must be different from value class name!");
-
- return false;
- }
- }
- else if (newVal.equals(pojo.keyClassName())) {
- MessageBox.warningDialog(owner, "Value class name must be different from key class name!");
-
- return false;
- }
-
- return checkClassNameUnique(pojo, newVal, key);
- }
-
- /**
- * Create generate pane with controls.
- */
- private void createGeneratePane() {
- genPnl = Controls.paneEx(10, 10, 0, 10);
-
- genPnl.addColumn();
- genPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- genPnl.addColumn(35, 35, 35, Priority.NEVER);
-
- genPnl.addRow(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- genPnl.addRows(8);
-
- TableColumn<PojoDescriptor, Boolean> useCol = Controls.customColumn("Schema / Table", "use",
- "If checked then this table will be used for XML and POJOs generation", PojoDescriptorCell.cellFactory());
-
- TableColumn<PojoDescriptor, String> keyClsCol = Controls.textColumn("Key Class Name", "keyClassName", "Key class name",
- new TextColumnValidator<PojoDescriptor>() {
- @Override public boolean valid(PojoDescriptor rowVal, String newVal) {
- boolean valid = checkClassName(rowVal, newVal, true);
-
- if (valid)
- rowVal.keyClassName(newVal);
-
- return valid;
- }
- });
-
- TableColumn<PojoDescriptor, String> valClsCol = Controls.textColumn("Value Class Name", "valueClassName",
- "Value class name", new TextColumnValidator<PojoDescriptor>() {
- @Override public boolean valid(PojoDescriptor rowVal, String newVal) {
- boolean valid = checkClassName(rowVal, newVal, false);
-
- if (valid)
- rowVal.valueClassName(newVal);
-
- return valid;
- }
- });
-
- pojosTbl = Controls.tableView("Tables not found in database", useCol, keyClsCol, valClsCol);
-
- TableColumn<PojoField, Boolean> useFldCol = Controls.customColumn("Use", "use",
- "Check to use this field for XML and POJO generation\n" +
- "Note that NOT NULL columns cannot be unchecked", PojoFieldUseCell.cellFactory());
- useFldCol.setMinWidth(50);
- useFldCol.setMaxWidth(50);
-
- TableColumn<PojoField, Boolean> keyCol = Controls.booleanColumn("Key", "key",
- "Check to include this field into key object");
-
- TableColumn<PojoField, Boolean> akCol = Controls.booleanColumn("AK", "affinityKey",
- "Check to annotate key filed with @AffinityKeyMapped annotation in generated POJO class\n" +
- "Note that a class can have only ONE key field annotated with @AffinityKeyMapped annotation");
-
- TableColumn<PojoField, String> dbNameCol = Controls.tableColumn("DB Name", "dbName", "Field name in database");
-
- TableColumn<PojoField, String> dbTypeNameCol = Controls.tableColumn("DB Type", "dbTypeName", "Field type in database");
-
- TableColumn<PojoField, String> javaNameCol = Controls.textColumn("Java Name", "javaName", "Field name in POJO class",
- new TextColumnValidator<PojoField>() {
- @Override public boolean valid(PojoField rowVal, String newVal) {
- if (newVal.trim().isEmpty()) {
- MessageBox.warningDialog(owner, "Java name must be non empty!");
-
- return false;
- }
-
- for (PojoField field : curPojo.fields())
- if (rowVal != field && newVal.equals(field.javaName())) {
- MessageBox.warningDialog(owner, "Java name must be unique!");
-
- return false;
- }
-
- rowVal.javaName(newVal);
-
- return true;
- }
- });
-
- TableColumn<PojoField, String> javaTypeNameCol = Controls.customColumn("Java Type", "javaTypeName",
- "Field java type in POJO class", JavaTypeCell.cellFactory());
-
- fieldsTbl = Controls.tableView("Select table to see table columns",
- useFldCol, keyCol, akCol, dbNameCol, dbTypeNameCol, javaNameCol, javaTypeNameCol);
-
- genPnl.add(Controls.splitPane(pojosTbl, fieldsTbl, 0.6), 3);
-
- final GridPaneEx keyValPnl = Controls.paneEx(0, 0, 0, 0);
- keyValPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- keyValPnl.addColumn();
- keyValPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- keyValPnl.addColumn();
-
- pkgTf = genPnl.addLabeled("Package:", Controls.textField("Package that will be used for POJOs generation"), 2);
-
- outFolderTf = genPnl.addLabeled("Output Folder:", Controls.textField("Output folder for XML and POJOs files"));
-
- genPnl.add(Controls.button("...", "Select output folder", new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- DirectoryChooser dc = new DirectoryChooser();
-
- try {
- File outFolder = new File(outFolderTf.getText());
-
- if (outFolder.exists())
- dc.setInitialDirectory(outFolder);
- }
- catch (Exception ignored) {
- // No-op.
- }
-
- File folder = dc.showDialog(owner);
-
- if (folder != null)
- outFolderTf.setText(folder.getAbsolutePath());
- }
- }));
-
- pojoIncludeKeysCh = genPnl.add(Controls.checkBox("Include key fields into value POJOs",
- "If selected then include key fields into value object", true), 3);
-
- pojoConstructorCh = genPnl.add(Controls.checkBox("Generate constructors for POJOs",
- "If selected then generate empty and full constructors for POJOs", false), 3);
-
- generateAliasesCh = genPnl.add(Controls.checkBox("Generate aliases for SQL fields",
- "If selected then generate aliases for SQL fields with db names", true), 3);
-
- xmlSingleFileCh = genPnl.add(Controls.checkBox("Write all configurations to a single XML file",
- "If selected then all configurations will be saved into the file 'ignite-type-metadata.xml'", true), 3);
-
- GridPaneEx regexPnl = Controls.paneEx(5, 5, 5, 5);
- regexPnl.addColumn();
- regexPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
- regexPnl.addColumn();
- regexPnl.addColumn(100, 100, Double.MAX_VALUE, Priority.ALWAYS);
-
- regexTf = regexPnl.addLabeled(" Regexp:", Controls.textField("Regular expression. For example: (\\w+)"));
-
- replaceTf = regexPnl.addLabeled(" Replace with:", Controls.textField("Replace text. For example: $1_SomeText"));
-
- final ComboBox<String> replaceCb = regexPnl.addLabeled(" Replace:", Controls.comboBox("Replacement target",
- "Key class names", "Value class names", "Java names"));
-
- regexPnl.add(Controls.buttonsPane(Pos.CENTER_LEFT, false,
- Controls.button("Rename Selected", "Replaces each substring of this string that matches the given regular expression" +
- " with the given replacement",
- new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- if (!checkInput(regexTf, false, "Regular expression should not be empty!"))
- return;
-
- String sel = replaceCb.getSelectionModel().getSelectedItem();
-
- boolean isFields = "Java names".equals(sel) && curTbl == fieldsTbl;
-
- String src = isFields ? "fields" : "tables";
-
- String target = "\"" + sel + "\"";
-
- Collection<PojoDescriptor> selPojos = pojosTbl.getSelectionModel().getSelectedItems();
-
- Collection<PojoField> selFields = fieldsTbl.getSelectionModel().getSelectedItems();
-
- boolean isEmpty = isFields ? selFields.isEmpty() : selPojos.isEmpty();
-
- if (isEmpty) {
- MessageBox.warningDialog(owner, "Please select " + src + " to rename " + target + "!");
-
- return;
- }
-
- if (!MessageBox.confirmDialog(owner, "Are you sure you want to rename " + target +
- " for all selected " + src + "?"))
- return;
-
- String regex = regexTf.getText();
-
- String replace = replaceTf.getText();
-
- try {
- switch (replaceCb.getSelectionModel().getSelectedIndex()) {
- case 0:
- renameKeyClassNames(selPojos, regex, replace);
- break;
-
- case 1:
- renameValueClassNames(selPojos, regex, replace);
- break;
-
- default:
- if (isFields)
- renameFieldsJavaNames(selFields, regex, replace);
- else
- renamePojosJavaNames(selPojos, regex, replace);
- }
- }
- catch (Exception e) {
- MessageBox.errorDialog(owner, "Failed to rename " + target + "!", e);
- }
- }
- }),
- Controls.button("Reset Selected", "Revert changes for selected items to initial auto-generated values",
- new EventHandler<ActionEvent>() {
- @Override public void handle(ActionEvent evt) {
- String sel = replaceCb.getSelectionModel().getSelectedItem();
-
- boolean isFields = "Java names".equals(sel) && curTbl == fieldsTbl;
-
- String src = isFields ? "fields" : "tables";
-
- String target = "\"" + sel + "\"";
-
- Collection<PojoDescriptor> selPojos = pojosTbl.getSelectionModel().getSelectedItems();
-
- Collection<PojoField> selFields = fieldsTbl.getSelectionModel().getSelectedItems();
-
- boolean isEmpty = isFields ? selFields.isEmpty() : selPojos.isEmpty();
-
- if (isEmpty) {
- MessageBox.warningDialog(owner, "Please select " + src + "to revert " + target + "!");
-
- return;
- }
-
- if (!MessageBox.confirmDialog(owner,
- "Are you sure you want to revert " + target + " for all selected " + src + "?"))
- return;
-
- switch (replaceCb.getSelectionModel().getSelectedIndex()) {
- case 0:
- revertKeyClassNames(selPojos);
- break;
-
- case 1:
- revertValueClassNames(selPojos);
- break;
-
- default:
- if (isFields)
- revertFieldsJavaNames(selFields);
- else
- revertPojosJavaNames(selPojos);
- }
- }
- })
- ), 2).setPadding(new Insets(0, 0, 0, 10));
-
- pojosTbl.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<PojoDescriptor>() {
- @Override public void changed(ObservableValue<? extends PojoDescriptor> val,
- PojoDescriptor oldVal, PojoDescriptor newItem) {
- if (newItem != null && newItem.parent() != null) {
- curPojo = newItem;
-
- fieldsTbl.setItems(curPojo.fields());
- fieldsTbl.getSelectionModel().clearSelection();
-
- keyValPnl.setDisable(false);
- }
- else {
- curPojo = null;
- fieldsTbl.setItems(NO_FIELDS);
-
- keyValPnl.setDisable(true);
- }
- }
- });
-
- pojosTbl.focusedProperty().addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- if (newVal)
- curTbl = pojosTbl;
- }
- });
-
- fieldsTbl.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
- @Override public void changed(ObservableValue<? extends Number> val, Number oldVal, Number newVal) {
- if (curPojo != null) {
- TableView.TableViewSelectionModel<PojoDescriptor> selMdl = pojosTbl.getSelectionModel();
-
- List<Integer> selIndices = new ArrayList<>(selMdl.getSelectedIndices());
-
- if (selIndices.size() > 1) {
- for (Integer idx : selIndices) {
- if (pojos.get(idx) != curPojo)
- selMdl.clearSelection(idx);
- }
- }
- }
- }
- });
-
- fieldsTbl.focusedProperty().addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- if (newVal)
- curTbl = fieldsTbl;
- }
- });
-
- genPnl.add(Controls.titledPane("Rename \"Key class name\", \"Value class name\" or \"Java name\" for selected tables",
- regexPnl, true), 3);
-
- genLayerPnl = Controls.stackPane(genPnl);
- }
-
- /**
- * Rename key class name for selected POJOs.
- *
- * @param selPojos Selected POJOs to rename.
- * @param regex Regex to search.
- * @param replace Text for replacement.
- */
- private void renameKeyClassNames(Collection<PojoDescriptor> selPojos, String regex, String replace) {
- for (PojoDescriptor pojo : selPojos)
- pojo.keyClassName(pojo.keyClassName().replaceAll(regex, replace));
- }
-
- /**
- * Rename value class name for selected POJOs.
- *
- * @param selPojos Selected POJOs to rename.
- * @param regex Regex to search.
- * @param replace Text for replacement.
- */
- private void renameValueClassNames(Collection<PojoDescriptor> selPojos, String regex, String replace) {
- for (PojoDescriptor pojo : selPojos)
- pojo.valueClassName(pojo.valueClassName().replaceAll(regex, replace));
- }
-
- /**
- * Rename fields java name for selected POJOs.
- *
- * @param selPojos Selected POJOs to rename.
- * @param regex Regex to search.
- * @param replace Text for replacement.
- */
- private void renamePojosJavaNames(Collection<PojoDescriptor> selPojos, String regex, String replace) {
- for (PojoDescriptor pojo : selPojos)
- for (PojoField field : pojo.fields())
- field.javaName(field.javaName().replaceAll(regex, replace));
- }
-
- /**
- * Rename fields java name for current POJO.
- *
- * @param selFields Selected fields for current POJO to rename.
- * @param regex Regex to search.
- * @param replace Text for replacement.
- */
- private void renameFieldsJavaNames(Collection<PojoField> selFields, String regex, String replace) {
- for (PojoField field : selFields)
- field.javaName(field.javaName().replaceAll(regex, replace));
- }
-
- /**
- * Revert key class name for selected POJOs to initial value.
- *
- * @param selPojos Selected POJOs to revert.
- */
- private void revertKeyClassNames(Collection<PojoDescriptor> selPojos) {
- for (PojoDescriptor pojo : selPojos)
- pojo.revertKeyClassName();
- }
-
- /**
- * Revert value class name for selected POJOs to initial value.
- *
- * @param selPojos Selected POJOs to revert.
- */
- private void revertValueClassNames(Collection<PojoDescriptor> selPojos) {
- for (PojoDescriptor pojo : selPojos)
- pojo.revertValueClassName();
- }
-
- /**
- * Revert fields java name for selected POJOs to initial value.
- *
- * @param selPojos Selected POJOs to revert.
- */
- private void revertPojosJavaNames(Collection<PojoDescriptor> selPojos) {
- for (PojoDescriptor pojo : selPojos)
- pojo.revertJavaNames();
- }
-
- /**
- * Revert fields java name for current POJO to initial value.
- *
- * @param selFields Selected POJO fields to revert.
- */
- private void revertFieldsJavaNames(Collection<PojoField> selFields) {
- for (PojoField field : selFields)
- field.resetJavaName();
- }
-
- /**
- * @return POJOs checked in table-tree-view.
- */
- private Collection<PojoDescriptor> checkedPojos() {
- Collection<PojoDescriptor> res = new ArrayList<>();
-
- for (PojoDescriptor pojo : pojos)
- if (pojo.checked())
- res.add(pojo);
-
- return res;
- }
-
- /**
- * Gets string property.
- *
- * @param key Property key.
- * @param dflt Default value.
- * @return Property value as string.
- */
- private String getStringProp(String key, String dflt) {
- String val = prefs.getProperty(key);
-
- if (val != null)
- return val;
-
- return dflt;
- }
-
- /**
- * Sets string property.
- *
- * @param key Property key.
- * @param val Value to set.
- */
- private void setStringProp(String key, String val) {
- prefs.put(key, val);
- }
-
- /**
- * Gets int property.
- *
- * @param key Property key.
- * @param dflt Default value.
- * @return Property value as int.
- */
- private int getIntProp(String key, int dflt) {
- String val = prefs.getProperty(key);
-
- if (val != null)
- try {
- return Integer.parseInt(val);
- }
- catch (NumberFormatException ignored) {
- return dflt;
- }
-
- return dflt;
- }
-
- /**
- * Sets int property.
- *
- * @param key Property key.
- * @param val Value to set.
- */
- private void setIntProp(String key, int val) {
- prefs.put(key, String.valueOf(val));
- }
-
- /**
- * Gets boolean property.
- *
- * @param key Property key.
- * @param dflt Default value.
- * @return Property value as boolean.
- */
- private boolean getBoolProp(String key, boolean dflt) {
- String val = prefs.getProperty(key);
-
- if (val != null)
- return Boolean.parseBoolean(val);
-
- return dflt;
- }
-
- /**
- * Sets boolean property.
- *
- * @param key Property key.
- * @param val Value to set.
- */
- private void setBoolProp(String key, boolean val) {
- prefs.put(key, String.valueOf(val));
- }
-
- /**
- * Resolve path.
- *
- * @param key Preferences key.
- * @param dflt Default value.
- * @return String with full file path or default value.
- */
- private String resolveFilePath(String key, String dflt) {
- String path = prefs.getProperty(key);
-
- if (path != null) {
- File file = U.resolveIgnitePath(path);
-
- if (file != null)
- return file.getAbsolutePath();
- }
-
- return dflt;
- }
-
- /** {@inheritDoc} */
- @Override public void start(Stage primaryStage) {
- owner = primaryStage;
-
- if (prefsFile.exists())
- try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(prefsFile))) {
- prefs.load(in);
- }
- catch (IOException e) {
- log.log(Level.SEVERE, "Failed to load preferences. Default preferences will be used", e);
- }
-
- // Load custom preferences.
- List<String> params = getParameters().getRaw();
-
- if (!params.isEmpty()) {
- String customPrefsFileName = params.get(0);
-
- if (customPrefsFileName.isEmpty())
- log.log(Level.WARNING, "Path to file with custom preferences is not specified.");
- else {
- File customPrefsFile = U.resolveIgnitePath(customPrefsFileName);
-
- if (customPrefsFile == null)
- log.log(Level.WARNING, "Failed to resolve path to file with custom preferences: " +
- customPrefsFileName);
- else {
- Properties customPrefs = new Properties();
-
- try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(customPrefsFile))) {
- customPrefs.load(in);
- }
- catch (IOException e) {
- log.log(Level.SEVERE, "Failed to load custom preferences.", e);
- }
-
- prefs.putAll(customPrefs);
- }
- }
- }
-
- // Restore presets.
- for (Preset preset : presets) {
- String key = "presets." + preset.pref + ".";
-
- preset.jar = getStringProp(key + "jar", preset.jar);
- preset.drv = getStringProp(key + "drv", preset.drv);
- preset.url = getStringProp(key + "url", preset.url);
- preset.user = getStringProp(key + "user", preset.user);
- }
-
- primaryStage.setTitle("Apache Ignite Auto Schema Import Utility");
-
- primaryStage.getIcons().addAll(
- Controls.image("ignite", 16),
- Controls.image("ignite", 24),
- Controls.image("ignite", 32),
- Controls.image("ignite", 48),
- Controls.image("ignite", 64),
- Controls.image("ignite", 128));
-
- pi = Controls.progressIndicator(50);
-
- createGeneratePane();
-
- hdrPane = createHeaderPane();
- rootPane = Controls.borderPane(hdrPane, createConnectionPane(), createButtonsPane(), null, null);
-
- primaryStage.setScene(Controls.scene(rootPane));
-
- primaryStage.setWidth(650);
- primaryStage.setMinWidth(650);
-
- primaryStage.setHeight(650);
- primaryStage.setMinHeight(650);
-
- prev();
-
- // Restore window pos and size.
- if (prefs.getProperty(PREF_WINDOW_X) != null) {
- int x = getIntProp(PREF_WINDOW_X, 100);
- int y = getIntProp(PREF_WINDOW_Y, 100);
- int w = getIntProp(PREF_WINDOW_WIDTH, 650);
- int h = getIntProp(PREF_WINDOW_HEIGHT, 650);
-
- // Ensure that window fit any available screen.
- if (!Screen.getScreensForRectangle(x, y, w, h).isEmpty()) {
- primaryStage.setX(x);
- primaryStage.setY(y);
-
- primaryStage.setWidth(w);
- primaryStage.setHeight(h);
- }
- }
- else
- primaryStage.centerOnScreen();
-
- String userHome = System.getProperty("user.home").replace('\\', '/');
-
- // Restore connection pane settings.
- rdbmsCb.getSelectionModel().select(getIntProp(PREF_JDBC_DB_PRESET, 0));
- jdbcDrvJarTf.setText(resolveFilePath(PREF_JDBC_DRIVER_JAR, "h2.jar"));
- jdbcDrvClsTf.setText(getStringProp(PREF_JDBC_DRIVER_CLASS, "org.h2.Driver"));
- jdbcUrlTf.setText(getStringProp(PREF_JDBC_URL, "jdbc:h2:" + userHome + "/ignite-schema-import/db"));
- userTf.setText(getStringProp(PREF_JDBC_USER, "sa"));
-
- // Restore generation pane settings.
- outFolderTf.setText(resolveFilePath(PREF_OUT_FOLDER, userHome + "/ignite-schema-import/out"));
-
- pkgTf.setText(getStringProp(PREF_POJO_PACKAGE, "org.apache.ignite"));
- pojoIncludeKeysCh.setSelected(getBoolProp(PREF_POJO_INCLUDE, true));
- pojoConstructorCh.setSelected(getBoolProp(PREF_POJO_CONSTRUCTOR, false));
- generateAliasesCh.setSelected(getBoolProp(PREF_GENERATE_ALIASES, true));
-
- xmlSingleFileCh.setSelected(getBoolProp(PREF_XML_SINGLE, true));
-
- regexTf.setText(getStringProp(PREF_NAMING_PATTERN, "(\\w+)"));
- replaceTf.setText(getStringProp(PREF_NAMING_REPLACE, "$1_SomeText"));
-
- primaryStage.show();
- }
-
- /**
- * Save preset.
- *
- * @param preset Preset to save.
- */
- private void savePreset(Preset preset) {
- String key = "presets." + preset.pref + ".";
-
- preset.jar = jdbcDrvJarTf.getText();
- setStringProp(key + "jar", preset.jar);
-
- preset.drv = jdbcDrvClsTf.getText();
- setStringProp(key + "drv", preset.drv);
-
- preset.url = jdbcUrlTf.getText();
- setStringProp(key + "url", preset.url);
-
- preset.user = userTf.getText();
- setStringProp(key + "user", preset.user);
-
- savePreferences();
- }
-
- /**
- * Save user preferences.
- */
- private void savePreferences() {
- try (FileOutputStream out = new FileOutputStream(prefsFile)) {
- prefs.store(out, "Apache Ignite Schema Import Utility");
- }
- catch (IOException e) {
- MessageBox.errorDialog(owner, "Failed to save preferences!", e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public void stop() throws Exception {
- // Save window pos and size.
- setIntProp(PREF_WINDOW_X, (int)owner.getX());
- setIntProp(PREF_WINDOW_Y, (int)owner.getY());
- setIntProp(PREF_WINDOW_WIDTH, (int)owner.getWidth());
- setIntProp(PREF_WINDOW_HEIGHT, (int)owner.getHeight());
-
- // Save connection pane settings.
- setIntProp(PREF_JDBC_DB_PRESET, rdbmsCb.getSelectionModel().getSelectedIndex());
- setStringProp(PREF_JDBC_DRIVER_JAR, jdbcDrvJarTf.getText());
- setStringProp(PREF_JDBC_DRIVER_CLASS, jdbcDrvClsTf.getText());
- setStringProp(PREF_JDBC_URL, jdbcUrlTf.getText());
- setStringProp(PREF_JDBC_USER, userTf.getText());
-
- // Save generation pane settings.
- setStringProp(PREF_OUT_FOLDER, outFolderTf.getText());
-
- setStringProp(PREF_POJO_PACKAGE, pkgTf.getText());
- setBoolProp(PREF_POJO_INCLUDE, pojoIncludeKeysCh.isSelected());
- setBoolProp(PREF_POJO_CONSTRUCTOR, pojoConstructorCh.isSelected());
- setBoolProp(PREF_GENERATE_ALIASES, generateAliasesCh.isSelected());
-
- setBoolProp(PREF_XML_SINGLE, xmlSingleFileCh.isSelected());
-
- setStringProp(PREF_NAMING_PATTERN, regexTf.getText());
- setStringProp(PREF_NAMING_REPLACE, replaceTf.getText());
-
- savePreferences();
- }
-
- /** Presets for database settings. */
- private static class Preset {
- /** Name in preferences. */
- private String pref;
-
- /** RDBMS name to show on screen. */
- private String name;
-
- /** Path to JDBC driver jar. */
- private String jar;
-
- /** JDBC driver class name. */
- private String drv;
-
- /** JDBC URL. */
- private String url;
-
- /** User name. */
- private String user;
-
- /**
- * Preset constructor.
- *
- * @param pref Name in preferences.
- * @param name RDBMS name to show on screen.
- * @param jar Path to JDBC driver jar..
- * @param drv JDBC driver class name.
- * @param url JDBC URL.
- * @param user User name.
- */
- Preset(String pref, String name, String jar, String drv, String url, String user) {
- this.pref = pref;
- this.name = name;
- this.jar = jar;
- this.drv = drv;
- this.url = url;
- this.user = user;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return name;
- }
- }
-
- /**
- * Special table cell to select possible java type conversions.
- */
- private static class JavaTypeCell extends TableCell<PojoField, String> {
- /** Combo box. */
- private final ComboBox<String> comboBox;
-
- /**
- * Creates a ComboBox cell factory for use in TableColumn controls.
- *
- * @return Cell factory for cell with java types combobox.
- */
- public static Callback<TableColumn<PojoField, String>, TableCell<PojoField, String>> cellFactory() {
- return new Callback<TableColumn<PojoField, String>, TableCell<PojoField, String>>() {
- @Override public TableCell<PojoField, String> call(TableColumn<PojoField, String> col) {
- return new JavaTypeCell();
- }
- };
- }
-
- /**
- * Default constructor.
- */
- private JavaTypeCell() {
- comboBox = new ComboBox<>(FXCollections.<String>emptyObservableList());
-
- comboBox.valueProperty().addListener(new ChangeListener<String>() {
- @Override public void changed(ObservableValue<? extends String> val, String oldVal, String newVal) {
- if (isEditing())
- commitEdit(newVal);
- }
- });
-
- getStyleClass().add("combo-box-table-cell");
- }
-
- /** {@inheritDoc} */
- @Override public void startEdit() {
- if (comboBox.getItems().size() > 1) {
- comboBox.getSelectionModel().select(getItem());
-
- super.startEdit();
-
- setText(null);
- setGraphic(comboBox);
- }
- }
-
- /** {@inheritDoc} */
- @Override public void cancelEdit() {
- super.cancelEdit();
-
- setText(getItem());
-
- setGraphic(null);
- }
-
- /** {@inheritDoc} */
- @Override public void updateItem(String item, boolean empty) {
- super.updateItem(item, empty);
-
- setGraphic(null);
- setText(null);
-
- if (!empty) {
- setText(item);
-
- TableRow row = getTableRow();
-
- if (row != null) {
- PojoField pojo = (PojoField)row.getItem();
-
- if (pojo != null) {
- comboBox.setItems(pojo.conversions());
- comboBox.getSelectionModel().select(pojo.javaTypeName());
- }
- }
- }
- }
- }
-
- /**
- * Special list view cell to select loaded schemas.
- */
- private static class SchemaCell implements Callback<SchemaDescriptor, ObservableValue<Boolean>> {
- /** {@inheritDoc} */
- @Override public ObservableValue<Boolean> call(SchemaDescriptor item) {
- return item.selected();
- }
- }
-
- /**
- * Special table cell to select schema or table.
- */
- private static class PojoDescriptorCell extends TableCell<PojoDescriptor, Boolean> {
- /** Previous POJO bound to cell. */
- private PojoDescriptor prevPojo;
-
- /** Previous cell graphic. */
- private Pane prevGraphic;
-
- /**
- * Creates a ComboBox cell factory for use in TableColumn controls.
- *
- * @return Cell factory for schema / table selection.
- */
- public static Callback<TableColumn<PojoDescriptor, Boolean>, TableCell<PojoDescriptor, Boolean>> cellFactory() {
- return new Callback<TableColumn<PojoDescriptor, Boolean>, TableCell<PojoDescriptor, Boolean>>() {
- @Override public TableCell<PojoDescriptor, Boolean> call(TableColumn<PojoDescriptor, Boolean> col) {
- return new PojoDescriptorCell();
- }
- };
- }
-
- /** {@inheritDoc} */
- @Override public void updateItem(Boolean item, boolean empty) {
- super.updateItem(item, empty);
-
- setGraphic(null);
-
- if (!empty) {
- TableRow row = getTableRow();
-
- if (row != null) {
- final PojoDescriptor pojo = (PojoDescriptor)row.getItem();
-
- if (pojo != null) {
- if (prevGraphic == null || pojo != prevPojo) {
- boolean isTbl = pojo.parent() != null;
-
- CheckBox ch = new CheckBox();
- ch.setAllowIndeterminate(false);
- ch.indeterminateProperty().bindBidirectional(pojo.indeterminate());
- ch.selectedProperty().bindBidirectional(pojo.useProperty());
-
- Label lb = new Label(isTbl ? pojo.table() : pojo.schema());
-
- Pane pnl = new HBox(5);
- pnl.setPadding(new Insets(0, 0, 0, isTbl ? 25 : 5));
- pnl.getChildren().addAll(ch, lb);
-
- prevPojo = pojo;
- prevGraphic = pnl;
- }
-
- setGraphic(prevGraphic);
- }
- }
- }
- }
- }
-
- /**
- * Special table cell to select "used" fields for code generation.
- */
- private static class PojoFieldUseCell extends TableCell<PojoField, Boolean> {
- /** Previous POJO field bound to cell. */
- private PojoField prevField;
-
- /** Previous cell graphic. */
- private CheckBox prevGraphic;
-
- /**
- * Creates a ComboBox cell factory for use in TableColumn controls.
- *
- * @return Cell factory for used fields selection.
- */
- public static Callback<TableColumn<PojoField, Boolean>, TableCell<PojoField, Boolean>> cellFactory() {
- return new Callback<TableColumn<PojoField, Boolean>, TableCell<PojoField, Boolean>>() {
- @Override public TableCell<PojoField, Boolean> call(TableColumn<PojoField, Boolean> col) {
- return new PojoFieldUseCell();
- }
- };
- }
-
- /** {@inheritDoc} */
- @Override public void updateItem(Boolean item, boolean empty) {
- super.updateItem(item, empty);
-
- setGraphic(null);
-
- if (!empty) {
- TableRow row = getTableRow();
-
- if (row != null) {
- final PojoField field = (PojoField)row.getItem();
-
- if (field != null) {
- if (prevGraphic == null || prevField != field) {
- setAlignment(Pos.CENTER);
-
- CheckBox ch = new CheckBox();
- ch.setDisable(!field.nullable());
- ch.selectedProperty().bindBidirectional(field.useProperty());
-
- prevField = field;
- prevGraphic = ch;
- }
-
- setGraphic(prevGraphic);
- }
- }
- }
- }
- }
-}
[13/22] ignite git commit: Fixed test.
Posted by pt...@apache.org.
Fixed test.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/676d6f77
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/676d6f77
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/676d6f77
Branch: refs/heads/ignite-3477-master
Commit: 676d6f778c8ffa50f4fbc864e8e3ce00549de34e
Parents: 512b7af
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sun Apr 9 18:30:18 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sun Apr 9 18:30:18 2017 +0700
----------------------------------------------------------------------
.../processors/rest/JettyRestProcessorAbstractSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/676d6f77/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 5e3d896..ea8aaae 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -1413,7 +1413,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
ret = content(new VisorGatewayArgument(VisorQueryTask.class)
.forNode(locNode)
- .argument(VisorQueryArg.class, "person", URLEncoder.encode("select * from Person", CHARSET), false, 1));
+ .argument(VisorQueryArg.class, "person", URLEncoder.encode("select * from Person", CHARSET), false, false, false, 1));
info("VisorQueryTask result: " + ret);
[15/22] ignite git commit: Merge remote-tracking branch
'origin/master'
Posted by pt...@apache.org.
Merge remote-tracking branch 'origin/master'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7201f2c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7201f2c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7201f2c4
Branch: refs/heads/ignite-3477-master
Commit: 7201f2c415b8c8e77585ad3585fa7f42a6804180
Parents: 139efb1 676d6f7
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Sun Apr 9 14:23:04 2017 +0200
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Sun Apr 9 14:23:04 2017 +0200
----------------------------------------------------------------------
.../processors/rest/JettyRestProcessorAbstractSelfTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[10/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
deleted file mode 100644
index 07361ba..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java
+++ /dev/null
@@ -1,199 +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.schema.parser.dialect;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.schema.parser.DbColumn;
-import org.apache.ignite.schema.parser.DbTable;
-
-/**
- * Metadata dialect that uses standard JDBC for reading metadata.
- */
-public class JdbcMetadataDialect extends DatabaseMetadataDialect {
- /** */
- private static final String[] TABLES_ONLY = {"TABLE"};
-
- /** */
- private static final String[] TABLES_AND_VIEWS = {"TABLE", "VIEW"};
-
- /** Schema catalog index. */
- private static final int TBL_CATALOG_IDX = 1;
-
- /** Schema name index. */
- private static final int TBL_SCHEMA_IDX = 2;
-
- /** Table name index. */
- private static final int TBL_NAME_IDX = 3;
-
- /** Primary key column name index. */
- private static final int PK_COL_NAME_IDX = 4;
-
- /** Column name index. */
- private static final int COL_NAME_IDX = 4;
-
- /** Column data type index. */
- private static final int COL_DATA_TYPE_IDX = 5;
-
- /** Column type name index. */
- private static final int COL_TYPE_NAME_IDX = 6;
-
- /** Column nullable index. */
- private static final int COL_NULLABLE_IDX = 11;
-
- /** Index name index. */
- private static final int IDX_NAME_IDX = 6;
-
- /** Index column name index. */
- private static final int IDX_COL_NAME_IDX = 9;
-
- /** Index column descend index. */
- private static final int IDX_ASC_OR_DESC_IDX = 10;
-
- /** {@inheritDoc} */
- @Override public Collection<String> schemas(Connection conn) throws SQLException {
- Collection<String> schemas = new ArrayList<>();
-
- ResultSet rs = conn.getMetaData().getSchemas();
-
- Set<String> sys = systemSchemas();
-
- while(rs.next()) {
- String schema = rs.getString(1);
-
- // Skip system schemas.
- if (sys.contains(schema))
- continue;
-
- schemas.add(schema);
- }
-
- return schemas;
- }
-
- /**
- * @return If {@code true} use catalogs for table division.
- */
- protected boolean useCatalog() {
- return false;
- }
-
- /**
- * @return If {@code true} use schemas for table division.
- */
- protected boolean useSchema() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException {
- DatabaseMetaData dbMeta = conn.getMetaData();
-
- Set<String> sys = systemSchemas();
-
- Collection<String> unsignedTypes = unsignedTypes(dbMeta);
-
- if (schemas.isEmpty())
- schemas.add(null);
-
- Collection<DbTable> tbls = new ArrayList<>();
-
- for (String toSchema: schemas) {
- try (ResultSet tblsRs = dbMeta.getTables(useCatalog() ? toSchema : null, useSchema() ? toSchema : null, "%",
- tblsOnly ? TABLES_ONLY : TABLES_AND_VIEWS)) {
- while (tblsRs.next()) {
- String tblCatalog = tblsRs.getString(TBL_CATALOG_IDX);
- String tblSchema = tblsRs.getString(TBL_SCHEMA_IDX);
- String tblName = tblsRs.getString(TBL_NAME_IDX);
-
- // In case of MySql we should use catalog.
- String schema = tblSchema != null ? tblSchema : tblCatalog;
-
- // Skip system schemas.
- if (sys.contains(schema))
- continue;
-
- Collection<String> pkCols = new HashSet<>();
-
- try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
- while (pkRs.next())
- pkCols.add(pkRs.getString(PK_COL_NAME_IDX));
- }
-
- Collection<DbColumn> cols = new ArrayList<>();
-
- try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) {
- while (colsRs.next()) {
- String colName = colsRs.getString(COL_NAME_IDX);
-
- cols.add(new DbColumn(
- colName,
- colsRs.getInt(COL_DATA_TYPE_IDX),
- pkCols.contains(colName),
- colsRs.getInt(COL_NULLABLE_IDX) == DatabaseMetaData.columnNullable,
- unsignedTypes.contains(colsRs.getString(COL_TYPE_NAME_IDX))));
- }
- }
-
- Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
- try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) {
- while (idxRs.next()) {
- String idxName = idxRs.getString(IDX_NAME_IDX);
-
- String colName = idxRs.getString(IDX_COL_NAME_IDX);
-
- if (idxName == null || colName == null)
- continue;
-
- QueryIndex idx = idxs.get(idxName);
-
- if (idx == null) {
- idx = index(idxName);
-
- idxs.put(idxName, idx);
- }
-
- String askOrDesc = idxRs.getString(IDX_ASC_OR_DESC_IDX);
-
- Boolean asc = askOrDesc == null || "A".equals(askOrDesc);
-
- idx.getFields().put(colName, asc);
- }
- }
-
- tbls.add(table(schema, tblName, cols, idxs.values()));
- }
- }
- }
-
- return tbls;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java
deleted file mode 100644
index 7bd6f31..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.schema.parser.dialect;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * MySQL specific metadata dialect.
- */
-public class MySQLMetadataDialect extends JdbcMetadataDialect {
- /** Type name index. */
- private static final int TYPE_NAME_IDX = 1;
-
- /** {@inheritDoc} */
- @Override public Collection<String> schemas(Connection conn) throws SQLException {
- Collection<String> schemas = new ArrayList<>();
-
- ResultSet rs = conn.getMetaData().getCatalogs();
-
- Set<String> sys = systemSchemas();
-
- while(rs.next()) {
- String schema = rs.getString(1);
-
- // Skip system schemas.
- if (sys.contains(schema))
- continue;
-
- schemas.add(schema);
- }
-
- return schemas;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useCatalog() {
- return true;
- }
-
- /** {@inheritDoc} */
- @Override protected boolean useSchema() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
- Set<String> unsignedTypes = new HashSet<>();
-
- try (ResultSet typeRs = dbMeta.getTypeInfo()) {
- while (typeRs.next()) {
- String typeName = typeRs.getString(TYPE_NAME_IDX);
-
- if (typeName.contains("UNSIGNED"))
- unsignedTypes.add(typeName);
- }
- }
-
- return unsignedTypes;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
deleted file mode 100644
index 47fb05c..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java
+++ /dev/null
@@ -1,360 +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.schema.parser.dialect;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.QueryIndexType;
-import org.apache.ignite.schema.parser.DbColumn;
-import org.apache.ignite.schema.parser.DbTable;
-
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BLOB;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.CHAR;
-import static java.sql.Types.CLOB;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.LONGVARBINARY;
-import static java.sql.Types.LONGVARCHAR;
-import static java.sql.Types.NUMERIC;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.SQLXML;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
-
-/**
- * Oracle specific metadata dialect.
- */
-public class OracleMetadataDialect extends DatabaseMetadataDialect {
- /** SQL to get columns metadata. */
- private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," +
- " a.data_type, a.data_precision, a.data_scale " +
- "FROM all_tab_columns a %s " +
- " %s " +
- " ORDER BY a.owner, a.table_name, a.column_id";
-
- /** SQL to get list of PRIMARY KEYS columns. */
- private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" +
- " FROM all_constraints a" +
- " INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" +
- " WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'";
-
- /** SQL to get indexes metadata. */
- private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" +
- " FROM all_ind_columns i" +
- " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" +
- " WHERE i.index_owner = ? and i.table_name = ?" +
- " ORDER BY i.index_name, i.column_position";
-
- /** Owner index. */
- private static final int OWNER_IDX = 1;
-
- /** Table name index. */
- private static final int TBL_NAME_IDX = 2;
-
- /** Column name index. */
- private static final int COL_NAME_IDX = 3;
-
- /** Nullable index. */
- private static final int NULLABLE_IDX = 4;
-
- /** Data type index. */
- private static final int DATA_TYPE_IDX = 5;
-
- /** Numeric precision index. */
- private static final int DATA_PRECISION_IDX = 6;
-
- /** Numeric scale index. */
- private static final int DATA_SCALE_IDX = 7;
-
- /** Index name index. */
- private static final int IDX_NAME_IDX = 1;
-
- /** Index name index. */
- private static final int IDX_EXPR_IDX = 2;
-
- /** Index column name index. */
- private static final int IDX_COL_NAME_IDX = 3;
-
- /** Index column sort order index. */
- private static final int IDX_COL_DESCEND_IDX = 4;
-
- /** {@inheritDoc} */
- @Override public Set<String> systemSchemas() {
- return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW",
- "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM",
- "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
-
- "APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM",
- "SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL",
-
- "BI", "HR", "OE", "PM", "IX", "SH"));
- }
-
- /** {@inheritDoc} */
- @Override public Collection<String> schemas(Connection conn) throws SQLException {
- Collection<String> schemas = new ArrayList<>();
-
- ResultSet rs = conn.getMetaData().getSchemas();
-
- Set<String> sysSchemas = systemSchemas();
-
- while(rs.next()) {
- String schema = rs.getString(1);
-
- if (!sysSchemas.contains(schema) && !schema.startsWith("FLOWS_"))
- schemas.add(schema);
- }
-
- return schemas;
- }
-
- /**
- * @param rs Result set with column type metadata from Oracle database.
- * @return JDBC type.
- * @throws SQLException If failed to decode type.
- */
- private int decodeType(ResultSet rs) throws SQLException {
- String type = rs.getString(DATA_TYPE_IDX);
-
- if (type.startsWith("TIMESTAMP"))
- return TIMESTAMP;
- else {
- switch (type) {
- case "CHAR":
- case "NCHAR":
- return CHAR;
-
- case "VARCHAR2":
- case "NVARCHAR2":
- return VARCHAR;
-
- case "LONG":
- return LONGVARCHAR;
-
- case "LONG RAW":
- return LONGVARBINARY;
-
- case "FLOAT":
- return FLOAT;
-
- case "NUMBER":
- int precision = rs.getInt(DATA_PRECISION_IDX);
- int scale = rs.getInt(DATA_SCALE_IDX);
-
- if (scale > 0) {
- if (scale < 4 && precision < 19)
- return FLOAT;
-
- if (scale > 4 || precision > 19)
- return DOUBLE;
-
- return NUMERIC;
- }
- else {
- if (precision < 1)
- return INTEGER;
-
- if (precision < 2)
- return BOOLEAN;
-
- if (precision < 4)
- return TINYINT;
-
- if (precision < 6)
- return SMALLINT;
-
- if (precision < 11)
- return INTEGER;
-
- if (precision < 20)
- return BIGINT;
-
- return NUMERIC;
- }
-
- case "DATE":
- return DATE;
-
- case "BFILE":
- case "BLOB":
- return BLOB;
-
- case "CLOB":
- case "NCLOB":
- return CLOB;
-
- case "XMLTYPE":
- return SQLXML;
- }
- }
-
- return OTHER;
- }
-
- /**
- * Retrieve primary key columns.
- *
- * @param stmt Prepared SQL statement to execute.
- * @param owner DB owner.
- * @param tbl Table name.
- * @return Primary key columns.
- * @throws SQLException If failed to retrieve primary key columns.
- */
- private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Set<String> pkCols = new HashSet<>();
-
- stmt.setString(1, owner);
- stmt.setString(2, tbl);
-
- try (ResultSet pkRs = stmt.executeQuery()) {
- while(pkRs.next())
- pkCols.add(pkRs.getString(1));
- }
-
- return pkCols;
- }
-
- /**
- * Retrieve index columns.
- *
- * @param stmt Prepared SQL statement to execute.
- * @param owner DB owner.
- * @param tbl Table name.
- * @return Indexes.
- * @throws SQLException If failed to retrieve indexes columns.
- */
- private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
- Map<String, QueryIndex> idxs = new LinkedHashMap<>();
-
- stmt.setString(1, owner);
- stmt.setString(2, tbl);
-
- try (ResultSet idxsRs = stmt.executeQuery()) {
- while (idxsRs.next()) {
- String idxName = idxsRs.getString(IDX_NAME_IDX);
-
- QueryIndex idx = idxs.get(idxName);
-
- if (idx == null) {
- idx = index(idxName);
-
- idxs.put(idxName, idx);
- }
-
- String expr = idxsRs.getString(IDX_EXPR_IDX);
-
- String col = expr == null ? idxsRs.getString(IDX_COL_NAME_IDX) : expr.replaceAll("\"", "");
-
- idx.getFields().put(col, !"DESC".equals(idxsRs.getString(IDX_COL_DESCEND_IDX)));
- }
- }
-
- return idxs.values();
- }
-
- /** {@inheritDoc} */
- @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException {
- Collection<DbTable> tbls = new ArrayList<>();
-
- PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS);
-
- PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES);
-
- if (schemas.isEmpty())
- schemas.add(null);
-
- Set<String> sysSchemas = systemSchemas();
-
- try (Statement colsStmt = conn.createStatement()) {
- for (String schema: schemas) {
- if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_")))
- continue;
-
- Collection<DbColumn> cols = new ArrayList<>();
-
- Set<String> pkCols = Collections.emptySet();
- Collection<QueryIndex> idxs = Collections.emptyList();
-
- String sql = String.format(SQL_COLUMNS,
- tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "",
- schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : "");
-
- try (ResultSet colsRs = colsStmt.executeQuery(sql)) {
- String prevSchema = "";
- String prevTbl = "";
-
- boolean first = true;
-
- while (colsRs.next()) {
- String owner = colsRs.getString(OWNER_IDX);
- String tbl = colsRs.getString(TBL_NAME_IDX);
-
- if (sysSchemas.contains(owner) || (schema != null && schema.startsWith("FLOWS_")))
- continue;
-
- boolean changed = !owner.equals(prevSchema) || !tbl.equals(prevTbl);
-
- if (changed) {
- if (first)
- first = false;
- else
- tbls.add(table(prevSchema, prevTbl, cols, idxs));
-
- prevSchema = owner;
- prevTbl = tbl;
- cols = new ArrayList<>();
- pkCols = primaryKeys(pkStmt, owner, tbl);
- idxs = indexes(idxStmt, owner, tbl);
- }
-
- String colName = colsRs.getString(COL_NAME_IDX);
-
- cols.add(new DbColumn(colName, decodeType(colsRs), pkCols.contains(colName),
- !"N".equals(colsRs.getString(NULLABLE_IDX)), false));
- }
-
- if (!cols.isEmpty())
- tbls.add(table(prevSchema, prevTbl, cols, idxs));
- }
- }
- }
-
- return tbls;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/README.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/README.txt b/modules/schema-import/README.txt
deleted file mode 100644
index ba185b6..0000000
--- a/modules/schema-import/README.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-Apache Ignite Schema Import Module
-------------------------------------------
-
-Ignite ships with its own database schema mapping wizard which provides automatic support for integrating with
-persistence stores. This utility automatically connects to the underlying database and generates all the required
-XML OR-mapping configuration and Java domain model POJOs.
-
-To start the wizard for generating database schema mapping, execute bin/ignite-schema-import.sh script:
-
-For connection with RDBMS system from utility you need to provide: connection url and jdbc driver.
-Note that JDBC drivers are not supplied with the utility and should be provided separately.
-
-Moving from disk-based architectures to in-memory architectures
-------------------------------------------
-
-Use Schema Import Utility for generation of type mapping and domain model in Java.
-
-For example you may use the following script for create sample type 'Person' in your RDBMS system:
-
-create table PERSON(id integer not null PRIMARY KEY, first_name varchar(50), last_name varchar(50), salary double);
-
-insert into PERSON(id, first_name, last_name, salary) values(1, 'Johannes', 'Kepler', 1000);
-insert into PERSON(id, first_name, last_name, salary) values(2, 'Galileo', 'Galilei', 1200);
-insert into PERSON(id, first_name, last_name, salary) values(3, 'Henry', 'More', 1150);
-insert into PERSON(id, first_name, last_name, salary) values(4, 'Polish', 'Brethren', 2000);
-insert into PERSON(id, first_name, last_name, salary) values(5, 'Robert', 'Boyle', 2500);
-insert into PERSON(id, first_name, last_name, salary) values(6, 'Isaac', 'Newton', 1300);
-
-The Ignite Schema Import utility generates the following artifacts:
- # Java POJO key and value classes (enter "org.apache.ignite.schema" package name before generation).
- # XML QueryEntities configuration.
- # Java configuration snippet (alternative to XML).
-
-After you exit from the wizard, you should:
- # Copy generated POJO java classes to you project source folder.
- # Copy XML declaration of QueryEntitres to your Ignite XML configuration file under appropriate
- CacheConfiguration root.
- # Setup your Ignite XML configuration file DataSource to your RDBMS system for CacheJdbcPojoStore.
- # Or paste Java snippet with cache configuration into your Ignite initialization logic.
- # You need place compiled domain model classes, jdbc driver (used for connect to you RDBMS system) in Ignite node
- classpath, for example place in 'libs' folder.
-
-Example of spring configuration:
-
-<!-- Sample data source. -->
-<bean id="myDataSource" class="org.h2.jdbcx.JdbcDataSource"/>
-
-<bean class="org.apache.ignite.configuration.IgniteConfiguration">
- ...
- <!-- Cache configuration. -->
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- ...
-
- <!-- Cache store. -->
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
- <property name="dataSourceBean" value="myDataSource"/>
- <bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore">
- <property name="dataSourceBean" value="myDataSource" />
- <property name="types">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
- <property name="cacheName" value="myCache" />
- <property name="databaseSchema" value="MY_DB_SCHEMA" />
- <property name="databaseTable" value="PERSON" />
- <property name="keyType" value="java.lang.Integer" />
- <property name="keyFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType" >
- <util:constant static-field="java.sql.Types.INTEGER"/>
- </property>
- <property name="databaseFieldName" value="ID" />
- <property name="javaFieldType" value="java.lang.Integer" />
- <property name="javaFieldName" value="id" />
- </bean>
- </list>
- </property>
- <property name="valueType" value="my.company.Person" />
- <property name="valueFields">
- <list>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType" >
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="first_name" />
- <property name="javaFieldType" value="java.lang.String" />
- <property name="javaFieldName" value="firstName" />
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType" >
- <util:constant static-field="java.sql.Types.VARCHAR"/>
- </property>
- <property name="databaseFieldName" value="last_name" />
- <property name="javaFieldType" value="java.lang.String" />
- <property name="javaFieldName" value="lastName" />
- </bean>
- <bean class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
- <property name="databaseFieldType" >
- <util:constant static-field="java.sql.Types.DOUBLE"/>
- </property>
- <property name="databaseFieldName" value="salary" />
- <property name="javaFieldType" value="java.lang.Double" />
- <property name="javaFieldName" value="salary" />
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- </bean>
- </property>
- ...
- </bean>
- </list>
- </property>
- ...
-</bean>
-
-Example of java code configuration:
-
-IgniteConfiguration cfg = new IgniteConfiguration();
-...
-CacheConfiguration ccfg = new CacheConfiguration<>();
-
-// Create store factory.
-CacheJdbcPojoStoreFactory storeFactory = new CacheJdbcPojoStoreFactory();
-storeFactory.setDataSourceBean("myDataSource");
-
-// Configure cache types.
-Collection<JdbcType> jdbcTypes = new ArrayList<>();
-
-// PERSON type mapping.
-JdbcType jdbcType = new JdbcType();
-
-jdbcType.setCacheName(CACHE_NAME);
-
-jdbcType.setDatabaseSchema("MY_DB_SCHEMA");
-jdbcType.setDatabaseTable("PERSON");
-
-jdbcType.setKeyType("java.lang.Integer");
-jdbcType.setValueType("my.company.Person");
-
-// Key fields for PERSONS.
-jdbcType.setKeyFields(F.asArray(new JdbcType(Types.INTEGER, "ID", Integer.class, "id")));
-
-// Value fields for PERSONS.
-jdbcType.setValueFields(F.asArray(
- new JdbcType(Types.INTEGER, "ID", int.class, "id"),
- new JdbcType(Types.VARCHAR, "first_name", String.class, "firstName"),
- new JdbcType(Types.VARCHAR, "last_name", String.class, "lastName"),
- new JdbcType(Types.DOUBLE, "salary", Double.class, "salary")
-));
-
-storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[]));
-
-// Configure cache to use store.
-ccfg.setReadThrough(true);
-ccfg.setWriteThrough(true);
-ccfg.setCacheStoreFactory(storeFactory);
-
-cfg.setCacheConfiguration(ccfg);
-
-...
-
-// Start Ignite node.
-Ignition.start(cfg);
-
-Now you can load all data from database to cache:
- IgniteCache<Long, Person> cache = ignite.jcache(CACHE_NAME);
- cache.loadCache(null);
-
-Or you can load data from database to cache with custom SQL:
- cache.loadCache(null, "java.lang.Long", "select * from PERSON where id = 2")
-
-Also if you put data into cache it will be inserted / updated in underlying database.
-
-
-Performance optimization.
-------------------------------------------
-
-1. Use DataSource with connection pool.
-2. Enable write-behind feature by default write-behind is disabled.
- Note, write-behind should not be used with TRANSACTIONAL caches.
-
-Example of spring configuration:
-
-<bean class="org.apache.ignite.configuration.IgniteConfiguration">
- ...
- <!-- Cache configuration. -->
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- ...
- <!-- Sets flag indicating whether write-behind is enabled.. -->
- <property name="writeBehindEnabled" value="true/>
- ...
- </bean>
- </list>
- </property>
- ...
-</bean>
-
-Example of java code configuration:
-
-IgniteConfiguration cfg = new IgniteConfiguration();
-...
-CacheConfiguration ccfg = new CacheConfiguration<>();
-...
-ccfg.setWriteBehindEnabled(true);
-...
-// Start Ignite node.
-Ignition.start(cfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
deleted file mode 100644
index 5380dcc..0000000
--- a/modules/schema-import/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-parent</artifactId>
- <version>1</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>ignite-schema-import</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <url>http://ignite.apache.org</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-schema-import-db</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
-
- <testResources>
- <testResource>
- <directory>src/test/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </testResource>
- </testResources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.apache.ignite.schema.ui.SchemaImportApp</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>schema-import</id>
- <activation>
- <file>
- <exists>${java.home}/lib/jfxrt.jar</exists>
- </file>
- </activation>
- <dependencies>
- <dependency>
- <groupId>javafx</groupId>
- <artifactId>jfxrt</artifactId>
- <version>${java.version}</version>
- <scope>system</scope>
- <systemPath>${java.home}/lib/jfxrt.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/data_connection_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/data_connection_48x48.png b/modules/schema-import/src/main/java/media/data_connection_48x48.png
deleted file mode 100644
index 475f219..0000000
Binary files a/modules/schema-import/src/main/java/media/data_connection_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/error_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/error_48x48.png b/modules/schema-import/src/main/java/media/error_48x48.png
deleted file mode 100644
index e341b8a..0000000
Binary files a/modules/schema-import/src/main/java/media/error_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_128x128.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_128x128.png b/modules/schema-import/src/main/java/media/ignite_128x128.png
deleted file mode 100644
index d99a83c..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_128x128.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_16x16.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_16x16.png b/modules/schema-import/src/main/java/media/ignite_16x16.png
deleted file mode 100644
index 3e07d33..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_16x16.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_24x24.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_24x24.png b/modules/schema-import/src/main/java/media/ignite_24x24.png
deleted file mode 100644
index 8da5c97..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_24x24.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_32x32.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_32x32.png b/modules/schema-import/src/main/java/media/ignite_32x32.png
deleted file mode 100644
index c6c6819..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_32x32.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_48x48.png b/modules/schema-import/src/main/java/media/ignite_48x48.png
deleted file mode 100644
index 5b684cc..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/ignite_64x64.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/ignite_64x64.png b/modules/schema-import/src/main/java/media/ignite_64x64.png
deleted file mode 100644
index c1d348b..0000000
Binary files a/modules/schema-import/src/main/java/media/ignite_64x64.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/information_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/information_48x48.png b/modules/schema-import/src/main/java/media/information_48x48.png
deleted file mode 100644
index 8712a1b..0000000
Binary files a/modules/schema-import/src/main/java/media/information_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/question_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/question_48x48.png b/modules/schema-import/src/main/java/media/question_48x48.png
deleted file mode 100644
index 84683f9..0000000
Binary files a/modules/schema-import/src/main/java/media/question_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/sign_warning_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/sign_warning_48x48.png b/modules/schema-import/src/main/java/media/sign_warning_48x48.png
deleted file mode 100644
index 5e7cccd..0000000
Binary files a/modules/schema-import/src/main/java/media/sign_warning_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/style.css
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/style.css b/modules/schema-import/src/main/java/media/style.css
deleted file mode 100644
index 6eee5f9..0000000
--- a/modules/schema-import/src/main/java/media/style.css
+++ /dev/null
@@ -1,134 +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.
- */
-
-.root {
- -fx-background-color: eeeeee;
-}
-
-.button {
- -fx-font-size: 14;
- -fx-focus-color: gray;
-}
-
-.label {
- -fx-font-size: 14;
-}
-
-.check-box {
- -fx-font-size: 14;
- -fx-focus-color: gray;
-}
-
-.combo-box-base {
- -fx-font-size: 14;
- -fx-focus-color: gray;
-}
-
-.combo-box-popup .list-view {
- -fx-font-size : 14;
-}
-
-.text-area {
- -fx-font-size: 14;
- -fx-background-color: transparent, transparent, transparent;
-}
-
-.text-area .scroll-pane {
- -fx-background-color: transparent;
-}
-
-.text-area .scroll-pane .viewport{
- -fx-background-color: transparent;
-}
-
-.text-area .scroll-pane .content{
- -fx-background-color: transparent;
-}
-
-.text-area .scroll-bar:vertical:disabled {
- -fx-opacity: 0;
-}
-
-.text-field {
- -fx-font-size: 14;
- -fx-background-color: -fx-text-box-border, -fx-control-inner-background, -fx-control-inner-background;
-}
-
-.text-field:focused {
- -fx-background-color: -fx-text-box-border, -fx-control-inner-background, -fx-control-inner-background;
-}
-
-.table-view {
- -fx-focus-color: gray;
- -fx-font-size: 14;
-}
-
-.table-view .table-row-cell:selected {
- -fx-background-color: -fx-table-cell-border-color, -fx-cell-hover-color;
- -fx-background-insets: 0, 0 0 1 0;
-}
-
-.table-view:focused .table-row-cell:selected {
- -fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-selection-bar;
-}
-
-.table-row-cell:empty {
- -fx-background-color: white;
-}
-
-.table-row-cell:empty .table-cell {
- -fx-border-width: 0px;
-}
-
-.tooltip {
- -fx-font-size: 14;
- -fx-background-radius: 0 0 0 0;
-}
-
-.page-corner {
- -fx-shape: " ";
-}
-
-.progress-indicator {
- -fx-progress-color: gray
-}
-
-.split-pane {
- -fx-background-color: -fx-box-border, eeeeee;
-}
-
-.titled-pane {
- -fx-font-size: 14;
-}
-
-.titled-pane:focused {
- -fx-text-fill: -fx-text-base-color;
-}
-
-.titled-pane:focused > .title {
- -fx-color: eeeeee;
-}
-
-.titled-pane:focused > .title > .arrow-button .arrow {
- -fx-background-color: black;
-}
-
-#banner {
- -fx-font-size: 20px;
- -fx-font-weight: bold;
- -fx-background-color: white
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/media/text_tree_48x48.png
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/text_tree_48x48.png b/modules/schema-import/src/main/java/media/text_tree_48x48.png
deleted file mode 100644
index 6ca9e65..0000000
Binary files a/modules/schema-import/src/main/java/media/text_tree_48x48.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
deleted file mode 100644
index 5cdc6c6..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ /dev/null
@@ -1,831 +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.schema.generator;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.ui.ConfirmCallable;
-import org.apache.ignite.schema.ui.MessageBox;
-
-import static org.apache.ignite.schema.ui.MessageBox.Result.CANCEL;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO_TO_ALL;
-
-/**
- * Code generator of POJOs for key and value classes and configuration snippet.
- */
-public class CodeGenerator {
- /** */
- private static final String TAB = " ";
- /** */
- private static final String TAB2 = TAB + TAB;
- /** */
- private static final String TAB3 = TAB + TAB + TAB;
-
- /** Java key words. */
- private static final Set<String> JAVA_KEYWORDS = new HashSet<>(Arrays.asList(
- "abstract", "assert", "boolean", "break", "byte",
- "case", "catch", "char", "class", "const",
- "continue", "default", "do", "double", "else",
- "enum", "extends", "false", "final", "finally",
- "float", "for", "goto", "if", "implements",
- "import", "instanceof", "int", "interface", "long",
- "native", "new", "null", "package", "private",
- "protected", "public", "return", "short", "static",
- "strictfp", "super", "switch", "synchronized", "this",
- "throw", "throws", "transient", "true", "try",
- "void", "volatile", "while"
- ));
-
- /** java.lang.* */
- private static final String JAVA_LANG_PKG = "java.lang.";
-
- /** java.util.* */
- private static final String JAVA_UTIL_PKG = "java.util.";
-
- /** Regexp to validate java identifier. */
- private static final Pattern VALID_JAVA_IDENTIFIER =
- Pattern.compile("\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*");
-
- /**
- * Checks if string is a valid java identifier.
- *
- * @param identifier String to check.
- * @param split If {@code true} then identifier will be split by dots.
- * @param msg Identifier type.
- * @param type Checked type.
- * @throws IllegalStateException If passed string is not valid java identifier.
- */
- private static void checkValidJavaIdentifier(String identifier, boolean split, String msg, String type)
- throws IllegalStateException {
- if (identifier.isEmpty())
- throw new IllegalStateException(msg + " could not be empty!");
-
- String[] parts = split ? identifier.split("\\.") : new String[] {identifier};
-
- if (parts.length == 0)
- throw new IllegalStateException(msg + " could not has empty parts!");
-
- for (String part : parts) {
- if (part.isEmpty())
- throw new IllegalStateException(msg + " could not has empty parts!");
-
- if (JAVA_KEYWORDS.contains(part))
- throw new IllegalStateException(msg + " could not contains reserved keyword:" +
- " [type = " + type + ", identifier=" + identifier + ", keyword=" + part + "]");
-
- if (!VALID_JAVA_IDENTIFIER.matcher(part).matches())
- throw new IllegalStateException("Invalid " + msg.toLowerCase() + " name: " +
- " [type = " + type + ", identifier=" + identifier + ", illegal part=" + part + "]");
- }
- }
-
- /**
- * Add line to source code without indent.
- *
- * @param src Source code.
- * @param line Code line.
- */
- private static void add0(Collection<String> src, String line) {
- src.add(line);
- }
-
- /**
- * Add line to source code with one indent.
- *
- * @param src Source code.
- * @param line Code line.
- */
- private static void add1(Collection<String> src, String line) {
- src.add(TAB + line);
- }
-
- /**
- * Add line to source code with two indents.
- *
- * @param src Source code.
- * @param line Code line.
- */
- private static void add2(Collection<String> src, String line) {
- src.add(TAB2 + line);
- }
-
- /**
- * Add line to source code with two indents.
- *
- * @param src Source code.
- * @param fmt Code line with format placeholders.
- * @param args Format arguments.
- */
- private static void add2Fmt(Collection<String> src, String fmt, Object... args) {
- add2(src, String.format(fmt, args));
- }
-
- /**
- * Add line to source code with three indents.
- *
- * @param src Source code.
- * @param line Code line.
- */
- private static void add3(Collection<String> src, String line) {
- src.add(TAB3 + line);
- }
-
- /**
- * @param str Source string.
- * @return String with first letters in upper case.
- */
- private static String capitalizeFirst(String str) {
- return Character.toUpperCase(str.charAt(0)) + str.substring(1);
- }
-
- /**
- * @param type Full type name.
- * @return Field java type name.
- */
- private static String javaTypeName(String type) {
- return type.startsWith("java.lang.") ? type.substring(10) : type;
- }
-
- /**
- * @param field POJO field descriptor.
- * @return Field java type name.
- */
- private static String javaTypeName(PojoField field) {
- return javaTypeName(field.javaTypeName());
- }
-
- /**
- * Generate class header.
- *
- * @param src Source code.
- * @param pkg Package name.
- * @param desc Class description.
- * @param cls Class declaration.
- * @param imports Optional imports.
- */
- private static void header(Collection<String> src, String pkg, String desc, String cls, String... imports) {
- // License.
- add0(src, "/*");
- add0(src, " * Licensed to the Apache Software Foundation (ASF) under one or more");
- add0(src, " * contributor license agreements. See the NOTICE file distributed with");
- add0(src, " * this work for additional information regarding copyright ownership.");
- add0(src, " * The ASF licenses this file to You under the Apache License, Version 2.0");
- add0(src, " * (the \"License\"); you may not use this file except in compliance with");
- add0(src, " * the License. You may obtain a copy of the License at");
- add0(src, " *");
- add0(src, " * http://www.apache.org/licenses/LICENSE-2.0");
- add0(src, " *");
- add0(src, " * Unless required by applicable law or agreed to in writing, software");
- add0(src, " * distributed under the License is distributed on an \"AS IS\" BASIS,");
- add0(src, " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
- add0(src, " * See the License for the specific language governing permissions and");
- add0(src, " * limitations under the License.");
- add0(src, " */");
- add0(src, "");
-
- // Package.
- add0(src, "package " + pkg + ";");
- add0(src, "");
-
- // Imports.
- if (imports != null && imports.length > 0) {
- for (String imp : imports)
- add0(src, imp.isEmpty() ? "" : "import " + imp + ";");
-
- add0(src, "");
- }
-
- // Class.
- add0(src, "/**");
- add0(src, " * " + desc + " definition.");
- add0(src, " *");
- add0(src, " * Code generated by Apache Ignite Schema Import utility: "
- + new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + ".");
- add0(src, " */");
- add0(src, "public class " + cls + " {");
- }
-
- /**
- * Write source code to file.
- *
- * @param src Source code.
- * @param out Target file.
- * @throws IOException If failed to write source code to file.
- */
- private static void write(Collection<String> src, File out) throws IOException {
- // Write generated code to file.
- try (Writer writer = new BufferedWriter(new FileWriter(out))) {
- for (String line : src)
- writer.write(line + '\n');
- }
- }
-
- /**
- * Ensure that all folders for packages exist.
- *
- * @param pkg Packages.
- * @throws IOException If failed to ensure.
- */
- private static void ensurePackages(File pkg) throws IOException {
- if (!pkg.exists() && !pkg.mkdirs())
- throw new IOException("Failed to create folders for package: " + pkg);
- }
-
- /**
- * Generate java class code.
- *
- * @param pojo POJO descriptor.
- * @param key {@code true} if key class should be generated.
- * @param pkg Package name.
- * @param pkgFolder Folder where to save generated class.
- * @param constructor {@code true} if empty and full constructors should be generated.
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @param askOverwrite Callback to ask user to confirm file overwrite.
- * @throws IOException If failed to write generated code into file.
- */
- private static void generateCode(PojoDescriptor pojo, boolean key, String pkg, File pkgFolder,
- boolean constructor, boolean includeKeys, ConfirmCallable askOverwrite) throws IOException {
- String type = key ? pojo.keyClassName() : pojo.valueClassName();
-
- checkValidJavaIdentifier(pkg, true, "Package", type);
-
- checkValidJavaIdentifier(type, false, "Type", type);
-
- ensurePackages(pkgFolder);
-
- File out = new File(pkgFolder, type + ".java");
-
- if (out.exists()) {
- MessageBox.Result choice = askOverwrite.confirm(out.getName());
-
- if (CANCEL == choice)
- throw new IllegalStateException("POJO generation was canceled!");
-
- if (NO == choice || NO_TO_ALL == choice)
- return;
- }
-
- Collection<String> src = new ArrayList<>(256);
-
- header(src, pkg, type, type + " implements Serializable", "java.io.*");
-
- add1(src, "/** */");
- add1(src, "private static final long serialVersionUID = 0L;");
- add0(src, "");
-
- Collection<PojoField> fields = key ? pojo.keyFields() : pojo.valueFields(includeKeys);
-
- // Generate fields declaration.
- for (PojoField field : fields) {
- String fldName = field.javaName();
-
- checkValidJavaIdentifier(fldName, false, "Field", type);
-
- add1(src, "/** Value for " + fldName + ". */");
-
- if (key && field.affinityKey())
- add1(src, "@AffinityKeyMapped");
-
- add1(src, "private " + javaTypeName(field) + " " + fldName + ";");
- add0(src, "");
- }
-
- // Generate constructors.
- if (constructor) {
- add1(src, "/**");
- add1(src, " * Empty constructor.");
- add1(src, " */");
- add1(src, "public " + type + "() {");
- add2(src, "// No-op.");
- add1(src, "}");
-
- add0(src, "");
-
- add1(src, "/**");
- add1(src, " * Full constructor.");
- add1(src, " */");
- add1(src, "public " + type + "(");
-
- Iterator<PojoField> it = fields.iterator();
-
- while (it.hasNext()) {
- PojoField field = it.next();
-
- add2(src, javaTypeName(field) + " " + field.javaName() + (it.hasNext() ? "," : ""));
- }
- add1(src, ") {");
-
- for (PojoField field : fields)
- add2Fmt(src, "this.%1$s = %1$s;", field.javaName());
-
- add1(src, "}");
- add0(src, "");
- }
-
- // Generate getters and setters methods.
- for (PojoField field : fields) {
- String fldName = field.javaName();
-
- String fldType = javaTypeName(field);
-
- String mtdName = capitalizeFirst(fldName);
-
- add1(src, "/**");
- add1(src, " * Gets " + fldName + ".");
- add1(src, " *");
- add1(src, " * @return Value for " + fldName + ".");
- add1(src, " */");
- add1(src, "public " + fldType + " get" + mtdName + "() {");
- add2(src, "return " + fldName + ";");
- add1(src, "}");
- add0(src, "");
-
- add1(src, "/**");
- add1(src, " * Sets " + fldName + ".");
- add1(src, " *");
- add1(src, " * @param " + fldName + " New value for " + fldName + ".");
- add1(src, " */");
- add1(src, "public void set" + mtdName + "(" + fldType + " " + fldName + ") {");
- add2(src, "this." + fldName + " = " + fldName + ";");
- add1(src, "}");
- add0(src, "");
- }
-
- // Generate equals() method.
- add1(src, "/** {@inheritDoc} */");
- add1(src, "@Override public boolean equals(Object o) {");
- add2(src, "if (this == o)");
- add3(src, "return true;");
- add0(src, "");
-
- add2(src, "if (!(o instanceof " + type + "))");
- add3(src, "return false;");
- add0(src, "");
-
- add2Fmt(src, "%1$s that = (%1$s)o;", type);
-
- for (PojoField field : fields) {
- add0(src, "");
-
- String javaName = field.javaName();
-
- if (field.primitive()) {
- switch (field.javaTypeName()) {
- case "float":
- add2Fmt(src, "if (Float.compare(%1$s, that.%1$s) != 0)", javaName);
- break;
-
- case "double":
- add2Fmt(src, "if (Double.compare(%1$s, that.%1$s) != 0)", javaName);
- break;
-
- default:
- add2Fmt(src, "if (%1$s != that.%1$s)", javaName);
- }
- }
- else
- add2Fmt(src, "if (%1$s != null ? !%1$s.equals(that.%1$s) : that.%1$s != null)", javaName);
-
- add3(src, "return false;");
- }
-
- add0(src, "");
- add2(src, "return true;");
- add1(src, "}");
- add0(src, "");
-
- // Generate hashCode() method.
- add1(src, "/** {@inheritDoc} */");
- add1(src, "@Override public int hashCode() {");
-
- List<String> hash = new ArrayList<>(fields.size() * 2);
-
- boolean first = true;
- boolean tempVar = false;
-
- for (PojoField field : fields) {
- String javaName = field.javaName();
-
- if (!first)
- add0(hash, "");
-
- if (field.primitive()) {
- switch (field.javaTypeName()) {
- case "boolean":
- add2Fmt(hash, first ? "int res = %s ? 1 : 0;" : "res = 31 * res + (%s ? 1 : 0);", javaName);
- break;
-
- case "byte":
- case "short":
- add2Fmt(hash, first ? "int res = (int)%s;" : "res = 31 * res + (int)%s;", javaName);
- break;
-
- case "int":
- add2Fmt(hash, first ? "int res = %s;" : "res = 31 * res + %s;", javaName);
- break;
-
- case "long":
- add2Fmt(hash, first
- ? "int res = (int)(%1$s ^ (%1$s >>> 32));"
- : "res = 31 * res + (int)(%1$s ^ (%1$s >>> 32));", javaName);
- break;
-
- case "float":
- add2Fmt(hash, first
- ? "int res = %1$s != +0.0f ? Float.floatToIntBits(%1$s) : 0;"
- : "res = 31 * res + (%1$s != +0.0f ? Float.floatToIntBits(%1$s) : 0);", javaName);
- break;
-
- case "double":
- add2Fmt(hash, (tempVar ? "ig_hash_temp" : "long ig_hash_temp") +
- " = Double.doubleToLongBits(%s);", javaName);
-
- add0(hash, "");
-
- add2Fmt(hash, first
- ? "int res = (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));"
- : "res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));", javaName);
-
- tempVar = true;
- break;
- }
- }
- else
- add2Fmt(hash, first ? "int res = %1$s != null ? %1$s.hashCode() : 0;"
- : "res = 31 * res + (%1$s != null ? %1$s.hashCode() : 0);", javaName);
-
- first = false;
- }
-
- for (String line : hash)
- add0(src, line);
-
- add0(src, "");
- add2(src, "return res;");
- add1(src, "}");
- add0(src, "");
-
- // Generate toString() method.
- add1(src, "/** {@inheritDoc} */");
- add1(src, "@Override public String toString() {");
-
- Iterator<PojoField> it = fields.iterator();
-
- add2Fmt(src, "return \"%1$s [%2$s=\" + %2$s +", type, it.next().javaName());
-
- while (it.hasNext())
- add3(src, String.format("\", %1$s=\" + %1$s +", it.next().javaName()));
-
- add3(src, "\"]\";");
- add1(src, "}");
-
- add0(src, "}");
- add0(src, "");
-
- // Write generated code to file.
- write(src, out);
- }
-
- /**
- * Generate source code for type by its metadata.
- *
- * @param pojo POJO descriptor.
- * @param outFolder Output folder.
- * @param pkg Types package.
- * @param constructor {@code true} if empty and full constructors should be generated.
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @param askOverwrite Callback to ask user to confirm file overwrite.
- * @throws IOException If failed to write generated code into file.
- */
- public static void pojos(PojoDescriptor pojo, String outFolder, String pkg, boolean constructor,
- boolean includeKeys, ConfirmCallable askOverwrite) throws IOException {
- File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar));
-
- generateCode(pojo, true, pkg, pkgFolder, constructor, false, askOverwrite);
-
- generateCode(pojo, false, pkg, pkgFolder, constructor, includeKeys, askOverwrite);
- }
-
- /**
- * Add type fields.
- *
- * @param src Source code lines.
- * @param owner Fields owner collection.
- * @param fields Fields metadata.
- */
- private static void addFields(Collection<String> src, String owner, Collection<PojoField> fields) {
- for (PojoField field : fields) {
- String javaTypeName = field.javaTypeName();
-
- if (javaTypeName.startsWith(JAVA_LANG_PKG))
- javaTypeName = javaTypeName.substring(JAVA_LANG_PKG.length());
- else if (javaTypeName.startsWith(JAVA_UTIL_PKG))
- javaTypeName = javaTypeName.substring(JAVA_UTIL_PKG.length());
-
- add2(src, owner + ".add(new JdbcTypeField(Types." + field.dbTypeName() + ", \"" + field.dbName() + "\", " +
- javaTypeName + ".class, \"" + field.javaName() + "\"));");
- }
- }
-
- /**
- * Generate java snippet for cache configuration with JDBC store and types metadata.
- *
- * @param pojos POJO descriptors.
- * @param pkg Types package.
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @param generateAliases {@code true} if aliases should be generated for query fields.
- * @param outFolder Output folder.
- * @param askOverwrite Callback to ask user to confirm file overwrite.
- * @throws IOException If generation failed.
- */
- public static void snippet(Collection<PojoDescriptor> pojos, String pkg, boolean includeKeys,
- boolean generateAliases, String outFolder, ConfirmCallable askOverwrite) throws IOException {
- File pkgFolder = new File(outFolder, pkg.replace('.', File.separatorChar));
-
- ensurePackages(pkgFolder);
-
- File cacheCfg = new File(pkgFolder, "CacheConfig.java");
-
- if (cacheCfg.exists()) {
- MessageBox.Result choice = askOverwrite.confirm(cacheCfg.getName());
-
- if (CANCEL == choice)
- throw new IllegalStateException("Java snippet generation was canceled!");
-
- if (NO == choice || NO_TO_ALL == choice)
- return;
- }
-
- Collection<String> src = new ArrayList<>(256);
-
- header(src, pkg, "CacheConfig", "CacheConfig", "java.sql.*", "java.util.*", "", "org.apache.ignite.cache.*",
- "org.apache.ignite.cache.store.jdbc.*", "org.apache.ignite.configuration.*");
-
- // Generate methods for each type in order to avoid compiler error "java: code too large".
- for (PojoDescriptor pojo : pojos) {
- String tbl = pojo.table();
- String valClsName = pojo.valueClassName();
- Collection<PojoField> fields = pojo.valueFields(true);
-
- add1(src, "/**");
- add1(src, " * Create JDBC type for " + tbl + ".");
- add1(src, " *");
- add1(src, " * @param cacheName Cache name.");
- add1(src, " * @return Configured JDBC type.");
- add1(src, " */");
- add1(src, "private static JdbcType jdbcType" + valClsName + "(String cacheName) {");
-
- add2(src, "JdbcType jdbcType = new JdbcType();");
- add0(src, "");
-
- add2(src, "jdbcType.setCacheName(cacheName);");
-
- // Database schema.
- if (pojo.schema() != null)
- add2(src, "jdbcType.setDatabaseSchema(\"" + pojo.schema() + "\");");
-
- // Database table.
- add2(src, "jdbcType.setDatabaseTable(\"" + tbl + "\");");
-
- // Java info.
- add2(src, "jdbcType.setKeyType(\"" + pkg + "." + pojo.keyClassName() + "\");");
- add2(src, "jdbcType.setValueType(\"" + pkg + "." + valClsName + "\");");
- add0(src, "");
-
- // Key fields.
- add2(src, "// Key fields for " + tbl + ".");
- add2(src, "Collection<JdbcTypeField> keys = new ArrayList<>();");
- addFields(src, "keys", pojo.keyFields());
- add2(src, "jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));");
- add0(src, "");
-
- // Value fields.
- add2(src, "// Value fields for " + tbl + ".");
- add2(src, "Collection<JdbcTypeField> vals = new ArrayList<>();");
- addFields(src, "vals", pojo.valueFields(includeKeys));
- add2(src, "jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));");
- add0(src, "");
- add2(src, "return jdbcType;");
- add1(src, "}");
- add0(src, "");
-
- add1(src, "/**");
- add1(src, " * Create SQL Query descriptor for " + tbl + ".");
- add1(src, " *");
- add1(src, " * @return Configured query entity.");
- add1(src, " */");
- add1(src, "private static QueryEntity queryEntity" + valClsName + "() {");
-
- // Query entity.
- add2(src, "QueryEntity qryEntity = new QueryEntity();");
- add0(src, "");
- add2(src, "qryEntity.setKeyType(\"" + pkg + "." + pojo.keyClassName() + "\");");
- add2(src, "qryEntity.setValueType(\"" + pkg + "." + valClsName + "\");");
-
- add0(src, "");
-
- // Query fields.
- add2(src, "// Query fields for " + tbl + ".");
- add2(src, "LinkedHashMap<String, String> fields = new LinkedHashMap<>();");
- add0(src, "");
-
- for (PojoField field : fields)
- add2(src, "fields.put(\"" + field.javaName() + "\", \"" +
- GeneratorUtils.boxPrimitiveType(field.javaTypeName()) + "\");");
-
- add0(src, "");
- add2(src, "qryEntity.setFields(fields);");
- add0(src, "");
-
- // Aliases.
- if (generateAliases) {
- Collection<PojoField> aliases = new ArrayList<>();
-
- for (PojoField field : fields) {
- if (!field.javaName().equalsIgnoreCase(field.dbName()))
- aliases.add(field);
- }
-
- if (!aliases.isEmpty()) {
- add2(src, "// Aliases for fields.");
- add2(src, "Map<String, String> aliases = new HashMap<>();");
- add0(src, "");
-
- for (PojoField alias : aliases)
- add2(src, "aliases.put(\"" + alias.javaName() + "\", \"" + alias.dbName() + "\");");
-
- add0(src, "");
- add2(src, "qryEntity.setAliases(aliases);");
- add0(src, "");
- }
- }
-
- // Indexes.
- Collection<QueryIndex> idxs = pojo.indexes();
-
- if (!idxs.isEmpty()) {
- boolean first = true;
- boolean firstIdx = true;
-
- for (QueryIndex idx : idxs) {
- Set<Map.Entry<String, Boolean>> dbIdxFlds = idx.getFields().entrySet();
-
- int sz = dbIdxFlds.size();
-
- List<T2<String, Boolean>> idxFlds = new ArrayList<>(sz);
-
- for (Map.Entry<String, Boolean> idxFld : dbIdxFlds) {
- PojoField field = GeneratorUtils.findFieldByName(fields, idxFld.getKey());
-
- if (field != null)
- idxFlds.add(new T2<>(field.javaName(), idxFld.getValue()));
- else
- break;
- }
-
- // Only if all fields present, add index description.
- if (idxFlds.size() == sz) {
- if (first) {
- add2(src, "// Indexes for " + tbl + ".");
- add2(src, "Collection<QueryIndex> idxs = new ArrayList<>();");
- add0(src, "");
- }
-
- if (sz == 1) {
- T2<String, Boolean> idxFld = idxFlds.get(0);
-
- add2(src, "idxs.add(new QueryIndex(\"" + idxFld.getKey() + "\", " + idxFld.getValue() + ", \"" +
- idx.getName() + "\"));");
- add0(src, "");
- }
- else {
- add2(src, (firstIdx ? "QueryIndex " : "") + "idx = new QueryIndex();");
- add0(src, "");
-
- add2(src, "idx.setName(\"" + idx.getName() + "\");");
- add0(src, "");
-
- add2(src, "idx.setIndexType(QueryIndexType." + idx.getIndexType() + ");");
- add0(src, "");
-
- add2(src, (firstIdx ? "LinkedHashMap<String, Boolean> " : "") +
- "idxFlds = new LinkedHashMap<>();");
- add0(src, "");
-
- for (T2<String, Boolean> idxFld : idxFlds)
- add2(src, "idxFlds.put(\"" + idxFld.getKey() + "\", " + idxFld.getValue() + ");");
-
- add0(src, "");
-
- add2(src, "idx.setFields(idxFlds);");
- add0(src, "");
-
- add2(src, "idxs.add(idx);");
- add0(src, "");
-
- firstIdx = false;
- }
-
- first = false;
- }
- }
-
- if (!first) {
- add2(src, "qryEntity.setIndexes(idxs);");
- add0(src, "");
- }
- }
-
- add2(src, "return qryEntity;");
-
- add1(src, "}");
- add0(src, "");
- }
-
- add1(src, "/**");
- add1(src, " * Configure cache.");
- add1(src, " *");
- add1(src, " * @param cacheName Cache name.");
- add1(src, " * @param storeFactory Cache store factory.");
- add1(src, " * @return Cache configuration.");
- add1(src, " */");
- add1(src, "public static <K, V> CacheConfiguration<K, V> cache(String cacheName," +
- " CacheJdbcPojoStoreFactory<K, V> storeFactory) {");
- add2(src, "if (storeFactory == null)");
- add3(src, " throw new IllegalArgumentException(\"Cache store factory cannot be null.\");");
- add0(src, "");
- add2(src, "CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(cacheName);");
- add0(src, "");
- add2(src, "ccfg.setCacheStoreFactory(storeFactory);");
- add2(src, "ccfg.setReadThrough(true);");
- add2(src, "ccfg.setWriteThrough(true);");
- add0(src, "");
-
- add2(src, "// Configure JDBC types.");
- add2(src, "Collection<JdbcType> jdbcTypes = new ArrayList<>();");
- add0(src, "");
-
- for (PojoDescriptor pojo : pojos)
- add2(src, "jdbcTypes.add(jdbcType" + pojo.valueClassName() + "(cacheName));");
-
- add0(src, "");
-
- add2(src, "storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));");
- add0(src, "");
-
-
- add2(src, "// Configure query entities.");
- add2(src, "Collection<QueryEntity> qryEntities = new ArrayList<>();");
- add0(src, "");
-
- for (PojoDescriptor pojo : pojos)
- add2(src, "qryEntities.add(queryEntity" + pojo.valueClassName() + "());");
-
- add0(src, "");
-
- add2(src, "ccfg.setQueryEntities(qryEntities);");
- add0(src, "");
-
- add2(src, "return ccfg;");
- add1(src, "}");
-
- add0(src, "}");
-
- write(src, cacheCfg);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
deleted file mode 100644
index ac710db..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/GeneratorUtils.java
+++ /dev/null
@@ -1,70 +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.schema.generator;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ignite.schema.model.PojoField;
-
-/**
- * Schema import generator utils.
- */
-public class GeneratorUtils {
- /** Map of conformity between primitive type and Java class. */
- private static final Map<String, String> primitiveToObject = new HashMap<>();
-
- static {
- primitiveToObject.put("boolean", "java.lang.Boolean");
- primitiveToObject.put("byte", "java.lang.Byte");
- primitiveToObject.put("short", "java.lang.Short");
- primitiveToObject.put("int", "java.lang.Integer");
- primitiveToObject.put("long", "java.lang.Long");
- primitiveToObject.put("float", "java.lang.Float");
- primitiveToObject.put("double", "java.lang.Double");
- }
-
- /**
- * Convert primitive type to conformity Java class.
- *
- * @param type Primitive type.
- * @return Conformity Java class
- */
- public static String boxPrimitiveType(String type) {
- if (primitiveToObject.containsKey(type))
- return primitiveToObject.get(type);
-
- return type;
- }
-
- /**
- * Find field by name.
- *
- * @param fields Field descriptors.
- * @param name Field name to find.
- * @return Field descriptor or {@code null} if not found.
- */
- public static PojoField findFieldByName(Collection<PojoField> fields, String name) {
- for (PojoField field: fields)
- if (field.dbName().equals(name))
- return field;
-
- return null;
- }
-}
[11/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
IGNITE-4349 Discontinue the schema-import utility.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6ee9c0f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6ee9c0f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6ee9c0f
Branch: refs/heads/ignite-3477-master
Commit: f6ee9c0fb5f5d116c79c840a13010ce51e5cf512
Parents: 4e80ddf
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Apr 8 18:18:34 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Apr 8 18:18:34 2017 +0700
----------------------------------------------------------------------
DEVNOTES.txt | 3 -
assembly/dependencies-fabric-lgpl.xml | 3 -
assembly/dependencies-fabric.xml | 3 -
assembly/dependencies-schema-import.xml | 57 -
assembly/release-base.xml | 2 -
assembly/release-fabric-base.xml | 9 -
assembly/release-schema-import.xml | 50 -
bin/ignite-schema-import.bat | 110 -
bin/ignite-schema-import.sh | 87 -
examples/README-LGPL.txt | 4 +-
examples/README.txt | 2 -
examples/pom-standalone-lgpl.xml | 1 -
examples/pom-standalone.xml | 1 -
examples/pom.xml | 1 -
examples/schema-import/README.txt | 38 -
examples/schema-import/bin/db-init.sql | 28 -
examples/schema-import/bin/h2-server.bat | 80 -
examples/schema-import/bin/h2-server.sh | 66 -
.../schema-import/bin/schema-import.properties | 28 -
examples/schema-import/pom-standalone.xml | 90 -
examples/schema-import/pom.xml | 101 -
.../org/apache/ignite/schema/CacheConfig.java | 36 -
.../java/org/apache/ignite/schema/Demo.java | 134 --
.../java/org/apache/ignite/schema/DemoNode.java | 38 -
.../ignite/schema/H2DataSourceFactory.java | 35 -
.../java/org/apache/ignite/schema/Person.java | 44 -
.../org/apache/ignite/schema/PersonKey.java | 37 -
.../test/config/store/jdbc/ignite-jdbc-type.xml | 2 +-
.../cache/store/jdbc/model/Organization.java | 2 -
.../cache/store/jdbc/model/OrganizationKey.java | 2 -
.../ignite/cache/store/jdbc/model/Person.java | 2 -
.../store/jdbc/model/PersonComplexKey.java | 4 +-
.../cache/store/jdbc/model/PersonKey.java | 2 -
modules/schema-import-db/README.txt | 4 -
modules/schema-import-db/pom.xml | 55 -
.../apache/ignite/schema/parser/DbColumn.java | 88 -
.../ignite/schema/parser/DbMetadataReader.java | 147 --
.../apache/ignite/schema/parser/DbTable.java | 82 -
.../parser/dialect/DB2MetadataDialect.java | 33 -
.../parser/dialect/DatabaseMetadataDialect.java | 102 -
.../parser/dialect/JdbcMetadataDialect.java | 199 --
.../parser/dialect/MySQLMetadataDialect.java | 82 -
.../parser/dialect/OracleMetadataDialect.java | 360 ---
modules/schema-import/README.txt | 216 --
modules/schema-import/pom.xml | 119 -
.../main/java/media/data_connection_48x48.png | Bin 4443 -> 0 bytes
.../src/main/java/media/error_48x48.png | Bin 4349 -> 0 bytes
.../src/main/java/media/ignite_128x128.png | Bin 4917 -> 0 bytes
.../src/main/java/media/ignite_16x16.png | Bin 608 -> 0 bytes
.../src/main/java/media/ignite_24x24.png | Bin 930 -> 0 bytes
.../src/main/java/media/ignite_32x32.png | Bin 1203 -> 0 bytes
.../src/main/java/media/ignite_48x48.png | Bin 1868 -> 0 bytes
.../src/main/java/media/ignite_64x64.png | Bin 2453 -> 0 bytes
.../src/main/java/media/information_48x48.png | Bin 4102 -> 0 bytes
.../src/main/java/media/question_48x48.png | Bin 3857 -> 0 bytes
.../src/main/java/media/sign_warning_48x48.png | Bin 2988 -> 0 bytes
.../schema-import/src/main/java/media/style.css | 134 --
.../src/main/java/media/text_tree_48x48.png | Bin 2567 -> 0 bytes
.../ignite/schema/generator/CodeGenerator.java | 831 -------
.../ignite/schema/generator/GeneratorUtils.java | 70 -
.../ignite/schema/generator/XmlGenerator.java | 446 ----
.../ignite/schema/model/PojoDescriptor.java | 497 ----
.../apache/ignite/schema/model/PojoField.java | 461 ----
.../ignite/schema/model/SchemaDescriptor.java | 62 -
.../schema/parser/DatabaseMetadataParser.java | 115 -
.../ignite/schema/ui/ConfirmCallable.java | 83 -
.../org/apache/ignite/schema/ui/Controls.java | 697 ------
.../org/apache/ignite/schema/ui/GridPaneEx.java | 180 --
.../org/apache/ignite/schema/ui/MessageBox.java | 274 ---
.../apache/ignite/schema/ui/ModalDialog.java | 50 -
.../ignite/schema/ui/SchemaImportApp.java | 2115 ------------------
.../ignite/schema/ui/TextColumnValidator.java | 32 -
.../schema/test/AbstractSchemaImportTest.java | 181 --
.../test/generator/CodeGeneratorTest.java | 81 -
.../schema/test/generator/XmlGeneratorTest.java | 42 -
.../ignite/schema/test/model/CacheConfig.txt | 409 ----
.../apache/ignite/schema/test/model/Objects.txt | 531 -----
.../ignite/schema/test/model/ObjectsKey.txt | 96 -
.../ignite/schema/test/model/Primitives.txt | 535 -----
.../ignite/schema/test/model/PrimitivesKey.txt | 96 -
.../org/apache/ignite/schema/test/model/Tst.txt | 535 -----
.../apache/ignite/schema/test/model/TstKey.txt | 96 -
.../schema/test/model/ignite-type-metadata.xml | 666 ------
.../test/parser/DbMetadataParserTest.java | 134 --
.../testsuites/IgniteSchemaImportTestSuite.java | 42 -
modules/web-console/web-agent/pom.xml | 12 -
.../ignite/console/agent/db/DbColumn.java | 88 +
.../console/agent/db/DbMetadataReader.java | 142 ++
.../apache/ignite/console/agent/db/DbTable.java | 82 +
.../agent/db/dialect/DB2MetadataDialect.java | 33 +
.../db/dialect/DatabaseMetadataDialect.java | 102 +
.../agent/db/dialect/JdbcMetadataDialect.java | 199 ++
.../agent/db/dialect/MySQLMetadataDialect.java | 82 +
.../agent/db/dialect/OracleMetadataDialect.java | 359 +++
.../agent/handlers/DatabaseListener.java | 20 +-
pom.xml | 121 -
96 files changed, 1103 insertions(+), 12217 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index 79bedfd..d3c162e 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -25,9 +25,6 @@ With Apache Ignite.NET:
Look for apache-ignite-fabric-<version>-bin.zip in ./target/bin directory.
-NOTE: JDK version should be 1.7.0-* or >= 1.8.0-u40.
- Schema Import module use JavaFX, under OpenJDK may be compiled and run only on OpenJDK 8 with installed OpenJFX.
-
Ignite Hadoop Accelerator Maven Build Instructions
============================================
mvn clean package -DskipTests -Dignite.edition=hadoop [-Dhadoop.version=X.X.X] [-Dspark.version=x.y.z]
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-fabric-lgpl.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric-lgpl.xml b/assembly/dependencies-fabric-lgpl.xml
index 6d547c4..4cff146 100644
--- a/assembly/dependencies-fabric-lgpl.xml
+++ b/assembly/dependencies-fabric-lgpl.xml
@@ -120,14 +120,11 @@
<exclude>org.apache.ignite:ignite-extdata-uri</exclude>
<exclude>org.apache.ignite:ignite-extdata-uri-dep</exclude>
<exclude>org.apache.ignite:ignite-examples</exclude>
- <exclude>org.apache.ignite:ignite-schema-import-demo</exclude>
<exclude>org.apache.ignite:ignite-indexing</exclude>
<exclude>org.apache.ignite:ignite-visor-console</exclude>
<exclude>org.apache.ignite:ignite-visor-console_2.10</exclude>
<exclude>org.apache.ignite:ignite-visor-plugins</exclude>
<exclude>org.apache.ignite:ignite-hadoop</exclude>
- <exclude>org.apache.ignite:ignite-schema-import</exclude>
- <exclude>org.apache.ignite:ignite-schema-import-db</exclude>
<exclude>org.apache.ignite:ignite-codegen</exclude>
<exclude>org.apache.ignite:ignite-apache-license-gen</exclude>
<exclude>org.apache.ignite:ignite-appserver-test</exclude>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml
index d4000d6..840216f 100644
--- a/assembly/dependencies-fabric.xml
+++ b/assembly/dependencies-fabric.xml
@@ -120,14 +120,11 @@
<exclude>org.apache.ignite:ignite-extdata-uri</exclude>
<exclude>org.apache.ignite:ignite-extdata-uri-dep</exclude>
<exclude>org.apache.ignite:ignite-examples</exclude>
- <exclude>org.apache.ignite:ignite-schema-import-demo</exclude>
<exclude>org.apache.ignite:ignite-indexing</exclude>
<exclude>org.apache.ignite:ignite-visor-console</exclude>
<exclude>org.apache.ignite:ignite-visor-console_2.10</exclude>
<exclude>org.apache.ignite:ignite-visor-plugins</exclude>
<exclude>org.apache.ignite:ignite-hadoop</exclude>
- <exclude>org.apache.ignite:ignite-schema-import</exclude>
- <exclude>org.apache.ignite:ignite-schema-import-db</exclude>
<exclude>org.apache.ignite:ignite-codegen</exclude>
<exclude>org.apache.ignite:ignite-apache-license-gen</exclude>
<exclude>org.apache.ignite:ignite-hibernate</exclude>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/dependencies-schema-import.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-schema-import.xml b/assembly/dependencies-schema-import.xml
deleted file mode 100644
index d7aa3ae..0000000
--- a/assembly/dependencies-schema-import.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
- http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>dependencies-schema-import</id>
-
- <formats>
- <format>dir</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <moduleSets>
- <moduleSet>
- <includes>
- <include>org.apache.ignite:ignite-schema-import</include>
- <include>org.apache.ignite:ignite-schema-import-db</include>
- </includes>
- <sources>
- <includeModuleDirectory>false</includeModuleDirectory>
- <fileSets>
- <fileSet>
- <directory>target</directory>
- <outputDirectory>/schema-import</outputDirectory>
- <includes>
- <include>*.jar</include>
- </includes>
- <excludes>
- <exclude>*-tests.jar</exclude>
- <exclude>*-javadoc.jar</exclude>
- <exclude>*-sources.jar</exclude>
- </excludes>
- </fileSet>
- </fileSets>
- </sources>
- </moduleSet>
- </moduleSets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-base.xml b/assembly/release-base.xml
index 6870284..bc3d473 100644
--- a/assembly/release-base.xml
+++ b/assembly/release-base.xml
@@ -63,7 +63,6 @@
<exclude>igniterouter.bat</exclude>
<exclude>**/build-classpath.bat</exclude>
<exclude>ignitevisorcmd.bat</exclude>
- <exclude>ignite-schema-import.bat</exclude>
</excludes>
</fileSet>
@@ -80,7 +79,6 @@
<exclude>**/build-classpath.sh</exclude>
<exclude>**/service.sh</exclude>
<exclude>ignitevisorcmd.sh</exclude>
- <exclude>ignite-schema-import.sh</exclude>
</excludes>
</fileSet>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index 7a25594..c3bad39 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -61,12 +61,6 @@
</file>
<file>
- <source>examples/schema-import/pom-standalone.xml</source>
- <outputDirectory>/examples/schema-import</outputDirectory>
- <destName>pom.xml</destName>
- </file>
-
- <file>
<source>config/dotnet/default-dotnet.xml</source>
<outputDirectory>/config/dotnet</outputDirectory>
</file>
@@ -221,9 +215,6 @@
<include>rest/**</include>
<include>memcached/**</include>
<include>redis/**</include>
- <include>schema-import/src/**</include>
- <include>schema-import/bin/**</include>
- <include>schema-import/README.txt</include>
</includes>
</fileSet>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/assembly/release-schema-import.xml
----------------------------------------------------------------------
diff --git a/assembly/release-schema-import.xml b/assembly/release-schema-import.xml
deleted file mode 100644
index 38457b9..0000000
--- a/assembly/release-schema-import.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
- http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>release-schema-import</id>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <formats>
- <format>dir</format>
- </formats>
-
- <fileSets>
- <fileSet>
- <directory>bin</directory>
- <outputDirectory>/</outputDirectory>
- <includes>
- <include>**/ignite-schema-import.bat</include>
- </includes>
- </fileSet>
-
- <fileSet>
- <directory>bin</directory>
- <outputDirectory>/</outputDirectory>
- <fileMode>0755</fileMode>
- <includes>
- <include>**/ignite-schema-import.sh</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
deleted file mode 100644
index a4ec86b..0000000
--- a/bin/ignite-schema-import.bat
+++ /dev/null
@@ -1,110 +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.
-::
-
-::
-:: Starts Ignite Schema Import Utility.
-::
-
-@echo off
-
-if "%OS%" == "Windows_NT" setlocal
-
-:: Check JAVA_HOME.
-if not "%JAVA_HOME%" == "" goto checkJdk
- echo %0, ERROR: JAVA_HOME environment variable is not found.
- echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8.
- echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava
-goto error_finish
-
-:checkJdk
-:: Check that JDK is where it should be.
-if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
- echo %0, ERROR: The JDK is not found in %JAVA_HOME%.
- echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK.
-goto error_finish
-
-:checkJdkVersion
-"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul
-if %ERRORLEVEL% equ 0 goto checkIgniteHome1
- echo %0, ERROR: The version of JAVA installed in %JAVA_HOME% is incorrect.
- echo %0, ERROR: Please install JDK 1.7 or 1.8.
- echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava
-goto error_finish
-
-:: Check IGNITE_HOME.
-:checkIgniteHome1
-if not "%IGNITE_HOME%" == "" goto checkIgniteHome2
- pushd "%~dp0"/..
- set IGNITE_HOME=%CD%
- popd
-
-:checkIgniteHome2
-:: Strip double quotes from IGNITE_HOME
-set IGNITE_HOME=%IGNITE_HOME:"=%
-
-:: remove all trailing slashes from IGNITE_HOME.
-if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
-if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
-goto checkIgniteHome3
-
-:removeTrailingSlash
-set IGNITE_HOME=%IGNITE_HOME:~0,-1%
-goto checkIgniteHome2
-
-:checkIgniteHome3
-if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
- echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
- echo Please create IGNITE_HOME environment variable pointing to location of
- echo Ignite installation folder.
- goto error_finish
-
-:checkIgniteHome4
-
-::
-:: Set SCRIPTS_HOME - base path to scripts.
-::
-set SCRIPTS_HOME=%IGNITE_HOME%\bin
-
-:: Remove trailing spaces
-for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
-
-if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
- echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
-
-:run
-
-::
-:: Set IGNITE_LIBS
-::
-call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\build-classpath.bat" &:: Will be removed in the binary release.
-set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*;%IGNITE_LIBS%
-
-::
-:: Set program name.
-::
-set PROG_NAME=ignite-schema-import.bat
-if "%OS%" == "Windows_NT" set PROG_NAME=%~nx0%
-
-::
-:: Starts Ignite Schema Import Utility.
-::
-"%JAVA_HOME%\bin\java.exe" %JVM_OPTS% -cp "%CP%" org.apache.ignite.schema.ui.SchemaImportApp %*
-
-:error_finish
-
-goto :eof
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
deleted file mode 100755
index 1029882..0000000
--- a/bin/ignite-schema-import.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-#
-# Starts Ignite Schema Import Utility.
-#
-
-# Remember command line parameters
-ARGS=$@
-
-#
-# Import common functions.
-#
-if [ "${IGNITE_HOME}" = "" ];
- then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
- else IGNITE_HOME_TMP=${IGNITE_HOME};
-fi
-
-#
-# Set SCRIPTS_HOME - base path to scripts.
-#
-SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
-
-source "${SCRIPTS_HOME}"/include/functions.sh
-
-#
-# Discover path to Java executable and check it's version.
-#
-checkJava
-
-#
-# Discover IGNITE_HOME environment variable.
-#
-setIgniteHome
-
-#
-# Parse command line parameters.
-#
-. "${SCRIPTS_HOME}"/include/parseargs.sh
-
-#
-# Set IGNITE_LIBS.
-#
-. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/build-classpath.sh # Will be removed in the binary release.
-CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*${SEP}${IGNITE_LIBS}"
-
-#
-# JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
-#
-# ADD YOUR/CHANGE ADDITIONAL OPTIONS HERE
-#
-JVM_OPTS="-Xms256m -Xmx1g -XX:MaxPermSize=128M ${JVM_OPTS}"
-
-# Mac OS specific support to display correct name in the dock.
-osname=`uname`
-
-if [ "${DOCK_OPTS}" == "" ]; then
- DOCK_OPTS="-Xdock:name=Ignite Schema Import Utility"
-fi
-
-#
-# Starts Ignite Schema Import Utility.
-#
-case $osname in
- Darwin*)
- "$JAVA" ${JVM_OPTS} "${DOCK_OPTS}" -cp "${CP}" org.apache.ignite.schema.ui.SchemaImportApp ${ARGS}
- ;;
- *)
- "$JAVA" ${JVM_OPTS} -cp "${CP}" org.apache.ignite.schema.ui.SchemaImportApp ${ARGS}
- ;;
-esac
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/README-LGPL.txt
----------------------------------------------------------------------
diff --git a/examples/README-LGPL.txt b/examples/README-LGPL.txt
index 0f95971..f8ca0d8 100644
--- a/examples/README-LGPL.txt
+++ b/examples/README-LGPL.txt
@@ -11,8 +11,6 @@ The examples folder contains he following subfolders:
- `config` - contains Ignite configuration files needed for examples.
- `memcached` - contains PHP script demonstrating how Ignite Cache can be accessed using Memcached client.
- `rest` - contains PHP script demonstrating how Ignite Cache can be accessed via HTTP API.
-- `schema-import` - contains demo project for Apache Ignite Schema Import Utility. Refer to enclosed
- README.txt file for more information on how to build and run the demo.
- `src/main/java` - contains Java examples for different Ignite modules and features.
- `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples
are excluded by default, enable `java8` Maven profile to include them (JDK8 is required).
@@ -30,4 +28,4 @@ class loading: `examples/config/example-ignite.xml`. To run a remote node in IDE
Java7 vs Java8
===============
Some examples (not all) which can benefit from Java8 Lambda support were re-written with Java8 lambdas.
-For full set of examples, look at both Java7 and Java8 packages.
\ No newline at end of file
+For full set of examples, look at both Java7 and Java8 packages.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/README.txt
----------------------------------------------------------------------
diff --git a/examples/README.txt b/examples/README.txt
index 26970d6..a17c9c8 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -11,8 +11,6 @@ The examples folder contains he following subfolders:
- `config` - contains Ignite configuration files needed for examples.
- `memcached` - contains PHP script demonstrating how Ignite Cache can be accessed using Memcached client.
- `rest` - contains PHP script demonstrating how Ignite Cache can be accessed via HTTP API.
-- `schema-import` - contains demo project for Apache Ignite Schema Import Utility. Refer to enclosed
- README.txt file for more information on how to build and run the demo.
- `src/main/java` - contains Java examples for different Ignite modules and features.
- `src/main/java8` - contains additional set of Java examples utilizing Java 8 lambdas. These examples
are excluded by default, enable `java8` Maven profile to include them (JDK8 is required).
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index f664514..16fe125 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -221,7 +221,6 @@
</goals>
<configuration>
<sources>
- <source>schema-import/src/main/java</source>
<source>${lgpl.folder}</source>
<source>${java8.folder}</source>
<source>${spark.folder}</source>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index 029ca77..fe6ab21 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -222,7 +222,6 @@
</goals>
<configuration>
<sources>
- <source>schema-import/src/main/java</source>
<source>${lgpl.folder}</source>
<source>${java8.folder}</source>
<source>${spark.folder}</source>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index e7fd67d..2bbcc8a 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -282,7 +282,6 @@
</goals>
<configuration>
<sources>
- <source>schema-import/src/main/java</source>
<source>${lgpl.folder}</source>
<source>${java8.folder}</source>
<source>${spark.folder}</source>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/README.txt
----------------------------------------------------------------------
diff --git a/examples/schema-import/README.txt b/examples/schema-import/README.txt
deleted file mode 100644
index ff2d517..0000000
--- a/examples/schema-import/README.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-Apache Ignite Schema Import Utility
-===================================
-
-Ignite ships with CacheJdbcPojoStore, which is out-of-the-box JDBC
-implementation of the IgniteCacheStore interface, and automatically
-handles all the write-through and read-through logic.
-
-Ignite also ships with its own database schema mapping wizard which provides automatic
-support for integrating with persistence stores. This utility automatically connects to
-the underlying database and generates all the required XML OR-mapping configuration
-and Java domain model POJOs.
-
-Schema Import Utility Demo
-==========================
-1. Start H2 database: "examples/schema-import/bin/h2-server.sh"
- H2 server will start and H2 Console will be opened in your default browser.
-
-2. Connect to H2 database with following settings:
-
- a. Select "Generic H2 (Server)" settings.
-
- b. IMPORTANT: enter JDBC URL "jdbc:h2:tcp://localhost/~/schema-import/demo"
-
- c. Click "Connect".
-
-3. Paste content of "examples/schema-import/bin/db-init.sql" into H2 Console and execute.
-
-4. Start Schema Import utility: "IGNITE_HOME/bin/ignite-schema-import.sh examples/schema-import/bin/schema-import.properties"
- Schema Utility will start with predefined settings for this demo.
- Click "Next", "Generate" and answer "Yes" to all override warnings.
-
-5. Import "examples/schema-import/pom.xml" in your Java IDE.
-
-6. Run "Demo.java" example.
-
-For more information on how to get started with Apache Ignite Schema Import Utility please visit:
-
- http://apacheignite.readme.io/docs/automatic-persistence
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/db-init.sql
----------------------------------------------------------------------
diff --git a/examples/schema-import/bin/db-init.sql b/examples/schema-import/bin/db-init.sql
deleted file mode 100644
index 8a91a6a..0000000
--- a/examples/schema-import/bin/db-init.sql
+++ /dev/null
@@ -1,28 +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.
---
-
--- Script of database initialization for Schema Import Demo.
-drop table PERSON;
-
-create table PERSON(id integer not null PRIMARY KEY, first_name varchar(50), last_name varchar(50), salary double not null);
-
-insert into PERSON(id, first_name, last_name, salary) values(1, 'Johannes', 'Kepler', 1000);
-insert into PERSON(id, first_name, last_name, salary) values(2, 'Galileo', 'Galilei', 2000);
-insert into PERSON(id, first_name, last_name, salary) values(3, 'Henry', 'More', 3000);
-insert into PERSON(id, first_name, last_name, salary) values(4, 'Polish', 'Brethren', 4000);
-insert into PERSON(id, first_name, last_name, salary) values(5, 'Robert', 'Boyle', 5000);
-insert into PERSON(id, first_name, last_name, salary) values(6, 'Isaac', 'Newton', 6000);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/h2-server.bat
----------------------------------------------------------------------
diff --git a/examples/schema-import/bin/h2-server.bat b/examples/schema-import/bin/h2-server.bat
deleted file mode 100644
index d445231..0000000
--- a/examples/schema-import/bin/h2-server.bat
+++ /dev/null
@@ -1,80 +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.
-::
-
-::
-:: Starts H2 database server and console for Ignite Schema Import demo.
-::
-
-@echo off
-
-if "%OS%" == "Windows_NT" setlocal
-
-:: Check JAVA_HOME.
-if not "%JAVA_HOME%" == "" goto checkJdk
- echo %0, ERROR: JAVA_HOME environment variable is not found.
- echo %0, ERROR: Please create JAVA_HOME variable pointing to location of JDK 1.7 or JDK 1.8.
- echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava
-goto error_finish
-
-:checkJdk
-:: Check that JDK is where it should be.
-if exist "%JAVA_HOME%\bin\java.exe" goto checkJdkVersion
- echo %0, ERROR: The JDK is not found in %JAVA_HOME%.
- echo %0, ERROR: Please modify your script so that JAVA_HOME would point to valid location of JDK.
-goto error_finish
-
-:checkJdkVersion
-"%JAVA_HOME%\bin\java.exe" -version 2>&1 | findstr "1\.[78]\." > nul
-if %ERRORLEVEL% equ 0 goto checkIgniteHome1
- echo %0, ERROR: The version of JAVA installed in %JAVA_HOME% is incorrect.
- echo %0, ERROR: Please install JDK 1.7 or 1.8.
- echo %0, ERROR: You can also download latest JDK at: http://java.sun.com/getjava
-goto error_finish
-
-:: Check IGNITE_HOME.
-:checkIgniteHome1
-if not "%IGNITE_HOME%" == "" goto checkIgniteHome2
- pushd "%~dp0"/../../..
- set IGNITE_HOME=%CD%
- popd
-
-:checkIgniteHome2
-:: Strip double quotes from IGNITE_HOME
-set IGNITE_HOME=%IGNITE_HOME:"=%
-
-:: remove all trailing slashes from IGNITE_HOME.
-if %IGNITE_HOME:~-1,1% == \ goto removeTrailingSlash
-if %IGNITE_HOME:~-1,1% == / goto removeTrailingSlash
-goto checkIgniteHome3
-
-:removeTrailingSlash
-set IGNITE_HOME=%IGNITE_HOME:~0,-1%
-goto checkIgniteHome2
-
-:checkIgniteHome3
-if exist "%IGNITE_HOME%\config" goto run
- echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable is not valid.
- echo Please create IGNITE_HOME environment variable pointing to location of
- echo Ignite installation folder.
- goto error_finish
-
-:run
-
-:: Starts H2 server and console.
-"%JAVA_HOME%\bin\java.exe" -cp "%IGNITE_HOME%\libs\ignite-indexing\h2-1.4.191.jar" org.h2.tools.Console %*
-
-:error_finish
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/h2-server.sh
----------------------------------------------------------------------
diff --git a/examples/schema-import/bin/h2-server.sh b/examples/schema-import/bin/h2-server.sh
deleted file mode 100755
index 512a1d9..0000000
--- a/examples/schema-import/bin/h2-server.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-#
-# Starts H2 database server and console for Ignite Schema Import demo.
-#
-
-# Remember command line parameters
-ARGS=$@
-
-#
-# Import common functions.
-#
-if [ "${IGNITE_HOME}" = "" ];
- then IGNITE_HOME_TMP="$(dirname "$(cd "$(dirname "$0")/../.."; "pwd")")";
- else IGNITE_HOME_TMP=${IGNITE_HOME};
-fi
-
-#
-# Set SCRIPTS_HOME - base path to scripts.
-#
-SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
-
-source "${SCRIPTS_HOME}"/include/functions.sh
-
-#
-# Discover path to Java executable and check it's version.
-#
-checkJava
-
-#
-# Discover IGNITE_HOME environment variable.
-#
-setIgniteHome
-
-# Mac OS specific support to display correct name in the dock.
-osname=`uname`
-
-if [ "${DOCK_OPTS}" == "" ]; then
- DOCK_OPTS="-Dapple.awt.UIElement="true""
-fi
-
-# Starts H2 server and console.
-case $osname in
- Darwin*)
- "${JAVA}" "${DOCK_OPTS}" -cp "${IGNITE_HOME}/libs/ignite-indexing/h2-1.4.191.jar" org.h2.tools.Console ${ARGS}
- ;;
- *)
- "${JAVA}" -cp "${IGNITE_HOME}/libs/ignite-indexing/h2-1.4.191.jar" org.h2.tools.Console ${ARGS}
- ;;
-esac
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/bin/schema-import.properties
----------------------------------------------------------------------
diff --git a/examples/schema-import/bin/schema-import.properties b/examples/schema-import/bin/schema-import.properties
deleted file mode 100644
index 99ebab8..0000000
--- a/examples/schema-import/bin/schema-import.properties
+++ /dev/null
@@ -1,28 +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.
-#
-
-#
-# Predefined properties for Ignite Schema Import Demo
-#
-jdbc.db.preset=0
-jdbc.driver.jar=libs/ignite-indexing/h2-1.4.191.jar
-jdbc.driver.class=org.h2.Driver
-jdbc.url=jdbc:h2:tcp://localhost/~/schema-import/demo
-jdbc.user=sa
-out.folder=examples/schema-import/src/main/java
-pojo.package=org.apache.ignite.schema
-pojo.constructor=true
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom-standalone.xml b/examples/schema-import/pom-standalone.xml
deleted file mode 100644
index e443728..0000000
--- a/examples/schema-import/pom-standalone.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ 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.
- -->
-
-<!--
- POM file.
--->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-schema-import-demo</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
-
- <dependencies>
- <dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>1.0.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-spring</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-log4j</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-indexing</artifactId>
- <version>to_be_replaced_by_ignite_version</version>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/examples/schema-import/pom.xml b/examples/schema-import/pom.xml
deleted file mode 100644
index 0838512..0000000
--- a/examples/schema-import/pom.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
- -->
-
-<!--
- POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-parent</artifactId>
- <version>1</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <artifactId>ignite-schema-import-demo</artifactId>
- <version>2.0.0-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>javax.cache</groupId>
- <artifactId>cache-api</artifactId>
- <version>${javax.cache.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-spring</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-log4j</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-indexing</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>src/main/java</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.java
deleted file mode 100644
index c5801cc..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/CacheConfig.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.schema;
-
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
-import org.apache.ignite.configuration.CacheConfiguration;
-
-/**
- * CacheConfig stub. Will be generated by Ignite Schema Import Utility.
- */
-public class CacheConfig {
- /**
- * Configure cache.
- *
- * @param name Cache name.
- * @param storeFactory Cache store factory.
- */
- public static <K, V> CacheConfiguration<K, V> cache(String name, CacheJdbcPojoStoreFactory<K, V> storeFactory) {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
deleted file mode 100644
index fa52a1d..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Demo.java
+++ /dev/null
@@ -1,134 +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.schema;
-
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStore;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.transactions.Transaction;
-
-/**
- * This demo demonstrates the use of cache with {@link CacheJdbcPojoStore}
- * together with automatic Ignite schema-import utility.
- * <p>
- * This Demo can work stand-alone. You can also choose to start
- * several {@link DemoNode} instances as well to form a cluster.
- */
-public class Demo {
- /**
- * Executes demo.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If example execution failed.
- */
- public static void main(String[] args) throws IgniteException {
- System.out.println(">>> Start demo...");
-
- // Start Ignite node.
- try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
- CacheJdbcPojoStoreFactory<PersonKey, Person> pojoStoreFactory = new CacheJdbcPojoStoreFactory<>();
-
- pojoStoreFactory.setDataSourceFactory(new H2DataSourceFactory());
-
- // Configure cache store.
- CacheConfiguration<PersonKey, Person> cfg = CacheConfig.cache("PersonCache", pojoStoreFactory);
-
- try (IgniteCache<PersonKey, Person> cache = ignite.getOrCreateCache(cfg)) {
- // Preload cache from database.
- preload(cache);
-
- // Read-through from database
- // and store in cache.
- readThrough(cache);
-
- // Perform transaction and
- // write-through to database.
- transaction(ignite, cache);
- }
- }
- }
-
- /**
- * Demonstrates cache preload from database.
- */
- private static void preload(IgniteCache<PersonKey, Person> cache) {
- System.out.println();
- System.out.println(">>> Loading entries from database.");
-
- // Preload all person keys that are less than or equal to 3.
- cache.loadCache(null, PersonKey.class.getName(), "select * from PERSON where ID <= 3");
-
- for (Cache.Entry<PersonKey, Person> person : cache)
- System.out.println(">>> Loaded Person: " + person);
- }
-
- /**
- * Demonstrates cache read through from database.
- */
- private static void readThrough(IgniteCache<PersonKey, Person> cache) {
- PersonKey key = new PersonKey(4);
-
- System.out.println();
- System.out.println(">>> Read-through person from database for ID: " + key.getId());
-
- // Check that person with ID=4 is not in cache.
- Person p = cache.localPeek(key);
-
- assert p == null;
-
- // Read-through form database.
- p = cache.get(new PersonKey(4));
-
- System.out.println(">>> Loaded person from database: " + p);
- }
-
- /**
- * Demonstrates cache transaction joining database transaction.
- */
- private static void transaction(Ignite ignite, IgniteCache<PersonKey, Person> cache) {
- PersonKey key = new PersonKey(5);
-
- System.out.println();
- System.out.println(">>> Update salary and write-through to database for person with ID: " + key.getId());
-
- try (Transaction tx = ignite.transactions().txStart()) {
- // Read-through from database.
- Person p = cache.get(key);
-
- System.out.println(">>> Loaded person from database: " + p);
-
- double salary = p.getSalary();
-
- // Raise salary by 20%.
- p.setSalary(salary * 1.2);
-
- // Write-through to database
- // and store in cache.
- cache.put(key, p);
-
- tx.commit();
- }
-
- System.out.println(">>> Updated person: " + cache.get(key));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java
deleted file mode 100644
index 0f8c192..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/DemoNode.java
+++ /dev/null
@@ -1,38 +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.schema;
-
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-
-/**
- * Starts demo node. You can start as many demo nodes as you like for the demo.
- */
-public class DemoNode {
- /**
- * Starts demo node.
- *
- * @param args Command line arguments, none required.
- * @throws IgniteException If example execution failed.
- */
- public static void main(String[] args) throws IgniteException {
- System.out.println(">>> Start demo node...");
-
- Ignition.start("examples/config/example-ignite.xml");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java
deleted file mode 100644
index 6a4ea0a..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/H2DataSourceFactory.java
+++ /dev/null
@@ -1,35 +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.schema;
-
-import javax.cache.configuration.Factory;
-import javax.sql.DataSource;
-import org.h2.jdbcx.JdbcConnectionPool;
-
-/**
- * Datasource to use for store tests.
- */
-public class H2DataSourceFactory implements Factory<DataSource> {
- /** DB connection URL. */
- private static final String DFLT_CONN_URL = "jdbc:h2:tcp://localhost/~/schema-import/demo";
-
- /** {@inheritDoc} */
- @Override public DataSource create() {
- return JdbcConnectionPool.create(DFLT_CONN_URL, "sa", "");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java
deleted file mode 100644
index 799c876..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/Person.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.schema;
-
-/**
- * Person stub. Will be generated by Ignite Schema Import Utility.
- */
-public class Person {
- /**
- * Empty constructor.
- */
- public Person() {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-
- /**
- * @return Salary.
- */
- public double getSalary() {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-
- /**
- * @param salary Salary.
- */
- public void setSalary(double salary) {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
----------------------------------------------------------------------
diff --git a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java b/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.java
deleted file mode 100644
index dd241ad..0000000
--- a/examples/schema-import/src/main/java/org/apache/ignite/schema/PersonKey.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.schema;
-
-/**
- * PersonKey definition.
- */
-public class PersonKey {
- /**
- * Full constructor.
- */
- public PersonKey(int id) {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-
- /**
- * @return Person ID.
- */
- public int getId() {
- throw new IllegalStateException("Please run Ignite Schema Import Utility as described in README.txt");
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
index 4df4f04..6b75041 100644
--- a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
+++ b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
@@ -18,7 +18,7 @@
-->
<!--
- XML generated by Apache Ignite Schema Import utility: 02/03/2015
+ JdbcType beans.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Organization.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Organization.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Organization.java
index 1ba3002..69470eb 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Organization.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Organization.java
@@ -21,8 +21,6 @@ import java.io.Serializable;
/**
* Organization definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/03/2015.
*/
public class Organization implements Serializable {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/OrganizationKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/OrganizationKey.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/OrganizationKey.java
index 7d3a37a..271daea 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/OrganizationKey.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/OrganizationKey.java
@@ -21,8 +21,6 @@ import java.io.Serializable;
/**
* OrganizationKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/03/2015.
*/
public class OrganizationKey implements Serializable {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
index 89258b4..07270b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/Person.java
@@ -22,8 +22,6 @@ import java.sql.Date;
/**
* Person definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/03/2015.
*/
public class Person implements Serializable {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonComplexKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonComplexKey.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonComplexKey.java
index c213e66..554831c 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonComplexKey.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonComplexKey.java
@@ -21,8 +21,6 @@ import java.io.Serializable;
/**
* PersonComplexKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/03/2015.
*/
public class PersonComplexKey implements Serializable {
/** */
@@ -143,4 +141,4 @@ public class PersonComplexKey implements Serializable {
", cityId=" + cityId +
"]";
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonKey.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonKey.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonKey.java
index a46c830..01737ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonKey.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/model/PersonKey.java
@@ -21,8 +21,6 @@ import java.io.Serializable;
/**
* PersonKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 02/03/2015.
*/
public class PersonKey implements Serializable {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/README.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/README.txt b/modules/schema-import-db/README.txt
deleted file mode 100644
index 556e1c6..0000000
--- a/modules/schema-import-db/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Apache Ignite Schema Import DB Module
-------------------------------------------
-
-Utility classes to extract database metadata.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/pom.xml b/modules/schema-import-db/pom.xml
deleted file mode 100644
index ea28ee1..0000000
--- a/modules/schema-import-db/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-parent</artifactId>
- <version>1</version>
- <relativePath>../../parent</relativePath>
- </parent>
-
- <artifactId>ignite-schema-import-db</artifactId>
- <version>2.0.0-SNAPSHOT</version>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java
deleted file mode 100644
index 10fd50f..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java
+++ /dev/null
@@ -1,88 +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.schema.parser;
-
-/**
- * Database table column.
- */
-public class DbColumn {
- /** Column name. */
- private final String name;
-
- /** Column JDBC type. */
- private final int type;
-
- /** Is this column belongs to primary key. */
- private final boolean key;
-
- /** Is {@code NULL} allowed for column in database. */
- private final boolean nullable;
-
- /** Whether column unsigned. */
- private final boolean unsigned;
-
- /**
- * @param name Column name.
- * @param type Column JDBC type.
- * @param key {@code true} if this column belongs to primary key.
- * @param nullable {@code true} if {@code NULL } allowed for column in database.
- * @param unsigned {@code true} if column is unsigned.
- */
- public DbColumn(String name, int type, boolean key, boolean nullable, boolean unsigned) {
- this.name = name;
- this.type = type;
- this.key = key;
- this.nullable = nullable;
- this.unsigned = unsigned;
- }
-
- /**
- * @return Column name.
- */
- public String name() {
- return name;
- }
-
- /**
- * @return Column JDBC type.
- */
- public int type() {
- return type;
- }
-
- /**
- * @return {@code true} if this column belongs to primary key.
- */
- public boolean key() {
- return key;
- }
-
- /**
- * @return {@code true} if {@code NULL } allowed for column in database.
- */
- public boolean nullable() {
- return nullable;
- }
-
- /**
- * @return {@code true} if column is unsigned.
- */
- public boolean unsigned() {
- return unsigned;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java
deleted file mode 100644
index 5b45f33..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbMetadataReader.java
+++ /dev/null
@@ -1,147 +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.schema.parser;
-
-import org.apache.ignite.schema.parser.dialect.*;
-
-import java.io.*;
-import java.net.*;
-import java.sql.*;
-import java.util.*;
-import java.util.logging.*;
-
-/**
- * Singleton to extract database metadata.
- */
-public class DbMetadataReader {
- /** Logger. */
- private static final Logger log = Logger.getLogger(DbMetadataReader.class.getName());
-
- /** */
- private static final DbMetadataReader INSTANCE = new DbMetadataReader();
-
- /** */
- private final Map<String, Driver> drivers = new HashMap<>();
-
- /**
- * Default constructor.
- */
- private DbMetadataReader() {
- // No-op.
- }
-
- /**
- * @return Instance.
- */
- public static DbMetadataReader getInstance() {
- return INSTANCE;
- }
-
- /**
- * Get specified dialect object for selected database.
- *
- * @param conn Connection to database.
- * @return Specific dialect object.
- */
- private DatabaseMetadataDialect dialect(Connection conn) {
- try {
- String dbProductName = conn.getMetaData().getDatabaseProductName();
-
- if ("Oracle".equals(dbProductName))
- return new OracleMetadataDialect();
- else if (dbProductName.startsWith("DB2/"))
- return new DB2MetadataDialect();
- else if (dbProductName.equals("MySQL"))
- return new MySQLMetadataDialect();
- else
- return new JdbcMetadataDialect();
- }
- catch (SQLException e) {
- log.log(Level.SEVERE, "Failed to resolve dialect (JdbcMetaDataDialect will be used.", e);
-
- return new JdbcMetadataDialect();
- }
- }
-
- /**
- * Get list of schemas from database.
- *
- * @param conn Connection to database.
- * @return List of schema names.
- * @throws SQLException If schemas loading failed.
- */
- public Collection<String> schemas(Connection conn) throws SQLException {
- return dialect(conn).schemas(conn);
- }
-
- /**
- * Extract DB metadata.
- *
- * @param conn Connection.
- * @param schemas List of database schemas to process. In case of empty list all schemas will be processed.
- * @param tblsOnly Tables only flag.
- */
- public Collection<DbTable> metadata(Connection conn, List<String> schemas, boolean tblsOnly) throws SQLException {
- return dialect(conn).tables(conn, schemas, tblsOnly);
- }
-
- /**
- * Connect to database.
- *
- * @param jdbcDrvJarPath Path to JDBC driver.
- * @param jdbcDrvCls JDBC class name.
- * @param jdbcUrl JDBC connection URL.
- * @param jdbcInfo Connection properties.
- * @return Connection to database.
- * @throws SQLException if connection failed.
- */
- public Connection connect(String jdbcDrvJarPath, String jdbcDrvCls, String jdbcUrl, Properties jdbcInfo)
- throws SQLException {
- Driver drv = drivers.get(jdbcDrvCls);
-
- if (drv == null) {
- if (jdbcDrvJarPath.isEmpty())
- throw new IllegalStateException("Driver jar file name is not specified.");
-
- File drvJar = new File(jdbcDrvJarPath);
-
- if (!drvJar.exists())
- throw new IllegalStateException("Driver jar file is not found.");
-
- try {
- URL u = new URL("jar:" + drvJar.toURI() + "!/");
-
- URLClassLoader ucl = URLClassLoader.newInstance(new URL[] {u});
-
- drv = (Driver)Class.forName(jdbcDrvCls, true, ucl).newInstance();
-
- drivers.put(jdbcDrvCls, drv);
- }
- catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- Connection conn = drv.connect(jdbcUrl, jdbcInfo);
-
- if (conn == null)
- throw new IllegalStateException("Connection was not established (JDBC driver returned null value).");
-
- return conn;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java
deleted file mode 100644
index 39f6f7b..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.schema.parser;
-
-import org.apache.ignite.cache.QueryIndex;
-
-import java.util.Collection;
-
-/**
- * Database table.
- */
-public class DbTable {
- /** Schema name. */
- private final String schema;
-
- /** Table name. */
- private final String tbl;
-
- /** Columns. */
- private final Collection<DbColumn> cols;
-
- /** Indexes. */
- private final Collection<QueryIndex> idxs;
-
- /**
- * Default columns.
- *
- * @param schema Schema name.
- * @param tbl Table name.
- * @param cols Columns.
- * @param idxs Indexes;
- */
- public DbTable(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex> idxs) {
- this.schema = schema;
- this.tbl = tbl;
- this.cols = cols;
- this.idxs = idxs;
- }
-
- /**
- * @return Schema name.
- */
- public String schema() {
- return schema;
- }
-
- /**
- * @return Table name.
- */
- public String table() {
- return tbl;
- }
-
- /**
- * @return Columns.
- */
- public Collection<DbColumn> columns() {
- return cols;
- }
-
- /**
- * @return Indexes.
- */
- public Collection<QueryIndex> indexes() {
- return idxs;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java
deleted file mode 100644
index d277e4b..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java
+++ /dev/null
@@ -1,33 +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.schema.parser.dialect;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * DB2 specific metadata dialect.
- */
-public class DB2MetadataDialect extends JdbcMetadataDialect {
- /** {@inheritDoc} */
- @Override public Set<String> systemSchemas() {
- return new HashSet<>(Arrays.asList("SYSIBM", "SYSCAT", "SYSSTAT", "SYSTOOLS", "SYSFUN", "SYSIBMADM",
- "SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC"));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java
deleted file mode 100644
index 56ee59b..0000000
--- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java
+++ /dev/null
@@ -1,102 +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.schema.parser.dialect;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.QueryIndexType;
-import org.apache.ignite.schema.parser.DbColumn;
-import org.apache.ignite.schema.parser.DbTable;
-
-/**
- * Base class for database metadata dialect.
- */
-public abstract class DatabaseMetadataDialect {
- /**
- * Gets schemas from database.
- *
- * @param conn Database connection.
- * @return Collection of schema descriptors.
- * @throws SQLException If failed to get schemas.
- */
- public abstract Collection<String> schemas(Connection conn) throws SQLException;
-
- /**
- * Gets tables from database.
- *
- * @param conn Database connection.
- * @param schemas Collection of schema names to load.
- * @param tblsOnly If {@code true} then gets only tables otherwise gets tables and views.
- * @return Collection of table descriptors.
- * @throws SQLException If failed to get tables.
- */
- public abstract Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException;
-
- /**
- * @return Collection of database system schemas.
- */
- public Set<String> systemSchemas() {
- return Collections.singleton("INFORMATION_SCHEMA");
- }
-
- /**
- * @return Collection of unsigned type names.
- * @throws SQLException If failed to get unsigned type names.
- */
- public Set<String> unsignedTypes(DatabaseMetaData dbMeta) throws SQLException {
- return Collections.emptySet();
- }
-
- /**
- * Create table descriptor.
- *
- * @param schema Schema name.
- * @param tbl Table name.
- * @param cols Table columns.
- * @param idxs Table indexes.
- * @return New {@code DbTable} instance.
- */
- protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Collection<QueryIndex>idxs) {
- return new DbTable(schema, tbl, cols, idxs);
- }
-
- /**
- * Create index descriptor.
- *
- * @param idxName Index name.
- * @return New initialized {@code QueryIndex} instance.
- */
- protected QueryIndex index(String idxName) {
- QueryIndex idx = new QueryIndex();
-
- idx.setName(idxName);
- idx.setIndexType(QueryIndexType.SORTED);
- idx.setFields(new LinkedHashMap<String, Boolean>());
-
- return idx;
- }
-}
[19/22] ignite git commit: IGNITE-4354: Sorted fields sorting logc in
BinaryObjectBuilder. This closes #1759.
Posted by pt...@apache.org.
IGNITE-4354: Sorted fields sorting logc in BinaryObjectBuilder. This closes #1759.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c48260f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c48260f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c48260f
Branch: refs/heads/ignite-3477-master
Commit: 5c48260f3d79bafd72af87e19077f150831d07e9
Parents: 62a3b4d
Author: Alexander Paschenko <al...@gmail.com>
Authored: Mon Apr 10 16:34:35 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Apr 10 16:34:35 2017 +0300
----------------------------------------------------------------------
.../binary/builder/BinaryObjectBuilderImpl.java | 36 +++++++++++---------
1 file changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c48260f/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
index 6827c96..02e06fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/builder/BinaryObjectBuilderImpl.java
@@ -500,6 +500,21 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
}
}
+ /**
+ * If value of {@link #assignedVals} is null, set it according to
+ * {@link BinaryUtils#FIELDS_SORTED_ORDER}.
+ */
+ private Map<String, Object> assignedValues() {
+ if (assignedVals == null) {
+ if (BinaryUtils.FIELDS_SORTED_ORDER)
+ assignedVals = new TreeMap<>();
+ else
+ assignedVals = new LinkedHashMap<>();
+ }
+
+ return assignedVals;
+ }
+
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public <T> T getField(String name) {
@@ -526,19 +541,12 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
@Override public BinaryObjectBuilder setField(String name, Object val0) {
Object val = val0 == null ? new BinaryValueWithType(BinaryUtils.typeByClass(Object.class), null) : val0;
- if (assignedVals == null) {
- if (BinaryUtils.FIELDS_SORTED_ORDER)
- assignedVals = new TreeMap<>();
- else
- assignedVals = new LinkedHashMap<>();
- }
-
- Object oldVal = assignedVals.put(name, val);
+ Object oldVal = assignedValues().put(name, val);
if (oldVal instanceof BinaryValueWithType && val0 != null) {
((BinaryValueWithType)oldVal).value(val);
- assignedVals.put(name, oldVal);
+ assignedValues().put(name, oldVal);
}
return this;
@@ -555,10 +563,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
else
typeId = BinaryUtils.typeByClass(type);
- if (assignedVals == null)
- assignedVals = new LinkedHashMap<>();
-
- assignedVals.put(name, new BinaryValueWithType(typeId, val));
+ assignedValues().put(name, new BinaryValueWithType(typeId, val));
return this;
}
@@ -578,10 +583,7 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
* @return {@code this} instance for chaining.
*/
@Override public BinaryObjectBuilderImpl removeField(String name) {
- if (assignedVals == null)
- assignedVals = new LinkedHashMap<>();
-
- assignedVals.put(name, REMOVED_FIELD_MARKER);
+ assignedValues().put(name, REMOVED_FIELD_MARKER);
return this;
}
[12/22] ignite git commit: IGNITE-2558 - NearCacheConfiguration does
not extend MutableConfiguration. This fixes #1701.
Posted by pt...@apache.org.
IGNITE-2558 - NearCacheConfiguration does not extend MutableConfiguration. This fixes #1701.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/512b7af9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/512b7af9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/512b7af9
Branch: refs/heads/ignite-3477-master
Commit: 512b7af90e3fc8e6ae5690c4b187bb65ba82f218
Parents: f6ee9c0
Author: Max Kozlov <dr...@gmail.com>
Authored: Sun Apr 9 00:05:46 2017 +0200
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Sun Apr 9 00:05:46 2017 +0200
----------------------------------------------------------------------
.../configuration/NearCacheConfiguration.java | 56 +-------------------
1 file changed, 2 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/512b7af9/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
index 7c948dc..19def1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
@@ -17,11 +17,7 @@
package org.apache.ignite.configuration;
-import javax.cache.configuration.Factory;
-import javax.cache.configuration.MutableConfiguration;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.integration.CacheLoader;
-import javax.cache.integration.CacheWriter;
+import java.io.Serializable;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.eviction.EvictionPolicy;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -36,7 +32,7 @@ import static org.apache.ignite.configuration.CacheConfiguration.DFLT_NEAR_START
* or most frequently accessed data. Just like with a partitioned cache,
* the user can control the size of the near cache and its eviction policies.
*/
-public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
+public class NearCacheConfiguration<K, V> implements Serializable {
/** */
private static final long serialVersionUID = 0L;
@@ -59,8 +55,6 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
* @param ccfg Configuration to copy.
*/
public NearCacheConfiguration(NearCacheConfiguration<K, V> ccfg) {
- super(ccfg);
-
nearEvictPlc = ccfg.getNearEvictionPolicy();
nearStartSize = ccfg.getNearStartSize();
}
@@ -112,52 +106,6 @@ public class NearCacheConfiguration<K, V> extends MutableConfiguration<K, V> {
}
/** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setTypes(Class<K> keyType, Class<V> valueType) {
- return (CacheConfiguration<K, V>)super.setTypes(keyType, valueType);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setCacheLoaderFactory(Factory<? extends CacheLoader<K, V>> factory) {
- return (CacheConfiguration<K, V>)super.setCacheLoaderFactory(factory);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setCacheWriterFactory(
- Factory<? extends CacheWriter<? super K, ? super V>> factory) {
- return (CacheConfiguration<K, V>)super.setCacheWriterFactory(factory);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setExpiryPolicyFactory(Factory<? extends ExpiryPolicy> factory) {
- return (CacheConfiguration<K, V>)super.setExpiryPolicyFactory(factory);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setReadThrough(boolean isReadThrough) {
- return (CacheConfiguration<K, V>)super.setReadThrough(isReadThrough);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setWriteThrough(boolean isWriteThrough) {
- return (CacheConfiguration<K, V>)super.setWriteThrough(isWriteThrough);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setStoreByValue(boolean isStoreByValue) {
- return (CacheConfiguration<K, V>)super.setStoreByValue(isStoreByValue);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setStatisticsEnabled(boolean enabled) {
- return (CacheConfiguration<K, V>)super.setStatisticsEnabled(enabled);
- }
-
- /** {@inheritDoc} */
- @Override public CacheConfiguration<K, V> setManagementEnabled(boolean enabled) {
- return (CacheConfiguration<K, V>)super.setManagementEnabled(enabled);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(NearCacheConfiguration.class, this, super.toString());
}
[16/22] ignite git commit: minor
Posted by pt...@apache.org.
minor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/118baebf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/118baebf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/118baebf
Branch: refs/heads/ignite-3477-master
Commit: 118baebf800b91089981754e349688b8e07ac517
Parents: 7201f2c
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Apr 10 11:54:48 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Apr 10 11:54:48 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/spi/deployment/local/LocalDeploymentSpi.java | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/118baebf/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
index 9d46737..b0088d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/deployment/local/LocalDeploymentSpi.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.deployment.local;
import java.io.InputStream;
import java.util.Collection;
-import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
@@ -232,7 +231,7 @@ public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSp
// Maps resources to classes.
// Map may contain 2 entries for one class.
- Map<String, String> regRsrcs = new HashMap<>(2, 1.0f);
+ Map<String, String> regRsrcs = U.newHashMap(2);
// Check alias collision for added classes.
String alias = null;
@@ -416,4 +415,4 @@ public class LocalDeploymentSpi extends IgniteSpiAdapter implements DeploymentSp
super(spiAdapter);
}
}
-}
\ No newline at end of file
+}
[03/22] ignite git commit: IGNITE-4905 DML benchmarks
ClassCastException fix - Fixes #1722.
Posted by pt...@apache.org.
IGNITE-4905 DML benchmarks ClassCastException fix - Fixes #1722.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/77740bf6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/77740bf6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/77740bf6
Branch: refs/heads/ignite-3477-master
Commit: 77740bf6fa72b1e669196b945165d59ecb8daeed
Parents: a6d518d
Author: Alexander Paschenko <al...@gmail.com>
Authored: Fri Apr 7 17:12:20 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Apr 7 17:12:20 2017 +0300
----------------------------------------------------------------------
.../yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java | 5 +++--
.../yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/77740bf6/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java
index 218e8dc..19c40e3 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlDeleteFilteredBenchmark.java
@@ -20,6 +20,7 @@ package org.apache.ignite.yardstick.cache.dml;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.yardstick.cache.IgniteCacheAbstractBenchmark;
@@ -39,7 +40,7 @@ public class IgniteSqlDeleteFilteredBenchmark extends IgniteCacheAbstractBenchma
private AtomicInteger delCnt = new AtomicInteger();
/** */
- private AtomicInteger delItemsCnt = new AtomicInteger();
+ private AtomicLong delItemsCnt = new AtomicLong();
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
@@ -55,7 +56,7 @@ public class IgniteSqlDeleteFilteredBenchmark extends IgniteCacheAbstractBenchma
double maxSalary = salary + 1000;
- int res = (Integer) cache().query(new SqlFieldsQuery("delete from Person where salary >= ? and salary <= ?")
+ Long res = (Long)cache().query(new SqlFieldsQuery("delete from Person where salary >= ? and salary <= ?")
.setArgs(salary, maxSalary)).getAll().get(0).get(0);
delItemsCnt.getAndAdd(res);
http://git-wip-us.apache.org/repos/asf/ignite/blob/77740bf6/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java
index 94a83df..c66f335 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/dml/IgniteSqlUpdateFilteredBenchmark.java
@@ -20,6 +20,7 @@ package org.apache.ignite.yardstick.cache.dml;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.yardstick.cache.IgniteCacheAbstractBenchmark;
@@ -39,7 +40,7 @@ public class IgniteSqlUpdateFilteredBenchmark extends IgniteCacheAbstractBenchma
private AtomicInteger updCnt = new AtomicInteger();
/** */
- private AtomicInteger updItemsCnt = new AtomicInteger();
+ private AtomicLong updItemsCnt = new AtomicLong();
/** {@inheritDoc} */
@Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
@@ -55,7 +56,7 @@ public class IgniteSqlUpdateFilteredBenchmark extends IgniteCacheAbstractBenchma
double maxSalary = salary + 1000;
- int res = (Integer) cache().query(new SqlFieldsQuery("update Person set salary = (salary - ?1 + ?2) / 2 " +
+ Long res = (Long)cache().query(new SqlFieldsQuery("update Person set salary = (salary - ?1 + ?2) / 2 " +
"where salary >= ?1 and salary <= ?2").setArgs(salary, maxSalary)).getAll().get(0).get(0);
updItemsCnt.getAndAdd(res);
[14/22] ignite git commit: IGNITE-4812 - Disabled EventStorageSpi by
default. This fixes #1623.
Posted by pt...@apache.org.
IGNITE-4812 - Disabled EventStorageSpi by default. This fixes #1623.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/139efb10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/139efb10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/139efb10
Branch: refs/heads/ignite-3477-master
Commit: 139efb10aac41fa0ba242793fc5d922cee31a9d5
Parents: 512b7af
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Sun Apr 9 14:22:52 2017 +0200
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Sun Apr 9 14:22:52 2017 +0200
----------------------------------------------------------------------
.../configuration/IgniteConfiguration.java | 4 +-
.../ignite/internal/IgniteEventsImpl.java | 8 +-
.../org/apache/ignite/internal/IgnitionEx.java | 4 +-
.../eventstorage/GridEventStorageManager.java | 12 ++-
.../spi/eventstorage/NoopEventStorageSpi.java | 53 +++++++++++
.../GridEventStorageDefaultExceptionTest.java | 94 ++++++++++++++++++++
.../testframework/junits/GridAbstractTest.java | 3 +
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
.../ignite/internal/GridFactorySelfTest.java | 3 +
9 files changed, 175 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index b8e718d..49ae9bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -66,7 +66,7 @@ import org.apache.ignite.spi.deployment.local.LocalDeploymentSpi;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.eventstorage.EventStorageSpi;
-import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
import org.apache.ignite.spi.failover.FailoverSpi;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
import org.apache.ignite.spi.indexing.IndexingSpi;
@@ -1591,7 +1591,7 @@ public class IgniteConfiguration {
/**
* Should return fully configured event SPI implementation. If not provided,
- * {@link MemoryEventStorageSpi} will be used.
+ * {@link NoopEventStorageSpi} will be used.
*
* @return Grid event SPI implementation or {@code null} to use default implementation.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
index 9acccab..030e2db 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEventsImpl.java
@@ -78,8 +78,7 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
}
/** {@inheritDoc} */
- @Override public <T extends Event> List<T> remoteQuery(IgnitePredicate<T> p, long timeout,
- @Nullable int... types) {
+ @Override public <T extends Event> List<T> remoteQuery(IgnitePredicate<T> p, long timeout, @Nullable int... types) {
A.notNull(p, "p");
guard();
@@ -248,6 +247,9 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
try {
return ctx.event().localEvents(compoundPredicate(p, types));
}
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
finally {
unguard();
}
@@ -400,4 +402,4 @@ public class IgniteEventsImpl extends AsyncSupportAdapter<IgniteEvents> implemen
protected Object readResolve() throws ObjectStreamException {
return prj.events();
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 1b8f920..7e99c77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -93,7 +93,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.deployment.local.LocalDeploymentSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
-import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
import org.apache.ignite.spi.indexing.noop.NoopIndexingSpi;
import org.apache.ignite.spi.loadbalancing.LoadBalancingSpi;
@@ -2184,7 +2184,7 @@ public class IgnitionEx {
cfg.setDeploymentSpi(new LocalDeploymentSpi());
if (cfg.getEventStorageSpi() == null)
- cfg.setEventStorageSpi(new MemoryEventStorageSpi());
+ cfg.setEventStorageSpi(new NoopEventStorageSpi());
if (cfg.getCheckpointSpi() == null)
cfg.setCheckpointSpi(new NoopCheckpointSpi());
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
index 77bd7d4..d49463e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
@@ -61,6 +61,8 @@ import org.apache.ignite.marshaller.Marshaller;
import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.eventstorage.EventStorageSpi;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
@@ -954,9 +956,17 @@ public class GridEventStorageManager extends GridManagerAdapter<EventStorageSpi>
* @return Collection of grid events.
*/
@SuppressWarnings("unchecked")
- public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p) {
+ public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p) throws IgniteCheckedException {
assert p != null;
+ if (getSpi() instanceof NoopEventStorageSpi) {
+ throw new IgniteCheckedException(
+ "Failed to query events because default no-op event storage SPI is used. " +
+ "Consider configuring " + MemoryEventStorageSpi.class.getSimpleName() + " or another " +
+ EventStorageSpi.class.getSimpleName() + " implementation via " +
+ "IgniteConfiguration.setEventStorageSpi() configuration property.");
+ }
+
if (p instanceof PlatformEventFilterListener) {
PlatformEventFilterListener p0 = (PlatformEventFilterListener)p;
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/NoopEventStorageSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/NoopEventStorageSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/NoopEventStorageSpi.java
new file mode 100644
index 0000000..41cf7f6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/NoopEventStorageSpi.java
@@ -0,0 +1,53 @@
+/*
+ * 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.spi.eventstorage;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.IgniteSpiAdapter;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.IgniteSpiMultipleInstancesSupport;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * No-op implementation of {@link EventStorageSpi}.
+ */
+@IgniteSpiMultipleInstancesSupport(true)
+public class NoopEventStorageSpi extends IgniteSpiAdapter implements EventStorageSpi {
+ /** {@inheritDoc} */
+ @Override public <T extends Event> Collection<T> localEvents(IgnitePredicate<T> p) {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void record(Event evt) throws IgniteSpiException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public void spiStop() throws IgniteSpiException {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageDefaultExceptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageDefaultExceptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageDefaultExceptionTest.java
new file mode 100644
index 0000000..2cf727e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridEventStorageDefaultExceptionTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.testframework.junits.common.GridCommonTest;
+
+/**
+ * Event storage tests with default no-op spi.
+ */
+@GridCommonTest(group = "Kernal Self")
+public class GridEventStorageDefaultExceptionTest extends GridCommonAbstractTest {
+ /** */
+ public GridEventStorageDefaultExceptionTest() {
+ super(/*start grid*/true);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ cfg.setEventStorageSpi(new NoopEventStorageSpi());
+
+ return cfg;
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testLocalNodeEventStorage() throws Exception {
+ try {
+ grid().events().localQuery(F.<Event>alwaysTrue());
+
+ assert false : "Exception must be thrown.";
+ }
+ catch (IgniteException e) {
+ assertTrue(
+ "Wrong exception message: " + e.getMessage(),
+ e.getMessage().startsWith("Failed to query events because default no-op event storage SPI is used."));
+ }
+ }
+
+ /**
+ * @throws Exception In case of error.
+ */
+ public void testRemoteNodeEventStorage() throws Exception {
+ try {
+ grid().events().remoteQuery(F.<Event>alwaysTrue(), 0);
+
+ assert false : "Exception should be thrown";
+ }
+ catch (IgniteException e) {
+ assertTrue(
+ "Wrong exception message: " + e.getMessage(),
+ e.getMessage().startsWith("Failed to query events due to exception on remote node."));
+
+ boolean found = false;
+
+ Throwable t = e;
+
+ while ((t = t.getCause()) != null) {
+ if (t instanceof IgniteCheckedException && t.getMessage().startsWith(
+ "Failed to query events because default no-op event storage SPI is used.")) {
+ found = true;
+
+ break;
+ }
+ }
+
+ assertTrue("Incorrect exception thrown.", found);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 1bb4540..bfdf635 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -90,6 +90,7 @@ import org.apache.ignite.spi.discovery.tcp.TestTcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger;
@@ -1498,6 +1499,8 @@ public abstract class GridAbstractTest extends TestCase {
cfg.setCheckpointSpi(cpSpi);
+ cfg.setEventStorageSpi(new MemoryEventStorageSpi());
+
cfg.setIncludeEventTypes(EventType.EVTS_ALL);
return cfg;
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
index 810c488..41042f1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.GridCollisionJobsContextSelfTest;
import org.apache.ignite.internal.GridDeploymentMultiThreadedSelfTest;
import org.apache.ignite.internal.GridDeploymentSelfTest;
import org.apache.ignite.internal.GridEventStorageCheckAllEventsSelfTest;
+import org.apache.ignite.internal.GridEventStorageDefaultExceptionTest;
import org.apache.ignite.internal.GridEventStorageRuntimeConfigurationSelfTest;
import org.apache.ignite.internal.GridEventStorageSelfTest;
import org.apache.ignite.internal.GridFailoverCustomTopologySelfTest;
@@ -141,6 +142,7 @@ public class IgniteComputeGridTestSuite {
suite.addTestSuite(GridTaskNameAnnotationSelfTest.class);
suite.addTestSuite(GridJobCheckpointCleanupSelfTest.class);
suite.addTestSuite(GridEventStorageSelfTest.class);
+ suite.addTestSuite(GridEventStorageDefaultExceptionTest.class);
suite.addTestSuite(GridFailoverTaskWithPredicateSelfTest.class);
suite.addTestSuite(GridProjectionLocalJobMultipleArgumentsSelfTest.class);
suite.addTestSuite(GridAffinitySelfTest.class);
http://git-wip-us.apache.org/repos/asf/ignite/blob/139efb10/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java b/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java
index 7764d46..75128fc 100644
--- a/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/internal/GridFactorySelfTest.java
@@ -59,6 +59,7 @@ import org.apache.ignite.spi.collision.CollisionSpi;
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.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.apache.ignite.testframework.http.GridEmbeddedHttpServer;
@@ -317,6 +318,8 @@ public class GridFactorySelfTest extends GridCommonAbstractTest {
cfg.setLifecycleBeans(bean1, bean2);
cfg.setIgniteInstanceName(igniteInstanceName);
+ cfg.setEventStorageSpi(new MemoryEventStorageSpi());
+
cfg.setConnectorConfiguration(null);
try (Ignite g = IgniteSpring.start(cfg, new GenericApplicationContext())) {
[05/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
new file mode 100644
index 0000000..1722948
--- /dev/null
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/OracleMetadataDialect.java
@@ -0,0 +1,359 @@
+/*
+ * 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.console.agent.db.dialect;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.console.agent.db.DbColumn;
+import org.apache.ignite.console.agent.db.DbTable;
+
+import static java.sql.Types.BIGINT;
+import static java.sql.Types.BLOB;
+import static java.sql.Types.BOOLEAN;
+import static java.sql.Types.CHAR;
+import static java.sql.Types.CLOB;
+import static java.sql.Types.DATE;
+import static java.sql.Types.DOUBLE;
+import static java.sql.Types.FLOAT;
+import static java.sql.Types.INTEGER;
+import static java.sql.Types.LONGVARBINARY;
+import static java.sql.Types.LONGVARCHAR;
+import static java.sql.Types.NUMERIC;
+import static java.sql.Types.OTHER;
+import static java.sql.Types.SMALLINT;
+import static java.sql.Types.SQLXML;
+import static java.sql.Types.TIMESTAMP;
+import static java.sql.Types.TINYINT;
+import static java.sql.Types.VARCHAR;
+
+/**
+ * Oracle specific metadata dialect.
+ */
+public class OracleMetadataDialect extends DatabaseMetadataDialect {
+ /** SQL to get columns metadata. */
+ private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," +
+ " a.data_type, a.data_precision, a.data_scale " +
+ "FROM all_tab_columns a %s " +
+ " %s " +
+ " ORDER BY a.owner, a.table_name, a.column_id";
+
+ /** SQL to get list of PRIMARY KEYS columns. */
+ private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" +
+ " FROM all_constraints a" +
+ " INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" +
+ " WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'";
+
+ /** SQL to get indexes metadata. */
+ private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" +
+ " FROM all_ind_columns i" +
+ " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" +
+ " WHERE i.index_owner = ? and i.table_name = ?" +
+ " ORDER BY i.index_name, i.column_position";
+
+ /** Owner index. */
+ private static final int OWNER_IDX = 1;
+
+ /** Table name index. */
+ private static final int TBL_NAME_IDX = 2;
+
+ /** Column name index. */
+ private static final int COL_NAME_IDX = 3;
+
+ /** Nullable index. */
+ private static final int NULLABLE_IDX = 4;
+
+ /** Data type index. */
+ private static final int DATA_TYPE_IDX = 5;
+
+ /** Numeric precision index. */
+ private static final int DATA_PRECISION_IDX = 6;
+
+ /** Numeric scale index. */
+ private static final int DATA_SCALE_IDX = 7;
+
+ /** Index name index. */
+ private static final int IDX_NAME_IDX = 1;
+
+ /** Index name index. */
+ private static final int IDX_EXPR_IDX = 2;
+
+ /** Index column name index. */
+ private static final int IDX_COL_NAME_IDX = 3;
+
+ /** Index column sort order index. */
+ private static final int IDX_COL_DESCEND_IDX = 4;
+
+ /** {@inheritDoc} */
+ @Override public Set<String> systemSchemas() {
+ return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW",
+ "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM",
+ "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB",
+
+ "APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM",
+ "SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL",
+
+ "BI", "HR", "OE", "PM", "IX", "SH"));
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<String> schemas(Connection conn) throws SQLException {
+ Collection<String> schemas = new ArrayList<>();
+
+ ResultSet rs = conn.getMetaData().getSchemas();
+
+ Set<String> sysSchemas = systemSchemas();
+
+ while(rs.next()) {
+ String schema = rs.getString(1);
+
+ if (!sysSchemas.contains(schema) && !schema.startsWith("FLOWS_"))
+ schemas.add(schema);
+ }
+
+ return schemas;
+ }
+
+ /**
+ * @param rs Result set with column type metadata from Oracle database.
+ * @return JDBC type.
+ * @throws SQLException If failed to decode type.
+ */
+ private int decodeType(ResultSet rs) throws SQLException {
+ String type = rs.getString(DATA_TYPE_IDX);
+
+ if (type.startsWith("TIMESTAMP"))
+ return TIMESTAMP;
+ else {
+ switch (type) {
+ case "CHAR":
+ case "NCHAR":
+ return CHAR;
+
+ case "VARCHAR2":
+ case "NVARCHAR2":
+ return VARCHAR;
+
+ case "LONG":
+ return LONGVARCHAR;
+
+ case "LONG RAW":
+ return LONGVARBINARY;
+
+ case "FLOAT":
+ return FLOAT;
+
+ case "NUMBER":
+ int precision = rs.getInt(DATA_PRECISION_IDX);
+ int scale = rs.getInt(DATA_SCALE_IDX);
+
+ if (scale > 0) {
+ if (scale < 4 && precision < 19)
+ return FLOAT;
+
+ if (scale > 4 || precision > 19)
+ return DOUBLE;
+
+ return NUMERIC;
+ }
+ else {
+ if (precision < 1)
+ return INTEGER;
+
+ if (precision < 2)
+ return BOOLEAN;
+
+ if (precision < 4)
+ return TINYINT;
+
+ if (precision < 6)
+ return SMALLINT;
+
+ if (precision < 11)
+ return INTEGER;
+
+ if (precision < 20)
+ return BIGINT;
+
+ return NUMERIC;
+ }
+
+ case "DATE":
+ return DATE;
+
+ case "BFILE":
+ case "BLOB":
+ return BLOB;
+
+ case "CLOB":
+ case "NCLOB":
+ return CLOB;
+
+ case "XMLTYPE":
+ return SQLXML;
+ }
+ }
+
+ return OTHER;
+ }
+
+ /**
+ * Retrieve primary key columns.
+ *
+ * @param stmt Prepared SQL statement to execute.
+ * @param owner DB owner.
+ * @param tbl Table name.
+ * @return Primary key columns.
+ * @throws SQLException If failed to retrieve primary key columns.
+ */
+ private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException {
+ Set<String> pkCols = new HashSet<>();
+
+ stmt.setString(1, owner);
+ stmt.setString(2, tbl);
+
+ try (ResultSet pkRs = stmt.executeQuery()) {
+ while(pkRs.next())
+ pkCols.add(pkRs.getString(1));
+ }
+
+ return pkCols;
+ }
+
+ /**
+ * Retrieve index columns.
+ *
+ * @param stmt Prepared SQL statement to execute.
+ * @param owner DB owner.
+ * @param tbl Table name.
+ * @return Indexes.
+ * @throws SQLException If failed to retrieve indexes columns.
+ */
+ private Collection<QueryIndex> indexes(PreparedStatement stmt, String owner, String tbl) throws SQLException {
+ Map<String, QueryIndex> idxs = new LinkedHashMap<>();
+
+ stmt.setString(1, owner);
+ stmt.setString(2, tbl);
+
+ try (ResultSet idxsRs = stmt.executeQuery()) {
+ while (idxsRs.next()) {
+ String idxName = idxsRs.getString(IDX_NAME_IDX);
+
+ QueryIndex idx = idxs.get(idxName);
+
+ if (idx == null) {
+ idx = index(idxName);
+
+ idxs.put(idxName, idx);
+ }
+
+ String expr = idxsRs.getString(IDX_EXPR_IDX);
+
+ String col = expr == null ? idxsRs.getString(IDX_COL_NAME_IDX) : expr.replaceAll("\"", "");
+
+ idx.getFields().put(col, !"DESC".equals(idxsRs.getString(IDX_COL_DESCEND_IDX)));
+ }
+ }
+
+ return idxs.values();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly)
+ throws SQLException {
+ Collection<DbTable> tbls = new ArrayList<>();
+
+ PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS);
+
+ PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES);
+
+ if (schemas.isEmpty())
+ schemas.add(null);
+
+ Set<String> sysSchemas = systemSchemas();
+
+ try (Statement colsStmt = conn.createStatement()) {
+ for (String schema: schemas) {
+ if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_")))
+ continue;
+
+ Collection<DbColumn> cols = new ArrayList<>();
+
+ Set<String> pkCols = Collections.emptySet();
+ Collection<QueryIndex> idxs = Collections.emptyList();
+
+ String sql = String.format(SQL_COLUMNS,
+ tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "",
+ schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : "");
+
+ try (ResultSet colsRs = colsStmt.executeQuery(sql)) {
+ String prevSchema = "";
+ String prevTbl = "";
+
+ boolean first = true;
+
+ while (colsRs.next()) {
+ String owner = colsRs.getString(OWNER_IDX);
+ String tbl = colsRs.getString(TBL_NAME_IDX);
+
+ if (sysSchemas.contains(owner) || (schema != null && schema.startsWith("FLOWS_")))
+ continue;
+
+ boolean changed = !owner.equals(prevSchema) || !tbl.equals(prevTbl);
+
+ if (changed) {
+ if (first)
+ first = false;
+ else
+ tbls.add(table(prevSchema, prevTbl, cols, idxs));
+
+ prevSchema = owner;
+ prevTbl = tbl;
+ cols = new ArrayList<>();
+ pkCols = primaryKeys(pkStmt, owner, tbl);
+ idxs = indexes(idxStmt, owner, tbl);
+ }
+
+ String colName = colsRs.getString(COL_NAME_IDX);
+
+ cols.add(new DbColumn(colName, decodeType(colsRs), pkCols.contains(colName),
+ !"N".equals(colsRs.getString(NULLABLE_IDX)), false));
+ }
+
+ if (!cols.isEmpty())
+ tbls.add(table(prevSchema, prevTbl, cols, idxs));
+ }
+ }
+ }
+
+ return tbls;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
index 4577228..a0e9f8f 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/DatabaseListener.java
@@ -34,8 +34,8 @@ import java.util.Map;
import java.util.Properties;
import org.apache.ignite.console.agent.AgentConfiguration;
import org.apache.ignite.console.demo.AgentMetadataDemo;
-import org.apache.ignite.schema.parser.DbMetadataReader;
-import org.apache.ignite.schema.parser.DbTable;
+import org.apache.ignite.console.agent.db.DbMetadataReader;
+import org.apache.ignite.console.agent.db.DbTable;
import org.apache.log4j.Logger;
import static org.apache.ignite.console.agent.AgentUtils.resolvePath;
@@ -51,6 +51,9 @@ public class DatabaseListener {
private final File driversFolder;
/** */
+ private final DbMetadataReader dbMetaReader;
+
+ /** */
private final AbstractListener schemasLsnr = new AbstractListener() {
@Override public Object execute(Map<String, Object> args) throws Exception {
String driverPath = null;
@@ -79,6 +82,7 @@ public class DatabaseListener {
}
};
+ /** */
private final AbstractListener metadataLsnr = new AbstractListener() {
@SuppressWarnings("unchecked")
@Override public Object execute(Map<String, Object> args) throws Exception {
@@ -118,6 +122,7 @@ public class DatabaseListener {
}
};
+ /** */
private final AbstractListener availableDriversLsnr = new AbstractListener() {
@Override public Object execute(Map<String, Object> args) throws Exception {
if (driversFolder == null) {
@@ -176,6 +181,7 @@ public class DatabaseListener {
*/
public DatabaseListener(AgentConfiguration cfg) {
driversFolder = resolvePath(cfg.driversFolder() == null ? "jdbc-drivers" : cfg.driversFolder());
+ dbMetaReader = new DbMetadataReader();
}
/**
@@ -184,7 +190,7 @@ public class DatabaseListener {
* @param jdbcUrl JDBC URL.
* @param jdbcInfo Properties to connect to database.
* @return Connection to database.
- * @throws SQLException
+ * @throws SQLException If failed to connect.
*/
private Connection connect(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
Properties jdbcInfo) throws SQLException {
@@ -194,7 +200,7 @@ public class DatabaseListener {
if (!new File(jdbcDriverJarPath).isAbsolute() && driversFolder != null)
jdbcDriverJarPath = new File(driversFolder, jdbcDriverJarPath).getPath();
- return DbMetadataReader.getInstance().connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo);
+ return dbMetaReader.connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo);
}
/**
@@ -203,7 +209,7 @@ public class DatabaseListener {
* @param jdbcUrl JDBC URL.
* @param jdbcInfo Properties to connect to database.
* @return Collection of schema names.
- * @throws SQLException
+ * @throws SQLException If failed to load schemas.
*/
protected Collection<String> schemas(String jdbcDriverJarPath, String jdbcDriverCls, String jdbcUrl,
Properties jdbcInfo) throws SQLException {
@@ -212,7 +218,7 @@ public class DatabaseListener {
", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
- Collection<String> schemas = DbMetadataReader.getInstance().schemas(conn);
+ Collection<String> schemas = dbMetaReader.schemas(conn);
if (log.isDebugEnabled())
log.debug("Finished collection of schemas [jdbcUrl=" + jdbcUrl + ", count=" + schemas.size() + "]");
@@ -261,7 +267,7 @@ public class DatabaseListener {
", drvCls=" + jdbcDriverCls + ", jdbcUrl=" + jdbcUrl + "]");
try (Connection conn = connect(jdbcDriverJarPath, jdbcDriverCls, jdbcUrl, jdbcInfo)) {
- Collection<DbTable> metadata = DbMetadataReader.getInstance().metadata(conn, schemas, tblsOnly);
+ Collection<DbTable> metadata = dbMetaReader.metadata(conn, schemas, tblsOnly);
if (log.isDebugEnabled())
log.debug("Finished collection of metadata [jdbcUrl=" + jdbcUrl + ", count=" + metadata.size() + "]");
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 04226b9..41338dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -340,11 +340,6 @@
<substitution expression="${project.version}" />
</replaceregexp>
- <replaceregexp file="${basedir}/target/release-package/examples/schema-import/pom.xml" byline="true">
- <regexp pattern="to_be_replaced_by_ignite_version" />
- <substitution expression="${project.version}" />
- </replaceregexp>
-
<chmod dir="${basedir}/target/release-package" perm="755" includes="**/*.sh" />
<!--
@@ -605,7 +600,6 @@
<id>examples</id>
<modules>
<module>examples</module>
- <module>examples/schema-import</module>
</modules>
</profile>
@@ -788,125 +782,10 @@
</profile>
<profile>
- <id>java8-schema-import</id>
- <activation>
- <file>
- <exists>${java.home}/lib/ext/jfxrt.jar</exists>
- </file>
- </activation>
- <modules>
- <module>modules/schema-import</module>
- <module>modules/schema-import-db</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.4</version>
- <inherited>false</inherited>
-
- <executions>
- <execution>
- <id>dependencies-schema-import</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>assembly/dependencies-schema-import.xml</descriptor>
- </descriptors>
- <outputDirectory>target/release-package/bin</outputDirectory>
- <finalName>include</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
-
- <execution>
- <id>schema-import-scripts</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>assembly/release-schema-import.xml</descriptor>
- </descriptors>
- <outputDirectory>target/release-package</outputDirectory>
- <finalName>bin</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>schema-import</id>
- <activation>
- <file>
- <exists>${java.home}/lib/jfxrt.jar</exists>
- </file>
- </activation>
- <modules>
- <module>modules/schema-import</module>
- <module>modules/schema-import-db</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.4</version>
- <inherited>false</inherited>
-
- <executions>
- <execution>
- <id>dependencies-schema-import</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>assembly/dependencies-schema-import.xml</descriptor>
- </descriptors>
- <outputDirectory>target/release-package/bin</outputDirectory>
- <finalName>include</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
-
- <execution>
- <id>schema-import-scripts</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>assembly/release-schema-import.xml</descriptor>
- </descriptors>
- <outputDirectory>target/release-package</outputDirectory>
- <finalName>bin</finalName>
- <appendAssemblyId>false</appendAssemblyId>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>web-console</id>
<modules>
<module>modules/web-console</module>
<module>modules/web-console/web-agent</module>
- <module>modules/schema-import-db</module>
</modules>
</profile>
[17/22] ignite git commit: IGNITE-4935 .NET:
IgniteConfiguration.EventStorageSpi
Posted by pt...@apache.org.
IGNITE-4935 .NET: IgniteConfiguration.EventStorageSpi
This closes #1761
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4425b40f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4425b40f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4425b40f
Branch: refs/heads/ignite-3477-master
Commit: 4425b40f93f4b61e815dd7352022b5fcbe4765f0
Parents: 118baeb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Apr 10 12:33:52 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Apr 10 12:34:12 2017 +0300
----------------------------------------------------------------------
.../utils/PlatformConfigurationUtils.java | 29 +++++-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 66 +++++++++---
.../IgniteConfigurationSerializerTest.cs | 13 ++-
.../IgniteConfigurationTest.cs | 15 ++-
.../Apache.Ignite.Core.csproj | 3 +
.../Events/IEventStorageSpi.cs | 33 ++++++
.../Events/MemoryEventStorageSpi.cs | 100 +++++++++++++++++++
.../Events/NoopEventStorageSpi.cs | 27 +++++
.../Apache.Ignite.Core/IgniteConfiguration.cs | 48 ++++++++-
.../IgniteConfigurationSection.xsd | 22 ++++
.../Plugin/IPluginConfiguration.cs | 4 +-
11 files changed, 338 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 7fb25c8..f1ef625 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -67,9 +67,11 @@ 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.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.eventstorage.EventStorageSpi;
+import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
+import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
import org.apache.ignite.spi.swapspace.SwapSpaceSpi;
import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpiMBean;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@ -673,6 +675,18 @@ public class PlatformConfigurationUtils {
assert swapType == SWAP_TYP_NONE;
}
+ switch (in.readByte()) {
+ case 1:
+ cfg.setEventStorageSpi(new NoopEventStorageSpi());
+ break;
+
+ case 2:
+ cfg.setEventStorageSpi(new MemoryEventStorageSpi()
+ .setExpireCount(in.readLong())
+ .setExpireAgeMs(in.readLong()));
+ break;
+ }
+
readPluginConfiguration(cfg, in);
}
@@ -1116,6 +1130,19 @@ public class PlatformConfigurationUtils {
w.writeByte(SWAP_TYP_NONE);
}
+ EventStorageSpi eventStorageSpi = cfg.getEventStorageSpi();
+
+ if (eventStorageSpi == null) {
+ w.writeByte((byte) 0);
+ } else if (eventStorageSpi instanceof NoopEventStorageSpi) {
+ w.writeByte((byte) 1);
+ } else if (eventStorageSpi instanceof MemoryEventStorageSpi) {
+ w.writeByte((byte) 2);
+
+ w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireCount());
+ w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireAgeMs());
+ }
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 994b334..329d307 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -50,15 +50,6 @@ namespace Apache.Ignite.Core.Tests
/** */
private IIgnite[] _grids;
-
- /** */
- public static int IdGen;
-
- [TestFixtureTearDown]
- public void FixtureTearDown()
- {
- StopGrids();
- }
/// <summary>
/// Executes before each test.
@@ -74,7 +65,7 @@ namespace Apache.Ignite.Core.Tests
/// Executes after each test.
/// </summary>
[TearDown]
- public virtual void TearDown()
+ public void TearDown()
{
try
{
@@ -97,6 +88,15 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
+ /// Fixture tear down.
+ /// </summary>
+ [TestFixtureTearDown]
+ public void FixtureTearDown()
+ {
+ StopGrids();
+ }
+
+ /// <summary>
/// Tests enable/disable of event types.
/// </summary>
[Test]
@@ -611,6 +611,36 @@ namespace Apache.Ignite.Core.Tests
}
/// <summary>
+ /// Tests the event store configuration.
+ /// </summary>
+ [Test]
+ public void TestConfiguration()
+ {
+ var cfg = _grid1.GetConfiguration().EventStorageSpi as MemoryEventStorageSpi;
+
+ Assert.IsNotNull(cfg);
+
+ Assert.AreEqual(MemoryEventStorageSpi.DefaultExpirationTimeout, cfg.ExpirationTimeout);
+ Assert.AreEqual(MemoryEventStorageSpi.DefaultMaxEventCount, cfg.MaxEventCount);
+
+ // Test user-defined event storage.
+ var igniteCfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ IgniteInstanceName = "grid4",
+ EventStorageSpi = new MyEventStorage()
+ };
+
+ var ex = Assert.Throws<IgniteException>(() => Ignition.Start(igniteCfg));
+ Assert.AreEqual("Failed to start Ignite.NET, check inner exception for details", ex.Message);
+
+ Assert.IsNotNull(ex.InnerException);
+ Assert.AreEqual("Unsupported IgniteConfiguration.EventStorageSpi: " +
+ "'Apache.Ignite.Core.Tests.MyEventStorage'. Supported implementations: " +
+ "'Apache.Ignite.Core.Events.NoopEventStorageSpi', " +
+ "'Apache.Ignite.Core.Events.MemoryEventStorageSpi'.", ex.InnerException.Message);
+ }
+
+ /// <summary>
/// Checks base event fields serialization.
/// </summary>
/// <param name="evt">The evt.</param>
@@ -666,7 +696,7 @@ namespace Apache.Ignite.Core.Tests
/// <summary>
/// Gets the Ignite configuration.
/// </summary>
- private static IgniteConfiguration Configuration(string springConfigUrl)
+ private static IgniteConfiguration GetConfiguration(string springConfigUrl)
{
return new IgniteConfiguration
{
@@ -679,7 +709,8 @@ namespace Apache.Ignite.Core.Tests
{
new BinaryTypeConfiguration(typeof (RemoteEventBinarizableFilter))
}
- }
+ },
+ EventStorageSpi = new MemoryEventStorageSpi()
};
}
@@ -761,9 +792,9 @@ namespace Apache.Ignite.Core.Tests
if (_grid1 != null)
return;
- _grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml"));
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
- _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
+ _grid1 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid1.xml"));
+ _grid2 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid2.xml"));
+ _grid3 = Ignition.Start(GetConfiguration("config\\compute\\compute-grid3.xml"));
_grids = new[] {_grid1, _grid2, _grid3};
}
@@ -1069,4 +1100,9 @@ namespace Apache.Ignite.Core.Tests
throw new NotImplementedException();
}
}
+
+ public class MyEventStorage : IEventStorageSpi
+ {
+ // No-op.
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 6015f80..1d39e69 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -137,6 +137,7 @@ namespace Apache.Ignite.Core.Tests
<pluginConfigurations>
<iPluginConfiguration type='Apache.Ignite.Core.Tests.Plugin.TestIgnitePluginConfiguration, Apache.Ignite.Core.Tests' />
</pluginConfigurations>
+ <eventStorageSpi type='MemoryEventStorageSpi' expirationTimeout='00:00:23.45' maxEventCount='129' />
</igniteConfig>";
var cfg = IgniteConfiguration.FromXml(xml);
@@ -255,6 +256,11 @@ namespace Apache.Ignite.Core.Tests
var cachePlugCfg = cacheCfg.PluginConfigurations.Cast<CachePluginConfiguration>().Single();
Assert.AreEqual("baz", cachePlugCfg.TestProperty);
+
+ var eventStorage = cfg.EventStorageSpi as MemoryEventStorageSpi;
+ Assert.IsNotNull(eventStorage);
+ Assert.AreEqual(23.45, eventStorage.ExpirationTimeout.TotalSeconds);
+ Assert.AreEqual(129, eventStorage.MaxEventCount);
}
/// <summary>
@@ -796,7 +802,12 @@ namespace Apache.Ignite.Core.Tests
ReadStripesNumber = 77,
BaseDirectory = "test"
},
- PluginConfigurations = new[] {new TestIgnitePluginConfiguration() }
+ PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
+ EventStorageSpi = new MemoryEventStorageSpi
+ {
+ ExpirationTimeout = TimeSpan.FromMilliseconds(12345),
+ MaxEventCount = 257
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 5063c21..f9f8a61 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -83,6 +83,7 @@ namespace Apache.Ignite.Core.Tests
CheckDefaultValueAttributes(new AtomicConfiguration());
CheckDefaultValueAttributes(new TransactionConfiguration());
CheckDefaultValueAttributes(new FileSwapSpaceSpi());
+ CheckDefaultValueAttributes(new MemoryEventStorageSpi());
}
/// <summary>
@@ -198,6 +199,13 @@ namespace Apache.Ignite.Core.Tests
Assert.IsNotNull(resCfg.PluginConfigurations);
Assert.AreEqual(cfg.PluginConfigurations, resCfg.PluginConfigurations);
+
+ var eventCfg = cfg.EventStorageSpi as MemoryEventStorageSpi;
+ var resEventCfg = resCfg.EventStorageSpi as MemoryEventStorageSpi;
+ Assert.IsNotNull(eventCfg);
+ Assert.IsNotNull(resEventCfg);
+ Assert.AreEqual(eventCfg.ExpirationTimeout, resEventCfg.ExpirationTimeout);
+ Assert.AreEqual(eventCfg.MaxEventCount, resEventCfg.MaxEventCount);
}
}
@@ -546,7 +554,12 @@ namespace Apache.Ignite.Core.Tests
}
}
},
- PluginConfigurations = new[] { new TestIgnitePluginConfiguration() }
+ PluginConfigurations = new[] { new TestIgnitePluginConfiguration() },
+ EventStorageSpi = new MemoryEventStorageSpi
+ {
+ ExpirationTimeout = TimeSpan.FromSeconds(5),
+ MaxEventCount = 10
+ }
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 2a174eb..6553f1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -93,6 +93,9 @@
<ItemGroup>
<Compile Include="Binary\BinaryArrayEqualityComparer.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
+ <Compile Include="Events\IEventStorageSpi.cs" />
+ <Compile Include="Events\MemoryEventStorageSpi.cs" />
+ <Compile Include="Events\NoopEventStorageSpi.cs" />
<Compile Include="Impl\Binary\BinaryFieldEqualityComparer.cs" />
<Compile Include="Binary\BinaryReflectiveSerializer.cs" />
<Compile Include="Common\JavaException.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventStorageSpi.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventStorageSpi.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventStorageSpi.cs
new file mode 100644
index 0000000..f04c30c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventStorageSpi.cs
@@ -0,0 +1,33 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Events
+{
+ using System.Diagnostics.CodeAnalysis;
+
+ /// <summary>
+ /// Manages local event storage.
+ /// <para />
+ /// Only predefined implementations are supported:
+ /// <see cref="NoopEventStorageSpi"/>, <see cref="MemoryEventStorageSpi"/>.
+ /// </summary>
+ [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
+ public interface IEventStorageSpi
+ {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/Events/MemoryEventStorageSpi.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/MemoryEventStorageSpi.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/MemoryEventStorageSpi.cs
new file mode 100644
index 0000000..e00c155
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/MemoryEventStorageSpi.cs
@@ -0,0 +1,100 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Events
+{
+ using System;
+ using System.ComponentModel;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// In-memory event storage.
+ /// </summary>
+ public class MemoryEventStorageSpi : IEventStorageSpi
+ {
+ /// <summary>
+ /// Default event count limit.
+ /// </summary>
+ public const long DefaultMaxEventCount = 10000;
+
+ /// <summary>
+ /// The default expiration timeout.
+ /// </summary>
+ public static readonly TimeSpan DefaultExpirationTimeout = TimeSpan.FromSeconds(-1);
+
+ /// <summary>
+ /// Gets or sets the expiration timeout for stored events.
+ /// Negative value means no expiration.
+ /// Defaults to -1 second.
+ /// </summary>
+ [DefaultValue(typeof(TimeSpan), "-0:0:1")]
+ public TimeSpan ExpirationTimeout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the maximum event count to store. When this limit is reached, older events are removed.
+ /// Defaults to <see cref="DefaultMaxEventCount"/>.
+ /// </summary>
+ [DefaultValue(DefaultMaxEventCount)]
+ public long MaxEventCount { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MemoryEventStorageSpi"/> class.
+ /// </summary>
+ public MemoryEventStorageSpi()
+ {
+ ExpirationTimeout = DefaultExpirationTimeout;
+ MaxEventCount = DefaultMaxEventCount;
+ }
+
+ /// <summary>
+ /// Reads instance.
+ /// </summary>
+ internal static MemoryEventStorageSpi Read(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ var eventCount = reader.ReadLong();
+ var timeout = reader.ReadLong();
+
+ return new MemoryEventStorageSpi
+ {
+ MaxEventCount = eventCount,
+ ExpirationTimeout = timeout < 0 || timeout > TimeSpan.MaxValue.TotalMilliseconds
+ ? DefaultExpirationTimeout
+ : TimeSpan.FromMilliseconds(timeout)
+ };
+ }
+
+ /// <summary>
+ /// Writes this instance.
+ /// </summary>
+ internal void Write(IBinaryRawWriter writer)
+ {
+ writer.WriteLong(MaxEventCount);
+
+ if (ExpirationTimeout == TimeSpan.MaxValue || ExpirationTimeout < TimeSpan.Zero)
+ {
+ writer.WriteLong(long.MaxValue);
+ }
+ else
+ {
+ writer.WriteLong((long) ExpirationTimeout.TotalMilliseconds);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/Events/NoopEventStorageSpi.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/NoopEventStorageSpi.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/NoopEventStorageSpi.cs
new file mode 100644
index 0000000..c69531f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/NoopEventStorageSpi.cs
@@ -0,0 +1,27 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Events
+{
+ /// <summary>
+ /// No-op event storage interface, does not store anything.
+ /// </summary>
+ public class NoopEventStorageSpi : IEventStorageSpi
+ {
+ // No-op.
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 28842e9..20e2be8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -30,6 +30,7 @@
using Apache.Ignite.Core.Cache;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Communication;
using Apache.Ignite.Core.Communication.Tcp;
using Apache.Ignite.Core.DataStructures.Configuration;
@@ -348,7 +349,33 @@
// Swap space
SwapSpaceSerializer.Write(writer, SwapSpaceSpi);
- // Plugins
+ // Event storage
+ if (EventStorageSpi == null)
+ {
+ writer.WriteByte(0);
+ }
+ else if (EventStorageSpi is NoopEventStorageSpi)
+ {
+ writer.WriteByte(1);
+ }
+ else
+ {
+ var memEventStorage = EventStorageSpi as MemoryEventStorageSpi;
+
+ if (memEventStorage == null)
+ {
+ throw new IgniteException(string.Format(
+ "Unsupported IgniteConfiguration.EventStorageSpi: '{0}'. " +
+ "Supported implementations: '{1}', '{2}'.",
+ EventStorageSpi.GetType(), typeof(NoopEventStorageSpi), typeof(MemoryEventStorageSpi)));
+ }
+
+ writer.WriteByte(2);
+
+ memEventStorage.Write(writer);
+ }
+
+ // Plugins (should be last)
if (PluginConfigurations != null)
{
var pos = writer.Stream.Position;
@@ -484,6 +511,17 @@
// Swap
SwapSpaceSpi = SwapSpaceSerializer.Read(r);
+
+ // Event storage
+ switch (r.ReadByte())
+ {
+ case 1: EventStorageSpi = new NoopEventStorageSpi();
+ break;
+
+ case 2:
+ EventStorageSpi = MemoryEventStorageSpi.Read(r);
+ break;
+ }
}
/// <summary>
@@ -923,5 +961,13 @@
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public ICollection<IPluginConfiguration> PluginConfigurations { get; set; }
+
+ /// <summary>
+ /// Gets or sets the event storage interface.
+ /// <para />
+ /// Only predefined implementations are supported:
+ /// <see cref="NoopEventStorageSpi"/>, <see cref="MemoryEventStorageSpi"/>.
+ /// </summary>
+ public IEventStorageSpi EventStorageSpi { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 375d128..3691aa0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1208,6 +1208,28 @@
</xs:attribute>
</xs:complexType>
</xs:element>
+ <xs:element name="eventStorageSpi" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Event storage space SPI.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Assembly-qualified type name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="expirationTimeout" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Expiration timeout for stored events. Negative for unlimited.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxEventCount" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Maximum event count to store.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
<xs:element name="pluginConfigurations" minOccurs="0">
<xs:annotation>
<xs:documentation>Plugin configurations.</xs:documentation>
http://git-wip-us.apache.org/repos/asf/ignite/blob/4425b40f/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginConfiguration.cs
index 4d594f4..47c6599 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Plugin/IPluginConfiguration.cs
@@ -17,11 +17,10 @@
namespace Apache.Ignite.Core.Plugin
{
- using System.Diagnostics.CodeAnalysis;
using Apache.Ignite.Core.Binary;
/// <summary>
- /// Plugin configuration marker interface.
+ /// Plugin configuration interface.
/// <para />
/// Implementations should be linked to corresponding <see cref="IPluginProvider{TConfig}"/>
/// via <see cref="PluginProviderTypeAttribute"/>.
@@ -41,7 +40,6 @@ namespace Apache.Ignite.Core.Plugin
/// </code>
/// </example>
/// </summary>
- [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
public interface IPluginConfiguration
{
/// <summary>
[20/22] ignite git commit: ignite-4571 - reviewed contribution
Posted by pt...@apache.org.
ignite-4571 - reviewed contribution
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b99c1980
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b99c1980
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b99c1980
Branch: refs/heads/ignite-3477-master
Commit: b99c1980dfe250b3f24a94eb4b6cb948bb314ab5
Parents: 5c48260
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Mon Apr 10 18:29:33 2017 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Apr 10 18:29:33 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAtomicFuture.java | 2 +-
.../processors/cache/GridCacheMvccManager.java | 84 ++++++++++++++++----
.../cache/GridDeferredAckMessageSender.java | 11 ++-
.../GridDhtAtomicAbstractUpdateFuture.java | 4 +-
.../GridNearAtomicAbstractUpdateFuture.java | 2 +-
.../GridNearAtomicSingleUpdateFuture.java | 21 ++---
.../dht/atomic/GridNearAtomicUpdateFuture.java | 23 +++---
.../cache/transactions/IgniteTxManager.java | 2 +-
8 files changed, 102 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
index 8df229e..87ae29c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicFuture.java
@@ -27,7 +27,7 @@ public interface GridCacheAtomicFuture<R> extends GridCacheFuture<R> {
/**
* @return Future ID.
*/
- public Long id();
+ public long id();
/**
* Gets future that will be completed when it is safe when update is finished on the given version of topology.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index dff2c88..712d136 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -81,6 +81,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
/** Maxim number of removed locks. */
private static final int MAX_REMOVED_LOCKS = 10240;
+ /** Maxim number of atomic IDs for thread. Must be power of two! */
+ protected static final int THREAD_RESERVE_SIZE = 0x4000;
+
/** */
private static final int MAX_NESTED_LSNR_CALLS = getInteger(IGNITE_MAX_NESTED_LISTENER_CALLS, 5);
@@ -106,9 +109,6 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
@GridToStringExclude
private final ConcurrentMap<GridCacheVersion, Collection<GridCacheMvccFuture<?>>> mvccFuts = newMap();
- /** */
- private final AtomicLong atomicFutId = new AtomicLong(U.currentTimeMillis());
-
/** Pending atomic futures. */
private final ConcurrentHashMap8<Long, GridCacheAtomicFuture<?>> atomicFuts = new ConcurrentHashMap8<>();
@@ -138,6 +138,16 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
/** */
private volatile boolean stopping;
+ /** Global atomic id counter. */
+ protected final AtomicLong globalAtomicCnt = new AtomicLong();
+
+ /** Per thread atomic id counter. */
+ private final ThreadLocal<LongWrapper> threadAtomicCnt = new ThreadLocal<LongWrapper>() {
+ @Override protected LongWrapper initialValue() {
+ return new LongWrapper(globalAtomicCnt.getAndAdd(THREAD_RESERVE_SIZE));
+ }
+ };
+
/** Lock callback. */
@GridToStringExclude
private final GridCacheMvccCallback cb = new GridCacheMvccCallback() {
@@ -256,9 +266,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
cacheFut.onNodeLeft(discoEvt.eventNode().id());
if (cacheFut.isCancelled() || cacheFut.isDone()) {
- Long futId = cacheFut.id();
+ long futId = cacheFut.id();
- if (futId != null)
+ if (futId > 0)
atomicFuts.remove(futId, cacheFut);
}
}
@@ -426,18 +436,11 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
- * @return ID for atomic cache update future.
- */
- public long atomicFutureId() {
- return atomicFutId.incrementAndGet();
- }
-
- /**
* @param futId Future ID.
* @param fut Future.
* @return {@code False} if future was forcibly completed with error.
*/
- public boolean addAtomicFuture(Long futId, GridCacheAtomicFuture<?> fut) {
+ public boolean addAtomicFuture(long futId, GridCacheAtomicFuture<?> fut) {
IgniteInternalFuture<?> old = atomicFuts.put(futId, fut);
assert old == null : "Old future is not null [futId=" + futId + ", fut=" + fut + ", old=" + old + ']';
@@ -472,7 +475,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @param futId Future ID.
* @return Future.
*/
- @Nullable public IgniteInternalFuture<?> atomicFuture(Long futId) {
+ @Nullable public IgniteInternalFuture<?> atomicFuture(long futId) {
return atomicFuts.get(futId);
}
@@ -480,7 +483,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @param futId Future ID.
* @return Removed future.
*/
- @Nullable public IgniteInternalFuture<?> removeAtomicFuture(Long futId) {
+ @Nullable public IgniteInternalFuture<?> removeAtomicFuture(long futId) {
return atomicFuts.remove(futId);
}
@@ -1174,6 +1177,20 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
}
/**
+ * @return Next future ID for atomic futures.
+ */
+ public long nextAtomicId() {
+ LongWrapper cnt = threadAtomicCnt.get();
+
+ long res = cnt.getAndIncrement();
+
+ if ((cnt.get() & (THREAD_RESERVE_SIZE - 1)) == 0)
+ cnt.set(globalAtomicCnt.getAndAdd(THREAD_RESERVE_SIZE));
+
+ return res;
+ }
+
+ /**
*
*/
private class FinishLockFuture extends GridFutureAdapter<Object> {
@@ -1382,4 +1399,41 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
return S.toString(DataStreamerFuture.class, this, super.toString());
}
}
+
+ /** Long wrapper. */
+ private static class LongWrapper {
+ /** */
+ private long val;
+
+ /**
+ * @param val Value.
+ */
+ public LongWrapper(long val) {
+ this.val = val + 1;
+
+ if (this.val == 0)
+ this.val = 1;
+ }
+
+ /**
+ * @param val Value to set.
+ */
+ public void set(long val) {
+ this.val = val;
+ }
+
+ /**
+ * @return Current value.
+ */
+ public long get() {
+ return val;
+ }
+
+ /**
+ * @return Current value (and stores incremented value).
+ */
+ public long getAndIncrement() {
+ return val++;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridDeferredAckMessageSender.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridDeferredAckMessageSender.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridDeferredAckMessageSender.java
index 5265ec9..89aa725 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridDeferredAckMessageSender.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridDeferredAckMessageSender.java
@@ -21,7 +21,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.closure.GridClosureProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
@@ -33,7 +32,7 @@ import org.jsr166.ConcurrentLinkedDeque8;
/**
*
*/
-public abstract class GridDeferredAckMessageSender {
+public abstract class GridDeferredAckMessageSender<T> {
/** Deferred message buffers. */
private ConcurrentMap<UUID, DeferredAckMessageBuffer> deferredAckMsgBuffers = new ConcurrentHashMap8<>();
@@ -67,7 +66,7 @@ public abstract class GridDeferredAckMessageSender {
* @param nodeId Node ID.
* @param vers Versions to send.
*/
- public abstract void finish(UUID nodeId, ConcurrentLinkedDeque8<GridCacheVersion> vers);
+ public abstract void finish(UUID nodeId, ConcurrentLinkedDeque8<T> vers);
/**
*
@@ -81,7 +80,7 @@ public abstract class GridDeferredAckMessageSender {
* @param nodeId Node ID to send message to.
* @param ver Version to ack.
*/
- public void sendDeferredAckMessage(UUID nodeId, GridCacheVersion ver) {
+ public void sendDeferredAckMessage(UUID nodeId, T ver) {
while (true) {
DeferredAckMessageBuffer buf = deferredAckMsgBuffers.get(nodeId);
@@ -117,7 +116,7 @@ public abstract class GridDeferredAckMessageSender {
private AtomicBoolean guard = new AtomicBoolean(false);
/** Versions. */
- private ConcurrentLinkedDeque8<GridCacheVersion> vers = new ConcurrentLinkedDeque8<>();
+ private ConcurrentLinkedDeque8<T> vers = new ConcurrentLinkedDeque8<>();
/** Node ID. */
private final UUID nodeId;
@@ -173,7 +172,7 @@ public abstract class GridDeferredAckMessageSender {
* @param ver Version to send.
* @return {@code True} if request was handled, {@code false} if this buffer is filled and cannot be used.
*/
- public boolean add(GridCacheVersion ver) {
+ public boolean add(T ver) {
readLock().lock();
boolean snd = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
index 5ff5aa4..0940acb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicAbstractUpdateFuture.java
@@ -110,7 +110,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
this.updateReq = updateReq;
this.writeVer = writeVer;
- futId = cctx.mvcc().atomicFutureId();
+ futId = cctx.mvcc().nextAtomicId();
if (log == null) {
msgLog = cctx.shared().atomicMessageLogger();
@@ -295,7 +295,7 @@ public abstract class GridDhtAtomicAbstractUpdateFuture extends GridFutureAdapte
}
/** {@inheritDoc} */
- @Override public final Long id() {
+ @Override public final long id() {
return futId;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
index 39abb73..a2adb05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
@@ -138,7 +138,7 @@ public abstract class GridNearAtomicAbstractUpdateFuture extends GridFutureAdapt
/** Future ID. */
@GridToStringInclude
- protected Long futId;
+ protected long futId;
/** Operation result. */
protected GridCacheReturn opRes;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
index c2372d1..e4ba457 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
@@ -125,7 +125,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
}
/** {@inheritDoc} */
- @Override public Long id() {
+ @Override public long id() {
synchronized (mux) {
return futId;
}
@@ -216,7 +216,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
AffinityTopologyVersion remapTopVer0;
synchronized (mux) {
- if (futId == null || futId != res.futureId())
+ if (futId == 0 || futId != res.futureId())
return;
assert reqState != null;
@@ -258,7 +258,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
CachePartialUpdateCheckedException err0 = null;
synchronized (mux) {
- if (futId == null || futId != res.futureId())
+ if (futId == 0 || futId != res.futureId())
return;
req = reqState.processPrimaryResponse(nodeId, res);
@@ -331,7 +331,8 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
* @return Non-null topology version if update should be remapped.
*/
private AffinityTopologyVersion onAllReceived() {
- assert futId != null;
+ assert Thread.holdsLock(mux);
+ assert futId > 0;
AffinityTopologyVersion remapTopVer0 = null;
@@ -362,7 +363,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
cctx.mvcc().removeAtomicFuture(futId);
reqState = null;
- futId = null;
+ futId = 0;
topVer = AffinityTopologyVersion.ZERO;
remapTopVer = null;
@@ -479,7 +480,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
/** {@inheritDoc} */
@Override protected void map(AffinityTopologyVersion topVer) {
- long futId = cctx.mvcc().atomicFutureId();
+ long futId = cctx.mvcc().nextAtomicId();
Exception err = null;
PrimaryRequestState reqState0 = null;
@@ -488,7 +489,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
reqState0 = mapSingleUpdate(topVer, futId);
synchronized (mux) {
- assert this.futId == null : this;
+ assert this.futId == 0 : this;
assert this.topVer == AffinityTopologyVersion.ZERO : this;
this.topVer = topVer;
@@ -529,7 +530,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
/**
* @param futId Future ID.
*/
- private void checkDhtNodes(Long futId) {
+ private void checkDhtNodes(long futId) {
GridCacheReturn opRes0 = null;
CachePartialUpdateCheckedException err0 = null;
AffinityTopologyVersion remapTopVer0 = null;
@@ -537,7 +538,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
GridNearAtomicCheckUpdateRequest checkReq = null;
synchronized (mux) {
- if (this.futId == null || !this.futId.equals(futId))
+ if (this.futId == 0 || this.futId != futId)
return;
assert reqState != null;
@@ -570,7 +571,7 @@ public class GridNearAtomicSingleUpdateFuture extends GridNearAtomicAbstractUpda
synchronized (mux) {
id0 = futId;
- futId = null;
+ futId = 0;
}
return id0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index a44ccf9..84deefc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -150,7 +150,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
/** {@inheritDoc} */
- @Override public Long id() {
+ @Override public long id() {
synchronized (mux) {
return futId;
}
@@ -167,7 +167,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
List<GridNearAtomicCheckUpdateRequest> checkReqs = null;
synchronized (mux) {
- if (futId == null)
+ if (futId == 0)
return false;
if (singleReq != null) {
@@ -300,7 +300,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
AffinityTopologyVersion remapTopVer0;
synchronized (mux) {
- if (futId == null || futId != res.futureId())
+ if (futId == 0 || futId != res.futureId())
return;
PrimaryRequestState reqState;
@@ -373,7 +373,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
boolean rcvAll;
synchronized (mux) {
- if (futId == null || futId != res.futureId())
+ if (futId == 0 || futId != res.futureId())
return;
if (singleReq != null) {
@@ -534,7 +534,8 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
* @return Non null topology version if update should be remapped.
*/
@Nullable private AffinityTopologyVersion onAllReceived() {
- assert futId != null;
+ assert Thread.holdsLock(mux);
+ assert futId > 0;
AffinityTopologyVersion remapTopVer0 = null;
@@ -577,7 +578,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
if (remapTopVer0 != null) {
cctx.mvcc().removeAtomicFuture(futId);
- futId = null;
+ futId = 0;
topVer = AffinityTopologyVersion.ZERO;
remapTopVer = null;
@@ -767,7 +768,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
return;
}
- Long futId = cctx.mvcc().atomicFutureId();
+ long futId = cctx.mvcc().nextAtomicId();
Exception err = null;
PrimaryRequestState singleReq0 = null;
@@ -801,7 +802,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
}
synchronized (mux) {
- assert this.futId == null : this;
+ assert this.futId == 0 : this;
assert this.topVer == AffinityTopologyVersion.ZERO : this;
this.topVer = topVer;
@@ -856,7 +857,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
checkDhtNodes(futId);
}
- private void checkDhtNodes(Long futId) {
+ private void checkDhtNodes(long futId) {
GridCacheReturn opRes0 = null;
CachePartialUpdateCheckedException err0 = null;
AffinityTopologyVersion remapTopVer0 = null;
@@ -866,7 +867,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
boolean rcvAll = false;
synchronized (mux) {
- if (this.futId == null || !this.futId.equals(futId))
+ if (this.futId == 0 || this.futId != futId)
return;
if (singleReq != null) {
@@ -940,7 +941,7 @@ public class GridNearAtomicUpdateFuture extends GridNearAtomicAbstractUpdateFutu
synchronized (mux) {
id0 = futId;
- futId = null;
+ futId = 0;
}
return id0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b99c1980/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index d1334ef..6b383a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -211,7 +211,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
txHnd = new IgniteTxHandler(cctx);
- deferredAckMsgSnd = new GridDeferredAckMessageSender(cctx.time(), cctx.kernalContext().closure()) {
+ deferredAckMsgSnd = new GridDeferredAckMessageSender<GridCacheVersion>(cctx.time(), cctx.kernalContext().closure()) {
@Override public int getTimeout() {
return DEFERRED_ONE_PHASE_COMMIT_ACK_REQUEST_TIMEOUT;
}
[18/22] ignite git commit: IGNITE-4733: Removed unused methods in
GridFunc and F0 classes. This closes #1563.
Posted by pt...@apache.org.
IGNITE-4733: Removed unused methods in GridFunc and F0 classes. This closes #1563.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/62a3b4d7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/62a3b4d7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/62a3b4d7
Branch: refs/heads/ignite-3477-master
Commit: 62a3b4d718cd37ab6964d757b285daa126342424
Parents: 4425b40
Author: devozerov <vo...@gridgain.com>
Authored: Mon Apr 10 15:01:01 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Apr 10 15:01:01 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/util/F0.java | 196 +-----
.../ignite/internal/util/lang/GridFunc.java | 620 +------------------
2 files changed, 9 insertions(+), 807 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/62a3b4d7/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
index 130987b..497baaf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/F0.java
@@ -21,18 +21,11 @@ import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicateAdapter;
-import org.apache.ignite.internal.processors.cache.CacheEntrySerializablePredicate;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
import org.apache.ignite.internal.util.lang.GridFunc;
import org.apache.ignite.internal.util.lang.GridNodePredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.Nullable;
@@ -52,6 +45,7 @@ public class F0 {
* @param <T> Type of the free variable, i.e. the element the predicate is called on.
* @return Negated predicate (not peer-deployable).
*/
+ @SuppressWarnings("unchecked")
public static <T> IgnitePredicate<T> not(@Nullable final IgnitePredicate<? super T>... p) {
return F.isAlwaysFalse(p) ? F.<T>alwaysTrue() : F.isAlwaysTrue(p) ? F.<T>alwaysFalse() : new P1<T>() {
@Override public boolean apply(T t) {
@@ -90,8 +84,6 @@ public class F0 {
public static <T> IgnitePredicate<T> notIn(@Nullable final Collection<? extends T> c) {
return F.isEmpty(c) ? GridFunc.<T>alwaysTrue() : new P1<T>() {
@Override public boolean apply(T t) {
- assert c != null;
-
return !c.contains(t);
}
};
@@ -115,151 +107,6 @@ public class F0 {
}
/**
- * @param p1 Filter1.
- * @param p2 Filter2.
- * @return And filter.
- */
- public static CacheEntryPredicate and0(@Nullable final CacheEntryPredicate[] p1,
- @Nullable final CacheEntryPredicate... p2) {
- if (CU.isAlwaysFalse0(p1) || CU.isAlwaysFalse0(p2))
- return CU.alwaysFalse0();
-
- if (CU.isAlwaysTrue0(p1) && CU.isAlwaysTrue0(p2))
- return CU.alwaysTrue0();
-
- final boolean e1 = F.isEmpty(p1);
- final boolean e2 = F.isEmpty(p2);
-
- if (e1 && e2)
- return CU.alwaysTrue0();
-
- if (e1 && !e2) {
- assert p2 != null;
-
- if (p2.length == 1)
- return p2[0];
- }
-
- if (!e1 && e2) {
- assert p1 != null;
-
- if (p1.length == 1)
- return p1[0];
- }
-
- return new CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
- @Override public boolean apply(GridCacheEntryEx e) {
- if (!e1) {
- assert p1 != null;
-
- for (CacheEntryPredicate p : p1)
- if (p != null && !p.apply(e))
- return false;
- }
-
- if (!e2) {
- assert p2 != null;
-
- for (CacheEntryPredicate p : p2)
- if (p != null && !p.apply(e))
- return false;
- }
-
- return true;
- }
-
- @Override public void entryLocked(boolean locked) {
- if (p1 != null) {
- for (CacheEntryPredicate p : p1) {
- if (p != null)
- p.entryLocked(locked);
- }
- }
-
- if (p2 != null) {
- for (CacheEntryPredicate p : p2) {
- if (p != null)
- p.entryLocked(locked);
- }
- }
- }
-
- @Override public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException {
- if (!e1) {
- assert p1 != null;
-
- for (CacheEntryPredicate p : p1)
- p.prepareMarshal(ctx);
- }
-
- if (!e2) {
- assert p2 != null;
-
- for (CacheEntryPredicate p : p2)
- p.prepareMarshal(ctx);
- }
- }
- });
- }
-
- /**
- * @param p Filter1.
- * @param ps Filter2.
- * @return And filter.
- */
- public static CacheEntryPredicate and0(
- @Nullable final CacheEntryPredicate p,
- @Nullable final CacheEntryPredicate... ps) {
- if (p == null && F.isEmptyOrNulls(ps))
- return CU.alwaysTrue0();
-
- if (F.isAlwaysFalse(p) && F.isAlwaysFalse(ps))
- return CU.alwaysFalse0();
-
- if (F.isAlwaysTrue(p) && F.isAlwaysTrue(ps))
- return CU.alwaysTrue0();
-
- return new CacheEntrySerializablePredicate(new CacheEntryPredicateAdapter() {
- @Override public boolean apply(GridCacheEntryEx e) {
- assert ps != null;
-
- if (p != null && !p.apply(e))
- return false;
-
- for (CacheEntryPredicate p : ps) {
- if (p != null && !p.apply(e))
- return false;
- }
-
- return true;
- }
-
- @Override public void entryLocked(boolean locked) {
- assert ps != null;
-
- if (p != null)
- p.entryLocked(locked);
-
- for (CacheEntryPredicate p : ps) {
- if (p != null)
- p.entryLocked(locked);
- }
- }
-
- @Override public void prepareMarshal(GridCacheContext ctx) throws IgniteCheckedException {
- assert ps != null;
-
- if (p != null)
- p.prepareMarshal(ctx);
-
- for (CacheEntryPredicate p : ps)
- if (p != null)
- p.prepareMarshal(ctx);
- }
- });
- }
-
- /**
* Get a predicate (non peer-deployable) that evaluates to {@code true} if each of its component predicates
* evaluates to {@code true}. The components are evaluated in order they are supplied.
* Evaluation will be stopped as soon as first predicate evaluates to {@code false}.
@@ -272,7 +119,7 @@ public class F0 {
* @return Predicate that evaluates to {@code true} if each of its component predicates
* evaluates to {@code true}.
*/
- @SuppressWarnings({"unchecked"})
+ @SuppressWarnings({"unchecked", "ConfusingArgumentToVarargsMethod"})
public static <T> IgnitePredicate<T> and(@Nullable final IgnitePredicate<? super T>[] p1,
@Nullable final IgnitePredicate<? super T>... p2) {
if (F.isAlwaysFalse(p1) || F.isAlwaysFalse(p2))
@@ -287,16 +134,12 @@ public class F0 {
if (e1 && e2)
return F.alwaysTrue();
- if (e1 && !e2) {
- assert p2 != null;
-
+ if (e1) {
if (p2.length == 1)
return (IgnitePredicate<T>)p2[0];
}
if (!e1 && e2) {
- assert p1 != null;
-
if (p1.length == 1)
return (IgnitePredicate<T>)p1[0];
}
@@ -305,15 +148,11 @@ public class F0 {
Set<UUID> ids = new GridLeanSet<>();
if (!e1) {
- assert p1 != null;
-
for (IgnitePredicate<? super T> p : p1)
ids.addAll(((GridNodePredicate)p).nodeIds());
}
if (!e2) {
- assert p2 != null;
-
for (IgnitePredicate<? super T> p : p2)
ids.addAll(((GridNodePredicate)p).nodeIds());
}
@@ -325,16 +164,12 @@ public class F0 {
return new P1<T>() {
@Override public boolean apply(T t) {
if (!e1) {
- assert p1 != null;
-
for (IgnitePredicate<? super T> p : p1)
if (p != null && !p.apply(t))
return false;
}
if (!e2) {
- assert p2 != null;
-
for (IgnitePredicate<? super T> p : p2)
if (p != null && !p.apply(t))
return false;
@@ -359,7 +194,7 @@ public class F0 {
* @return Predicate that evaluates to {@code true} if each of its component predicates
* evaluates to {@code true}.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "ConfusingArgumentToVarargsMethod", "ConstantConditions"})
public static <T> IgnitePredicate<T> and(
@Nullable final IgnitePredicate<? super T> p,
@Nullable final IgnitePredicate<? super T>... ps
@@ -428,8 +263,6 @@ public class F0 {
public static <T> IgnitePredicate<T> in(@Nullable final Collection<? extends T> c) {
return F.isEmpty(c) ? GridFunc.<T>alwaysFalse() : new P1<T>() {
@Override public boolean apply(T t) {
- assert c != null;
-
return c.contains(t);
}
};
@@ -475,31 +308,10 @@ public class F0 {
* @param ps Collection of predicates to test.
* @return {@code True} if all passed in predicates are instances of {@link GridNodePredicate} class.
*/
- public static boolean isAllNodePredicates(@Nullable Iterable<? extends IgnitePredicate<?>> ps) {
- if (F.isEmpty(ps))
- return false;
-
- assert ps != null;
-
- for (IgnitePredicate<?> p : ps)
- if (!(p instanceof GridNodePredicate))
- return false;
-
- return true;
- }
-
- /**
- * Tests if all passed in predicates are instances of {@link GridNodePredicate} class.
- *
- * @param ps Collection of predicates to test.
- * @return {@code True} if all passed in predicates are instances of {@link GridNodePredicate} class.
- */
public static boolean isAllNodePredicates(@Nullable IgnitePredicate<?>... ps) {
if (F.isEmpty(ps))
return false;
- assert ps != null;
-
for (IgnitePredicate<?> p : ps)
if (!(p instanceof GridNodePredicate))
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/62a3b4d7/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index 5eb27d3..a00abe9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -35,14 +35,11 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
import javax.cache.Cache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.internal.IgniteFutureTimeoutCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.F0;
@@ -52,7 +49,6 @@ import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.GridLeanSet;
import org.apache.ignite.internal.util.GridSerializableCollection;
import org.apache.ignite.internal.util.GridSerializableIterator;
-import org.apache.ignite.internal.util.GridSerializableList;
import org.apache.ignite.internal.util.GridSerializableMap;
import org.apache.ignite.internal.util.GridSerializableSet;
import org.apache.ignite.internal.util.typedef.C1;
@@ -68,7 +64,6 @@ import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
-import org.apache.ignite.lang.IgniteOutClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.lang.IgniteReducer;
import org.jetbrains.annotations.NotNull;
@@ -153,13 +148,6 @@ public class GridFunc {
};
/** */
- private static final IgnitePredicate<Object> IS_NULL = new P1<Object>() {
- @Override public boolean apply(Object o) {
- return o == null;
- }
- };
-
- /** */
private static final IgnitePredicate<Object> IS_NOT_NULL = new P1<Object>() {
@Override public boolean apply(Object o) {
return o != null;
@@ -167,28 +155,6 @@ public class GridFunc {
};
/** */
- private static final IgniteCallable<?> LIST_FACTORY = new IgniteCallable<List>() {
- @Override public List call() {
- return new ArrayList();
- }
-
- @Override public String toString() {
- return "Array list factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<?> LINKED_LIST_FACTORY = new IgniteCallable<LinkedList>() {
- @Override public LinkedList call() {
- return new LinkedList();
- }
-
- @Override public String toString() {
- return "Linked list factory.";
- }
- };
-
- /** */
private static final IgniteCallable<?> SET_FACTORY = new IgniteCallable<Set>() {
@Override public Set call() {
return new HashSet();
@@ -211,39 +177,6 @@ public class GridFunc {
};
/** */
- private static final IgniteCallable<AtomicLong> ATOMIC_LONG_FACTORY = new IgniteCallable<AtomicLong>() {
- @Override public AtomicLong call() {
- return new AtomicLong(0);
- }
-
- @Override public String toString() {
- return "Atomic long factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<AtomicBoolean> ATOMIC_BOOL_FACTORY = new IgniteCallable<AtomicBoolean>() {
- @Override public AtomicBoolean call() {
- return new AtomicBoolean();
- }
-
- @Override public String toString() {
- return "Atomic boolean factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<?> ATOMIC_REF_FACTORY = new IgniteCallable<AtomicReference>() {
- @Override public AtomicReference call() {
- return new AtomicReference();
- }
-
- @Override public String toString() {
- return "Atomic reference factory.";
- }
- };
-
- /** */
private static final IgniteCallable<?> MAP_FACTORY = new IgniteCallable<Map>() {
@Override public Map call() {
return new HashMap();
@@ -322,35 +255,6 @@ public class GridFunc {
}
};
- /** */
- private static final IgniteClosure<ClusterNode, String> NODE2ID8 = new IgniteClosure<ClusterNode, String>() {
- @Override public String apply(ClusterNode n) {
- return U.id8(n.id());
- }
-
- @Override public String toString() {
- return "Grid node to node ID8 transformer closure.";
- }
- };
-
- /** */
- private static final IgniteClosure<UUID, String> ID2ID8 = new IgniteClosure<UUID, String>() {
- @Override public String apply(UUID id) {
- return U.id8(id);
- }
-
- @Override public String toString() {
- return "UUID to ID8 transformer closure.";
- }
- };
-
- /** */
- private static final IgnitePredicate<IgniteInternalFuture<?>> UNFINISHED_FUTURE = new IgnitePredicate<IgniteInternalFuture<?>>() {
- @Override public boolean apply(IgniteInternalFuture<?> f) {
- return !f.isDone();
- }
- };
-
/**
* Gets predicate that evaluates to {@code true} only for given local node ID.
*
@@ -562,39 +466,6 @@ public class GridFunc {
}
/**
- * Gets collections of data items from grid job res casted to specified type.
- * <p>
- * Here's the typical example of how this method is used in {@code reduce()} method
- * implementation (this example sums up all the values of {@code Integer} type):
- * <pre name="code" class="java">
- * public Integer reduce(List<ComputeJobResult> res) throws IgniteCheckedException {
- * return F.sum(F.<Integer>jobResults(res));
- * }
- * </pre>
- * <p>
- * Note that this method doesn't create a new collection but simply iterates over the input one.
- *
- * @param res Collection of grid job res.
- * @param <T> Type of the data item to cast to. See {@link org.apache.ignite.compute.ComputeJobResult#getData()} method.
- * @return Collections of data items casted to type {@code T}.
- * @see org.apache.ignite.compute.ComputeJobResult#getData()
- */
- @Deprecated
- public static <T> Collection<T> jobResults(@Nullable Collection<? extends ComputeJobResult> res) {
- if (isEmpty(res))
- return Collections.emptyList();
-
- assert res != null;
-
- Collection<T> c = new ArrayList<>(res.size());
-
- for (ComputeJobResult r : res)
- c.add(r.<T>getData());
-
- return c;
- }
-
- /**
* Convenient utility method that returns collection of node IDs for a given
* collection of grid nodes.
* <p>
@@ -612,43 +483,6 @@ public class GridFunc {
}
/**
- * Convenient utility method that returns collection of node ID8s for a given
- * collection of grid nodes. ID8 is a shorter string representation of node ID,
- * mainly the first 8 characters.
- * <p>
- * Note that this method doesn't create a new collection but simply iterates
- * over the input one.
- *
- * @param nodes Collection of grid nodes.
- * @return Collection of node IDs for given collection of grid nodes.
- */
- public static Collection<String> nodeId8s(@Nullable Collection<? extends ClusterNode> nodes) {
- if (nodes == null || nodes.isEmpty())
- return Collections.emptyList();
-
- return F.viewReadOnly(nodes, NODE2ID8);
- }
-
- /**
- * Convenient utility method that returns collection of node ID8s for a given
- * collection of node IDs. ID8 is a shorter string representation of node ID,
- * mainly the first 8 characters.
- * <p>
- * Note that this method doesn't create a new collection but simply iterates
- * over the input one.
- *
- * @param ids Collection of nodeIds.
- * @return Collection of node IDs for given collection of grid nodes.
- */
- @Deprecated
- public static Collection<String> id8s(@Nullable Collection<UUID> ids) {
- if (ids == null || ids.isEmpty())
- return Collections.emptyList();
-
- return F.viewReadOnly(ids, ID2ID8);
- }
-
- /**
* Creates absolute closure that does <tt>System.out.println(msg)</tt>.
*
* @param msg Message to print.
@@ -739,8 +573,6 @@ public class GridFunc {
return l;
}
- assert c != null;
-
Collection<T> ret = new ArrayList<>(c.size() + 1);
ret.add(t);
@@ -752,8 +584,6 @@ public class GridFunc {
if (isEmpty(c))
return Collections.singletonList(t);
- assert c != null;
-
return new GridSerializableCollection<T>() {
@NotNull
@Override public Iterator<T> iterator() {
@@ -804,6 +634,7 @@ public class GridFunc {
* @param <T> Element type.
* @return Concatenated {@code non-null} collection.
*/
+ @SuppressWarnings("ConstantConditions")
public static <T> Collection<T> concat(boolean cp, @Nullable final Collection<T> c1,
@Nullable final Collection<T> c2) {
if (cp) {
@@ -1079,55 +910,6 @@ public class GridFunc {
}
/**
- * Loses all entries in input map which keys are evaluated to {@code true} by all
- * given predicates.
- *
- * @param m Map to filter.
- * @param cp If {@code true} method creates new map not modifying input, otherwise does
- * <tt>in-place</tt> modifications.
- * @param p Optional set of predicates to use for filtration. If none provided - original
- * map (or its copy) will be returned.
- * @param <K> Type of the free variable for the predicate and type of map's keys.
- * @param <V> Type of map's values.
- * @return Filtered map.
- */
- @Deprecated
- public static <K, V> Map<K, V> loseKeys(
- Map<K, V> m,
- boolean cp,
- @Nullable final IgnitePredicate<? super K>... p
- ) {
- return lose(m, cp, new P1<Map.Entry<K, V>>() {
- @Override public boolean apply(Map.Entry<K, V> e) {
- return isAll(e.getKey(), p);
- }
- });
- }
-
- /**
- * Loses all entries in input map which values are evaluated to {@code true} by all
- * given predicates.
- *
- * @param m Map to filter.
- * @param cp If {@code true} method creates new map not modifying input, otherwise does
- * <tt>in-place</tt> modifications.
- * @param p Optional set of predicates to use for filtration. If none provided - original
- * map (or its copy) will be returned.
- * @param <K> Type of the free variable for the predicate and type of map's keys.
- * @param <V> Type of map's values.
- * @return Filtered map.
- */
- @Deprecated
- public static <K, V> Map<K, V> loseValues(Map<K, V> m, boolean cp,
- @Nullable final IgnitePredicate<? super V>... p) {
- return lose(m, cp, new P1<Map.Entry<K, V>>() {
- @Override public boolean apply(Map.Entry<K, V> e) {
- return isAll(e.getValue(), p);
- }
- });
- }
-
- /**
* Loses all elements in input list that are contained in {@code filter} collection.
*
* @param c Input list.
@@ -1138,6 +920,7 @@ public class GridFunc {
* @param <T> Type of list.
* @return List of remaining elements
*/
+ @SuppressWarnings("SuspiciousMethodCalls")
public static <T> List<T> loseList(List<T> c, boolean cp, @Nullable Collection<? super T> filter) {
A.notNull(c, "c");
@@ -1361,41 +1144,6 @@ public class GridFunc {
}
/**
- * Curries given closure.
- *
- * @param f Closure.
- * @param e Parameter.
- * @param <T> Input type.
- * @param <R> Output type.
- * @return Curried closure.
- */
- @Deprecated
- public static <T, R> IgniteOutClosure<R> curry(final IgniteClosure<? super T, R> f, final T e) {
- return new IgniteOutClosure<R>() {
- @Override public R apply() {
- return f.apply(e);
- }
- };
- }
-
- /**
- * Curries given closure.
- *
- * @param f Closure.
- * @param e Parameter.
- * @param <T> Input type.
- * @return Curried closure.
- */
- @Deprecated
- public static <T> GridAbsClosure curry(final IgniteInClosure<? super T> f, final T e) {
- return new GridAbsClosure() {
- @Override public void apply() {
- f.apply(e);
- }
- };
- }
-
- /**
* Converts array to {@link List}. Note that resulting list cannot
* be altered in size, as it it based on the passed in array -
* only current elements can be changed.
@@ -1650,8 +1398,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyList();
- assert c != null;
-
return isEmpty(p) || isAlwaysTrue(p) ? c : new GridSerializableCollection<T>() {
// Pass through (will fail for readonly).
@Override public boolean add(T e) {
@@ -1696,8 +1442,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyList();
- assert c != null;
-
return new GridSerializableCollection<T2>() {
@NotNull
@Override public Iterator<T2> iterator() {
@@ -1715,72 +1459,6 @@ public class GridFunc {
}
/**
- * Creates read-only light-weight view on given list with provided transformation.
- * Resulting list will only "have" {@code transformed} elements. Note that only wrapping
- * list will be created and no duplication of data will occur.
- *
- * @param c Input list that serves as a base for the view.
- * @param trans Transformation closure.
- * @param <T1> Type of the list.
- * @return Light-weight view on given list with provided transformation.
- */
- @SuppressWarnings("RedundantTypeArguments")
- @Deprecated
- public static <T1, T2> List<T2> viewListReadOnly(@Nullable final List<? extends T1> c,
- final IgniteClosure<? super T1, T2> trans) {
- A.notNull(trans, "trans");
-
- if (isEmpty(c))
- return Collections.emptyList();
-
- assert c != null;
-
- return new GridSerializableList<T2>() {
- /** */
- private static final long serialVersionUID = 3126625219739967068L;
-
- @Override public T2 get(int idx) {
- return trans.apply(c.get(idx));
- }
-
- @NotNull
- @Override public Iterator<T2> iterator() {
- return F.<T1, T2>iterator(c, trans, true);
- }
-
- @Override public int size() {
- return c.size();
- }
-
- @Override public boolean isEmpty() {
- return c.isEmpty();
- }
- };
- }
-
- /**
- * Creates a view on given list with provided transformer and predicates.
- * Resulting list will only "have" elements for which all provided predicates, if any,
- * evaluate to {@code true}. Note that a new collection will be created and data will
- * be copied.
- *
- * @param c Input list that serves as a base for the view.
- * @param trans Transforming closure from T1 to T2.
- * @param p Optional predicates. If predicates are not provided - all elements will be in the view.
- * @return View on given list with provided predicate.
- */
- @Deprecated
- public static <T1, T2> List<T2> transformList(Collection<? extends T1> c,
- IgniteClosure<? super T1, T2> trans, @Nullable IgnitePredicate<? super T1>... p) {
- A.notNull(c, "c", trans, "trans");
-
- if (isAlwaysFalse(p))
- return Collections.emptyList();
-
- return new ArrayList<>(transform(retain(c, true, p), trans));
- }
-
- /**
* Creates light-weight view on given map with provided predicates. Resulting map will
* only "have" keys for which all provided predicates, if any, evaluates to {@code true}.
* Note that only wrapping map will be created and no duplication of data will occur.
@@ -1798,8 +1476,6 @@ public class GridFunc {
if (isEmpty(m) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert m != null;
-
return isEmpty(p) || isAlwaysTrue(p) ? m : new GridSerializableMap<K, V>() {
/** */
private static final long serialVersionUID = 5531745605372387948L;
@@ -1886,8 +1562,6 @@ public class GridFunc {
if (isEmpty(m) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert m != null;
-
final boolean hasPred = p != null && p.length > 0;
return new GridSerializableMap<K, V1>() {
@@ -2008,8 +1682,6 @@ public class GridFunc {
if (isEmpty(m) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert m != null;
-
return new GridSerializableMap<K, V1>() {
/** Entry predicate. */
private IgnitePredicate<Entry<K, V>> ep = new P1<Map.Entry<K, V>>() {
@@ -2130,8 +1802,6 @@ public class GridFunc {
if (isEmpty(c) || isAlwaysFalse(p))
return Collections.emptyMap();
- assert c != null;
-
return new GridSerializableMap<K, V>() {
/** Entry predicate. */
private IgnitePredicate<K> ep = new P1<K>() {
@@ -2313,60 +1983,6 @@ public class GridFunc {
}
/**
- * Converts collection of numbers to primitive {@code int[]} array.
- *
- * @param col Collection of numbers.
- * @return Array of integers.
- */
- public static int[] toIntArray(Collection<? extends Number> col) {
- if (col == null)
- return null;
-
- int[] res = new int[col.size()];
-
- Iterator<? extends Number> iter = col.iterator();
-
- for (int i = 0; i < res.length; i++)
- res[i] = iter.next().intValue();
-
- return res;
- }
-
- /**
- * Utility map getter. This method analogous to {@link #addIfAbsent(Map, Object, Callable)}
- * method but this one doesn't put the default value into the map when key is not found.
- *
- * @param map Map to get value from.
- * @param key Map key (can be {@code null}).
- * @param c Optional factory closure for the default value to be returned in
- * when {@code key} is not found. If closure is not provided - {@code null} will be returned.
- * @param <K> Map key type.
- * @param <V> Map value type.
- * @return Value for the {@code key} or default value produced by {@code c} if key is not
- * found (or {@code null} if key is not found and closure is not provided).
- * @throws GridClosureException Thrown in case when callable throws exception.
- * @see #newLinkedList()
- * @see #newList()
- * @see #newSet()
- * @see #newAtomicLong()
- * @see #newAtomicInt()
- * @see #newAtomicRef()
- * @see #newAtomicBoolean()
- */
- @Deprecated
- @Nullable public static <K, V> V returnIfAbsent(Map<? extends K, ? extends V> map, @Nullable K key,
- @Nullable Callable<V> c) {
- A.notNull(map, "map");
-
- try {
- return !map.containsKey(key) ? c == null ? null : c.call() : map.get(key);
- }
- catch (Exception e) {
- throw wrap(e);
- }
- }
-
- /**
* Returns a factory closure that creates new {@link ConcurrentLinkedDeque8} instance.
* Note that this method does not create a new closure but returns a static one.
*
@@ -2380,20 +1996,6 @@ public class GridFunc {
}
/**
- * Returns a factory closure that creates new {@link List} instance. Note that this
- * method does not create a new closure but returns a static one.
- *
- * @param <T> Type parameters for the created {@link List}.
- * @return Factory closure that creates new {@link List} instance every
- * time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static <T> IgniteCallable<List<T>> newList() {
- return (IgniteCallable<List<T>>)LIST_FACTORY;
- }
-
- /**
* Returns a factory closure that creates new {@link AtomicInteger} instance
* initialized to {@code zero}. Note that this method does not create a new
* closure but returns a static one.
@@ -2407,61 +2009,6 @@ public class GridFunc {
}
/**
- * Returns a factory closure that creates new {@link AtomicLong} instance
- * initialized to {@code zero}. Note that this method does not create a new
- * closure but returns a static one.
- *
- * @return Factory closure that creates new {@link AtomicLong} instance
- * initialized to {@code zero} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @Deprecated
- public static IgniteCallable<AtomicLong> newAtomicLong() {
- return ATOMIC_LONG_FACTORY;
- }
-
- /**
- * Returns a factory closure that creates new {@link AtomicReference} instance
- * initialized to {@code null}. Note that this method does not create a new closure
- * but returns a static one.
- *
- * @param <T> Type of the atomic reference.
- * @return Factory closure that creates new {@link AtomicReference} instance
- * initialized to {@code null} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static <T> IgniteCallable<AtomicReference<T>> newAtomicRef() {
- return (IgniteCallable<AtomicReference<T>>)ATOMIC_REF_FACTORY;
- }
-
- /**
- * Returns a factory closure that creates new {@link AtomicBoolean} instance
- * initialized to {@code false}. Note that this method does not create a new
- * closure but returns a static one.
- *
- * @return Factory closure that creates new {@link AtomicBoolean} instance
- * initialized to {@code false} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @Deprecated
- public static IgniteCallable<AtomicBoolean> newAtomicBoolean() {
- return ATOMIC_BOOL_FACTORY;
- }
-
- /**
- * Returns a factory closure that creates new {@link LinkedList} instance.
- * Note that this method does not create a new closure but returns a static one.
- *
- * @param <T> Type parameters for the created {@link LinkedList}.
- * @return Factory closure that creates new {@link LinkedList} instance every time its {@link
- * org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static <T> IgniteCallable<LinkedList<T>> newLinkedList() {
- return (IgniteCallable<LinkedList<T>>)LINKED_LIST_FACTORY;
- }
-
- /**
* Returns a factory closure that creates new {@link Set} instance. Note that this
* method does not create a new closure but returns a static one.
*
@@ -2793,17 +2340,6 @@ public class GridFunc {
}
/**
- * Gets predicate that evaluates to {@code true} if its free variable is {@code null}.
- *
- * @param <T> Type of the free variable, i.e. the element the predicate is called on.
- * @return Predicate that evaluates to {@code true} if its free variable is {@code null}.
- */
- @Deprecated
- public static <T> IgnitePredicate<T> isNull() {
- return (IgnitePredicate<T>) IS_NULL;
- }
-
- /**
* Gets predicate that evaluates to {@code true} if its free variable is not {@code null}.
*
* @param <T> Type of the free variable, i.e. the element the predicate is called on.
@@ -2869,25 +2405,6 @@ public class GridFunc {
}
/**
- * Gets predicate that evaluates to {@code true} if its free variable is instance of the given class.
- *
- * @param cls Class to compare to.
- * @param <T> Type of the free variable, i.e. the element the predicate is called on.
- * @return Predicate that evaluates to {@code true} if its free variable is instance
- * of the given class.
- */
- @Deprecated
- public static <T> IgnitePredicate<T> instanceOf(final Class<?> cls) {
- A.notNull(cls, "cls");
-
- return new P1<T>() {
- @Override public boolean apply(T t) {
- return t != null && cls.isAssignableFrom(t.getClass());
- }
- };
- }
-
- /**
* Gets first element from given collection or returns {@code null} if the collection is empty.
*
* @param c A collection.
@@ -2931,8 +2448,6 @@ public class GridFunc {
if (c == null)
return null;
- assert c != null;
-
if (c instanceof RandomAccess && c instanceof List) {
List<T> l = (List<T>)c;
@@ -3006,7 +2521,7 @@ public class GridFunc {
* @return Predicate that evaluates to {@code true} if each of its component predicates
* evaluates to {@code true}.
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({"unchecked", "ConfusingArgumentToVarargsMethod"})
public static <T> IgnitePredicate<T> and(@Nullable final IgnitePredicate<? super T>... ps) {
if (isEmpty(ps))
return F.alwaysTrue();
@@ -3018,8 +2533,6 @@ public class GridFunc {
return F.alwaysTrue();
if (F0.isAllNodePredicates(ps)) {
- assert ps != null;
-
Set<UUID> ids = new HashSet<>();
for (IgnitePredicate<? super T> p : ps) {
@@ -3039,8 +2552,6 @@ public class GridFunc {
else {
return new P1<T>() {
@Override public boolean apply(T t) {
- assert ps != null;
-
for (IgnitePredicate<? super T> p : ps)
if (p != null && !p.apply(t))
return false;
@@ -3090,8 +2601,6 @@ public class GridFunc {
public static <T> IgnitePredicate<T> notIn(@Nullable final Collection<? extends T> c) {
return isEmpty(c) ? GridFunc.<T>alwaysTrue() : new P1<T>() {
@Override public boolean apply(T t) {
- assert c != null;
-
return !c.contains(t);
}
};
@@ -3203,13 +2712,8 @@ public class GridFunc {
* found (or {@code null} if key is not found and closure is not provided). Note that
* in case when key is not found the default value will be put into the map.
* @throws GridClosureException Thrown in case when callable throws exception.
- * @see #newLinkedList()
- * @see #newList()
* @see #newSet()
- * @see #newAtomicLong()
* @see #newAtomicInt()
- * @see #newAtomicRef()
- * @see #newAtomicBoolean()
*/
@Nullable public static <K, V> V addIfAbsent(Map<? super K, V> map, @Nullable K key,
@Nullable Callable<? extends V> c) {
@@ -3388,20 +2892,6 @@ public class GridFunc {
}
/**
- * Upcasts collection type.
- *
- * @param c Initial collection.
- * @return Resulting collection.
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static <T extends R, R> Collection<R> upcast(Collection<T> c) {
- A.notNull(c, "c");
-
- return (Collection<R>)c;
- }
-
- /**
* Transforms an array to read only collection using provided closure.
*
* @param c Initial array to transform.
@@ -3780,8 +3270,6 @@ public class GridFunc {
if (!isEmpty(fs))
for (D e : c) {
- assert fs != null;
-
for (IgniteBiClosure<? super D, ? super B, B> f : fs)
b = f.apply(e, b);
}
@@ -4445,75 +3933,6 @@ public class GridFunc {
}
/**
- * Compares two arrays. Unlike {@code Arrays#equals(...)} method this implementation
- * checks two arrays as sets allowing the same elements to be in different indexes.
- *
- * @param a1 First array to check.
- * @param a2 Second array to check.
- * @param sorted Tells whether or not both arrays are pre-sorted so that binary
- * search could be used instead of iteration.
- * @param dups Tells whether or not arrays can contain duplicates. If arrays contain
- * duplicate the implementation will have to do double work.
- * @return {@code True} if arrays are equal, {@code false} otherwise.
- */
- @Deprecated
- public static boolean eqArray(Object[] a1, Object[] a2, boolean sorted, boolean dups) {
- if (a1 == a2)
- return true;
-
- if (a1 == null || a2 == null || a1.length != a2.length)
- return false;
-
- // Short circuit.
- if (a1.length == 1)
- return eq(a1[0], a2[0]);
-
- for (Object o1 : a1) {
- boolean found = false;
-
- if (sorted)
- found = Arrays.binarySearch(a2, o1) >= 0;
- else {
- for (Object o2 : a2) {
- if (eq(o1, o2)) {
- found = true;
-
- break;
- }
- }
- }
-
- if (!found)
- return false;
- }
-
- // If there are no dups - we can't skip checking seconds array
- // against first one.
- if (dups) {
- for (Object o2 : a2) {
- boolean found = false;
-
- if (sorted)
- found = Arrays.binarySearch(a1, o2) >= 0;
- else {
- for (Object o1 : a1) {
- if (eq(o2, o1)) {
- found = true;
-
- break;
- }
- }
- }
-
- if (!found)
- return false;
- }
- }
-
- return true;
- }
-
- /**
* Compares two {@link org.apache.ignite.cluster.ClusterNode} instances for equality.
* <p>
* Since introduction of {@link org.apache.ignite.cluster.ClusterNode} in Apache Ignite 3.0 the semantic of equality between
@@ -4583,26 +4002,6 @@ public class GridFunc {
}
/**
- * Checks if two collections passed in intersect.
- *
- * @param <E> Element type.
- * @param s1 Set1.
- * @param s2 Set2.
- * @return {@code True} if there is an intersection, {@code false} otherwise.
- */
- @Deprecated
- public static <E> boolean intersects(Iterable<E> s1, Collection<E>... s2) {
- for (E e1 : s1) {
- for (Collection<E> s : s2) {
- if (s.contains(e1))
- return true;
- }
- }
-
- return false;
- }
-
- /**
* Waits until all passed futures will be executed.
*
* @param futs Futures. If none provided - this method is no-op.
@@ -4621,7 +4020,8 @@ public class GridFunc {
* @throws IgniteCheckedException If any of the futures failed.
*/
@Deprecated
- public static <T> void awaitAll(long timeout, @Nullable Collection<IgniteInternalFuture<T>> futs) throws IgniteCheckedException {
+ public static <T> void awaitAll(long timeout, @Nullable Collection<IgniteInternalFuture<T>> futs)
+ throws IgniteCheckedException {
awaitAll(timeout, null, futs);
}
@@ -4674,14 +4074,4 @@ public class GridFunc {
return rdc == null ? null : rdc.reduce();
}
-
- /**
- * Returns predicate for filtering unfinished futures.
- *
- * @return Predicate for filtering unfinished futures.
- */
- @Deprecated
- public static IgnitePredicate<IgniteInternalFuture<?>> unfinishedFutures() {
- return UNFINISHED_FUTURE;
- }
}
[04/22] ignite git commit: IGNITE-4876 - Tests should wait for
topology change on all nodes
Posted by pt...@apache.org.
IGNITE-4876 - Tests should wait for topology change on all nodes
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4e80ddfe
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4e80ddfe
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4e80ddfe
Branch: refs/heads/ignite-3477-master
Commit: 4e80ddfe25d21f316de287bf5dade4ef0a0d17cc
Parents: 77740bf
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Fri Apr 7 17:17:04 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Apr 7 17:17:04 2017 +0300
----------------------------------------------------------------------
.../testframework/junits/GridAbstractTest.java | 53 +++++++++++++++++++-
1 file changed, 51 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4e80ddfe/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index ddcf91f..1bb4540 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -57,16 +57,20 @@ import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.binary.BinaryEnumCache;
import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.GridClassLoaderCache;
import org.apache.ignite.internal.util.GridTestClockTimer;
import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.LT;
@@ -138,6 +142,9 @@ public abstract class GridAbstractTest extends TestCase {
private static final long DFLT_TEST_TIMEOUT = 5 * 60 * 1000;
/** */
+ private static final int DFLT_TOP_WAIT_TIMEOUT = 2000;
+
+ /** */
private static final transient Map<Class<?>, TestCounters> tests = new ConcurrentHashMap<>();
/** */
@@ -953,6 +960,16 @@ public abstract class GridAbstractTest extends TestCase {
*/
@SuppressWarnings({"deprecation"})
protected void stopGrid(@Nullable String igniteInstanceName, boolean cancel) {
+ stopGrid(igniteInstanceName, cancel, true);
+ }
+
+ /**
+ * @param igniteInstanceName Ignite instance name.
+ * @param cancel Cancel flag.
+ * @param awaitTop Await topology change flag.
+ */
+ @SuppressWarnings({"deprecation"})
+ protected void stopGrid(@Nullable String igniteInstanceName, boolean cancel, boolean awaitTop) {
try {
Ignite ignite = grid(igniteInstanceName);
@@ -965,6 +982,9 @@ public abstract class GridAbstractTest extends TestCase {
G.stop(igniteInstanceName, cancel);
else
IgniteProcessProxy.stop(igniteInstanceName, cancel);
+
+ if (awaitTop)
+ awaitTopologyChange();
}
catch (IllegalStateException ignored) {
// Ignore error if grid already stopped.
@@ -999,10 +1019,10 @@ public abstract class GridAbstractTest extends TestCase {
}
for (Ignite g : clients)
- stopGrid(g.name(), cancel);
+ stopGrid(g.name(), cancel, false);
for (Ignite g : srvs)
- stopGrid(g.name(), cancel);
+ stopGrid(g.name(), cancel, false);
assert G.allGrids().isEmpty();
}
@@ -1996,6 +2016,35 @@ public abstract class GridAbstractTest extends TestCase {
/**
*
+ * @throws IgniteInterruptedCheckedException
+ */
+ public void awaitTopologyChange() throws IgniteInterruptedCheckedException {
+ for (Ignite g : G.allGrids()) {
+ final GridKernalContext ctx = ((IgniteKernal)g).context();
+
+ if (ctx.isStopping())
+ continue;
+
+ AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+ AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
+
+ if (! topVer.equals(exchVer)) {
+ info("topology version mismatch: node " + g.name() + " " + exchVer + ", " + topVer);
+
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override public boolean apply() {
+ AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+ AffinityTopologyVersion exchVer = ctx.cache().context().exchange().readyAffinityVersion();
+
+ return exchVer.equals(topVer);
+ }
+ }, DFLT_TOP_WAIT_TIMEOUT);
+ }
+ }
+ }
+
+ /**
+ *
*/
private static interface WriteReplaceOwner {
/**
[07/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/TextColumnValidator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/TextColumnValidator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/TextColumnValidator.java
deleted file mode 100644
index 6ec044d..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/TextColumnValidator.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.schema.ui;
-
-/**
- * Validator for editable table view text column.
- */
-public interface TextColumnValidator<T> {
- /**
- * Validate new value of text.
- *
- * @param rowVal Row value.
- * @param newVal New value of text.
- * @return {@code true} if text is valid.
- */
- public boolean valid(T rowVal, String newVal);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
deleted file mode 100644
index 8cb1196..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
+++ /dev/null
@@ -1,181 +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.schema.test;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import junit.framework.TestCase;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.parser.DatabaseMetadataParser;
-import org.apache.ignite.schema.ui.ConfirmCallable;
-import org.apache.ignite.schema.ui.MessageBox;
-
-/**
- * Base functional for Ignite Schema Import utility tests.
- */
-public abstract class AbstractSchemaImportTest extends TestCase {
- /** DB connection URL. */
- private static final String CONN_URL = "jdbc:h2:mem:autoCacheStore;DB_CLOSE_DELAY=-1";
-
- /** Path to temp folder where generated POJOs will be saved. */
- protected static final String OUT_DIR_PATH = System.getProperty("java.io.tmpdir") + "/ignite-schema-import/out";
-
- /** Auto confirmation of file conflicts. */
- protected static final ConfirmCallable YES_TO_ALL = new ConfirmCallable(null, "") {
- @Override public MessageBox.Result confirm(String msg) {
- return MessageBox.Result.YES_TO_ALL;
- }
- };
-
- /** List of ALL object parsed from test database. */
- protected List<PojoDescriptor> all;
-
- /** List of ONLY POJO descriptors. */
- protected List<PojoDescriptor> pojos;
-
- /** {@inheritDoc} */
- @Override public void setUp() throws Exception {
- Class.forName("org.h2.Driver");
-
- Connection conn = DriverManager.getConnection(CONN_URL, "sa", "");
-
- Statement stmt = conn.createStatement();
-
- stmt.executeUpdate("CREATE TABLE IF NOT EXISTS PRIMITIVES (pk INTEGER PRIMARY KEY, " +
- " boolCol BOOLEAN NOT NULL," +
- " byteCol TINYINT NOT NULL," +
- " shortCol SMALLINT NOT NULL," +
- " intCol INTEGER NOT NULL, " +
- " longCol BIGINT NOT NULL," +
- " floatCol REAL NOT NULL," +
- " doubleCol DOUBLE NOT NULL," +
- " doubleCol2 DOUBLE NOT NULL, " +
- " bigDecimalCol DECIMAL(10, 0)," +
- " strCol VARCHAR(10)," +
- " dateCol DATE," +
- " timeCol TIME," +
- " tsCol TIMESTAMP, " +
- " arrCol BINARY(10)," +
- " FIELD_WITH_ALIAS VARCHAR(10))");
-
- stmt.executeUpdate("CREATE TABLE IF NOT EXISTS OBJECTS (pk INTEGER PRIMARY KEY, " +
- " boolCol BOOLEAN," +
- " byteCol TINYINT," +
- " shortCol SMALLINT," +
- " intCol INTEGER," +
- " longCol BIGINT," +
- " floatCol REAL," +
- " doubleCol DOUBLE," +
- " doubleCol2 DOUBLE," +
- " bigDecimalCol DECIMAL(10, 0)," +
- " strCol VARCHAR(10), " +
- " dateCol DATE," +
- " timeCol TIME," +
- " tsCol TIMESTAMP," +
- " arrCol BINARY(10)," +
- " FIELD_WITH_ALIAS VARCHAR(10))");
-
- stmt.executeUpdate("CREATE INDEX IF NOT EXISTS IDX_1 ON OBJECTS (INTCOL ASC, LONGCOL ASC)");
-
- stmt.executeUpdate("CREATE INDEX IF NOT EXISTS IDX_2 ON OBJECTS (INTCOL ASC, LONGCOL DESC)");
-
- stmt.executeUpdate("CREATE SCHEMA IF NOT EXISTS TESTSCHEMA");
-
- stmt.executeUpdate("CREATE TABLE IF NOT EXISTS TESTSCHEMA.TST(pk INTEGER PRIMARY KEY, " +
- " boolCol BOOLEAN NOT NULL," +
- " byteCol TINYINT NOT NULL," +
- " shortCol SMALLINT NOT NULL," +
- " intCol INTEGER NOT NULL, " +
- " longCol BIGINT NOT NULL," +
- " floatCol REAL NOT NULL," +
- " doubleCol DOUBLE NOT NULL," +
- " doubleCol2 DOUBLE NOT NULL, " +
- " bigDecimalCol DECIMAL(10, 0)," +
- " strCol VARCHAR(10)," +
- " dateCol DATE," +
- " timeCol TIME," +
- " tsCol TIMESTAMP, " +
- " arrCol BINARY(10)," +
- " FIELD_WITH_ALIAS VARCHAR(10))");
-
- stmt.executeUpdate("CREATE INDEX IF NOT EXISTS IDX_3 ON TESTSCHEMA.TST (INTCOL ASC, LONGCOL ASC)");
-
- stmt.executeUpdate("CREATE INDEX IF NOT EXISTS IDX_4 ON TESTSCHEMA.TST (INTCOL ASC, LONGCOL DESC)");
-
- conn.commit();
-
- U.closeQuiet(stmt);
-
- List<String> schemas = new ArrayList<>();
-
- all = DatabaseMetadataParser.parse(conn, schemas, false);
-
- pojos = new ArrayList<>();
-
- for (PojoDescriptor pojo : all)
- if (pojo.parent() != null)
- pojos.add(pojo);
-
- U.closeQuiet(conn);
- }
-
- /**
- * Compare files by lines.
- *
- * @param exp Stream to read of expected file from test resources.
- * @param generated Generated file instance.
- * @param excludePtrn Marker string to exclude lines from comparing.
- * @return true if generated file correspond to expected.
- */
- protected boolean compareFilesInt(InputStream exp, File generated, String excludePtrn) {
- try (BufferedReader baseReader = new BufferedReader(new InputStreamReader(exp))) {
- try (BufferedReader generatedReader = new BufferedReader(new FileReader(generated))) {
- String baseLine;
-
- while ((baseLine = baseReader.readLine()) != null) {
- String generatedLine = generatedReader.readLine();
-
- if (!baseLine.equals(generatedLine) && !baseLine.contains(excludePtrn)
- && !generatedLine.contains(excludePtrn)) {
- System.out.println("Generated file: " + generated.toString());
- System.out.println("Expected: " + baseLine);
- System.out.println("Generated: " + generatedLine);
-
- return false;
- }
- }
-
- return true;
- }
- } catch (IOException e) {
- e.printStackTrace();
-
- return false;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/CodeGeneratorTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/CodeGeneratorTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/CodeGeneratorTest.java
deleted file mode 100644
index 0917139..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/CodeGeneratorTest.java
+++ /dev/null
@@ -1,81 +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.schema.test.generator;
-
-import java.io.File;
-import org.apache.ignite.schema.generator.CodeGenerator;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.test.AbstractSchemaImportTest;
-
-/**
- * Tests for POJO generator.
- */
-public class CodeGeneratorTest extends AbstractSchemaImportTest {
- /** Marker string to skip date generation while comparing.*/
- private static final String GEN_PTRN = "Code generated by Apache Ignite Schema Import utility";
-
- /** Test package. */
- private static final String TEST_PACKAGE = "org.apache.ignite.schema.test.model";
-
- /** Path to generated model. */
- private static final String TEST_PATH = "org/apache/ignite/schema/test/model";
-
- /**
- * Test that POJOs generated correctly.
- */
- public void testPojoGeneration() throws Exception {
- Boolean containsSchema = false;
-
- for (PojoDescriptor pojo : all) {
- if (pojo.valueClassName().isEmpty())
- containsSchema = true;
- else {
- CodeGenerator.pojos(pojo, OUT_DIR_PATH, TEST_PACKAGE, true, true, YES_TO_ALL);
-
- assertTrue("Generated key class POJO content is differ from expected for type " + pojo.keyClassName(),
- compareFiles(pojo.keyClassName(), TEST_PATH, GEN_PTRN));
-
- assertTrue("Generated value class POJO content is differ from expected for type " + pojo.valueClassName(),
- compareFiles(pojo.valueClassName(), TEST_PATH, GEN_PTRN));
- }
- }
-
- assertTrue("Generated POJOs does not contains schema.", containsSchema);
- }
-
- /**
- * Test that configuration generated correctly.
- */
- public void testConfigGeneration() throws Exception {
- CodeGenerator.snippet(pojos, TEST_PACKAGE, true, true, OUT_DIR_PATH, YES_TO_ALL);
-
- assertTrue("Generated configuration is differ from expected", compareFiles("CacheConfig", TEST_PATH, GEN_PTRN));
- }
-
- /**
- * @param typeName Type name.
- * @param intPath Internal path.
- * @return {@code true} if generated POJO as expected.
- */
- private boolean compareFiles(String typeName, String intPath, String excludePtrn) {
- String relPath = intPath + "/" + typeName;
-
- return compareFilesInt(getClass().getResourceAsStream("/" + relPath + ".txt"),
- new File(OUT_DIR_PATH + "/" + relPath + ".java"), excludePtrn);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/XmlGeneratorTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/XmlGeneratorTest.java b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/XmlGeneratorTest.java
deleted file mode 100644
index 8b12392..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/generator/XmlGeneratorTest.java
+++ /dev/null
@@ -1,42 +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.schema.test.generator;
-
-import java.io.File;
-import org.apache.ignite.schema.generator.XmlGenerator;
-import org.apache.ignite.schema.test.AbstractSchemaImportTest;
-
-/**
- * Tests for XML generator.
- */
-public class XmlGeneratorTest extends AbstractSchemaImportTest {
- /** */
- private static final String TEST_XML_FILE_NAME = "ignite-type-metadata.xml";
-
- /**
- * Test that XML generated correctly.
- */
- public void testXmlGeneration() throws Exception {
- XmlGenerator.generate("org.apache.ignite.schema.test.model", pojos, true, true,
- new File(OUT_DIR_PATH, TEST_XML_FILE_NAME), YES_TO_ALL);
-
- assertTrue("Generated XML file content is differ from expected one",
- compareFilesInt(getClass().getResourceAsStream("/org/apache/ignite/schema/test/model/" + TEST_XML_FILE_NAME),
- new File(OUT_DIR_PATH, TEST_XML_FILE_NAME), "XML generated by Apache Ignite Schema Import utility"));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/CacheConfig.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/CacheConfig.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/CacheConfig.txt
deleted file mode 100644
index 9573eb7..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/CacheConfig.txt
+++ /dev/null
@@ -1,409 +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.schema.test.model;
-
-import java.sql.*;
-import java.util.*;
-
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.store.jdbc.*;
-import org.apache.ignite.configuration.*;
-
-/**
- * CacheConfig definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 08/18/2016.
- */
-public class CacheConfig {
- /**
- * Create JDBC type for OBJECTS.
- *
- * @param cacheName Cache name.
- * @return Configured JDBC type.
- */
- private static JdbcType jdbcTypeObjects(String cacheName) {
- JdbcType jdbcType = new JdbcType();
-
- jdbcType.setCacheName(cacheName);
- jdbcType.setDatabaseSchema("PUBLIC");
- jdbcType.setDatabaseTable("OBJECTS");
- jdbcType.setKeyType("org.apache.ignite.schema.test.model.ObjectsKey");
- jdbcType.setValueType("org.apache.ignite.schema.test.model.Objects");
-
- // Key fields for OBJECTS.
- Collection<JdbcTypeField> keys = new ArrayList<>();
- keys.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));
-
- // Value fields for OBJECTS.
- Collection<JdbcTypeField> vals = new ArrayList<>();
- vals.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- vals.add(new JdbcTypeField(Types.BOOLEAN, "BOOLCOL", Boolean.class, "boolcol"));
- vals.add(new JdbcTypeField(Types.TINYINT, "BYTECOL", Byte.class, "bytecol"));
- vals.add(new JdbcTypeField(Types.SMALLINT, "SHORTCOL", Short.class, "shortcol"));
- vals.add(new JdbcTypeField(Types.INTEGER, "INTCOL", Integer.class, "intcol"));
- vals.add(new JdbcTypeField(Types.BIGINT, "LONGCOL", Long.class, "longcol"));
- vals.add(new JdbcTypeField(Types.REAL, "FLOATCOL", Float.class, "floatcol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL", Double.class, "doublecol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL2", Double.class, "doublecol2"));
- vals.add(new JdbcTypeField(Types.DECIMAL, "BIGDECIMALCOL", java.math.BigDecimal.class, "bigdecimalcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "STRCOL", String.class, "strcol"));
- vals.add(new JdbcTypeField(Types.DATE, "DATECOL", java.sql.Date.class, "datecol"));
- vals.add(new JdbcTypeField(Types.TIME, "TIMECOL", java.sql.Time.class, "timecol"));
- vals.add(new JdbcTypeField(Types.TIMESTAMP, "TSCOL", java.sql.Timestamp.class, "tscol"));
- vals.add(new JdbcTypeField(Types.VARBINARY, "ARRCOL", Object.class, "arrcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "FIELD_WITH_ALIAS", String.class, "fieldWithAlias"));
- jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));
-
- return jdbcType;
- }
-
- /**
- * Create SQL Query descriptor for OBJECTS.
- *
- * @return Configured query entity.
- */
- private static QueryEntity queryEntityObjects() {
- QueryEntity qryEntity = new QueryEntity();
-
- qryEntity.setKeyType("org.apache.ignite.schema.test.model.ObjectsKey");
- qryEntity.setValueType("org.apache.ignite.schema.test.model.Objects");
-
- // Query fields for OBJECTS.
- LinkedHashMap<String, String> fields = new LinkedHashMap<>();
-
- fields.put("pk", "java.lang.Integer");
- fields.put("boolcol", "java.lang.Boolean");
- fields.put("bytecol", "java.lang.Byte");
- fields.put("shortcol", "java.lang.Short");
- fields.put("intcol", "java.lang.Integer");
- fields.put("longcol", "java.lang.Long");
- fields.put("floatcol", "java.lang.Float");
- fields.put("doublecol", "java.lang.Double");
- fields.put("doublecol2", "java.lang.Double");
- fields.put("bigdecimalcol", "java.math.BigDecimal");
- fields.put("strcol", "java.lang.String");
- fields.put("datecol", "java.sql.Date");
- fields.put("timecol", "java.sql.Time");
- fields.put("tscol", "java.sql.Timestamp");
- fields.put("arrcol", "java.lang.Object");
- fields.put("fieldWithAlias", "java.lang.String");
-
- qryEntity.setFields(fields);
-
- // Aliases for fields.
- Map<String, String> aliases = new HashMap<>();
-
- aliases.put("fieldWithAlias", "FIELD_WITH_ALIAS");
-
- qryEntity.setAliases(aliases);
-
- // Indexes for OBJECTS.
- Collection<QueryIndex> idxs = new ArrayList<>();
-
- idxs.add(new QueryIndex("pk", true, "PRIMARY_KEY_C"));
-
- QueryIndex idx = new QueryIndex();
-
- idx.setName("IDX_1");
-
- idx.setIndexType(QueryIndexType.SORTED);
-
- LinkedHashMap<String, Boolean> idxFlds = new LinkedHashMap<>();
-
- idxFlds.put("intcol", true);
- idxFlds.put("longcol", true);
-
- idx.setFields(idxFlds);
-
- idxs.add(idx);
-
- idx = new QueryIndex();
-
- idx.setName("IDX_2");
-
- idx.setIndexType(QueryIndexType.SORTED);
-
- idxFlds = new LinkedHashMap<>();
-
- idxFlds.put("intcol", true);
- idxFlds.put("longcol", false);
-
- idx.setFields(idxFlds);
-
- idxs.add(idx);
-
- qryEntity.setIndexes(idxs);
-
- return qryEntity;
- }
-
- /**
- * Create JDBC type for PRIMITIVES.
- *
- * @param cacheName Cache name.
- * @return Configured JDBC type.
- */
- private static JdbcType jdbcTypePrimitives(String cacheName) {
- JdbcType jdbcType = new JdbcType();
-
- jdbcType.setCacheName(cacheName);
- jdbcType.setDatabaseSchema("PUBLIC");
- jdbcType.setDatabaseTable("PRIMITIVES");
- jdbcType.setKeyType("org.apache.ignite.schema.test.model.PrimitivesKey");
- jdbcType.setValueType("org.apache.ignite.schema.test.model.Primitives");
-
- // Key fields for PRIMITIVES.
- Collection<JdbcTypeField> keys = new ArrayList<>();
- keys.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));
-
- // Value fields for PRIMITIVES.
- Collection<JdbcTypeField> vals = new ArrayList<>();
- vals.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- vals.add(new JdbcTypeField(Types.BOOLEAN, "BOOLCOL", boolean.class, "boolcol"));
- vals.add(new JdbcTypeField(Types.TINYINT, "BYTECOL", byte.class, "bytecol"));
- vals.add(new JdbcTypeField(Types.SMALLINT, "SHORTCOL", short.class, "shortcol"));
- vals.add(new JdbcTypeField(Types.INTEGER, "INTCOL", int.class, "intcol"));
- vals.add(new JdbcTypeField(Types.BIGINT, "LONGCOL", long.class, "longcol"));
- vals.add(new JdbcTypeField(Types.REAL, "FLOATCOL", float.class, "floatcol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL", double.class, "doublecol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL2", double.class, "doublecol2"));
- vals.add(new JdbcTypeField(Types.DECIMAL, "BIGDECIMALCOL", java.math.BigDecimal.class, "bigdecimalcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "STRCOL", String.class, "strcol"));
- vals.add(new JdbcTypeField(Types.DATE, "DATECOL", java.sql.Date.class, "datecol"));
- vals.add(new JdbcTypeField(Types.TIME, "TIMECOL", java.sql.Time.class, "timecol"));
- vals.add(new JdbcTypeField(Types.TIMESTAMP, "TSCOL", java.sql.Timestamp.class, "tscol"));
- vals.add(new JdbcTypeField(Types.VARBINARY, "ARRCOL", Object.class, "arrcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "FIELD_WITH_ALIAS", String.class, "fieldWithAlias"));
- jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));
-
- return jdbcType;
- }
-
- /**
- * Create SQL Query descriptor for PRIMITIVES.
- *
- * @return Configured query entity.
- */
- private static QueryEntity queryEntityPrimitives() {
- QueryEntity qryEntity = new QueryEntity();
-
- qryEntity.setKeyType("org.apache.ignite.schema.test.model.PrimitivesKey");
- qryEntity.setValueType("org.apache.ignite.schema.test.model.Primitives");
-
- // Query fields for PRIMITIVES.
- LinkedHashMap<String, String> fields = new LinkedHashMap<>();
-
- fields.put("pk", "java.lang.Integer");
- fields.put("boolcol", "java.lang.Boolean");
- fields.put("bytecol", "java.lang.Byte");
- fields.put("shortcol", "java.lang.Short");
- fields.put("intcol", "java.lang.Integer");
- fields.put("longcol", "java.lang.Long");
- fields.put("floatcol", "java.lang.Float");
- fields.put("doublecol", "java.lang.Double");
- fields.put("doublecol2", "java.lang.Double");
- fields.put("bigdecimalcol", "java.math.BigDecimal");
- fields.put("strcol", "java.lang.String");
- fields.put("datecol", "java.sql.Date");
- fields.put("timecol", "java.sql.Time");
- fields.put("tscol", "java.sql.Timestamp");
- fields.put("arrcol", "java.lang.Object");
- fields.put("fieldWithAlias", "java.lang.String");
-
- qryEntity.setFields(fields);
-
- // Aliases for fields.
- Map<String, String> aliases = new HashMap<>();
-
- aliases.put("fieldWithAlias", "FIELD_WITH_ALIAS");
-
- qryEntity.setAliases(aliases);
-
- // Indexes for PRIMITIVES.
- Collection<QueryIndex> idxs = new ArrayList<>();
-
- idxs.add(new QueryIndex("pk", true, "PRIMARY_KEY_D"));
-
- qryEntity.setIndexes(idxs);
-
- return qryEntity;
- }
-
- /**
- * Create JDBC type for TST.
- *
- * @param cacheName Cache name.
- * @return Configured JDBC type.
- */
- private static JdbcType jdbcTypeTst(String cacheName) {
- JdbcType jdbcType = new JdbcType();
-
- jdbcType.setCacheName(cacheName);
- jdbcType.setDatabaseSchema("TESTSCHEMA");
- jdbcType.setDatabaseTable("TST");
- jdbcType.setKeyType("org.apache.ignite.schema.test.model.TstKey");
- jdbcType.setValueType("org.apache.ignite.schema.test.model.Tst");
-
- // Key fields for TST.
- Collection<JdbcTypeField> keys = new ArrayList<>();
- keys.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));
-
- // Value fields for TST.
- Collection<JdbcTypeField> vals = new ArrayList<>();
- vals.add(new JdbcTypeField(Types.INTEGER, "PK", int.class, "pk"));
- vals.add(new JdbcTypeField(Types.BOOLEAN, "BOOLCOL", boolean.class, "boolcol"));
- vals.add(new JdbcTypeField(Types.TINYINT, "BYTECOL", byte.class, "bytecol"));
- vals.add(new JdbcTypeField(Types.SMALLINT, "SHORTCOL", short.class, "shortcol"));
- vals.add(new JdbcTypeField(Types.INTEGER, "INTCOL", int.class, "intcol"));
- vals.add(new JdbcTypeField(Types.BIGINT, "LONGCOL", long.class, "longcol"));
- vals.add(new JdbcTypeField(Types.REAL, "FLOATCOL", float.class, "floatcol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL", double.class, "doublecol"));
- vals.add(new JdbcTypeField(Types.DOUBLE, "DOUBLECOL2", double.class, "doublecol2"));
- vals.add(new JdbcTypeField(Types.DECIMAL, "BIGDECIMALCOL", java.math.BigDecimal.class, "bigdecimalcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "STRCOL", String.class, "strcol"));
- vals.add(new JdbcTypeField(Types.DATE, "DATECOL", java.sql.Date.class, "datecol"));
- vals.add(new JdbcTypeField(Types.TIME, "TIMECOL", java.sql.Time.class, "timecol"));
- vals.add(new JdbcTypeField(Types.TIMESTAMP, "TSCOL", java.sql.Timestamp.class, "tscol"));
- vals.add(new JdbcTypeField(Types.VARBINARY, "ARRCOL", Object.class, "arrcol"));
- vals.add(new JdbcTypeField(Types.VARCHAR, "FIELD_WITH_ALIAS", String.class, "fieldWithAlias"));
- jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));
-
- return jdbcType;
- }
-
- /**
- * Create SQL Query descriptor for TST.
- *
- * @return Configured query entity.
- */
- private static QueryEntity queryEntityTst() {
- QueryEntity qryEntity = new QueryEntity();
-
- qryEntity.setKeyType("org.apache.ignite.schema.test.model.TstKey");
- qryEntity.setValueType("org.apache.ignite.schema.test.model.Tst");
-
- // Query fields for TST.
- LinkedHashMap<String, String> fields = new LinkedHashMap<>();
-
- fields.put("pk", "java.lang.Integer");
- fields.put("boolcol", "java.lang.Boolean");
- fields.put("bytecol", "java.lang.Byte");
- fields.put("shortcol", "java.lang.Short");
- fields.put("intcol", "java.lang.Integer");
- fields.put("longcol", "java.lang.Long");
- fields.put("floatcol", "java.lang.Float");
- fields.put("doublecol", "java.lang.Double");
- fields.put("doublecol2", "java.lang.Double");
- fields.put("bigdecimalcol", "java.math.BigDecimal");
- fields.put("strcol", "java.lang.String");
- fields.put("datecol", "java.sql.Date");
- fields.put("timecol", "java.sql.Time");
- fields.put("tscol", "java.sql.Timestamp");
- fields.put("arrcol", "java.lang.Object");
- fields.put("fieldWithAlias", "java.lang.String");
-
- qryEntity.setFields(fields);
-
- // Aliases for fields.
- Map<String, String> aliases = new HashMap<>();
-
- aliases.put("fieldWithAlias", "FIELD_WITH_ALIAS");
-
- qryEntity.setAliases(aliases);
-
- // Indexes for TST.
- Collection<QueryIndex> idxs = new ArrayList<>();
-
- idxs.add(new QueryIndex("pk", true, "PRIMARY_KEY_1"));
-
- QueryIndex idx = new QueryIndex();
-
- idx.setName("IDX_3");
-
- idx.setIndexType(QueryIndexType.SORTED);
-
- LinkedHashMap<String, Boolean> idxFlds = new LinkedHashMap<>();
-
- idxFlds.put("intcol", true);
- idxFlds.put("longcol", true);
-
- idx.setFields(idxFlds);
-
- idxs.add(idx);
-
- idx = new QueryIndex();
-
- idx.setName("IDX_4");
-
- idx.setIndexType(QueryIndexType.SORTED);
-
- idxFlds = new LinkedHashMap<>();
-
- idxFlds.put("intcol", true);
- idxFlds.put("longcol", false);
-
- idx.setFields(idxFlds);
-
- idxs.add(idx);
-
- qryEntity.setIndexes(idxs);
-
- return qryEntity;
- }
-
- /**
- * Configure cache.
- *
- * @param cacheName Cache name.
- * @param storeFactory Cache store factory.
- * @return Cache configuration.
- */
- public static <K, V> CacheConfiguration<K, V> cache(String cacheName, CacheJdbcPojoStoreFactory<K, V> storeFactory) {
- if (storeFactory == null)
- throw new IllegalArgumentException("Cache store factory cannot be null.");
-
- CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(cacheName);
-
- ccfg.setCacheStoreFactory(storeFactory);
- ccfg.setReadThrough(true);
- ccfg.setWriteThrough(true);
-
- // Configure JDBC types.
- Collection<JdbcType> jdbcTypes = new ArrayList<>();
-
- jdbcTypes.add(jdbcTypeObjects(cacheName));
- jdbcTypes.add(jdbcTypePrimitives(cacheName));
- jdbcTypes.add(jdbcTypeTst(cacheName));
-
- storeFactory.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));
-
- // Configure query entities.
- Collection<QueryEntity> qryEntities = new ArrayList<>();
-
- qryEntities.add(queryEntityObjects());
- qryEntities.add(queryEntityPrimitives());
- qryEntities.add(queryEntityTst());
-
- ccfg.setQueryEntities(qryEntities);
-
- return ccfg;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Objects.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Objects.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Objects.txt
deleted file mode 100644
index 380191b..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Objects.txt
+++ /dev/null
@@ -1,531 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * Objects definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class Objects implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /** Value for boolcol. */
- private Boolean boolcol;
-
- /** Value for bytecol. */
- private Byte bytecol;
-
- /** Value for shortcol. */
- private Short shortcol;
-
- /** Value for intcol. */
- private Integer intcol;
-
- /** Value for longcol. */
- private Long longcol;
-
- /** Value for floatcol. */
- private Float floatcol;
-
- /** Value for doublecol. */
- private Double doublecol;
-
- /** Value for doublecol2. */
- private Double doublecol2;
-
- /** Value for bigdecimalcol. */
- private java.math.BigDecimal bigdecimalcol;
-
- /** Value for strcol. */
- private String strcol;
-
- /** Value for datecol. */
- private java.sql.Date datecol;
-
- /** Value for timecol. */
- private java.sql.Time timecol;
-
- /** Value for tscol. */
- private java.sql.Timestamp tscol;
-
- /** Value for arrcol. */
- private Object arrcol;
-
- /** Value for fieldWithAlias. */
- private String fieldWithAlias;
-
- /**
- * Empty constructor.
- */
- public Objects() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public Objects(
- int pk,
- Boolean boolcol,
- Byte bytecol,
- Short shortcol,
- Integer intcol,
- Long longcol,
- Float floatcol,
- Double doublecol,
- Double doublecol2,
- java.math.BigDecimal bigdecimalcol,
- String strcol,
- java.sql.Date datecol,
- java.sql.Time timecol,
- java.sql.Timestamp tscol,
- Object arrcol,
- String fieldWithAlias
- ) {
- this.pk = pk;
- this.boolcol = boolcol;
- this.bytecol = bytecol;
- this.shortcol = shortcol;
- this.intcol = intcol;
- this.longcol = longcol;
- this.floatcol = floatcol;
- this.doublecol = doublecol;
- this.doublecol2 = doublecol2;
- this.bigdecimalcol = bigdecimalcol;
- this.strcol = strcol;
- this.datecol = datecol;
- this.timecol = timecol;
- this.tscol = tscol;
- this.arrcol = arrcol;
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /**
- * Gets boolcol.
- *
- * @return Value for boolcol.
- */
- public Boolean getBoolcol() {
- return boolcol;
- }
-
- /**
- * Sets boolcol.
- *
- * @param boolcol New value for boolcol.
- */
- public void setBoolcol(Boolean boolcol) {
- this.boolcol = boolcol;
- }
-
- /**
- * Gets bytecol.
- *
- * @return Value for bytecol.
- */
- public Byte getBytecol() {
- return bytecol;
- }
-
- /**
- * Sets bytecol.
- *
- * @param bytecol New value for bytecol.
- */
- public void setBytecol(Byte bytecol) {
- this.bytecol = bytecol;
- }
-
- /**
- * Gets shortcol.
- *
- * @return Value for shortcol.
- */
- public Short getShortcol() {
- return shortcol;
- }
-
- /**
- * Sets shortcol.
- *
- * @param shortcol New value for shortcol.
- */
- public void setShortcol(Short shortcol) {
- this.shortcol = shortcol;
- }
-
- /**
- * Gets intcol.
- *
- * @return Value for intcol.
- */
- public Integer getIntcol() {
- return intcol;
- }
-
- /**
- * Sets intcol.
- *
- * @param intcol New value for intcol.
- */
- public void setIntcol(Integer intcol) {
- this.intcol = intcol;
- }
-
- /**
- * Gets longcol.
- *
- * @return Value for longcol.
- */
- public Long getLongcol() {
- return longcol;
- }
-
- /**
- * Sets longcol.
- *
- * @param longcol New value for longcol.
- */
- public void setLongcol(Long longcol) {
- this.longcol = longcol;
- }
-
- /**
- * Gets floatcol.
- *
- * @return Value for floatcol.
- */
- public Float getFloatcol() {
- return floatcol;
- }
-
- /**
- * Sets floatcol.
- *
- * @param floatcol New value for floatcol.
- */
- public void setFloatcol(Float floatcol) {
- this.floatcol = floatcol;
- }
-
- /**
- * Gets doublecol.
- *
- * @return Value for doublecol.
- */
- public Double getDoublecol() {
- return doublecol;
- }
-
- /**
- * Sets doublecol.
- *
- * @param doublecol New value for doublecol.
- */
- public void setDoublecol(Double doublecol) {
- this.doublecol = doublecol;
- }
-
- /**
- * Gets doublecol2.
- *
- * @return Value for doublecol2.
- */
- public Double getDoublecol2() {
- return doublecol2;
- }
-
- /**
- * Sets doublecol2.
- *
- * @param doublecol2 New value for doublecol2.
- */
- public void setDoublecol2(Double doublecol2) {
- this.doublecol2 = doublecol2;
- }
-
- /**
- * Gets bigdecimalcol.
- *
- * @return Value for bigdecimalcol.
- */
- public java.math.BigDecimal getBigdecimalcol() {
- return bigdecimalcol;
- }
-
- /**
- * Sets bigdecimalcol.
- *
- * @param bigdecimalcol New value for bigdecimalcol.
- */
- public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) {
- this.bigdecimalcol = bigdecimalcol;
- }
-
- /**
- * Gets strcol.
- *
- * @return Value for strcol.
- */
- public String getStrcol() {
- return strcol;
- }
-
- /**
- * Sets strcol.
- *
- * @param strcol New value for strcol.
- */
- public void setStrcol(String strcol) {
- this.strcol = strcol;
- }
-
- /**
- * Gets datecol.
- *
- * @return Value for datecol.
- */
- public java.sql.Date getDatecol() {
- return datecol;
- }
-
- /**
- * Sets datecol.
- *
- * @param datecol New value for datecol.
- */
- public void setDatecol(java.sql.Date datecol) {
- this.datecol = datecol;
- }
-
- /**
- * Gets timecol.
- *
- * @return Value for timecol.
- */
- public java.sql.Time getTimecol() {
- return timecol;
- }
-
- /**
- * Sets timecol.
- *
- * @param timecol New value for timecol.
- */
- public void setTimecol(java.sql.Time timecol) {
- this.timecol = timecol;
- }
-
- /**
- * Gets tscol.
- *
- * @return Value for tscol.
- */
- public java.sql.Timestamp getTscol() {
- return tscol;
- }
-
- /**
- * Sets tscol.
- *
- * @param tscol New value for tscol.
- */
- public void setTscol(java.sql.Timestamp tscol) {
- this.tscol = tscol;
- }
-
- /**
- * Gets arrcol.
- *
- * @return Value for arrcol.
- */
- public Object getArrcol() {
- return arrcol;
- }
-
- /**
- * Sets arrcol.
- *
- * @param arrcol New value for arrcol.
- */
- public void setArrcol(Object arrcol) {
- this.arrcol = arrcol;
- }
-
- /**
- * Gets fieldWithAlias.
- *
- * @return Value for fieldWithAlias.
- */
- public String getFieldWithAlias() {
- return fieldWithAlias;
- }
-
- /**
- * Sets fieldWithAlias.
- *
- * @param fieldWithAlias New value for fieldWithAlias.
- */
- public void setFieldWithAlias(String fieldWithAlias) {
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof Objects))
- return false;
-
- Objects that = (Objects)o;
-
- if (pk != that.pk)
- return false;
-
- if (boolcol != null ? !boolcol.equals(that.boolcol) : that.boolcol != null)
- return false;
-
- if (bytecol != null ? !bytecol.equals(that.bytecol) : that.bytecol != null)
- return false;
-
- if (shortcol != null ? !shortcol.equals(that.shortcol) : that.shortcol != null)
- return false;
-
- if (intcol != null ? !intcol.equals(that.intcol) : that.intcol != null)
- return false;
-
- if (longcol != null ? !longcol.equals(that.longcol) : that.longcol != null)
- return false;
-
- if (floatcol != null ? !floatcol.equals(that.floatcol) : that.floatcol != null)
- return false;
-
- if (doublecol != null ? !doublecol.equals(that.doublecol) : that.doublecol != null)
- return false;
-
- if (doublecol2 != null ? !doublecol2.equals(that.doublecol2) : that.doublecol2 != null)
- return false;
-
- if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null)
- return false;
-
- if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null)
- return false;
-
- if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null)
- return false;
-
- if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null)
- return false;
-
- if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null)
- return false;
-
- if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null)
- return false;
-
- if (fieldWithAlias != null ? !fieldWithAlias.equals(that.fieldWithAlias) : that.fieldWithAlias != null)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- res = 31 * res + (boolcol != null ? boolcol.hashCode() : 0);
-
- res = 31 * res + (bytecol != null ? bytecol.hashCode() : 0);
-
- res = 31 * res + (shortcol != null ? shortcol.hashCode() : 0);
-
- res = 31 * res + (intcol != null ? intcol.hashCode() : 0);
-
- res = 31 * res + (longcol != null ? longcol.hashCode() : 0);
-
- res = 31 * res + (floatcol != null ? floatcol.hashCode() : 0);
-
- res = 31 * res + (doublecol != null ? doublecol.hashCode() : 0);
-
- res = 31 * res + (doublecol2 != null ? doublecol2.hashCode() : 0);
-
- res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0);
-
- res = 31 * res + (strcol != null ? strcol.hashCode() : 0);
-
- res = 31 * res + (datecol != null ? datecol.hashCode() : 0);
-
- res = 31 * res + (timecol != null ? timecol.hashCode() : 0);
-
- res = 31 * res + (tscol != null ? tscol.hashCode() : 0);
-
- res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0);
-
- res = 31 * res + (fieldWithAlias != null ? fieldWithAlias.hashCode() : 0);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Objects [pk=" + pk +
- ", boolcol=" + boolcol +
- ", bytecol=" + bytecol +
- ", shortcol=" + shortcol +
- ", intcol=" + intcol +
- ", longcol=" + longcol +
- ", floatcol=" + floatcol +
- ", doublecol=" + doublecol +
- ", doublecol2=" + doublecol2 +
- ", bigdecimalcol=" + bigdecimalcol +
- ", strcol=" + strcol +
- ", datecol=" + datecol +
- ", timecol=" + timecol +
- ", tscol=" + tscol +
- ", arrcol=" + arrcol +
- ", fieldWithAlias=" + fieldWithAlias +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt
deleted file mode 100644
index cad109c..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/ObjectsKey.txt
+++ /dev/null
@@ -1,96 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * ObjectsKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class ObjectsKey implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /**
- * Empty constructor.
- */
- public ObjectsKey() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public ObjectsKey(
- int pk
- ) {
- this.pk = pk;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof ObjectsKey))
- return false;
-
- ObjectsKey that = (ObjectsKey)o;
-
- if (pk != that.pk)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "ObjectsKey [pk=" + pk +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt
deleted file mode 100644
index a07b379..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Primitives.txt
+++ /dev/null
@@ -1,535 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * Primitives definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class Primitives implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /** Value for boolcol. */
- private boolean boolcol;
-
- /** Value for bytecol. */
- private byte bytecol;
-
- /** Value for shortcol. */
- private short shortcol;
-
- /** Value for intcol. */
- private int intcol;
-
- /** Value for longcol. */
- private long longcol;
-
- /** Value for floatcol. */
- private float floatcol;
-
- /** Value for doublecol. */
- private double doublecol;
-
- /** Value for doublecol2. */
- private double doublecol2;
-
- /** Value for bigdecimalcol. */
- private java.math.BigDecimal bigdecimalcol;
-
- /** Value for strcol. */
- private String strcol;
-
- /** Value for datecol. */
- private java.sql.Date datecol;
-
- /** Value for timecol. */
- private java.sql.Time timecol;
-
- /** Value for tscol. */
- private java.sql.Timestamp tscol;
-
- /** Value for arrcol. */
- private Object arrcol;
-
- /** Value for fieldWithAlias. */
- private String fieldWithAlias;
-
- /**
- * Empty constructor.
- */
- public Primitives() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public Primitives(
- int pk,
- boolean boolcol,
- byte bytecol,
- short shortcol,
- int intcol,
- long longcol,
- float floatcol,
- double doublecol,
- double doublecol2,
- java.math.BigDecimal bigdecimalcol,
- String strcol,
- java.sql.Date datecol,
- java.sql.Time timecol,
- java.sql.Timestamp tscol,
- Object arrcol,
- String fieldWithAlias
- ) {
- this.pk = pk;
- this.boolcol = boolcol;
- this.bytecol = bytecol;
- this.shortcol = shortcol;
- this.intcol = intcol;
- this.longcol = longcol;
- this.floatcol = floatcol;
- this.doublecol = doublecol;
- this.doublecol2 = doublecol2;
- this.bigdecimalcol = bigdecimalcol;
- this.strcol = strcol;
- this.datecol = datecol;
- this.timecol = timecol;
- this.tscol = tscol;
- this.arrcol = arrcol;
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /**
- * Gets boolcol.
- *
- * @return Value for boolcol.
- */
- public boolean getBoolcol() {
- return boolcol;
- }
-
- /**
- * Sets boolcol.
- *
- * @param boolcol New value for boolcol.
- */
- public void setBoolcol(boolean boolcol) {
- this.boolcol = boolcol;
- }
-
- /**
- * Gets bytecol.
- *
- * @return Value for bytecol.
- */
- public byte getBytecol() {
- return bytecol;
- }
-
- /**
- * Sets bytecol.
- *
- * @param bytecol New value for bytecol.
- */
- public void setBytecol(byte bytecol) {
- this.bytecol = bytecol;
- }
-
- /**
- * Gets shortcol.
- *
- * @return Value for shortcol.
- */
- public short getShortcol() {
- return shortcol;
- }
-
- /**
- * Sets shortcol.
- *
- * @param shortcol New value for shortcol.
- */
- public void setShortcol(short shortcol) {
- this.shortcol = shortcol;
- }
-
- /**
- * Gets intcol.
- *
- * @return Value for intcol.
- */
- public int getIntcol() {
- return intcol;
- }
-
- /**
- * Sets intcol.
- *
- * @param intcol New value for intcol.
- */
- public void setIntcol(int intcol) {
- this.intcol = intcol;
- }
-
- /**
- * Gets longcol.
- *
- * @return Value for longcol.
- */
- public long getLongcol() {
- return longcol;
- }
-
- /**
- * Sets longcol.
- *
- * @param longcol New value for longcol.
- */
- public void setLongcol(long longcol) {
- this.longcol = longcol;
- }
-
- /**
- * Gets floatcol.
- *
- * @return Value for floatcol.
- */
- public float getFloatcol() {
- return floatcol;
- }
-
- /**
- * Sets floatcol.
- *
- * @param floatcol New value for floatcol.
- */
- public void setFloatcol(float floatcol) {
- this.floatcol = floatcol;
- }
-
- /**
- * Gets doublecol.
- *
- * @return Value for doublecol.
- */
- public double getDoublecol() {
- return doublecol;
- }
-
- /**
- * Sets doublecol.
- *
- * @param doublecol New value for doublecol.
- */
- public void setDoublecol(double doublecol) {
- this.doublecol = doublecol;
- }
-
- /**
- * Gets doublecol2.
- *
- * @return Value for doublecol2.
- */
- public double getDoublecol2() {
- return doublecol2;
- }
-
- /**
- * Sets doublecol2.
- *
- * @param doublecol2 New value for doublecol2.
- */
- public void setDoublecol2(double doublecol2) {
- this.doublecol2 = doublecol2;
- }
-
- /**
- * Gets bigdecimalcol.
- *
- * @return Value for bigdecimalcol.
- */
- public java.math.BigDecimal getBigdecimalcol() {
- return bigdecimalcol;
- }
-
- /**
- * Sets bigdecimalcol.
- *
- * @param bigdecimalcol New value for bigdecimalcol.
- */
- public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) {
- this.bigdecimalcol = bigdecimalcol;
- }
-
- /**
- * Gets strcol.
- *
- * @return Value for strcol.
- */
- public String getStrcol() {
- return strcol;
- }
-
- /**
- * Sets strcol.
- *
- * @param strcol New value for strcol.
- */
- public void setStrcol(String strcol) {
- this.strcol = strcol;
- }
-
- /**
- * Gets datecol.
- *
- * @return Value for datecol.
- */
- public java.sql.Date getDatecol() {
- return datecol;
- }
-
- /**
- * Sets datecol.
- *
- * @param datecol New value for datecol.
- */
- public void setDatecol(java.sql.Date datecol) {
- this.datecol = datecol;
- }
-
- /**
- * Gets timecol.
- *
- * @return Value for timecol.
- */
- public java.sql.Time getTimecol() {
- return timecol;
- }
-
- /**
- * Sets timecol.
- *
- * @param timecol New value for timecol.
- */
- public void setTimecol(java.sql.Time timecol) {
- this.timecol = timecol;
- }
-
- /**
- * Gets tscol.
- *
- * @return Value for tscol.
- */
- public java.sql.Timestamp getTscol() {
- return tscol;
- }
-
- /**
- * Sets tscol.
- *
- * @param tscol New value for tscol.
- */
- public void setTscol(java.sql.Timestamp tscol) {
- this.tscol = tscol;
- }
-
- /**
- * Gets arrcol.
- *
- * @return Value for arrcol.
- */
- public Object getArrcol() {
- return arrcol;
- }
-
- /**
- * Sets arrcol.
- *
- * @param arrcol New value for arrcol.
- */
- public void setArrcol(Object arrcol) {
- this.arrcol = arrcol;
- }
-
- /**
- * Gets fieldWithAlias.
- *
- * @return Value for fieldWithAlias.
- */
- public String getFieldWithAlias() {
- return fieldWithAlias;
- }
-
- /**
- * Sets fieldWithAlias.
- *
- * @param fieldWithAlias New value for fieldWithAlias.
- */
- public void setFieldWithAlias(String fieldWithAlias) {
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof Primitives))
- return false;
-
- Primitives that = (Primitives)o;
-
- if (pk != that.pk)
- return false;
-
- if (boolcol != that.boolcol)
- return false;
-
- if (bytecol != that.bytecol)
- return false;
-
- if (shortcol != that.shortcol)
- return false;
-
- if (intcol != that.intcol)
- return false;
-
- if (longcol != that.longcol)
- return false;
-
- if (Float.compare(floatcol, that.floatcol) != 0)
- return false;
-
- if (Double.compare(doublecol, that.doublecol) != 0)
- return false;
-
- if (Double.compare(doublecol2, that.doublecol2) != 0)
- return false;
-
- if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null)
- return false;
-
- if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null)
- return false;
-
- if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null)
- return false;
-
- if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null)
- return false;
-
- if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null)
- return false;
-
- if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null)
- return false;
-
- if (fieldWithAlias != null ? !fieldWithAlias.equals(that.fieldWithAlias) : that.fieldWithAlias != null)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- res = 31 * res + (boolcol ? 1 : 0);
-
- res = 31 * res + (int)bytecol;
-
- res = 31 * res + (int)shortcol;
-
- res = 31 * res + intcol;
-
- res = 31 * res + (int)(longcol ^ (longcol >>> 32));
-
- res = 31 * res + (floatcol != +0.0f ? Float.floatToIntBits(floatcol) : 0);
-
- long ig_hash_temp = Double.doubleToLongBits(doublecol);
-
- res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));
-
- ig_hash_temp = Double.doubleToLongBits(doublecol2);
-
- res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));
-
- res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0);
-
- res = 31 * res + (strcol != null ? strcol.hashCode() : 0);
-
- res = 31 * res + (datecol != null ? datecol.hashCode() : 0);
-
- res = 31 * res + (timecol != null ? timecol.hashCode() : 0);
-
- res = 31 * res + (tscol != null ? tscol.hashCode() : 0);
-
- res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0);
-
- res = 31 * res + (fieldWithAlias != null ? fieldWithAlias.hashCode() : 0);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Primitives [pk=" + pk +
- ", boolcol=" + boolcol +
- ", bytecol=" + bytecol +
- ", shortcol=" + shortcol +
- ", intcol=" + intcol +
- ", longcol=" + longcol +
- ", floatcol=" + floatcol +
- ", doublecol=" + doublecol +
- ", doublecol2=" + doublecol2 +
- ", bigdecimalcol=" + bigdecimalcol +
- ", strcol=" + strcol +
- ", datecol=" + datecol +
- ", timecol=" + timecol +
- ", tscol=" + tscol +
- ", arrcol=" + arrcol +
- ", fieldWithAlias=" + fieldWithAlias +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt
deleted file mode 100644
index 0844e63..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/PrimitivesKey.txt
+++ /dev/null
@@ -1,96 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * PrimitivesKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class PrimitivesKey implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /**
- * Empty constructor.
- */
- public PrimitivesKey() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public PrimitivesKey(
- int pk
- ) {
- this.pk = pk;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof PrimitivesKey))
- return false;
-
- PrimitivesKey that = (PrimitivesKey)o;
-
- if (pk != that.pk)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "PrimitivesKey [pk=" + pk +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Tst.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Tst.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Tst.txt
deleted file mode 100644
index f1db255..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/Tst.txt
+++ /dev/null
@@ -1,535 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * Tst definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class Tst implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /** Value for boolcol. */
- private boolean boolcol;
-
- /** Value for bytecol. */
- private byte bytecol;
-
- /** Value for shortcol. */
- private short shortcol;
-
- /** Value for intcol. */
- private int intcol;
-
- /** Value for longcol. */
- private long longcol;
-
- /** Value for floatcol. */
- private float floatcol;
-
- /** Value for doublecol. */
- private double doublecol;
-
- /** Value for doublecol2. */
- private double doublecol2;
-
- /** Value for bigdecimalcol. */
- private java.math.BigDecimal bigdecimalcol;
-
- /** Value for strcol. */
- private String strcol;
-
- /** Value for datecol. */
- private java.sql.Date datecol;
-
- /** Value for timecol. */
- private java.sql.Time timecol;
-
- /** Value for tscol. */
- private java.sql.Timestamp tscol;
-
- /** Value for arrcol. */
- private Object arrcol;
-
- /** Value for fieldWithAlias. */
- private String fieldWithAlias;
-
- /**
- * Empty constructor.
- */
- public Tst() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public Tst(
- int pk,
- boolean boolcol,
- byte bytecol,
- short shortcol,
- int intcol,
- long longcol,
- float floatcol,
- double doublecol,
- double doublecol2,
- java.math.BigDecimal bigdecimalcol,
- String strcol,
- java.sql.Date datecol,
- java.sql.Time timecol,
- java.sql.Timestamp tscol,
- Object arrcol,
- String fieldWithAlias
- ) {
- this.pk = pk;
- this.boolcol = boolcol;
- this.bytecol = bytecol;
- this.shortcol = shortcol;
- this.intcol = intcol;
- this.longcol = longcol;
- this.floatcol = floatcol;
- this.doublecol = doublecol;
- this.doublecol2 = doublecol2;
- this.bigdecimalcol = bigdecimalcol;
- this.strcol = strcol;
- this.datecol = datecol;
- this.timecol = timecol;
- this.tscol = tscol;
- this.arrcol = arrcol;
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /**
- * Gets boolcol.
- *
- * @return Value for boolcol.
- */
- public boolean getBoolcol() {
- return boolcol;
- }
-
- /**
- * Sets boolcol.
- *
- * @param boolcol New value for boolcol.
- */
- public void setBoolcol(boolean boolcol) {
- this.boolcol = boolcol;
- }
-
- /**
- * Gets bytecol.
- *
- * @return Value for bytecol.
- */
- public byte getBytecol() {
- return bytecol;
- }
-
- /**
- * Sets bytecol.
- *
- * @param bytecol New value for bytecol.
- */
- public void setBytecol(byte bytecol) {
- this.bytecol = bytecol;
- }
-
- /**
- * Gets shortcol.
- *
- * @return Value for shortcol.
- */
- public short getShortcol() {
- return shortcol;
- }
-
- /**
- * Sets shortcol.
- *
- * @param shortcol New value for shortcol.
- */
- public void setShortcol(short shortcol) {
- this.shortcol = shortcol;
- }
-
- /**
- * Gets intcol.
- *
- * @return Value for intcol.
- */
- public int getIntcol() {
- return intcol;
- }
-
- /**
- * Sets intcol.
- *
- * @param intcol New value for intcol.
- */
- public void setIntcol(int intcol) {
- this.intcol = intcol;
- }
-
- /**
- * Gets longcol.
- *
- * @return Value for longcol.
- */
- public long getLongcol() {
- return longcol;
- }
-
- /**
- * Sets longcol.
- *
- * @param longcol New value for longcol.
- */
- public void setLongcol(long longcol) {
- this.longcol = longcol;
- }
-
- /**
- * Gets floatcol.
- *
- * @return Value for floatcol.
- */
- public float getFloatcol() {
- return floatcol;
- }
-
- /**
- * Sets floatcol.
- *
- * @param floatcol New value for floatcol.
- */
- public void setFloatcol(float floatcol) {
- this.floatcol = floatcol;
- }
-
- /**
- * Gets doublecol.
- *
- * @return Value for doublecol.
- */
- public double getDoublecol() {
- return doublecol;
- }
-
- /**
- * Sets doublecol.
- *
- * @param doublecol New value for doublecol.
- */
- public void setDoublecol(double doublecol) {
- this.doublecol = doublecol;
- }
-
- /**
- * Gets doublecol2.
- *
- * @return Value for doublecol2.
- */
- public double getDoublecol2() {
- return doublecol2;
- }
-
- /**
- * Sets doublecol2.
- *
- * @param doublecol2 New value for doublecol2.
- */
- public void setDoublecol2(double doublecol2) {
- this.doublecol2 = doublecol2;
- }
-
- /**
- * Gets bigdecimalcol.
- *
- * @return Value for bigdecimalcol.
- */
- public java.math.BigDecimal getBigdecimalcol() {
- return bigdecimalcol;
- }
-
- /**
- * Sets bigdecimalcol.
- *
- * @param bigdecimalcol New value for bigdecimalcol.
- */
- public void setBigdecimalcol(java.math.BigDecimal bigdecimalcol) {
- this.bigdecimalcol = bigdecimalcol;
- }
-
- /**
- * Gets strcol.
- *
- * @return Value for strcol.
- */
- public String getStrcol() {
- return strcol;
- }
-
- /**
- * Sets strcol.
- *
- * @param strcol New value for strcol.
- */
- public void setStrcol(String strcol) {
- this.strcol = strcol;
- }
-
- /**
- * Gets datecol.
- *
- * @return Value for datecol.
- */
- public java.sql.Date getDatecol() {
- return datecol;
- }
-
- /**
- * Sets datecol.
- *
- * @param datecol New value for datecol.
- */
- public void setDatecol(java.sql.Date datecol) {
- this.datecol = datecol;
- }
-
- /**
- * Gets timecol.
- *
- * @return Value for timecol.
- */
- public java.sql.Time getTimecol() {
- return timecol;
- }
-
- /**
- * Sets timecol.
- *
- * @param timecol New value for timecol.
- */
- public void setTimecol(java.sql.Time timecol) {
- this.timecol = timecol;
- }
-
- /**
- * Gets tscol.
- *
- * @return Value for tscol.
- */
- public java.sql.Timestamp getTscol() {
- return tscol;
- }
-
- /**
- * Sets tscol.
- *
- * @param tscol New value for tscol.
- */
- public void setTscol(java.sql.Timestamp tscol) {
- this.tscol = tscol;
- }
-
- /**
- * Gets arrcol.
- *
- * @return Value for arrcol.
- */
- public Object getArrcol() {
- return arrcol;
- }
-
- /**
- * Sets arrcol.
- *
- * @param arrcol New value for arrcol.
- */
- public void setArrcol(Object arrcol) {
- this.arrcol = arrcol;
- }
-
- /**
- * Gets fieldWithAlias.
- *
- * @return Value for fieldWithAlias.
- */
- public String getFieldWithAlias() {
- return fieldWithAlias;
- }
-
- /**
- * Sets fieldWithAlias.
- *
- * @param fieldWithAlias New value for fieldWithAlias.
- */
- public void setFieldWithAlias(String fieldWithAlias) {
- this.fieldWithAlias = fieldWithAlias;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof Tst))
- return false;
-
- Tst that = (Tst)o;
-
- if (pk != that.pk)
- return false;
-
- if (boolcol != that.boolcol)
- return false;
-
- if (bytecol != that.bytecol)
- return false;
-
- if (shortcol != that.shortcol)
- return false;
-
- if (intcol != that.intcol)
- return false;
-
- if (longcol != that.longcol)
- return false;
-
- if (Float.compare(floatcol, that.floatcol) != 0)
- return false;
-
- if (Double.compare(doublecol, that.doublecol) != 0)
- return false;
-
- if (Double.compare(doublecol2, that.doublecol2) != 0)
- return false;
-
- if (bigdecimalcol != null ? !bigdecimalcol.equals(that.bigdecimalcol) : that.bigdecimalcol != null)
- return false;
-
- if (strcol != null ? !strcol.equals(that.strcol) : that.strcol != null)
- return false;
-
- if (datecol != null ? !datecol.equals(that.datecol) : that.datecol != null)
- return false;
-
- if (timecol != null ? !timecol.equals(that.timecol) : that.timecol != null)
- return false;
-
- if (tscol != null ? !tscol.equals(that.tscol) : that.tscol != null)
- return false;
-
- if (arrcol != null ? !arrcol.equals(that.arrcol) : that.arrcol != null)
- return false;
-
- if (fieldWithAlias != null ? !fieldWithAlias.equals(that.fieldWithAlias) : that.fieldWithAlias != null)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- res = 31 * res + (boolcol ? 1 : 0);
-
- res = 31 * res + (int)bytecol;
-
- res = 31 * res + (int)shortcol;
-
- res = 31 * res + intcol;
-
- res = 31 * res + (int)(longcol ^ (longcol >>> 32));
-
- res = 31 * res + (floatcol != +0.0f ? Float.floatToIntBits(floatcol) : 0);
-
- long ig_hash_temp = Double.doubleToLongBits(doublecol);
-
- res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));
-
- ig_hash_temp = Double.doubleToLongBits(doublecol2);
-
- res = 31 * res + (int)(ig_hash_temp ^ (ig_hash_temp >>> 32));
-
- res = 31 * res + (bigdecimalcol != null ? bigdecimalcol.hashCode() : 0);
-
- res = 31 * res + (strcol != null ? strcol.hashCode() : 0);
-
- res = 31 * res + (datecol != null ? datecol.hashCode() : 0);
-
- res = 31 * res + (timecol != null ? timecol.hashCode() : 0);
-
- res = 31 * res + (tscol != null ? tscol.hashCode() : 0);
-
- res = 31 * res + (arrcol != null ? arrcol.hashCode() : 0);
-
- res = 31 * res + (fieldWithAlias != null ? fieldWithAlias.hashCode() : 0);
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "Tst [pk=" + pk +
- ", boolcol=" + boolcol +
- ", bytecol=" + bytecol +
- ", shortcol=" + shortcol +
- ", intcol=" + intcol +
- ", longcol=" + longcol +
- ", floatcol=" + floatcol +
- ", doublecol=" + doublecol +
- ", doublecol2=" + doublecol2 +
- ", bigdecimalcol=" + bigdecimalcol +
- ", strcol=" + strcol +
- ", datecol=" + datecol +
- ", timecol=" + timecol +
- ", tscol=" + tscol +
- ", arrcol=" + arrcol +
- ", fieldWithAlias=" + fieldWithAlias +
- "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/TstKey.txt
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/TstKey.txt b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/TstKey.txt
deleted file mode 100644
index e2ce3c0..0000000
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/model/TstKey.txt
+++ /dev/null
@@ -1,96 +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.schema.test.model;
-
-import java.io.*;
-
-/**
- * TstKey definition.
- *
- * Code generated by Apache Ignite Schema Import utility: 01/27/2015.
- */
-public class TstKey implements Serializable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Value for pk. */
- private int pk;
-
- /**
- * Empty constructor.
- */
- public TstKey() {
- // No-op.
- }
-
- /**
- * Full constructor.
- */
- public TstKey(
- int pk
- ) {
- this.pk = pk;
- }
-
- /**
- * Gets pk.
- *
- * @return Value for pk.
- */
- public int getPk() {
- return pk;
- }
-
- /**
- * Sets pk.
- *
- * @param pk New value for pk.
- */
- public void setPk(int pk) {
- this.pk = pk;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (!(o instanceof TstKey))
- return false;
-
- TstKey that = (TstKey)o;
-
- if (pk != that.pk)
- return false;
-
- return true;
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- int res = pk;
-
- return res;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return "TstKey [pk=" + pk +
- "]";
- }
-}
[09/22] ignite git commit: IGNITE-4349 Discontinue the schema-import
utility.
Posted by pt...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
deleted file mode 100644
index df54e04..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
+++ /dev/null
@@ -1,446 +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.schema.generator;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.apache.ignite.cache.QueryEntity;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory;
-import org.apache.ignite.cache.store.jdbc.JdbcType;
-import org.apache.ignite.cache.store.jdbc.JdbcTypeField;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.PojoField;
-import org.apache.ignite.schema.ui.ConfirmCallable;
-import org.apache.ignite.schema.ui.MessageBox;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import static org.apache.ignite.schema.ui.MessageBox.Result.CANCEL;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO_TO_ALL;
-
-/**
- * Generator of XML files for type metadata.
- */
-public class XmlGenerator {
- /**
- * Add comment with license and generation date.
- *
- * @param doc XML document.
- */
- private static void addComment(Document doc) {
- doc.appendChild(doc.createComment("\n" +
- " Licensed to the Apache Software Foundation (ASF) under one or more\n" +
- " contributor license agreements. See the NOTICE file distributed with\n" +
- " this work for additional information regarding copyright ownership.\n" +
- " The ASF licenses this file to You under the Apache License, Version 2.0\n" +
- " (the \"License\"); you may not use this file except in compliance with\n" +
- " the License. You may obtain a copy of the License at\n\n" +
- " http://www.apache.org/licenses/LICENSE-2.0\n\n" +
- " Unless required by applicable law or agreed to in writing, software\n" +
- " distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
- " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" +
- " See the License for the specific language governing permissions and\n" +
- " limitations under the License.\n"));
-
- doc.appendChild(doc.createComment("\n XML generated by Apache Ignite Schema Import utility: " +
- new SimpleDateFormat("MM/dd/yyyy").format(new Date()) + "\n"));
- }
-
- /**
- * Add bean to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param cls Bean class.
- */
- private static Element addBean(Document doc, Node parent, Class<?> cls) {
- Element elem = doc.createElement("bean");
-
- elem.setAttribute("class", cls.getName());
-
- parent.appendChild(elem);
-
- return elem;
- }
-
- /**
- * Add element to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param tagName XML tag name.
- * @param attr1 Name for first attr.
- * @param val1 Value for first attribute.
- * @param attr2 Name for second attr.
- * @param val2 Value for second attribute.
- */
- private static Element addElement(Document doc, Node parent, String tagName,
- String attr1, String val1, String attr2, String val2) {
- Element elem = doc.createElement(tagName);
-
- if (attr1 != null)
- elem.setAttribute(attr1, val1);
-
- if (attr2 != null)
- elem.setAttribute(attr2, val2);
-
- parent.appendChild(elem);
-
- return elem;
- }
-
- /**
- * Add element to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param tagName XML tag name.
- */
- private static Element addElement(Document doc, Node parent, String tagName) {
- return addElement(doc, parent, tagName, null, null, null, null);
- }
-
- /**
- * Add element to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param tagName XML tag name.
- */
- private static Element addElement(Document doc, Node parent, String tagName, String attrName, String attrVal) {
- return addElement(doc, parent, tagName, attrName, attrVal, null, null);
- }
-
- /**
- * Add "property" element to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param name Value for "name" attribute
- * @param val Value for "value" attribute
- */
- private static Element addProperty(Document doc, Node parent, String name, String val) {
- String valAttr = val != null ? "value" : null;
-
- return addElement(doc, parent, "property", "name", name, valAttr, val);
- }
-
- /**
- * Add type descriptors to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param name Property name.
- * @param fields Collection of POJO fields.
- */
- private static void addJdbcFields(Document doc, Node parent, String name, Collection<PojoField> fields) {
- if (!fields.isEmpty()) {
- Element prop = addProperty(doc, parent, name, null);
-
- Element list = addElement(doc, prop, "list");
-
- for (PojoField field : fields) {
- Element item = addBean(doc, list, JdbcTypeField.class);
-
- Element dbType = addProperty(doc, item, "databaseFieldType", null);
- addElement(doc, dbType, "util:constant", "static-field", "java.sql.Types." + field.dbTypeName());
- addProperty(doc, item, "databaseFieldName", field.dbName());
- addProperty(doc, item, "javaFieldType", field.javaTypeName());
- addProperty(doc, item, "javaFieldName", field.javaName());
- }
- }
- }
-
- /**
- * Add query fields to xml document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param fields Map with fields.
- */
- private static void addQueryFields(Document doc, Node parent, Collection<PojoField> fields) {
- if (!fields.isEmpty()) {
- Element prop = addProperty(doc, parent, "fields", null);
-
- Element map = addElement(doc, prop, "util:map", "map-class", "java.util.LinkedHashMap");
-
- for (PojoField field : fields)
- addElement(doc, map, "entry", "key", field.javaName(), "value",
- GeneratorUtils.boxPrimitiveType(field.javaTypeName()));
- }
- }
-
- /**
- * Add query field aliases to xml document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param fields Map with fields.
- */
- private static void addQueryFieldAliases(Document doc, Node parent, Collection<PojoField> fields) {
- Collection<PojoField> aliases = new ArrayList<>();
-
- for (PojoField field : fields) {
- if (!field.javaName().equalsIgnoreCase(field.dbName()))
- aliases.add(field);
- }
-
- if (!aliases.isEmpty()) {
- Element prop = addProperty(doc, parent, "aliases", null);
-
- Element map = addElement(doc, prop, "map");
-
- for (PojoField alias : aliases)
- addElement(doc, map, "entry", "key", alias.javaName(), "value", alias.dbName());
- }
- }
-
- /**
- * Add indexes to xml document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param idxs Indexes.
- */
- private static void addQueryIndexes(Document doc, Node parent, Collection<PojoField> fields,
- Collection<QueryIndex> idxs) {
- if (!idxs.isEmpty()) {
- boolean firstIdx = true;
-
- Element list = null;
-
- for (QueryIndex idx : idxs) {
- Set<Map.Entry<String, Boolean>> dbIdxFlds = idx.getFields().entrySet();
-
- int sz = dbIdxFlds.size();
-
- List<T2<String, Boolean>> idxFlds = new ArrayList<>(sz);
-
- for (Map.Entry<String, Boolean> idxFld : dbIdxFlds) {
- PojoField field = GeneratorUtils.findFieldByName(fields, idxFld.getKey());
-
- if (field != null)
- idxFlds.add(new T2<>(field.javaName(), idxFld.getValue()));
- else
- break;
- }
-
- // Only if all fields present, add index description.
- if (idxFlds.size() == sz) {
- if (firstIdx) {
- Element prop = addProperty(doc, parent, "indexes", null);
-
- list = addElement(doc, prop, "list");
-
- firstIdx = false;
- }
-
- Element idxBean = addBean(doc, list, QueryIndex.class);
-
- addProperty(doc, idxBean, "name", idx.getName());
-
- Element idxType = addProperty(doc, idxBean, "indexType", null);
- addElement(doc, idxType, "util:constant", "static-field", "org.apache.ignite.cache.QueryIndexType." + idx.getIndexType());
-
- Element flds = addProperty(doc, idxBean, "fields", null);
-
- Element fldsMap = addElement(doc, flds, "map");
-
- for (T2<String, Boolean> fld : idxFlds)
- addElement(doc, fldsMap, "entry", "key", fld.getKey(), "value", fld.getValue().toString());
- }
- }
- }
- }
-
- /**
- * Add element with JDBC POJO store factory to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param pkg Package fo types.
- * @param pojo POJO descriptor.
- */
- private static void addJdbcPojoStoreFactory(Document doc, Node parent, String pkg, PojoDescriptor pojo,
- boolean includeKeys) {
- Element bean = addBean(doc, parent, JdbcType.class);
-
- addProperty(doc, bean, "databaseSchema", pojo.schema());
-
- addProperty(doc, bean, "databaseTable", pojo.table());
-
- addProperty(doc, bean, "keyType", pkg + "." + pojo.keyClassName());
-
- addProperty(doc, bean, "valueType", pkg + "." + pojo.valueClassName());
-
- addJdbcFields(doc, bean, "keyFields", pojo.keyFields());
-
- addJdbcFields(doc, bean, "valueFields", pojo.valueFields(includeKeys));
- }
-
- /**
- * Add element with query entity to XML document.
- *
- * @param doc XML document.
- * @param parent Parent XML node.
- * @param pkg Package fo types.
- * @param pojo POJO descriptor.
- * @param generateAliases {@code true} if aliases should be generated for query fields.
- */
- private static void addQueryEntity(Document doc, Node parent, String pkg, PojoDescriptor pojo, boolean generateAliases) {
- Element bean = addBean(doc, parent, QueryEntity.class);
-
- addProperty(doc, bean, "keyType", pkg + "." + pojo.keyClassName());
-
- addProperty(doc, bean, "valueType", pkg + "." + pojo.valueClassName());
-
- Collection<PojoField> fields = pojo.valueFields(true);
-
- addQueryFields(doc, bean, fields);
-
- if (generateAliases)
- addQueryFieldAliases(doc, bean, fields);
-
- addQueryIndexes(doc, bean, fields, pojo.indexes());
- }
-
- /**
- * Transform metadata into xml.
- *
- * @param pkg Package fo types.
- * @param pojo POJO descriptor.
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @param generateAliases {@code true} if aliases should be generated for query fields.
- * @param out File to output result.
- * @param askOverwrite Callback to ask user to confirm file overwrite.
- */
- public static void generate(String pkg, PojoDescriptor pojo, boolean includeKeys, boolean generateAliases, File out,
- ConfirmCallable askOverwrite) {
- generate(pkg, Collections.singleton(pojo), includeKeys, generateAliases, out, askOverwrite);
- }
-
- /**
- * Transform metadata into xml.
- *
- * @param pkg Package fo types.
- * @param pojos POJO descriptors.
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @param generateAliases {@code true} if aliases should be generated for query fields.
- * @param out File to output result.
- * @param askOverwrite Callback to ask user to confirm file overwrite.
- */
- public static void generate(String pkg, Collection<PojoDescriptor> pojos, boolean includeKeys,
- boolean generateAliases, File out, ConfirmCallable askOverwrite) {
-
- File outFolder = out.getParentFile();
-
- if (outFolder == null)
- throw new IllegalStateException("Invalid output file: " + out);
-
- if (!outFolder.exists() && !outFolder.mkdirs())
- throw new IllegalStateException("Failed to create output folder for XML file: " + outFolder);
-
- try {
- if (out.exists()) {
- MessageBox.Result choice = askOverwrite.confirm(out.getName());
-
- if (CANCEL == choice)
- throw new IllegalStateException("XML generation was canceled!");
-
- if (NO == choice || NO_TO_ALL == choice)
- return;
- }
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
-
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
-
- Document doc = docBuilder.newDocument();
- doc.setXmlStandalone(true);
-
- addComment(doc);
-
- Element beans = addElement(doc, doc, "beans");
- beans.setAttribute("xmlns", "http://www.springframework.org/schema/beans");
- beans.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- beans.setAttribute("xmlns:util", "http://www.springframework.org/schema/util");
- beans.setAttribute("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");
-
- Element factoryBean = addBean(doc, beans, CacheJdbcPojoStoreFactory.class);
- Element typesElem = addProperty(doc, factoryBean, "types", null);
- Element typesItemsElem = addElement(doc, typesElem, "list");
-
- for (PojoDescriptor pojo : pojos)
- addJdbcPojoStoreFactory(doc, typesItemsElem, pkg, pojo, includeKeys);
-
- for (PojoDescriptor pojo : pojos)
- addQueryEntity(doc, beans, pkg, pojo, generateAliases);
-
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
-
- Transformer transformer = transformerFactory.newTransformer();
-
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream(65536);
-
- transformer.transform(new DOMSource(doc), new StreamResult(baos));
-
- // Custom pretty-print of generated XML.
- Files.write(out.toPath(), baos.toString()
- .replaceAll("><", ">\n<")
- .replaceFirst("<!--", "\n<!--")
- .replaceFirst("-->", "-->\n")
- .replaceAll("\" xmlns", "\"\n xmlns")
- .replaceAll("\" xsi", "\"\n xsi")
- .replaceAll(" http://www.springframework", "\n http://www.springframework")
- .getBytes());
- }
- catch (ParserConfigurationException | TransformerException | IOException e) {
- throw new IllegalStateException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
deleted file mode 100644
index 4f696d6..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ /dev/null
@@ -1,497 +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.schema.model;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import javafx.beans.property.BooleanProperty;
-import javafx.beans.property.SimpleBooleanProperty;
-import javafx.beans.property.SimpleStringProperty;
-import javafx.beans.property.StringProperty;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.schema.parser.DbColumn;
-import org.apache.ignite.schema.parser.DbTable;
-
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BIT;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.CHAR;
-import static java.sql.Types.CLOB;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.LONGNVARCHAR;
-import static java.sql.Types.LONGVARCHAR;
-import static java.sql.Types.NCHAR;
-import static java.sql.Types.NCLOB;
-import static java.sql.Types.NUMERIC;
-import static java.sql.Types.NVARCHAR;
-import static java.sql.Types.REAL;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.SQLXML;
-import static java.sql.Types.TIME;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARCHAR;
-
-/**
- * Descriptor for java type.
- */
-public class PojoDescriptor {
- /** Database table. */
- private final DbTable tbl;
-
- /** Selected property. */
- private final BooleanProperty useProp;
-
- /** Previous name for key class. */
- private final String keyClsNamePrev;
-
- /** Key class name to show on screen. */
- private final StringProperty keyClsNameProp;
-
- /** Previous name for value class. */
- private final String valClsNamePrev;
-
- /** Value class name to show on screen. */
- private final StringProperty valClsNameProp;
-
- /** Parent item (schema name). */
- private final PojoDescriptor parent;
-
- /** Children items (tables names). */
- private Collection<PojoDescriptor> children = Collections.emptyList();
-
- /** Indeterminate state of parent. */
- private final BooleanProperty indeterminateProp = new SimpleBooleanProperty(false);
-
- /** Full database name: schema + table. */
- private final String fullDbName;
-
- /** Java class fields. */
- private final ObservableList<PojoField> fields;
-
- /**
- * Constructor of POJO descriptor.
- *
- * @param prn Parent descriptor.
- * @param tbl Database table Tab;e.
- */
- public PojoDescriptor(PojoDescriptor prn, DbTable tbl) {
- parent = prn;
-
- this.tbl = tbl;
-
- fullDbName = tbl.schema() + "." + tbl.table();
-
- valClsNamePrev = toJavaClassName(tbl.table());
- valClsNameProp = new SimpleStringProperty(valClsNamePrev);
-
- keyClsNamePrev = valClsNamePrev.isEmpty() ? "" : valClsNamePrev + "Key";
- keyClsNameProp = new SimpleStringProperty(keyClsNamePrev);
-
- Collection<DbColumn> cols = tbl.columns();
-
- List<PojoField> flds = new ArrayList<>(cols.size());
-
- for (DbColumn col : cols) {
- String colName = col.name();
-
- PojoField fld = new PojoField(colName, col.type(),
- toJavaFieldName(colName), toJavaType(col).getName(),
- col.key(), col.nullable());
-
- fld.owner(this);
-
- flds.add(fld);
- }
-
- fields = FXCollections.observableList(flds);
-
- boolean isTbl = parent != null;
-
- boolean hasKeys = !isTbl || !keyFields().isEmpty();
-
- useProp = new SimpleBooleanProperty(hasKeys);
-
- if (isTbl && !hasKeys && !parent.indeterminateProp.get())
- parent.indeterminateProp.set(true);
-
- useProp.addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- for (PojoDescriptor child : children)
- child.useProp.set(newVal);
-
- if (parent != null && !parent.children.isEmpty()) {
- Iterator<PojoDescriptor> it = parent.children.iterator();
-
- boolean parentIndeterminate = false;
- boolean first = it.next().useProp.get();
-
- while (it.hasNext()) {
- if (it.next().useProp.get() != first) {
- parentIndeterminate = true;
-
- break;
- }
- }
-
- parent.indeterminateProp.set(parentIndeterminate);
-
- if (!parentIndeterminate)
- parent.useProp.set(first);
- }
- }
- });
- }
-
- /**
- * @return Parent descriptor.
- */
- public PojoDescriptor parent() {
- return parent;
- }
-
- /**
- * @return Full database name: schema + table.
- */
- public String fullDbName() {
- return fullDbName;
- }
-
- /**
- * @return {@code true} if POJO descriptor is a table descriptor and checked in GUI.
- */
- public boolean checked() {
- return parent != null && useProp.get();
- }
-
- /**
- * @return Boolean property support for {@code use} property.
- */
- public BooleanProperty useProperty() {
- return useProp;
- }
-
- /**
- * @return Boolean property support for parent {@code indeterminate} property.
- */
- public BooleanProperty indeterminate() {
- return indeterminateProp;
- }
-
- /**
- * @return Key class name.
- */
- public String keyClassName() {
- return keyClsNameProp.get();
- }
-
- /**
- * @param name New key class name.
- */
- public void keyClassName(String name) {
- keyClsNameProp.set(name);
- }
-
- /**
- * @return Value class name.
- */
- public String valueClassName() {
- return valClsNameProp.get();
- }
-
- /**
- * @param name New value class name.
- */
- public void valueClassName(String name) {
- valClsNameProp.set(name);
- }
-
- /**
- * @return {@code true} if at least one field checked as "used".
- */
- public boolean hasFields() {
- for (PojoField field : fields)
- if (field.use())
- return true;
-
- return false;
- }
-
- /**
- * @return {@code true} if at least one field checked as "used" and checked as "key".
- */
- public boolean hasKeyFields() {
- for (PojoField field : fields)
- if (field.use() && field.key())
- return true;
-
- return false;
- }
-
- /**
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @return {@code true} if at least one field checked as "used" and not checked as "key".
- */
- public boolean hasValueFields(boolean includeKeys) {
- if (includeKeys)
- return hasKeyFields();
-
- for (PojoField field : fields)
- if (field.use() && !field.key())
- return true;
-
- return false;
- }
-
- /**
- * @return Collection of key fields.
- */
- public Collection<PojoField> keyFields() {
- Collection<PojoField> keys = new ArrayList<>();
-
- for (PojoField field : fields)
- if (field.use() && field.key() )
- keys.add(field);
-
- return keys;
- }
-
- /**
- * @param includeKeys {@code true} if key fields should be included into value class.
- * @return Collection of value fields.
- */
- public Collection<PojoField> valueFields(boolean includeKeys) {
- Collection<PojoField> vals = new ArrayList<>();
-
- for (PojoField field : fields)
- if (field.use() && (includeKeys || !field.key()))
- vals.add(field);
-
- return vals;
- }
-
- /**
- * Gets indexes indexes.
- *
- * @return Collection with indexes.
- */
- public Collection<QueryIndex> indexes() {
- return tbl.indexes();
- }
-
- /**
- * @return Key class name property.
- */
- public StringProperty keyClassNameProperty() {
- return keyClsNameProp;
- }
-
- /**
- * @return Value class name property.
- */
- public StringProperty valueClassNameProperty() {
- return valClsNameProp;
- }
-
- /**
- * @return Schema name.
- */
- public String schema() {
- return tbl.schema();
- }
-
- /**
- * @return Table name.
- */
- public String table() {
- return tbl.table();
- }
-
- /**
- * Sets children items.
- *
- * @param children Items to set.
- */
- public void children(Collection<PojoDescriptor> children) {
- this.children = children;
- }
-
- /**
- * @return {@code true} if descriptor was changed by user via GUI.
- */
- public boolean changed() {
- if (!keyClsNameProp.get().equals(keyClsNamePrev) || !valClsNameProp.get().equals(valClsNamePrev))
- return true;
-
- for (PojoField field : fields)
- if (field.changed())
- return true;
-
- return false;
- }
-
- /**
- * Revert changes to key class name made by user.
- */
- public void revertKeyClassName() {
- keyClsNameProp.set(keyClsNamePrev);
- }
-
- /**
- * Revert changes to value class name made by user.
- */
- public void revertValueClassName() {
- valClsNameProp.set(valClsNamePrev);
- }
-
- /**
- * Revert changes to java names made by user.
- */
- public void revertJavaNames() {
- for (PojoField field : fields)
- field.resetJavaName();
- }
-
- /**
- * @return Java class fields.
- */
- public ObservableList<PojoField> fields() {
- return fields;
- }
-
- /**
- * @param name Source name.
- * @return String converted to java class name notation.
- */
- private static String toJavaClassName(String name) {
- int len = name.length();
-
- StringBuilder buf = new StringBuilder(len);
-
- boolean capitalizeNext = true;
-
- for (int i = 0; i < len; i++) {
- char ch = name.charAt(i);
-
- if (Character.isWhitespace(ch) || '_' == ch)
- capitalizeNext = true;
- else if (capitalizeNext) {
- buf.append(Character.toUpperCase(ch));
-
- capitalizeNext = false;
- }
- else
- buf.append(Character.toLowerCase(ch));
- }
-
- return buf.toString();
- }
-
- /**
- * @param name Source name.
- * @return String converted to java field name notation.
- */
- private static String toJavaFieldName(String name) {
- String javaName = toJavaClassName(name);
-
- return Character.toLowerCase(javaName.charAt(0)) + javaName.substring(1);
- }
-
- /**
- * Convert JDBC data type to java type.
- *
- * @param col Database column descriptor.
- * @return Java data type.
- */
- private static Class<?> toJavaType(DbColumn col) {
- boolean nullable = col.nullable();
- boolean unsigned = col.unsigned();
-
- switch (col.type()) {
- case BIT:
- case BOOLEAN:
- return nullable ? Boolean.class : boolean.class;
-
- case TINYINT:
- return unsigned
- ? (nullable ? Short.class : short.class)
- : (nullable ? Byte.class : byte.class);
-
- case SMALLINT:
- return unsigned
- ? (nullable ? Integer.class : int.class)
- : (nullable ? Short.class : short.class);
-
- case INTEGER:
- return unsigned
- ? (nullable ? Long.class : long.class)
- : (nullable ? Integer.class : int.class);
-
- case BIGINT:
- return nullable ? Long.class : long.class;
-
- case REAL:
- return nullable ? Float.class : float.class;
-
- case FLOAT:
- case DOUBLE:
- return nullable ? Double.class : double.class;
-
- case NUMERIC:
- case DECIMAL:
- return BigDecimal.class;
-
- case CHAR:
- case VARCHAR:
- case LONGVARCHAR:
- case NCHAR:
- case NVARCHAR:
- case LONGNVARCHAR:
- case CLOB:
- case NCLOB:
- case SQLXML:
- return String.class;
-
- case DATE:
- return java.sql.Date.class;
-
- case TIME:
- return java.sql.Time.class;
-
- case TIMESTAMP:
- return java.sql.Timestamp.class;
-
- // BINARY, VARBINARY, LONGVARBINARY, ARRAY, BLOB, NULL, DATALINK
- // OTHER, JAVA_OBJECT, DISTINCT, STRUCT, REF, ROWID
- default:
- return Object.class;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
deleted file mode 100644
index 3ee2f8c..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoField.java
+++ /dev/null
@@ -1,461 +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.schema.model;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import javafx.beans.property.BooleanProperty;
-import javafx.beans.property.SimpleBooleanProperty;
-import javafx.beans.property.SimpleStringProperty;
-import javafx.beans.property.StringProperty;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-
-import static java.sql.Types.ARRAY;
-import static java.sql.Types.BIGINT;
-import static java.sql.Types.BINARY;
-import static java.sql.Types.BIT;
-import static java.sql.Types.BLOB;
-import static java.sql.Types.BOOLEAN;
-import static java.sql.Types.CHAR;
-import static java.sql.Types.CLOB;
-import static java.sql.Types.DATALINK;
-import static java.sql.Types.DATE;
-import static java.sql.Types.DECIMAL;
-import static java.sql.Types.DISTINCT;
-import static java.sql.Types.DOUBLE;
-import static java.sql.Types.FLOAT;
-import static java.sql.Types.INTEGER;
-import static java.sql.Types.JAVA_OBJECT;
-import static java.sql.Types.LONGNVARCHAR;
-import static java.sql.Types.LONGVARBINARY;
-import static java.sql.Types.LONGVARCHAR;
-import static java.sql.Types.NCHAR;
-import static java.sql.Types.NCLOB;
-import static java.sql.Types.NULL;
-import static java.sql.Types.NUMERIC;
-import static java.sql.Types.NVARCHAR;
-import static java.sql.Types.OTHER;
-import static java.sql.Types.REAL;
-import static java.sql.Types.REF;
-import static java.sql.Types.ROWID;
-import static java.sql.Types.SMALLINT;
-import static java.sql.Types.SQLXML;
-import static java.sql.Types.STRUCT;
-import static java.sql.Types.TIME;
-import static java.sql.Types.TIMESTAMP;
-import static java.sql.Types.TINYINT;
-import static java.sql.Types.VARBINARY;
-import static java.sql.Types.VARCHAR;
-
-/**
- * Field descriptor with properties for JavaFX GUI bindings.
- */
-public class PojoField {
- /** If this field should be used for code generation. */
- private final BooleanProperty useProp;
-
- /** If this field belongs to primary key. */
- private final BooleanProperty keyProp;
-
- /** If this field is an affinity key. */
- private final BooleanProperty akProp;
-
- /** If this field initially belongs to primary key. */
- private final boolean keyPrev;
-
- /** Field name in database. */
- private final StringProperty dbNameProp;
-
- /** Field type in database. */
- private final StringProperty dbTypeNameProp;
-
- /** Field name in POJO. */
- private final StringProperty javaNameProp;
-
- /** Initial field name in POJO. */
- private final String javaNamePrev;
-
- /** Field type in POJO. */
- private final StringProperty javaTypeNameProp;
-
- /** Initial field type in POJO. */
- private final String javaTypeNamePrev;
-
- /** Is {@code NULL} allowed for field in database. */
- private final boolean nullable;
-
- /** List of possible java type conversions. */
- private final ObservableList<String> conversions;
-
- /** Field owner. */
- private PojoDescriptor owner;
-
- /**
- * @param clss List of classes to get class names.
- * @return List of classes names to show in UI for manual select.
- */
- private static List<String> classNames(Class<?>... clss) {
- List<String> names = new ArrayList<>(clss.length);
-
- for (Class<?> cls : clss)
- names.add(cls.getName());
-
- return names;
- }
-
- /** Null number conversions. */
- private static final ObservableList<String> NULL_NUM_CONVERSIONS = FXCollections.observableArrayList();
-
- /** Not null number conversions. */
- private static final ObservableList<String> NOT_NULL_NUM_CONVERSIONS = FXCollections.observableArrayList();
-
- /** Primitive types. */
- private static final List<String> PRIMITIVES = classNames(boolean.class, byte.class, short.class,
- int.class, long.class, float.class, double.class);
-
- /** Object types. */
- private static final List<String> OBJECTS = classNames(Boolean.class, Byte.class, Short.class, Integer.class,
- Long.class, Float.class, Double.class, BigDecimal.class);
-
- static {
- NOT_NULL_NUM_CONVERSIONS.addAll(PRIMITIVES);
- NOT_NULL_NUM_CONVERSIONS.addAll(OBJECTS);
-
- NULL_NUM_CONVERSIONS.addAll(OBJECTS);
- }
-
- /**
- * @param dbType Database type.
- * @param nullable Nullable.
- * @param dflt Default.
- * @return List of possible type conversions.
- */
- private static ObservableList<String> conversions(int dbType, boolean nullable, String dflt) {
- switch (dbType) {
- case TINYINT:
- case SMALLINT:
- case INTEGER:
- case BIGINT:
- case REAL:
- case FLOAT:
- case DOUBLE:
- return nullable ? NULL_NUM_CONVERSIONS : NOT_NULL_NUM_CONVERSIONS;
-
- default:
- return FXCollections.singletonObservableList(dflt);
- }
- }
-
- /**
- * @param dbName Field name in database.
- * @param dbType Field JDBC type in database.
- * @param javaName Field name in POJO.
- * @param javaTypeName Field type in POJO.
- * @param key {@code true} if this field belongs to primary key.
- * @param nullable {@code true} if {@code NULL} allowed for field in database.
- */
- public PojoField(String dbName, int dbType, String javaName, String javaTypeName, boolean key, boolean nullable) {
- dbNameProp = new SimpleStringProperty(dbName);
-
- dbTypeNameProp = new SimpleStringProperty(jdbcTypeName(dbType));
-
- javaNamePrev = javaName;
-
- javaNameProp = new SimpleStringProperty(javaNamePrev);
-
- javaTypeNamePrev = javaTypeName;
-
- javaTypeNameProp = new SimpleStringProperty(javaTypeNamePrev);
-
- useProp = new SimpleBooleanProperty(true);
-
- keyPrev = key;
-
- keyProp = new SimpleBooleanProperty(keyPrev);
-
- this.nullable = nullable;
-
- akProp = new SimpleBooleanProperty(false);
-
- conversions = conversions(dbType, nullable, javaNamePrev);
-
- keyProp.addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- if (newVal) {
- if (!use())
- useProp.set(true);
- }
- else
- akProp.set(false);
- }
- });
-
- akProp.addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- if (newVal && owner != null) {
- keyProperty().set(true);
-
- for (PojoField field : owner.fields())
- if (field != PojoField.this && field.affinityKey())
- field.akProp.set(false);
- }
- }
- });
- }
-
- /**
- * @param jdbcType String name for JDBC type.
- * @return String name for JDBC type.
- */
- private static String jdbcTypeName(int jdbcType) {
- switch (jdbcType) {
- case BIT:
- return "BIT";
- case TINYINT:
- return "TINYINT";
- case SMALLINT:
- return "SMALLINT";
- case INTEGER:
- return "INTEGER";
- case BIGINT:
- return "BIGINT";
- case FLOAT:
- return "FLOAT";
- case REAL:
- return "REAL";
- case DOUBLE:
- return "DOUBLE";
- case NUMERIC:
- return "NUMERIC";
- case DECIMAL:
- return "DECIMAL";
- case CHAR:
- return "CHAR";
- case VARCHAR:
- return "VARCHAR";
- case LONGVARCHAR:
- return "LONGVARCHAR";
- case DATE:
- return "DATE";
- case TIME:
- return "TIME";
- case TIMESTAMP:
- return "TIMESTAMP";
- case BINARY:
- return "BINARY";
- case VARBINARY:
- return "VARBINARY";
- case LONGVARBINARY:
- return "LONGVARBINARY";
- case NULL:
- return "NULL";
- case OTHER:
- return "OTHER";
- case JAVA_OBJECT:
- return "JAVA_OBJECT";
- case DISTINCT:
- return "DISTINCT";
- case STRUCT:
- return "STRUCT";
- case ARRAY:
- return "ARRAY";
- case BLOB:
- return "BLOB";
- case CLOB:
- return "CLOB";
- case REF:
- return "REF";
- case DATALINK:
- return "DATALINK";
- case BOOLEAN:
- return "BOOLEAN";
- case ROWID:
- return "ROWID";
- case NCHAR:
- return "NCHAR";
- case NVARCHAR:
- return "NVARCHAR";
- case LONGNVARCHAR:
- return "LONGNVARCHAR";
- case NCLOB:
- return "NCLOB";
- case SQLXML:
- return "SQLXML";
- default:
- return "Unknown";
- }
- }
-
- /**
- * Revert changes to java names made by user.
- */
- public void resetJavaName() {
- javaNameProp.set(javaNamePrev);
- }
-
- /**
- * @param owner New field owner.
- */
- public void owner(PojoDescriptor owner) {
- this.owner = owner;
- }
-
- /**
- * @return {@code true} if filed should be used for code generation.
- */
- public boolean use() {
- return useProp.get();
- }
-
- /**
- * @return {@code true} if this field belongs to primary key.
- */
- public boolean key() {
- return keyProp.get();
- }
-
- /**
- * @param pk {@code true} if this field belongs to primary key.
- */
- public void key(boolean pk) {
- keyProp.set(pk);
- }
-
- /**
- * @return {@code true} if this field is an affinity key.
- */
- public boolean affinityKey() {
- return akProp.get();
- }
-
- /**
- * @return POJO field java name.
- */
- public String javaName() {
- return javaNameProp.get();
- }
-
- /**
- * @param name New POJO field java name.
- */
- public void javaName(String name) {
- javaNameProp.set(name);
- }
-
- /**
- * @return POJO field java type name.
- */
- public String javaTypeName() {
- return javaTypeNameProp.get();
- }
-
- /**
- * @return Field name in database.
- */
- public String dbName() {
- return dbNameProp.get();
- }
-
- /**
- * @return POJO field JDBC type name in database.
- */
- public String dbTypeName() {
- return dbTypeNameProp.get();
- }
-
- /**
- * @return Is NULL allowed for field in database.
- */
- public boolean nullable() {
- return nullable;
- }
-
- /**
- * @return List of possible java type conversions.
- */
- public ObservableList<String> conversions() {
- return conversions;
- }
-
- /**
- * @return {@code true} if type of field is primitive type.
- */
- public boolean primitive() {
- return PRIMITIVES.contains(javaTypeName());
- }
-
- /**
- * @return {@code true} if field was changed by user.
- */
- public boolean changed() {
- return keyPrev != key() || !javaNamePrev.equals(javaName()) || !javaTypeNamePrev.equals(javaTypeName());
- }
-
- /**
- * @return Boolean property support for {@code use} property.
- */
- public BooleanProperty useProperty() {
- return useProp;
- }
-
- /**
- * @return Boolean property support for {@code key} property.
- */
- public BooleanProperty keyProperty() {
- return keyProp;
- }
-
- /**
- * @return Boolean property support for {@code affinityKey} property.
- */
- public BooleanProperty affinityKeyProperty() {
- return akProp;
- }
-
- /**
- * @return String property support for {@code javaName} property.
- */
- public StringProperty javaNameProperty() {
- return javaNameProp;
- }
-
- /**
- * @return String property support for {@code javaTypeName} property.
- */
- public StringProperty javaTypeNameProperty() {
- return javaTypeNameProp;
- }
-
- /**
- * @return String property support for {@code dbName} property.
- */
- public StringProperty dbNameProperty() {
- return dbNameProp;
- }
-
- /**
- * @return String property support for {@code dbName} property.
- */
- public StringProperty dbTypeNameProperty() {
- return dbTypeNameProp;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/model/SchemaDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/SchemaDescriptor.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/SchemaDescriptor.java
deleted file mode 100644
index 7de2247..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/SchemaDescriptor.java
+++ /dev/null
@@ -1,62 +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.schema.model;
-
-import javafx.beans.property.BooleanProperty;
-import javafx.beans.property.SimpleBooleanProperty;
-
-/**
- * Descriptor for schema.
- */
-public class SchemaDescriptor {
- /** Schema name */
- private final String schema;
-
- /** State of schema selection. */
- private final BooleanProperty selected;
-
- /**
- * Constructor of schema descriptor.
- *
- * @param schema Schema.
- * @param selected Selection state.
- */
- public SchemaDescriptor(String schema, boolean selected) {
- this.schema = schema;
- this.selected = new SimpleBooleanProperty(selected);
- }
-
- /**
- * @return Schema name.
- */
- public String schema() {
- return schema;
- }
-
- /**
- * @return Boolean property support for {@code selected} property.
- */
- public BooleanProperty selected() {
- return selected;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return schema;
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java
deleted file mode 100644
index 6d87ed5..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java
+++ /dev/null
@@ -1,115 +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.schema.parser;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import org.apache.ignite.cache.QueryIndex;
-import org.apache.ignite.schema.model.PojoDescriptor;
-import org.apache.ignite.schema.model.SchemaDescriptor;
-
-/**
- * Database metadata parser.
- */
-public class DatabaseMetadataParser {
- /**
- * Get list of schemas from database.
- *
- * @param conn Connection to database.
- * @return List of schema descriptors.
- * @throws SQLException If schemas loading failed.
- */
- public static ObservableList<SchemaDescriptor> schemas(Connection conn) throws SQLException {
- Collection<String> dbSchemas = DbMetadataReader.getInstance().schemas(conn);
-
- List<SchemaDescriptor> uiSchemas = new ArrayList<>(dbSchemas.size());
-
- for (String schema : dbSchemas)
- uiSchemas.add(new SchemaDescriptor(schema, false));
-
- return FXCollections.observableList(uiSchemas);
- }
-
- /**
- * Parse database metadata.
- *
- * @param conn Connection to database.
- * @param schemas Collection of schema names to process.
- * @param tblsOnly If {@code true} then process tables only else process tables and views.
- * @return Collection of POJO descriptors.
- * @throws SQLException If parsing failed.
- */
- public static ObservableList<PojoDescriptor> parse(Connection conn, List<String> schemas, boolean tblsOnly)
- throws SQLException {
- Map<String, PojoDescriptor> parents = new HashMap<>();
-
- Map<String, Collection<PojoDescriptor>> childrens = new HashMap<>();
-
- for (DbTable tbl : DbMetadataReader.getInstance().metadata(conn, schemas, tblsOnly)) {
- String schema = tbl.schema();
-
- PojoDescriptor parent = parents.get(schema);
- Collection<PojoDescriptor> children = childrens.get(schema);
-
- if (parent == null) {
- parent = new PojoDescriptor(null, new DbTable(schema, "", Collections.<DbColumn>emptyList(),
- Collections.<QueryIndex>emptyList()));
-
- children = new ArrayList<>();
-
- parents.put(schema, parent);
- childrens.put(schema, children);
- }
-
- children.add(new PojoDescriptor(parent, tbl));
- }
-
- List<PojoDescriptor> res = new ArrayList<>();
-
- for (Map.Entry<String, PojoDescriptor> item : parents.entrySet()) {
- String schema = item.getKey();
- PojoDescriptor parent = item.getValue();
-
- Collection<PojoDescriptor> children = childrens.get(schema);
-
- if (!children.isEmpty()) {
- parent.children(children);
-
- res.add(parent); // Add schema description.
- res.addAll(children); // Add tables in schema.
- }
- }
-
- Collections.sort(res, new Comparator<PojoDescriptor>() {
- @Override public int compare(PojoDescriptor o1, PojoDescriptor o2) {
- return o1.fullDbName().compareTo(o2.fullDbName());
- }
- });
-
- return FXCollections.observableList(res);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java
deleted file mode 100644
index b23ff11..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/ConfirmCallable.java
+++ /dev/null
@@ -1,83 +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.schema.ui;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.FutureTask;
-import javafx.application.Platform;
-import javafx.stage.Stage;
-
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO;
-import static org.apache.ignite.schema.ui.MessageBox.Result.NO_TO_ALL;
-import static org.apache.ignite.schema.ui.MessageBox.Result.YES_TO_ALL;
-
-/**
- * Callable to ask user for confirmation from non EDT thread.
- */
-public class ConfirmCallable implements Callable<MessageBox.Result> {
- /** Owner window. */
- private final Stage owner;
-
- /** Message template. */
- private final String template;
-
- /** Message to show in confirmation dialog. */
- private String msg;
-
- /** User choice. */
- private MessageBox.Result choice = NO;
-
- /**
- * @param owner Owner window.
- * @param template Message template.
- */
- public ConfirmCallable(Stage owner, String template) {
- this.owner = owner;
- this.template = template;
- }
-
- /** {@inheritDoc} */
- @Override public MessageBox.Result call() throws Exception {
- choice = MessageBox.applyToAllChoiceDialog(owner, String.format(template, msg));
-
- return choice;
- }
-
- /**
- * Execute confirmation in EDT thread.
- *
- * @return Confirm result.
- */
- public MessageBox.Result confirm(String msg) {
- this.msg = msg;
-
- if (choice == YES_TO_ALL || choice == NO_TO_ALL)
- return choice;
-
- FutureTask<MessageBox.Result> fut = new FutureTask<>(this);
-
- Platform.runLater(fut);
-
- try {
- return fut.get();
- }
- catch (Exception ignored) {
- return NO;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/Controls.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/Controls.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/Controls.java
deleted file mode 100644
index 934a4c8..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/Controls.java
+++ /dev/null
@@ -1,697 +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.schema.ui;
-
-import com.sun.javafx.scene.control.skin.VirtualFlow;
-import javafx.application.Platform;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.collections.FXCollections;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.geometry.Insets;
-import javafx.geometry.Orientation;
-import javafx.geometry.Pos;
-import javafx.scene.Node;
-import javafx.scene.Parent;
-import javafx.scene.Scene;
-import javafx.scene.control.Button;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.ComboBox;
-import javafx.scene.control.Control;
-import javafx.scene.control.Label;
-import javafx.scene.control.ListView;
-import javafx.scene.control.PasswordField;
-import javafx.scene.control.ProgressIndicator;
-import javafx.scene.control.SelectionMode;
-import javafx.scene.control.SplitPane;
-import javafx.scene.control.TableCell;
-import javafx.scene.control.TableColumn;
-import javafx.scene.control.TableView;
-import javafx.scene.control.TextField;
-import javafx.scene.control.TitledPane;
-import javafx.scene.control.Tooltip;
-import javafx.scene.control.cell.CheckBoxListCell;
-import javafx.scene.control.cell.CheckBoxTableCell;
-import javafx.scene.control.cell.PropertyValueFactory;
-import javafx.scene.control.cell.TextFieldTableCell;
-import javafx.scene.image.Image;
-import javafx.scene.image.ImageView;
-import javafx.scene.input.KeyCode;
-import javafx.scene.input.KeyEvent;
-import javafx.scene.layout.BorderPane;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Pane;
-import javafx.scene.layout.StackPane;
-import javafx.scene.layout.VBox;
-import javafx.scene.text.Font;
-import javafx.scene.text.Text;
-import javafx.util.Callback;
-import javafx.util.converter.DefaultStringConverter;
-
-/**
- * Utility class to create controls.
- */
-public class Controls {
- /** */
- public static final Insets DFLT_PADDING = new Insets(10, 10, 10, 10);
-
- /**
- * Create scene with predefined style.
- *
- * @param root The root node of the scene graph.
- * @return New {@code Scene} instance.
- */
- public static Scene scene(Parent root) {
- Scene scene = new Scene(root);
-
- scene.getStylesheets().add("media/style.css");
-
- return scene;
- }
-
- /**
- * Create grid pane with default padding.
- *
- * @param top Top padding
- * @param right Right padding.
- * @param bottom Bottom padding.
- * @param left Left padding.
- * @return New {@code GridPaneEx} instance.
- */
- public static GridPaneEx paneEx(double top, double right, double bottom, double left) {
- GridPaneEx paneEx = new GridPaneEx();
-
- paneEx.setPadding(new Insets(top, right, bottom, left));
-
- return paneEx;
- }
-
- /**
- * Create new {@code HBox} with default padding.
- *
- * @param spacing Amount of horizontal space between each child.
- * @param dfltPadding If {@code true} than set default padding for pane.
- * @return New {@code HBox} instance.
- */
- public static HBox hBox(int spacing, boolean dfltPadding) {
- HBox hb = new HBox(spacing);
-
- if (dfltPadding)
- hb.setPadding(DFLT_PADDING);
-
- return hb;
- }
-
- /**
- * Create new {@code HBox} with default padding and add controls.
- *
- * @param spacing Amount of horizontal space between each child.
- * @param dfltPadding If {@code true} than set default padding for pane.
- * @param controls Controls to add.
- * @return New {@code HBox} instance.
- */
- public static HBox hBox(int spacing, boolean dfltPadding, Node... controls) {
- HBox hb = hBox(spacing, dfltPadding);
-
- hb.getChildren().addAll(controls);
-
- return hb;
- }
-
- /**
- * Create new {@code VBox} with default padding.
- *
- * @param spacing Amount of horizontal space between each child.
- * @return New {@code VBox} instance.
- */
- public static VBox vBox(int spacing) {
- VBox vb = new VBox(spacing);
-
- vb.setPadding(DFLT_PADDING);
-
- return vb;
- }
-
- /**
- * Create new {@code VBox} with default padding and add controls.
- *
- * @param spacing Amount of horizontal space between each child.
- * @param controls Controls to add.
- * @return New {@code VBox} instance.
- */
- public static VBox vBox(int spacing, Node... controls) {
- VBox vb = vBox(spacing);
-
- vb.getChildren().addAll(controls);
-
- return vb;
- }
-
- /**
- * Create stack pane.
- *
- * @param controls Controls to add.
- * @return New {@code StackPane} instance.
- */
- public static StackPane stackPane(Node... controls) {
- StackPane sp = new StackPane();
-
- sp.getChildren().addAll(controls);
-
- return sp;
- }
-
- /**
- * Create border pane.
- *
- * @param top Optional top control.
- * @param center Optional center control.
- * @param bottom Optional bottom control.
- * @param left Optional left control.
- * @param right Optional right control.
- * @return New {@code BorderPane} instance.
- */
- public static BorderPane borderPane(Node top, Node center, Node bottom, Node left, Node right) {
- BorderPane bp = new BorderPane();
-
- bp.setTop(top);
- bp.setCenter(center);
- bp.setBottom(bottom);
- bp.setLeft(left);
- bp.setRight(right);
-
- return bp;
- }
-
- /**
- * Sets control tooltip if needed.
- *
- * @param ctrl Target control.
- * @param tip Tooltip text.
- * @return Control itself for method chaining.
- */
- public static <T extends Control> T tooltip(T ctrl, String tip) {
- if (!tip.isEmpty())
- ctrl.setTooltip(new Tooltip(tip));
-
- return ctrl;
- }
-
- /**
- * Create label.
- *
- * @param text Label text.
- * @return New {@code Label} instance.
- */
- public static Label label(String text) {
- return new Label(text);
- }
-
- /**
- * Create button with text only.
- *
- * @param text Button text.
- * @param tip Tooltip text.
- * @param onAct Button action.
- * @return New {@code Button} instance.
- */
- public static Button button(String text, String tip, EventHandler<ActionEvent> onAct) {
- Button btn = new Button(text);
-
- btn.setOnAction(onAct);
-
- tooltip(btn, tip);
-
- return btn;
- }
-
- /**
- * Create button with icon only.
- *
- * @param icon Button icon.
- * @param tip Tooltip text.
- * @param onAct Button action.
- * @return New {@code Button} instance.
- */
- public static Button button(ImageView icon, String tip, EventHandler<ActionEvent> onAct) {
- Button btn = new Button();
-
- btn.setGraphic(icon);
- btn.setOnAction(onAct);
-
- tooltip(btn, tip);
-
- return btn;
- }
-
- /**
- * Create pane with buttons.
- *
- * @param alignment Alignment of buttons.
- * @param dfltPadding If {@code true} than set default padding for pane.
- * @param btns Buttons that will be added to pane.
- * @return New {@code HBox} instance with buttons.
- */
- public static Pane buttonsPane(Pos alignment, boolean dfltPadding, Button... btns) {
- HBox hb = hBox(10, dfltPadding, btns);
-
- hb.setAlignment(alignment);
-
- return hb;
- }
-
- /**
- * Create checkbox.
- *
- * @param text Checkbox text.
- * @param tip Tooltip tex.
- * @param sel Checkbox selected state.
- * @return New {@code Checkbox} instance.
- */
- public static CheckBox checkBox(String text, String tip, boolean sel) {
- CheckBox ch = new CheckBox(text);
-
- ch.setSelected(sel);
-
- tooltip(ch, tip);
-
- return ch;
- }
-
- /**
- * Create text field.
- *
- * @param tip Tooltip text.
- * @return New {@code TextField} instance.
- */
- public static TextField textField(String tip) {
- TextField tf = new TextField();
-
- tooltip(tf, tip);
-
- return tf;
- }
-
- /**
- * Create static text.
- *
- * @param text Text to show.
- * @param wrap Text wrapping width.
- * @return New {@code Text} instance.
- */
- public static Text text(String text, int wrap) {
- Text t = new Text(text);
-
- t.setFont(new Font(14));
-
- if (wrap > 0)
- t.setWrappingWidth(wrap);
-
- return t;
- }
-
- /**
- * Create password field.
- *
- * @param tip Tooltip text.
- * @return New {@code PasswordField} instance.
- */
- public static PasswordField passwordField(String tip) {
- PasswordField pf = new PasswordField();
-
- tooltip(pf, tip);
-
- return pf;
- }
-
- /**
- * Create combo box.
- *
- * @param tip Tooltip text.
- * @param items Combo box items.
- * @return New {@code ComboBox} instance.
- */
- public static <T> ComboBox<T> comboBox(String tip, T... items) {
- ComboBox<T> cb = new ComboBox<>(FXCollections.observableArrayList(items));
-
- cb.setMaxWidth(Double.MAX_VALUE);
- cb.getSelectionModel().select(0);
-
- tooltip(cb, tip);
-
- return cb;
- }
-
- /**
- * Create split pane for provided nodes.
- *
- * @param node1 First node.
- * @param node2 Second node.
- * @param pos Initial divider position.
- * @return New {@code SplitPane} instance.
- */
- public static SplitPane splitPane(Node node1, Node node2, double pos) {
- SplitPane sp = new SplitPane();
-
- sp.setOrientation(Orientation.VERTICAL);
- sp.getItems().addAll(node1, node2);
- sp.setDividerPosition(0, pos);
-
- return sp;
- }
-
- /**
- * Create titled pane.
- *
- * @param title Title.
- * @param node Node.
- * @param collapsible Collapsible flag.
- * @return New {@code TitledPane} instance.
- */
- public static TitledPane titledPane(String title, Node node, boolean collapsible) {
- TitledPane tp = new TitledPane(title, node);
-
- tp.setCollapsible(collapsible);
- tp.setExpanded(false);
-
- return tp;
- }
-
- /**
- * Create list view.
- *
- * @param tip Tooltip text.
- * @param cb Callback function for list view cell data binding.
- * @param <T> Type of showed by viewer element.
- * @return New {@code ListView} instance.
- */
- public static <T> ListView<T> list(String tip, Callback<T, ObservableValue<Boolean>> cb) {
- ListView lst = new ListView<>();
-
- lst.setCellFactory(CheckBoxListCell.forListView(cb));
-
- lst.setMinHeight(70);
- lst.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
-
- tooltip(lst, tip);
-
- return lst;
- }
-
- /**
- * Create table column.
- *
- * @param colName Column name to display.
- * @param propName Property name column is bound to.
- * @param tip Column tooltip text.
- * @param minWidth The minimum width column is permitted to be resized to.
- * @param maxWidth The maximum width column is permitted to be resized to.
- * @param editable {@code true} if column is editable.
- * @return New {@code TableColumn} instance.
- */
- private static <S, T> TableColumn<S, T> tableColumn(String colName, String propName, String tip,
- int minWidth, int maxWidth, boolean editable) {
- TableColumn<S, T> col = new TableColumn<>();
-
- col.setGraphic(tooltip(new Label(colName), tip));
-
- col.setSortable(false);
-
- if (minWidth > 0)
- col.setMinWidth(minWidth);
-
- if (maxWidth > 0)
- col.setMaxWidth(maxWidth);
-
- col.setCellValueFactory(new PropertyValueFactory<S, T>(propName));
-
- col.setEditable(editable);
-
- return col;
- }
-
- /**
- * Create table column.
- *
- * @param colName Column name to display.
- * @param propName Property name column is bound to.
- * @param tip Column tooltip text.
- * @return New {@code TableColumn} instance.
- */
- public static <S, T> TableColumn<S, T> tableColumn(String colName, String propName, String tip) {
- return tableColumn(colName, propName, tip, 100, 0, false);
- }
-
- /**
- * Create table column.
- *
- * @param colName Column name to display.
- * @param propName Property name column is bound to.
- * @param tip Column tooltip text.
- * @param cellFactory Custom cell factory.
- * @return New {@code TableColumn} instance.
- */
- public static <S, T> TableColumn<S, T> customColumn(String colName, String propName, String tip,
- Callback<TableColumn<S, T>, TableCell<S, T>> cellFactory) {
- TableColumn<S, T> col = tableColumn(colName, propName, tip, 100, 0, true);
-
- col.setCellFactory(cellFactory);
-
- return col;
- }
-
- /**
- * Create editable boolean table column.
- *
- * @param colName Column name to display.
- * @param propName Property name column is bound to.
- * @param tip Column tooltip text.
- * @return New {@code TableColumn} instance.
- */
- public static <S> TableColumn<S, Boolean> booleanColumn(String colName, String propName, String tip) {
- TableColumn<S, Boolean> col = tableColumn(colName, propName, tip, 50, 50, true);
-
- col.setCellFactory(CheckBoxTableCellEx.<S>cellFactory());
-
- return col;
-
- }
-
- /**
- * Create editable text table column.
- *
- * @param colName Column name to display.
- * @param propName Property name column is bound to.
- * @param tip Column tooltip text.
- * @return New {@code TableColumn} instance.
- */
- public static <S> TableColumn<S, String> textColumn(String colName, String propName, String tip,
- TextColumnValidator<S> validator) {
- TableColumn<S, String> col = tableColumn(colName, propName, tip, 100, 0, true);
-
- col.setCellFactory(TextFieldTableCellEx.cellFactory(validator));
-
- return col;
- }
-
- /**
- * Create table view.
- *
- * @param placeholder Text to show if table model is empty.
- * @param cols Columns to add.
- * @return New {@code TableView} instance.
- */
- public static <S> TableView<S> tableView(String placeholder, TableColumn<S, ?>... cols) {
- TableView<S> tbl = new TableView<>();
-
- tbl.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
- tbl.setEditable(true);
- tbl.setMinHeight(70);
- tbl.setPlaceholder(text(placeholder, 0));
-
- tbl.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
-
- tbl.getColumns().addAll(cols);
-
- return tbl;
- }
-
- /**
- * Create progress indicator.
- *
- * @param sz Indicator diameter.
- * @return New {@code ProgressIndicator} instance.
- */
- public static ProgressIndicator progressIndicator(int sz) {
- ProgressIndicator pi = new ProgressIndicator();
-
- pi.setMaxWidth(sz);
- pi.setMaxHeight(sz);
-
- return pi;
- }
-
- /**
- * Create image view.
- *
- * @param imgFileName Image filename.
- * @return New {@code ImageView} instance.
- */
- public static ImageView imageView(String imgFileName, int sz) {
- return new ImageView(image(imgFileName, sz));
- }
-
- /**
- * Gets image by its filename.
- *
- * @param imgFileName Image filename.
- * @return Loaded image.
- */
- public static Image image(String imgFileName, int sz) {
- return new Image(Controls.class.getClassLoader()
- .getResourceAsStream(String.format("media/%1$s_%2$dx%2$d.png", imgFileName, sz)));
- }
-
- /**
- * Customized checkbox.
- */
- private static class CheckBoxTableCellEx<S> extends CheckBoxTableCell<S, Boolean> {
- /** Creates a ComboBox cell factory for use in TableColumn controls. */
- public static <S> Callback<TableColumn<S, Boolean>, TableCell<S, Boolean>> cellFactory() {
- return new Callback<TableColumn<S, Boolean>, TableCell<S, Boolean>>() {
- @Override public TableCell<S, Boolean> call(TableColumn<S, Boolean> col) {
- return new CheckBoxTableCellEx<>();
- }
- };
- }
-
- /**
- * Default constructor.
- */
- private CheckBoxTableCellEx() {
- setAlignment(Pos.CENTER);
- }
- }
-
- /**
- * Special table text field cell that commit its content on focus lost.
- */
- private static class TextFieldTableCellEx<S> extends TextFieldTableCell<S, String> {
- /** */
- private final TextColumnValidator<S> validator;
- /** */
- private String curTxt = "";
-
- /** Row value. */
- private S rowVal;
-
- /** Create cell factory. */
- public static <S> Callback<TableColumn<S, String>, TableCell<S, String>>
- cellFactory(final TextColumnValidator<S> validator) {
- return new Callback<TableColumn<S, String>, TableCell<S, String>>() {
- @Override public TableCell<S, String> call(TableColumn<S, String> col) {
- return new TextFieldTableCellEx<>(validator);
- }
- };
- }
-
- /**
- * Text field cell constructor.
- *
- * @param validator Input text validator.
- */
- private TextFieldTableCellEx(TextColumnValidator<S> validator) {
- super(new DefaultStringConverter());
-
- this.validator = validator;
- }
-
- /** {@inheritDoc} */
- @Override public void startEdit() {
- String item = getItem();
-
- if (item == null || item.isEmpty())
- return;
-
- super.startEdit();
-
- rowVal = getTableView().getSelectionModel().getSelectedItem();
-
- Node g = getGraphic();
-
- if (g != null) {
- final TextField tf = (TextField)g;
-
- curTxt = tf.getText();
-
- tf.textProperty().addListener(new ChangeListener<String>() {
- @Override public void changed(ObservableValue<? extends String> val, String oldVal, String newVal) {
- curTxt = newVal;
- }
- });
-
- tf.setOnKeyPressed(new EventHandler<KeyEvent>() {
- @Override public void handle(KeyEvent evt) {
- if (KeyCode.ENTER == evt.getCode() || KeyCode.ESCAPE == evt.getCode())
- cancelEdit();
- }
- });
-
- tf.setOnKeyReleased(new EventHandler<KeyEvent>() {
- @Override public void handle(KeyEvent evt) {
- // No-op to overwrite JavaFX implementation.
- }
- });
-
- // Special hack for editable TextFieldTableCell.
- // Cancel edit when focus lost from text field, but do not cancel if focus lost to VirtualFlow.
- tf.focusedProperty().addListener(new ChangeListener<Boolean>() {
- @Override public void changed(ObservableValue<? extends Boolean> val, Boolean oldVal, Boolean newVal) {
- Node fo = getScene().getFocusOwner();
-
- if (!newVal) {
- if (fo instanceof VirtualFlow) {
- if (fo.getParent().getParent() != getTableView())
- cancelEdit();
- }
- else
- cancelEdit();
- }
- }
- });
-
- Platform.runLater(new Runnable() {
- @Override public void run() {
- tf.requestFocus();
- }
- });
- }
- }
-
- /** {@inheritDoc} */
- @Override public void cancelEdit() {
- boolean editing = isEditing();
-
- super.cancelEdit();
-
- if (editing && validator.valid(rowVal, curTxt))
- updateItem(curTxt, false);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6ee9c0f/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
deleted file mode 100644
index 292a7a0..0000000
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/GridPaneEx.java
+++ /dev/null
@@ -1,180 +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.schema.ui;
-
-import javafx.geometry.Pos;
-import javafx.scene.Node;
-import javafx.scene.control.Label;
-import javafx.scene.layout.ColumnConstraints;
-import javafx.scene.layout.GridPane;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.RowConstraints;
-
-/**
- * Utility extension of {@code GridPane}.
- */
-public class GridPaneEx extends GridPane {
- /** Current column. */
- private int col;
-
- /** Current row. */
- private int row;
-
- /**
- * Create pane.
- */
- public GridPaneEx() {
- setAlignment(Pos.TOP_LEFT);
- setHgap(5);
- setVgap(10);
- }
-
- /**
- * Add default column.
- */
- public void addColumn() {
- getColumnConstraints().add(new ColumnConstraints());
- }
-
- /**
- * Add column with constraints and horizontal grow priority for the column.
- *
- * @param min Column minimum size.
- * @param pref Column preferred size.
- * @param max Column max size.
- * @param hgrow Column horizontal grow priority.
- */
- public void addColumn(double min, double pref, double max, Priority hgrow) {
- ColumnConstraints cc = new ColumnConstraints(min, pref, max);
-
- cc.setHgrow(hgrow);
-
- getColumnConstraints().add(cc);
- }
-
- /**
- * Add default row.
- */
- public void addRow() {
- getRowConstraints().add(new RowConstraints());
- }
-
- /**
- * Add default rows.
- *
- * @param n Number of rows to add.
- */
- public void addRows(int n) {
- for (int i = 0; i < n; i++)
- addRow();
- }
-
- /**
- * Add row with constraints and vertical grow priority for the row.
- *
- * @param min Row minimum size.
- * @param pref Row preferred size.
- * @param max Row max size.
- * @param vgrow Row vertical grow priority.
- */
- public void addRow(double min, double pref, double max, Priority vgrow) {
- RowConstraints rc = new RowConstraints(min, pref, max);
-
- rc.setVgrow(vgrow);
-
- getRowConstraints().add(rc);
- }
-
- /**
- * Wrap to next row.
- */
- public void wrap() {
- col = 0;
-
- row++;
- }
-
- /**
- * Skip columns.
- *
- * @param span How many columns should be skipped.
- */
- public void skip(int span) {
- add(new Label(""), span);
- }
-
- /**
- * Move to next column.
- */
- private void nextCol(int span) {
- col += span;
-
- if (col >= getColumnConstraints().size())
- wrap();
- }
-
- /**
- * Add control to grid pane.
- *
- * @param ctrl Control to add.
- * @param span How many columns control should take.
- * @return Added control.
- */
- public <T extends Node> T add(T ctrl, int span) {
- add(ctrl, col, row, span, 1);
-
- nextCol(span);
-
- return ctrl;
- }
-
- /**
- * Add control to grid pane.
- *
- * @param ctrl Control to add.
- * @return Added control.
- */
- public <T extends Node> T add(T ctrl) {
- return add(ctrl, 1);
- }
-
- /**
- * Add control with label.
- *
- * @param text Label text.
- * @param ctrl Control to add.
- * @param span How many columns control should take.
- * @return Added control.
- */
- public <T extends Node> T addLabeled(String text, T ctrl, int span) {
- add(new Label(text));
-
- return add(ctrl, span);
- }
-
- /**
- * Add control with label.
- *
- * @param text Label text.
- * @param ctrl Control to add.
- * @return Added control.
- */
- public <T extends Node> T addLabeled(String text, T ctrl) {
- return addLabeled(text, ctrl, 1);
- }
-}
\ No newline at end of file
[02/22] ignite git commit: IGNITE-3522: Renamed "streamBufferSize"
property of FileSystemConfiguration to "bufferSize".
Posted by pt...@apache.org.
IGNITE-3522: Renamed "streamBufferSize" property of FileSystemConfiguration to "bufferSize".
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6d518d4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6d518d4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6d518d4
Branch: refs/heads/ignite-3477-master
Commit: a6d518d40b946c23918423e15fd332dc185783b6
Parents: 0ccb856
Author: devozerov <vo...@gridgain.com>
Authored: Thu Apr 6 14:07:46 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Thu Apr 6 14:07:46 2017 +0300
----------------------------------------------------------------------
.../ignite/configuration/FileSystemConfiguration.java | 6 +++---
.../apache/ignite/internal/processors/igfs/IgfsImpl.java | 10 +++++-----
.../internal/visor/node/VisorIgfsConfiguration.java | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6d518d4/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
index 75e9f7d..e1aaa711 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/FileSystemConfiguration.java
@@ -204,7 +204,7 @@ public class FileSystemConfiguration {
* Must preserve alphabetical order!
*/
blockSize = cfg.getBlockSize();
- bufSize = cfg.getStreamBufferSize();
+ bufSize = cfg.getBufferSize();
colocateMeta = cfg.isColocateMetadata();
dataCacheCfg = cfg.getDataCacheConfiguration();
dfltMode = cfg.getDefaultMode();
@@ -411,7 +411,7 @@ public class FileSystemConfiguration {
*
* @return Read/write buffers size (bytes).
*/
- public int getStreamBufferSize() {
+ public int getBufferSize() {
return bufSize;
}
@@ -421,7 +421,7 @@ public class FileSystemConfiguration {
* @param bufSize Read/write buffers size for stream operations (bytes) or {@code 0} to reset default value.
* @return {@code this} for chaining.
*/
- public FileSystemConfiguration setStreamBufferSize(int bufSize) {
+ public FileSystemConfiguration setBufferSize(int bufSize) {
A.ensure(bufSize >= 0, "bufSize >= 0");
this.bufSize = bufSize == 0 ? DFLT_BUF_SIZE : bufSize;
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6d518d4/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 6ffa202..a946c71 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -931,7 +931,7 @@ public final class IgfsImpl implements IgfsEx {
/** {@inheritDoc} */
@Override public IgfsInputStream open(IgfsPath path) {
- return open(path, cfg.getStreamBufferSize(), cfg.getSequentialReadsBeforePrefetch());
+ return open(path, cfg.getBufferSize(), cfg.getSequentialReadsBeforePrefetch());
}
/** {@inheritDoc} */
@@ -951,7 +951,7 @@ public final class IgfsImpl implements IgfsEx {
if (log.isDebugEnabled())
log.debug("Open file for reading [path=" + path + ", bufSize=" + bufSize + ']');
- int bufSize0 = bufSize == 0 ? cfg.getStreamBufferSize() : bufSize;
+ int bufSize0 = bufSize == 0 ? cfg.getBufferSize() : bufSize;
IgfsMode mode = resolveMode(path);
@@ -1034,7 +1034,7 @@ public final class IgfsImpl implements IgfsEx {
/** {@inheritDoc} */
@Override public IgfsOutputStream create(IgfsPath path, boolean overwrite) {
- return create0(path, cfg.getStreamBufferSize(), overwrite, null, 0, null, true);
+ return create0(path, cfg.getBufferSize(), overwrite, null, 0, null, true);
}
/** {@inheritDoc} */
@@ -1141,7 +1141,7 @@ public final class IgfsImpl implements IgfsEx {
/** {@inheritDoc} */
@Override public IgfsOutputStream append(IgfsPath path, boolean create) {
- return append(path, cfg.getStreamBufferSize(), create, null);
+ return append(path, cfg.getBufferSize(), create, null);
}
/** {@inheritDoc} */
@@ -1808,7 +1808,7 @@ public final class IgfsImpl implements IgfsEx {
* @return Real buffer size.
*/
private int bufferSize(int bufSize) {
- return bufSize == 0 ? cfg.getStreamBufferSize() : bufSize;
+ return bufSize == 0 ? cfg.getBufferSize() : bufSize;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6d518d4/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
index 7f8e3b0..723d2a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
@@ -134,7 +134,7 @@ public class VisorIgfsConfiguration implements Serializable, LessNamingBean {
cfg.dataCacheName = igfs.getDataCacheConfiguration().getName();
cfg.blockSize = igfs.getBlockSize();
cfg.prefetchBlocks = igfs.getPrefetchBlocks();
- cfg.streamBufSize = igfs.getStreamBufferSize();
+ cfg.streamBufSize = igfs.getBufferSize();
cfg.perNodeBatchSize = igfs.getPerNodeBatchSize();
cfg.perNodeParallelBatchCnt = igfs.getPerNodeParallelBatchCount();
[22/22] ignite git commit: Merge branch 'master' into
ignite-3477-master
Posted by pt...@apache.org.
Merge branch 'master' into ignite-3477-master
# Conflicts:
# modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
# modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
# modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
# modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
# modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
# modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2210635a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2210635a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2210635a
Branch: refs/heads/ignite-3477-master
Commit: 2210635aea0a39da7b3c9f699cbc268ef6eeece7
Parents: a68045f edfa353
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Apr 11 12:57:38 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Apr 11 12:57:38 2017 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 3 -
assembly/dependencies-fabric-lgpl.xml | 3 -
assembly/dependencies-fabric.xml | 3 -
assembly/dependencies-schema-import.xml | 57 -
assembly/release-base.xml | 2 -
assembly/release-fabric-base.xml | 9 -
assembly/release-schema-import.xml | 50 -
bin/ignite-schema-import.bat | 110 -
bin/ignite-schema-import.sh | 87 -
examples/README-LGPL.txt | 4 +-
examples/README.txt | 2 -
examples/pom-standalone-lgpl.xml | 1 -
examples/pom-standalone.xml | 1 -
examples/pom.xml | 1 -
examples/schema-import/README.txt | 38 -
examples/schema-import/bin/db-init.sql | 28 -
examples/schema-import/bin/h2-server.bat | 80 -
examples/schema-import/bin/h2-server.sh | 66 -
.../schema-import/bin/schema-import.properties | 28 -
examples/schema-import/pom-standalone.xml | 90 -
examples/schema-import/pom.xml | 101 -
.../org/apache/ignite/schema/CacheConfig.java | 36 -
.../java/org/apache/ignite/schema/Demo.java | 134 --
.../java/org/apache/ignite/schema/DemoNode.java | 38 -
.../ignite/schema/H2DataSourceFactory.java | 35 -
.../java/org/apache/ignite/schema/Person.java | 44 -
.../org/apache/ignite/schema/PersonKey.java | 37 -
.../JettyRestProcessorAbstractSelfTest.java | 3 +-
.../org/apache/ignite/IgniteFileSystem.java | 26 +-
.../configuration/FileSystemConfiguration.java | 6 +-
.../configuration/IgniteConfiguration.java | 4 +-
.../configuration/NearCacheConfiguration.java | 56 +-
.../ignite/internal/IgniteEventsImpl.java | 8 +-
.../org/apache/ignite/internal/IgnitionEx.java | 4 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 36 +-
.../eventstorage/GridEventStorageManager.java | 12 +-
.../processors/cache/GridCacheAtomicFuture.java | 2 +-
.../processors/cache/GridCacheMvccManager.java | 84 +-
.../cache/GridDeferredAckMessageSender.java | 11 +-
.../GridDhtAtomicAbstractUpdateFuture.java | 4 +-
.../GridNearAtomicAbstractUpdateFuture.java | 2 +-
.../GridNearAtomicSingleUpdateFuture.java | 21 +-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 23 +-
.../cache/transactions/IgniteTxManager.java | 2 +-
.../internal/processors/igfs/IgfsAsyncImpl.java | 8 +-
.../internal/processors/igfs/IgfsImpl.java | 20 +-
.../utils/PlatformConfigurationUtils.java | 28 +
.../org/apache/ignite/internal/util/F0.java | 196 +-
.../ignite/internal/util/lang/GridFunc.java | 620 +----
.../visor/igfs/VisorIgfsFormatTask.java | 2 +-
.../visor/node/VisorIgfsConfiguration.java | 2 +-
.../deployment/local/LocalDeploymentSpi.java | 5 +-
.../spi/eventstorage/NoopEventStorageSpi.java | 53 +
.../test/config/store/jdbc/ignite-jdbc-type.xml | 2 +-
.../cache/store/jdbc/model/Organization.java | 2 -
.../cache/store/jdbc/model/OrganizationKey.java | 2 -
.../ignite/cache/store/jdbc/model/Person.java | 2 -
.../store/jdbc/model/PersonComplexKey.java | 4 +-
.../cache/store/jdbc/model/PersonKey.java | 2 -
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 2 +-
.../igfs/IgfsFragmentizerAbstractSelfTest.java | 2 +-
.../ignite/igfs/IgfsFragmentizerSelfTest.java | 2 +-
.../GridEventStorageDefaultExceptionTest.java | 94 +
...faultIgfsSecondaryFileSystemTestAdapter.java | 2 +-
.../igfs/IgfsAbstractBaseSelfTest.java | 2 +-
.../processors/igfs/IgfsAbstractSelfTest.java | 4 +-
...sCachePerBlockLruEvictionPolicySelfTest.java | 2 +-
.../igfs/IgfsMetaManagerSelfTest.java | 2 +-
.../processors/igfs/IgfsMetricsSelfTest.java | 2 +-
.../internal/processors/igfs/IgfsMock.java | 4 +-
.../processors/igfs/IgfsProcessorSelfTest.java | 8 +-
.../processors/igfs/IgfsStreamsSelfTest.java | 2 +-
.../processors/igfs/IgfsTaskSelfTest.java | 2 +-
.../IgfsAbstractRecordResolverSelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 56 +-
.../testsuites/IgniteComputeGridTestSuite.java | 2 +
.../impl/HadoopTaskExecutionSelfTest.java | 2 +-
...opClientProtocolMultipleServersSelfTest.java | 2 +-
.../client/HadoopClientProtocolSelfTest.java | 2 +-
.../hadoop/impl/igfs/IgfsEventsTestSuite.java | 2 +-
modules/log4j2/pom.xml | 4 +-
.../ignite/logger/log4j2/Log4J2Logger.java | 23 +-
.../Apache.Ignite.Core.Tests/EventsTest.cs | 63 +-
.../IgniteConfigurationSerializerTest.cs | 13 +-
.../IgniteConfigurationTest.cs | 15 +-
.../Apache.Ignite.Core.csproj | 4 +
.../Events/IEventStorageSpi.cs | 33 +
.../Events/MemoryEventStorageSpi.cs | 100 +
.../Events/NoopEventStorageSpi.cs | 27 +
.../Apache.Ignite.Core/IgniteConfiguration.cs | 48 +-
.../IgniteConfigurationSection.xsd | 22 +
.../Plugin/IPluginConfiguration.cs | 4 +-
modules/schema-import-db/README.txt | 4 -
modules/schema-import-db/pom.xml | 55 -
.../apache/ignite/schema/parser/DbColumn.java | 88 -
.../ignite/schema/parser/DbMetadataReader.java | 147 --
.../apache/ignite/schema/parser/DbTable.java | 82 -
.../parser/dialect/DB2MetadataDialect.java | 33 -
.../parser/dialect/DatabaseMetadataDialect.java | 102 -
.../parser/dialect/JdbcMetadataDialect.java | 199 --
.../parser/dialect/MySQLMetadataDialect.java | 82 -
.../parser/dialect/OracleMetadataDialect.java | 360 ---
modules/schema-import/README.txt | 216 --
modules/schema-import/pom.xml | 119 -
.../main/java/media/data_connection_48x48.png | Bin 4443 -> 0 bytes
.../src/main/java/media/error_48x48.png | Bin 4349 -> 0 bytes
.../src/main/java/media/ignite_128x128.png | Bin 4917 -> 0 bytes
.../src/main/java/media/ignite_16x16.png | Bin 608 -> 0 bytes
.../src/main/java/media/ignite_24x24.png | Bin 930 -> 0 bytes
.../src/main/java/media/ignite_32x32.png | Bin 1203 -> 0 bytes
.../src/main/java/media/ignite_48x48.png | Bin 1868 -> 0 bytes
.../src/main/java/media/ignite_64x64.png | Bin 2453 -> 0 bytes
.../src/main/java/media/information_48x48.png | Bin 4102 -> 0 bytes
.../src/main/java/media/question_48x48.png | Bin 3857 -> 0 bytes
.../src/main/java/media/sign_warning_48x48.png | Bin 2988 -> 0 bytes
.../schema-import/src/main/java/media/style.css | 134 --
.../src/main/java/media/text_tree_48x48.png | Bin 2567 -> 0 bytes
.../ignite/schema/generator/CodeGenerator.java | 831 -------
.../ignite/schema/generator/GeneratorUtils.java | 70 -
.../ignite/schema/generator/XmlGenerator.java | 446 ----
.../ignite/schema/model/PojoDescriptor.java | 497 ----
.../apache/ignite/schema/model/PojoField.java | 461 ----
.../ignite/schema/model/SchemaDescriptor.java | 62 -
.../schema/parser/DatabaseMetadataParser.java | 115 -
.../ignite/schema/ui/ConfirmCallable.java | 83 -
.../org/apache/ignite/schema/ui/Controls.java | 697 ------
.../org/apache/ignite/schema/ui/GridPaneEx.java | 180 --
.../org/apache/ignite/schema/ui/MessageBox.java | 274 ---
.../apache/ignite/schema/ui/ModalDialog.java | 50 -
.../ignite/schema/ui/SchemaImportApp.java | 2115 ------------------
.../ignite/schema/ui/TextColumnValidator.java | 32 -
.../schema/test/AbstractSchemaImportTest.java | 181 --
.../test/generator/CodeGeneratorTest.java | 81 -
.../schema/test/generator/XmlGeneratorTest.java | 42 -
.../ignite/schema/test/model/CacheConfig.txt | 409 ----
.../apache/ignite/schema/test/model/Objects.txt | 531 -----
.../ignite/schema/test/model/ObjectsKey.txt | 96 -
.../ignite/schema/test/model/Primitives.txt | 535 -----
.../ignite/schema/test/model/PrimitivesKey.txt | 96 -
.../org/apache/ignite/schema/test/model/Tst.txt | 535 -----
.../apache/ignite/schema/test/model/TstKey.txt | 96 -
.../schema/test/model/ignite-type-metadata.xml | 666 ------
.../test/parser/DbMetadataParserTest.java | 134 --
.../testsuites/IgniteSchemaImportTestSuite.java | 42 -
.../ignite/internal/GridFactorySelfTest.java | 3 +
modules/web-console/web-agent/pom.xml | 12 -
.../ignite/console/agent/db/DbColumn.java | 88 +
.../console/agent/db/DbMetadataReader.java | 142 ++
.../apache/ignite/console/agent/db/DbTable.java | 82 +
.../agent/db/dialect/DB2MetadataDialect.java | 33 +
.../db/dialect/DatabaseMetadataDialect.java | 102 +
.../agent/db/dialect/JdbcMetadataDialect.java | 199 ++
.../agent/db/dialect/MySQLMetadataDialect.java | 82 +
.../agent/db/dialect/OracleMetadataDialect.java | 359 +++
.../agent/handlers/DatabaseListener.java | 20 +-
.../dml/IgniteSqlDeleteFilteredBenchmark.java | 5 +-
.../dml/IgniteSqlUpdateFilteredBenchmark.java | 5 +-
pom.xml | 121 -
158 files changed, 1879 insertions(+), 13246 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/configuration/NearCacheConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 46a9899,f1ef625..9c67b56
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@@ -79,6 -67,11 +79,9 @@@ import org.apache.ignite.spi.discovery.
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+ import org.apache.ignite.spi.eventstorage.EventStorageSpi;
+ import org.apache.ignite.spi.eventstorage.NoopEventStorageSpi;
+ import org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi;
-import org.apache.ignite.spi.swapspace.SwapSpaceSpi;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
import org.apache.ignite.transactions.TransactionConcurrency;
import org.apache.ignite.transactions.TransactionIsolation;
@@@ -598,6 -654,39 +601,18 @@@ public class PlatformConfigurationUtil
cfg.setTransactionConfiguration(tx);
}
- byte swapType = in.readByte();
-
- switch (swapType) {
- case SWAP_TYP_FILE: {
- FileSwapSpaceSpi swap = new FileSwapSpaceSpi();
-
- swap.setBaseDirectory(in.readString());
- swap.setMaximumSparsity(in.readFloat());
- swap.setMaxWriteQueueSize(in.readInt());
- swap.setReadStripesNumber(in.readInt());
- swap.setWriteBufferSize(in.readInt());
-
- cfg.setSwapSpaceSpi(swap);
-
- break;
- }
-
- default:
- assert swapType == SWAP_TYP_NONE;
- }
-
+ switch (in.readByte()) {
+ case 1:
+ cfg.setEventStorageSpi(new NoopEventStorageSpi());
+ break;
+
+ case 2:
+ cfg.setEventStorageSpi(new MemoryEventStorageSpi()
+ .setExpireCount(in.readLong())
+ .setExpireAgeMs(in.readLong()));
+ break;
+ }
+
readPluginConfiguration(cfg, in);
}
@@@ -1001,6 -1113,36 +1016,19 @@@
else
w.writeBoolean(false);
- SwapSpaceSpi swap = cfg.getSwapSpaceSpi();
-
- if (swap instanceof FileSwapSpaceSpi) {
- w.writeByte(SWAP_TYP_FILE);
-
- FileSwapSpaceSpi fileSwap = (FileSwapSpaceSpi)swap;
-
- w.writeString(fileSwap.getBaseDirectory());
- w.writeFloat(fileSwap.getMaximumSparsity());
- w.writeInt(fileSwap.getMaxWriteQueueSize());
- w.writeInt(fileSwap.getReadStripesNumber());
- w.writeInt(fileSwap.getWriteBufferSize());
- }
- else {
- w.writeByte(SWAP_TYP_NONE);
- }
-
+ EventStorageSpi eventStorageSpi = cfg.getEventStorageSpi();
+
+ if (eventStorageSpi == null) {
+ w.writeByte((byte) 0);
+ } else if (eventStorageSpi instanceof NoopEventStorageSpi) {
+ w.writeByte((byte) 1);
+ } else if (eventStorageSpi instanceof MemoryEventStorageSpi) {
+ w.writeByte((byte) 2);
+
+ w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireCount());
+ w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireAgeMs());
+ }
+
w.writeString(cfg.getIgniteHome());
w.writeLong(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit());
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCachePerBlockLruEvictionPolicySelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteComputeGridTestSuite.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 58fda7c,1d39e69..89e0d3d
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@@ -769,7 -794,20 +775,12 @@@ namespace Apache.Ignite.Core.Test
SpringConfigUrl = "test",
Logger = new IgniteNLogLogger(),
FailureDetectionTimeout = TimeSpan.FromMinutes(2),
- PluginConfigurations = new[] {new TestIgnitePluginConfiguration() }
- SwapSpaceSpi = new FileSwapSpaceSpi
- {
- MaximumSparsity = 0.1f,
- MaximumWriteQueueSize = 55,
- WriteBufferSize = 66,
- ReadStripesNumber = 77,
- BaseDirectory = "test"
- },
+ PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
+ EventStorageSpi = new MemoryEventStorageSpi
+ {
+ ExpirationTimeout = TimeSpan.FromMilliseconds(12345),
+ MaxEventCount = 257
+ }
};
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 8358f69,f9f8a61..f642976
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@@ -80,6 -82,8 +80,7 @@@ namespace Apache.Ignite.Core.Test
CheckDefaultValueAttributes(new LruEvictionPolicy());
CheckDefaultValueAttributes(new AtomicConfiguration());
CheckDefaultValueAttributes(new TransactionConfiguration());
- CheckDefaultValueAttributes(new FileSwapSpaceSpi());
+ CheckDefaultValueAttributes(new MemoryEventStorageSpi());
}
/// <summary>
@@@ -182,8 -194,18 +183,15 @@@
Assert.AreEqual("affKey", typ.AffinityKeyFieldName);
Assert.AreEqual(false, typ.KeepDeserialized);
- CollectionAssert.AreEqual(new[] {"fld1", "fld2"},
- ((BinaryFieldEqualityComparer)typ.EqualityComparer).FieldNames);
-
Assert.IsNotNull(resCfg.PluginConfigurations);
Assert.AreEqual(cfg.PluginConfigurations, resCfg.PluginConfigurations);
+
+ var eventCfg = cfg.EventStorageSpi as MemoryEventStorageSpi;
+ var resEventCfg = resCfg.EventStorageSpi as MemoryEventStorageSpi;
+ Assert.IsNotNull(eventCfg);
+ Assert.IsNotNull(resEventCfg);
+ Assert.AreEqual(eventCfg.ExpirationTimeout, resEventCfg.ExpirationTimeout);
+ Assert.AreEqual(eventCfg.MaxEventCount, resEventCfg.MaxEventCount);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 1a758ce,6553f1a..b52f968
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@@ -91,7 -91,12 +91,11 @@@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Binary\BinaryArrayEqualityComparer.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
+ <Compile Include="Events\IEventStorageSpi.cs" />
+ <Compile Include="Events\MemoryEventStorageSpi.cs" />
+ <Compile Include="Events\NoopEventStorageSpi.cs" />
+ <Compile Include="Impl\Binary\BinaryFieldEqualityComparer.cs" />
<Compile Include="Binary\BinaryReflectiveSerializer.cs" />
<Compile Include="Common\JavaException.cs" />
<Compile Include="DataStructures\Configuration\Package-Info.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index a3f5daf,20e2be8..c40fc6e
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@@ -319,7 -346,36 +320,33 @@@ namespace Apache.Ignite.Cor
else
writer.WriteBoolean(false);
- // Plugins
- // Swap space
- SwapSpaceSerializer.Write(writer, SwapSpaceSpi);
-
+ // Event storage
+ if (EventStorageSpi == null)
+ {
+ writer.WriteByte(0);
+ }
+ else if (EventStorageSpi is NoopEventStorageSpi)
+ {
+ writer.WriteByte(1);
+ }
+ else
+ {
+ var memEventStorage = EventStorageSpi as MemoryEventStorageSpi;
+
+ if (memEventStorage == null)
+ {
+ throw new IgniteException(string.Format(
+ "Unsupported IgniteConfiguration.EventStorageSpi: '{0}'. " +
+ "Supported implementations: '{1}', '{2}'.",
+ EventStorageSpi.GetType(), typeof(NoopEventStorageSpi), typeof(MemoryEventStorageSpi)));
+ }
+
+ writer.WriteByte(2);
+
+ memEventStorage.Write(writer);
+ }
+
+ // Plugins (should be last)
if (PluginConfigurations != null)
{
var pos = writer.Stream.Position;
@@@ -433,6 -508,20 +460,17 @@@
PessimisticTransactionLogLinger = TimeSpan.FromMilliseconds(r.ReadInt())
};
}
+
- // Swap
- SwapSpaceSpi = SwapSpaceSerializer.Read(r);
-
+ // Event storage
+ switch (r.ReadByte())
+ {
+ case 1: EventStorageSpi = new NoopEventStorageSpi();
+ break;
+
+ case 2:
+ EventStorageSpi = MemoryEventStorageSpi.Read(r);
+ break;
+ }
}
/// <summary>
@@@ -867,5 -961,13 +905,13 @@@
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public ICollection<IPluginConfiguration> PluginConfigurations { get; set; }
+
+ /// <summary>
+ /// Gets or sets the event storage interface.
+ /// <para />
- /// Only predefined implementations are supported:
++ /// Only predefined implementations are supported:
+ /// <see cref="NoopEventStorageSpi"/>, <see cref="MemoryEventStorageSpi"/>.
+ /// </summary>
+ public IEventStorageSpi EventStorageSpi { get; set; }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index f041a8f,3691aa0..569925f
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@@ -1139,6 -1171,65 +1139,28 @@@
</xs:attribute>
</xs:complexType>
</xs:element>
- <xs:element name="swapSpaceSpi" minOccurs="0">
- <xs:annotation>
- <xs:documentation>Swap space SPI.</xs:documentation>
- </xs:annotation>
- <xs:complexType>
- <xs:attribute name="type" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation>Assembly-qualified type name.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="baseDirectory" type="xs:string">
- <xs:annotation>
- <xs:documentation>Base directory.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="maximumSparsity" type="xs:decimal">
- <xs:annotation>
- <xs:documentation>Maximum sparsity. This property defines maximum acceptable wasted file space to whole file size ratio. When this ratio becomes higher than specified number compacting thread starts working.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="maximumWriteQueueSize" type="xs:int">
- <xs:annotation>
- <xs:documentation>Maximum size of the write queue in bytes. If there are more values are waiting to be written to disk then specified size, SPI will block on write operation.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="readStripesNumber" type="xs:int">
- <xs:annotation>
- <xs:documentation>Read stripes number. Defines number of file channels to be used concurrently. Defaults to Environment.ProcessorCount.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="writeBufferSize" type="xs:int">
- <xs:annotation>
- <xs:documentation>Size of the write buffer, in bytes. Write to disk occurs only when this buffer is full.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
- </xs:element>
+ <xs:element name="eventStorageSpi" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Event storage space SPI.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Assembly-qualified type name.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="expirationTimeout" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>Expiration timeout for stored events. Negative for unlimited.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxEventCount" type="xs:long">
+ <xs:annotation>
+ <xs:documentation>Maximum event count to store.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
<xs:element name="pluginConfigurations" minOccurs="0">
<xs:annotation>
<xs:documentation>Plugin configurations.</xs:documentation>
http://git-wip-us.apache.org/repos/asf/ignite/blob/2210635a/pom.xml
----------------------------------------------------------------------