You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/15 10:14:14 UTC
[1/7] ignite git commit: IGNITE-5082 Fixed UI for footer.
Repository: ignite
Updated Branches:
refs/heads/ignite-5075-cacheStart 5a024a5f1 -> f5a5fa020
IGNITE-5082 Fixed UI for footer.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/600f2b7b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/600f2b7b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/600f2b7b
Branch: refs/heads/ignite-5075-cacheStart
Commit: 600f2b7b726703418e02e8ee953bb821b01f4b56
Parents: 63fda7f
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Fri May 12 17:45:57 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri May 12 17:45:57 2017 +0700
----------------------------------------------------------------------
.../components/web-console-footer/style.scss | 4 ++++
.../frontend/views/includes/footer.pug | 23 --------------------
2 files changed, 4 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/600f2b7b/modules/web-console/frontend/app/components/web-console-footer/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-footer/style.scss b/modules/web-console/frontend/app/components/web-console-footer/style.scss
index 0b2fa8b..962b4f3 100644
--- a/modules/web-console/frontend/app/components/web-console-footer/style.scss
+++ b/modules/web-console/frontend/app/components/web-console-footer/style.scss
@@ -27,6 +27,10 @@ web-console-footer {
p {
margin-bottom: 0;
+
+ &:first-of-type {
+ margin-bottom: 5px;
+ }
}
.wcf-content {
http://git-wip-us.apache.org/repos/asf/ignite/blob/600f2b7b/modules/web-console/frontend/views/includes/footer.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/includes/footer.pug b/modules/web-console/frontend/views/includes/footer.pug
deleted file mode 100644
index 4ef3bf6..0000000
--- a/modules/web-console/frontend/views/includes/footer.pug
+++ /dev/null
@@ -1,23 +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.
-
-.container.container-footer
- footer
- .col-md-offset-1.col-md-10
- ignite-footer
- .col-md-1
- .pull-right
- ignite-powered-by-apache
[2/7] ignite git commit: IGNITE-5082 Fixed RAT.
Posted by sb...@apache.org.
IGNITE-5082 Fixed RAT.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4b2b6843
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4b2b6843
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4b2b6843
Branch: refs/heads/ignite-5075-cacheStart
Commit: 4b2b68434bf4560cb71485b93f366126730d59a7
Parents: 600f2b7
Author: Andrey Novikov <an...@gridgain.com>
Authored: Fri May 12 17:46:14 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri May 12 17:46:14 2017 +0700
----------------------------------------------------------------------
parent/pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4b2b6843/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 3b57895..12ff70a 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -900,7 +900,8 @@
<exclude>**/backend/config/settings.json.sample</exclude>
<exclude>**/backend/node_modules/**</exclude>
<exclude>**/frontend/build/**</exclude>
- <exclude>**/frontend/public/images/icons/**</exclude>
+ <exclude>**/frontend/public/images/**/*.png</exclude>
+ <exclude>**/frontend/public/images/**/*.svg</exclude>
<exclude>**/frontend/ignite_modules/**</exclude>
<exclude>**/frontend/ignite_modules_temp/**</exclude>
<exclude>**/frontend/node_modules/**</exclude>
[4/7] ignite git commit: IGNITE-5165 Add classes for new design
buttons and links.
Posted by sb...@apache.org.
IGNITE-5165 Add classes for new design buttons and links.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f038f63a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f038f63a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f038f63a
Branch: refs/heads/ignite-5075-cacheStart
Commit: f038f63a8a67c23061014a5356cde93814d5b8d2
Parents: ed4a7a1
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Mon May 15 10:31:27 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon May 15 10:31:27 2017 +0700
----------------------------------------------------------------------
.../components/web-console-header/style.scss | 9 -
.../frontend/app/primitives/btn/index.scss | 235 +++++++++++++++++++
.../frontend/public/stylesheets/variables.scss | 4 +
.../frontend/views/includes/header-right.pug | 4 +-
4 files changed, 241 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f038f63a/modules/web-console/frontend/app/components/web-console-header/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-header/style.scss b/modules/web-console/frontend/app/components/web-console-header/style.scss
index 5e382c8..78ff5f1 100644
--- a/modules/web-console/frontend/app/components/web-console-header/style.scss
+++ b/modules/web-console/frontend/app/components/web-console-header/style.scss
@@ -107,15 +107,6 @@ web-console-header {
&:nth-last-child(2) {
margin-right: $nav-item-margin;
}
-
- .btn-demo {
- padding: 8px 10px;
- font-size: $font-size-base;
- line-height: 18px;
- border-radius: 4px;
-
- margin-right: 0;
- }
}
.wch-revert-identity {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f038f63a/modules/web-console/frontend/app/primitives/btn/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/btn/index.scss b/modules/web-console/frontend/app/primitives/btn/index.scss
index ec62df4..7905927 100644
--- a/modules/web-console/frontend/app/primitives/btn/index.scss
+++ b/modules/web-console/frontend/app/primitives/btn/index.scss
@@ -15,6 +15,9 @@
* limitations under the License.
*/
+@import "./../../../public/stylesheets/variables.scss";
+
+// TODO IGNITE-5165 Remove and replace with btn-ignite in templates.
.btn.btn--stroke {
min-width: 36px;
height: 36px;
@@ -54,4 +57,236 @@
outline: none;
}
+}
+
+@mixin active-focus-shadows(
+ $focus: (0 0 5px #095d9a, 0 0 5px #095d9a),
+ $active: (inset 0 1px 3px 0 rgba(0, 0, 0, 0.5))
+) {
+ &.focus, &:focus {
+ box-shadow: $focus;
+ }
+
+ &.active, &:active {
+ box-shadow: $active;
+ }
+
+ &:active, &.active {
+ &:focus, &.focus {
+ &:not([disabled]) {
+ box-shadow: $focus, $active;
+ }
+ }
+ }
+}
+
+.btn-ignite {
+ $content-padding: 12px;
+ $icon-margin: 8px;
+
+ min-height: 36px;
+ display: inline-flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0 $content-padding;
+
+ border: none;
+ border-radius: 4px;
+ text-align: center;
+ outline: none;
+ font-family: Roboto, sans-serif;
+ font-size: 14px;
+ line-height: 16px;
+ text-decoration: none;
+
+ .icon {
+ &, &-right, &-left {
+ height: 16px;
+ }
+
+ &-right {
+ margin-left: $icon-margin;
+ }
+
+ &-left {
+ margin-right: $icon-margin;
+ }
+ }
+
+ // Icon tweaks
+ .icon.fa-caret-down {
+ margin: 0 -3px;
+ }
+
+ .fa {
+ line-height: inherit !important;
+ font-size: 16px;
+ }
+}
+
+.btn-ignite--primary {
+ $accent-color: $ignite-brand-primary;
+ $text-color: white;
+
+ background-color: $accent-color;
+ color: white;
+
+ &:hover, &.hover,
+ &:active, &.active {
+ &:not([disabled]) {
+ color: white;
+ background-color: change-color($accent-color, $lightness: 41%);
+ }
+ }
+
+ @include active-focus-shadows();
+
+ &[disabled] {
+ color: transparentize($text-color, 0.5);
+ background-color: change-color($accent-color, $lightness: 77%);
+ }
+}
+
+.btn-ignite--primary-outline {
+ $accent-color: $ignite-brand-primary;
+ $hover-color: change-color($accent-color, $lightness: 36%);
+ $disabled-color: #c5c5c5;
+
+ border: 1px solid $accent-color;
+ background: white;
+ color: $accent-color;
+
+ &:hover, &.hover,
+ &:active, &.active {
+ &:not([disabled]) {
+ color: $hover-color;
+ border-color: $hover-color;
+ }
+ }
+
+ @include active-focus-shadows($active: inset 0 1px 3px 0 $hover-color);
+
+ &[disabled] {
+ color: $disabled-color;
+ border-color: $disabled-color;
+ }
+}
+
+.btn-ignite--success {
+ $accent-color: $ignite-brand-success;
+ $text-color: white;
+
+ background-color: $accent-color;
+ color: white;
+
+ &:hover, &.hover,
+ &:active, &.active {
+ &:not([disabled]) {
+ color: white;
+ background-color: change-color($accent-color, $lightness: 26%);
+ }
+ }
+
+ @include active-focus-shadows();
+
+ &[disabled] {
+ color: transparentize($text-color, 0.5);
+ background-color: change-color($accent-color, $saturation: 57%, $lightness: 68%);
+ }
+}
+
+.btn-ignite--link-success {
+ $accent-color: $ignite-brand-success;
+
+ background: transparent;
+ color: $accent-color;
+ text-decoration: underline;
+
+ &:hover, &.hover,
+ &:active, &.active {
+ &:not([disabled]) {
+ color: change-color($accent-color, $lightness: 26%);
+ }
+ }
+
+ @include active-focus-shadows($active: ());
+
+ &[disabled] {
+ color: change-color($accent-color, $saturation: 57%, $lightness: 68%);
+ }
+}
+
+.btn-ignite--secondary {
+ background-color: white;
+ color: #424242;
+ border: 1px solid #dedede;
+
+ &:hover, &.hover,
+ &:active, &.active {
+ &:not([disabled]) {
+ border-color: #c5c5c5;
+ background-color: #eeeeee;
+ }
+ }
+
+ @include active-focus-shadows();
+
+ &[disabled] {
+ opacity: 0.5;
+ }
+}
+
+.btn-ignite-group {
+ display: inline-flex;
+
+ .btn-ignite:not(:first-of-type):not(:last-of-type) {
+ border-radius: 0;
+ }
+
+ .btn-ignite:not(:last-of-type) {
+ border-right-width: 1px;
+ border-right-style: solid;
+ }
+
+ .btn-ignite:first-of-type:not(:only-child) {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ }
+
+ .btn-ignite:last-of-type:not(:only-child) {
+ border-top-left-radius: 0;
+ border-bottom-left-radius: 0;
+ }
+
+ .btn-ignite.btn-ignite--primary {
+ $line-color: $ignite-brand-primary;
+ border-right-color: change-color($line-color, $lightness: 41%);
+ }
+}
+
+@mixin ignite-link($color, $color-hover) {
+ color: $color;
+
+ &:hover, &.hover,
+ &:focus, &.focus {
+ color: $color-hover;
+ text-decoration: none;
+ }
+}
+
+.link-primary {
+ @include ignite-link(
+ $color: $ignite-brand-primary,
+ $color-hover: change-color($ignite-brand-primary, $lightness: 41%)
+ );
+}
+
+.link-success {
+ @include ignite-link(
+ $color: $ignite-brand-success,
+ $color-hover: change-color($ignite-brand-success, $lightness: 26%)
+ );
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f038f63a/modules/web-console/frontend/public/stylesheets/variables.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/variables.scss b/modules/web-console/frontend/public/stylesheets/variables.scss
index 9c77436..d75438f 100644
--- a/modules/web-console/frontend/public/stylesheets/variables.scss
+++ b/modules/web-console/frontend/public/stylesheets/variables.scss
@@ -28,3 +28,7 @@ $ignite-background-color: #fff;
$ignite-new-background-color: #f9f9f9;
$ignite-header-color: #555;
$ignite-invalid-color: $brand-primary;
+
+// Color palette
+$ignite-brand-primary: #ee2b27; // Red
+$ignite-brand-success: #0067b9; // Blue
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f038f63a/modules/web-console/frontend/views/includes/header-right.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/includes/header-right.pug b/modules/web-console/frontend/views/includes/header-right.pug
index e8aeb01..62227e9 100644
--- a/modules/web-console/frontend/views/includes/header-right.pug
+++ b/modules/web-console/frontend/views/includes/header-right.pug
@@ -15,11 +15,11 @@
limitations under the License.
.wch-demo-toggle(ng-controller='demoController')
- button.btn.btn-info.btn-demo(
+ button.btn-ignite.btn-ignite--success(
ng-if='IgniteDemoMode'
ng-click='closeDemo()'
) Close Demo
- button.btn.btn-info.btn-demo(
+ button.btn-ignite.btn-ignite--success(
ng-if='!IgniteDemoMode'
ng-click='startDemo()'
) Start Demo
[6/7] ignite git commit: Removed unused IgniteInternalCache methods.
Posted by sb...@apache.org.
Removed unused IgniteInternalCache methods.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/330d9ef2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/330d9ef2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/330d9ef2
Branch: refs/heads/ignite-5075-cacheStart
Commit: 330d9ef26946541ae95a7221c1a2f02daf167812
Parents: 865eed7
Author: sboikov <sb...@gridgain.com>
Authored: Mon May 15 13:10:57 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon May 15 13:10:57 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 71 +-------
.../cache/GridCacheConcurrentMap.java | 5 -
.../cache/GridCacheConcurrentMapImpl.java | 28 ----
.../processors/cache/GridCacheProxyImpl.java | 60 -------
.../processors/cache/GridNoStorageCacheMap.java | 5 -
.../processors/cache/IgniteInternalCache.java | 61 -------
.../dht/GridCachePartitionedConcurrentMap.java | 9 --
.../distributed/dht/GridDhtCacheAdapter.java | 162 -------------------
.../distributed/near/GridNearCacheAdapter.java | 17 --
.../GridCachePartitionedFullApiSelfTest.java | 18 ---
.../cache/eviction/EvictionAbstractTest.java | 13 +-
.../hadoop/jobtracker/HadoopJobTracker.java | 20 ++-
.../cache/hibernate/HibernateCacheProxy.java | 25 ---
13 files changed, 28 insertions(+), 466 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 694f4b0..0ad383b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -991,78 +991,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
return entrySet((CacheEntryPredicate[])null);
}
- /**
- * Gets entry set containing internal entries.
- *
- * @param filter Filter.
- * @return Entry set.
- */
- @Override public final Set<Cache.Entry<K, V>> entrySetx(final CacheEntryPredicate... filter) {
- boolean keepBinary = ctx.keepBinary();
-
- return new EntrySet(map.entrySet(filter), keepBinary);
- }
-
- /** {@inheritDoc} */
- @Override public Set<Cache.Entry<K, V>> entrySet(int part) {
- throw new UnsupportedOperationException();
- }
-
/** {@inheritDoc} */
@Override public final Set<K> keySet() {
return new KeySet(map.entrySet());
}
- /** {@inheritDoc} */
- @Override public final Set<K> keySetx() {
- return keySet();
- }
-
- /** {@inheritDoc} */
- @Override public final Set<K> primaryKeySet() {
- return new KeySet(map.entrySet(CU.cachePrimary(ctx.grid().affinity(ctx.name()), ctx.localNode())));
- }
-
- /** {@inheritDoc} */
- @Override public Iterable<V> values() {
- return values((CacheEntryPredicate[])null);
- }
-
- /**
- * Collection of values cached on this node. You cannot modify this collection.
- * <p>
- * Iterator over this collection will not fail if collection was
- * concurrently updated by another thread. This means that iterator may or
- * may not return latest values depending on whether they were added before
- * or after current iterator position.
- * <p>
- * NOTE: this operation is not distributed and returns only the values cached on this node.
- *
- * @param filter Filters.
- * @return Collection of cached values.
- */
- public final Iterable<V> values(final CacheEntryPredicate... filter) {
- return new Iterable<V>() {
- @Override public Iterator<V> iterator() {
- return new Iterator<V>() {
- private final Iterator<? extends GridCacheEntryEx> it = entries().iterator();
-
- @Override public boolean hasNext() {
- return it.hasNext();
- }
-
- @Override public V next() {
- return (V)it.next().wrap().getValue();
- }
-
- @Override public void remove() {
- throw new UnsupportedOperationException("remove");
- }
- };
- }
- };
- }
-
/**
*
* @param key Entry key.
@@ -4491,7 +4424,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
* @return Entry set.
*/
public Set<Cache.Entry<K, V>> entrySet(@Nullable CacheEntryPredicate... filter) {
- return entrySetx(filter);
+ boolean keepBinary = ctx.keepBinary();
+
+ return new EntrySet(map.entrySet(filter), keepBinary);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index 0fe5c9f..eb3f28e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -89,11 +89,6 @@ public interface GridCacheConcurrentMap {
public void decrementPublicSize(GridCacheEntryEx e);
/**
- * @return Random entry out of hash map.
- */
- public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter);
-
- /**
* @param filter Filter.
* @return Iterable of the mappings contained in this map, excluding entries in unvisitable state.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
index 2c262df..45b455c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
@@ -292,34 +292,6 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
}
/** {@inheritDoc} */
- @Override public Set<KeyCacheObject> keySet(final CacheEntryPredicate... filter) {
- final IgnitePredicate<KeyCacheObject> p = new IgnitePredicate<KeyCacheObject>() {
- @Override public boolean apply(KeyCacheObject key) {
- GridCacheMapEntry entry = map.get(key);
-
- return entry != null && entry.visitable(filter);
- }
- };
-
- return new AbstractSet<KeyCacheObject>() {
- @Override public Iterator<KeyCacheObject> iterator() {
- return F.iterator0(map.keySet(), true, p);
- }
-
- @Override public int size() {
- return F.size(iterator());
- }
-
- @Override public boolean contains(Object o) {
- if (!(o instanceof KeyCacheObject))
- return false;
-
- return map.keySet().contains(o) && p.apply((KeyCacheObject)o);
- }
- };
- }
-
- /** {@inheritDoc} */
@Override public Collection<GridCacheMapEntry> entries(final CacheEntryPredicate... filter) {
final IgnitePredicate<GridCacheMapEntry> p = new IgnitePredicate<GridCacheMapEntry>() {
@Override public boolean apply(GridCacheMapEntry entry) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 837c22a..d81b9f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -844,42 +844,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
}
/** {@inheritDoc} */
- @Override public Set<K> keySetx() {
- CacheOperationContext prev = gate.enter(opCtx);
-
- try {
- return delegate.keySetx();
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
- @Override public Set<K> primaryKeySet() {
- CacheOperationContext prev = gate.enter(opCtx);
-
- try {
- return delegate.primaryKeySet();
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
- @Override public Iterable<V> values() {
- CacheOperationContext prev = gate.enter(opCtx);
-
- try {
- return delegate.values();
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
@Override public Set<Cache.Entry<K, V>> entrySet() {
CacheOperationContext prev = gate.enter(opCtx);
@@ -892,30 +856,6 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
}
/** {@inheritDoc} */
- @Override public Set<Cache.Entry<K, V>> entrySet(int part) {
- CacheOperationContext prev = gate.enter(opCtx);
-
- try {
- return delegate.entrySet(part);
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
- @Override public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter) {
- CacheOperationContext prev = gate.enter(opCtx);
-
- try {
- return delegate.entrySetx(filter);
- }
- finally {
- gate.leave(prev);
- }
- }
-
- /** {@inheritDoc} */
@Override public Iterator<Cache.Entry<K, V>> scanIterator(boolean keepBinary,
@Nullable IgniteBiPredicate<Object, Object> p) throws IgniteCheckedException {
CacheOperationContext prev = gate.enter(opCtx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
index 14a8482..86a573b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridNoStorageCacheMap.java
@@ -81,11 +81,6 @@ public class GridNoStorageCacheMap implements GridCacheConcurrentMap {
}
/** {@inheritDoc} */
- @Override public Set<KeyCacheObject> keySet(CacheEntryPredicate... filter) {
- return Collections.emptySet();
- }
-
- /** {@inheritDoc} */
@Override public Iterable<GridCacheMapEntry> entries(CacheEntryPredicate... filter) {
return Collections.emptySet();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index cc7fd3a..2f4a40e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -46,7 +46,6 @@ import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiPredicate;
@@ -878,46 +877,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
public Set<K> keySet();
/**
- * @return Set of keys including internal keys.
- */
- public Set<K> keySetx();
-
- /**
- * Set of keys for which this node is primary.
- * This set is dynamic and may change with grid topology changes.
- * Note that this set will contain mappings for all keys, even if their values are
- * {@code null} because they were invalidated. You can remove elements from
- * this set, but you cannot add elements to this set. All removal operation will be
- * reflected on the cache itself.
- * <p>
- * Iterator over this set will not fail if set was concurrently updated
- * by another thread. This means that iterator may or may not return latest
- * keys depending on whether they were added before or after current
- * iterator position.
- * <p>
- * NOTE: this operation is not distributed and returns only the keys cached on this node.
- *
- * @return Primary key set for the current node.
- */
- public Set<K> primaryKeySet();
-
- /**
- * Collection of values cached on this node. You can remove
- * elements from this collection, but you cannot add elements to this collection.
- * All removal operation will be reflected on the cache itself.
- * <p>
- * Iterator over this collection will not fail if collection was
- * concurrently updated by another thread. This means that iterator may or
- * may not return latest values depending on whether they were added before
- * or after current iterator position.
- * <p>
- * NOTE: this operation is not distributed and returns only the values cached on this node.
- *
- * @return Collection of cached values.
- */
- public Iterable<V> values();
-
- /**
* Gets set of all entries cached on this node. You can remove
* elements from this set, but you cannot add elements to this set.
* All removal operation will be reflected on the cache itself.
@@ -929,26 +888,6 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
public Set<Cache.Entry<K, V>> entrySet();
/**
- * Gets set containing cache entries that belong to provided partition or {@code null}
- * if partition is not found locally.
- * <p>
- * NOTE: this operation is not distributed and returns only the entries cached on this node.
- *
- * @param part Partition.
- * @return Set containing partition's entries or {@code null} if partition is
- * not found locally.
- */
- @Nullable public Set<Cache.Entry<K, V>> entrySet(int part);
-
- /**
- * Gets entry set containing internal entries.
- *
- * @param filter Filter.
- * @return Entry set.
- */
- public Set<Cache.Entry<K, V>> entrySetx(CacheEntryPredicate... filter);
-
- /**
* Starts new transaction with the specified concurrency and isolation.
*
* @param concurrency Concurrency.
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
index f021b65..dcc2d8b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
@@ -139,15 +139,6 @@ public class GridCachePartitionedConcurrentMap implements GridCacheConcurrentMap
}
/** {@inheritDoc} */
- @Override public Set<KeyCacheObject> keySet(final CacheEntryPredicate... filter) {
- return new PartitionedSet<KeyCacheObject>() {
- @Override protected Set<KeyCacheObject> set(GridDhtLocalPartition part) {
- return part.keySet(filter);
- }
- };
- }
-
- /** {@inheritDoc} */
@Override public Iterable<GridCacheMapEntry> entries(final CacheEntryPredicate... filter) {
return new Iterable<GridCacheMapEntry>() {
@Override public Iterator<GridCacheMapEntry> iterator() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 121c734..02badc1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -1077,101 +1077,10 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
}
/** {@inheritDoc} */
- @Override public Set<Cache.Entry<K, V>> entrySet(int part) {
- return new PartitionEntrySet(part);
- }
-
- /** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtCacheAdapter.class, this, super.toString());
}
- /**
- *
- */
- private class PartitionEntrySet extends AbstractSet<Cache.Entry<K, V>> {
- /** */
- private int partId;
-
- /**
- * @param partId Partition id.
- */
- private PartitionEntrySet(int partId) {
- this.partId = partId;
- }
-
- /** {@inheritDoc} */
- @NotNull @Override public Iterator<Cache.Entry<K, V>> iterator() {
- final GridDhtLocalPartition part = ctx.topology().localPartition(partId,
- ctx.discovery().topologyVersionEx(), false);
-
- Iterator<GridCacheMapEntry> partIt = part == null ? null : part.entries().iterator();
-
- return new PartitionEntryIterator(partIt);
- }
-
- /** {@inheritDoc} */
- @Override public boolean remove(Object o) {
- if (!(o instanceof Cache.Entry))
- return false;
-
- Cache.Entry<K, V> entry = (Cache.Entry<K, V>)o;
-
- K key = entry.getKey();
- V val = entry.getValue();
-
- if (val == null)
- return false;
-
- try {
- // Cannot use remove(key, val) since we may be in DHT cache and should go through near.
- return GridDhtCacheAdapter.this.remove(key, val);
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public boolean removeAll(Collection<?> c) {
- boolean rmv = false;
-
- for (Object o : c)
- rmv |= remove(o);
-
- return rmv;
- }
-
- /** {@inheritDoc} */
- @Override public boolean contains(Object o) {
- if (!(o instanceof Cache.Entry))
- return false;
-
- Cache.Entry<K, V> entry = (Cache.Entry<K, V>)o;
-
- try {
- return partId == ctx.affinity().partition(entry.getKey()) &&
- F.eq(entry.getValue(), localPeek(entry.getKey(), CachePeekModes.ONHEAP_ONLY, null));
- }
- catch (IgniteCheckedException e) {
- throw new IgniteException(e);
- }
- }
-
- /** {@inheritDoc} */
- @Override public int size() {
- GridDhtLocalPartition part = ctx.topology().localPartition(partId,
- ctx.discovery().topologyVersionEx(), false);
-
- return part != null ? part.publicSize() : 0;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(PartitionEntrySet.class, this, "super", super.toString(), true);
- }
- }
-
/** {@inheritDoc} */
@Override public List<GridCacheClearAllRunnable<K, V>> splitClearLocally(boolean srv, boolean near,
boolean readers) {
@@ -1323,77 +1232,6 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
}
/**
- * Complex partition iterator for both partition and swap iteration.
- */
- private class PartitionEntryIterator extends GridIteratorAdapter<Cache.Entry<K, V>> {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Next entry. */
- private Cache.Entry<K, V> entry;
-
- /** Last seen entry to support remove. */
- private Cache.Entry<K, V> last;
-
- /** Partition iterator. */
- private final Iterator<GridCacheMapEntry> partIt;
-
- /**
- * @param partIt Partition iterator.
- */
- private PartitionEntryIterator(@Nullable Iterator<GridCacheMapEntry> partIt) {
- this.partIt = partIt;
-
- advance();
- }
-
- /** {@inheritDoc} */
- @Override public boolean hasNextX() {
- return entry != null;
- }
-
- /** {@inheritDoc} */
- @Override public Cache.Entry<K, V> nextX() throws IgniteCheckedException {
- if (!hasNext())
- throw new NoSuchElementException();
-
- last = entry;
-
- advance();
-
- return last;
- }
-
- /** {@inheritDoc} */
- @Override public void removeX() throws IgniteCheckedException {
- if (last == null)
- throw new IllegalStateException();
-
- ctx.grid().cache(ctx.name()).remove(last.getKey(), last.getValue());
- }
-
- /**
- *
- */
- private void advance() {
- if (partIt != null) {
- while (partIt.hasNext()) {
- GridCacheEntryEx next = partIt.next();
-
- if (next instanceof GridCacheMapEntry && (!((GridCacheMapEntry)next).visitable(CU.empty0())))
- continue;
-
- entry = next.wrapLazyValue(ctx.keepBinary());
-
- return;
- }
- }
-
- entry = null;
- }
- }
-
- /**
* Multi update future.
*/
@SuppressWarnings("TypeMayBeWeakened")
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 0b25f58..f8240f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -339,23 +339,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
}
/** {@inheritDoc} */
- @Override public Set<Cache.Entry<K, V>> entrySet(int part) {
- return dht().entrySet(part);
- }
-
- /**
- * @return Keys for near cache only.
- */
- public Set<K> nearKeySet() {
- return super.keySet();
- }
-
- /** {@inheritDoc} */
- @Override public Collection<V> values() {
- return new GridCacheValueCollection<>(ctx, entrySet(), ctx.vararg(F.<K, V>cacheHasPeekValue()));
- }
-
- /** {@inheritDoc} */
@Override public boolean evict(K key) {
// Use unary 'and' to make sure that both sides execute.
return super.evict(key) & dht().evict(key);
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
index c10e348..ca12f70 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
@@ -59,24 +59,6 @@ public class GridCachePartitionedFullApiSelfTest extends GridCacheAbstractFullAp
/**
* @throws Exception If failed.
*/
- public void testPartitionEntrySetToString() throws Exception {
- GridCacheAdapter<String, Integer> cache = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
-
- for (int i = 0; i < 100; i++) {
- String key = String.valueOf(i);
-
- cache.getAndPut(key, i);
- }
-
- Affinity aff = grid(0).affinity(cache.name());
-
- for (int i = 0 ; i < aff.partitions(); i++)
- String.valueOf(cache.entrySet(i));
- }
-
- /**
- * @throws Exception If failed.
- */
public void testUpdate() throws Exception {
if (gridCount() > 1) {
IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
index b5bfcea..7fb40a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
@@ -780,7 +780,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
if (plcMax > 0) {
for (int i = 0; i < gridCnt; i++) {
- int actual = colocated(i).map().keySet().size();
+ int actual = colocated(i).map().size();
assertTrue("Cache size is greater then policy size [expected=" + endSize + ", actual=" + actual + ']',
actual <= endSize + (plcMaxMemSize > 0 ? 1 : plcBatchSize));
@@ -973,15 +973,16 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
/**
* @param plc Policy.
+ * @return Policy proxy.
*/
public static EvictionPolicyProxy proxy(EvictionPolicy plc) {
return new EvictionPolicyProxy(plc);
}
/**
- * Get current size.
+ * @return Get current size.
*/
- public int getCurrentSize() {
+ int getCurrentSize() {
try {
return (Integer)plc.getClass().getDeclaredMethod("getCurrentSize").invoke(plc);
}
@@ -991,9 +992,9 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
}
/**
- * Current memory size.
+ * @return Current memory size.
*/
- public long getCurrentMemorySize() {
+ long getCurrentMemorySize() {
try {
return (Long)plc.getClass().getMethod("getCurrentMemorySize").invoke(plc);
}
@@ -1003,7 +1004,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
}
/**
- * Current queue.
+ * @return Current queue.
*/
public Collection<EvictableEntry> queue() {
try {
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
index 9284c02..39f909e 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/jobtracker/HadoopJobTracker.java
@@ -37,7 +37,9 @@ import javax.cache.expiry.ExpiryPolicy;
import javax.cache.expiry.ModifiedExpiryPolicy;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventType;
@@ -101,6 +103,9 @@ import static org.apache.ignite.internal.processors.hadoop.taskexecutor.HadoopTa
*/
public class HadoopJobTracker extends HadoopComponent {
/** */
+ private static final CachePeekMode[] OFFHEAP_PEEK_MODE = {CachePeekMode.OFFHEAP};
+
+ /** */
private final GridMutex mux = new GridMutex();
/** */
@@ -679,9 +684,20 @@ public class HadoopJobTracker extends HadoopComponent {
if (ctx.jobUpdateLeader()) {
boolean checkSetup = evt.eventNode().order() < ctx.localNodeOrder();
+ Iterable<IgniteCache.Entry<HadoopJobId, HadoopJobMetadata>> entries;
+
+ try {
+ entries = jobMetaCache().localEntries(OFFHEAP_PEEK_MODE);
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to get local entries", e);
+
+ return;
+ }
+
// Iteration over all local entries is correct since system cache is REPLICATED.
- for (Object metaObj : jobMetaCache().values()) {
- HadoopJobMetadata meta = (HadoopJobMetadata)metaObj;
+ for (IgniteCache.Entry<HadoopJobId, HadoopJobMetadata> entry : entries) {
+ HadoopJobMetadata meta = entry.getValue();
HadoopJobId jobId = meta.jobId();
http://git-wip-us.apache.org/repos/asf/ignite/blob/330d9ef2/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
index 3d439dd..aa1f83b 100644
--- a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -266,36 +266,11 @@ public class HibernateCacheProxy implements IgniteInternalCache<Object, Object>
}
/** {@inheritDoc} */
- @Override public Set keySetx() {
- return delegate.keySetx();
- }
-
- /** {@inheritDoc} */
- @Override public Set primaryKeySet() {
- return delegate.primaryKeySet();
- }
-
- /** {@inheritDoc} */
- @Override public Iterable values() {
- return delegate.values();
- }
-
- /** {@inheritDoc} */
@Override public Set<Cache.Entry<Object, Object>> entrySet() {
return delegate.entrySet();
}
/** {@inheritDoc} */
- @Nullable @Override public Set<Cache.Entry<Object,Object>> entrySet(int part) {
- return delegate.entrySet(part);
- }
-
- /** {@inheritDoc} */
- @Override public Set<Cache.Entry<Object, Object>> entrySetx(CacheEntryPredicate... filter) {
- return delegate.entrySetx(filter);
- }
-
- /** {@inheritDoc} */
@Override public Transaction txStart(
TransactionConcurrency concurrency,
TransactionIsolation isolation
[5/7] ignite git commit: IGNITE-5086 Changed design for modals.
Posted by sb...@apache.org.
IGNITE-5086 Changed design for modals.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/865eed71
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/865eed71
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/865eed71
Branch: refs/heads/ignite-5075-cacheStart
Commit: 865eed71e9a0d735911b9409105e8e273a25ecc3
Parents: f038f63
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon May 15 15:17:28 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon May 15 15:17:28 2017 +0700
----------------------------------------------------------------------
.../activities-user-dialog.tpl.pug | 33 ++--
.../frontend/app/primitives/index.js | 2 +
.../frontend/app/primitives/modal/index.scss | 179 +++++++++++++++++++
.../frontend/app/primitives/table/index.scss | 91 ++++++++++
.../frontend/public/stylesheets/style.scss | 99 ++--------
.../web-console/frontend/views/signin.tpl.pug | 2 +-
6 files changed, 306 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.tpl.pug b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.tpl.pug
index 074851c..cb49dd0 100644
--- a/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.tpl.pug
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/activities-user-dialog.tpl.pug
@@ -14,23 +14,28 @@
See the License for the specific language governing permissions and
limitations under the License.
-.modal(tabindex='-1' role='dialog')
+.modal.modal--ignite(tabindex='-1' role='dialog')
.modal-dialog
.modal-content
.modal-header
- h4.modal-title
+ h4.modal-title
i.fa.fa-info-circle
- | Activities: {{ ctrl.user.userName }}
+ | Activity details: {{ ctrl.user.userName }}
+ button.close(type='button' aria-label='Close' ng-click='$hide()')
.modal-body.modal-body-with-scroll(id='activities-user-dialog')
- table.table.table-striped.table-bordered.table-hover(scrollable-container='#activities-user-dialog' st-table='displayedRows' st-safe-src='ctrl.data')
- thead
- th.text-center(st-sort='action | translate') Description
- th.text-center(st-sort='action') Action
- th.text-center(st-sort='amount') Visited
- tbody
- tr(ng-repeat='row in displayedRows')
- td.text-left {{ row.action | translate }}
- td.text-left {{ row.action }}
- td.text-left {{ row.amount }}
+ .panel--ignite
+ table.table--ignite(scrollable-container='#activities-user-dialog' st-table='displayedRows' st-safe-src='ctrl.data')
+ thead
+ th(st-sort='action | translate') Description
+ th(st-sort='action') Action
+ th(st-sort='amount') Visited
+ tbody
+ tr(ng-repeat='row in displayedRows')
+ td
+ .text-overflow {{ row.action | translate }}
+ td
+ .text-overflow {{ row.action }}
+ td.text-right
+ .text-overflow {{ row.amount }}
.modal-footer
- button.btn.btn-primary(id='confirm-btn-confirm' ng-click='$hide()') Close
+ button.btn-ignite.btn-ignite--success(id='confirm-btn-confirm' ng-click='$hide()') Close
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/app/primitives/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/index.js b/modules/web-console/frontend/app/primitives/index.js
index e72f087..8382c19 100644
--- a/modules/web-console/frontend/app/primitives/index.js
+++ b/modules/web-console/frontend/app/primitives/index.js
@@ -19,8 +19,10 @@ import './badge/index.scss';
import './btn/index.scss';
import './datepicker/index.scss';
import './tabs/index.scss';
+import './table/index.scss';
import './panel/index.scss';
import './dropdown/index.scss';
+import './modal/index.scss';
import './ui-grid/index.scss';
import './ui-grid-header/index.scss';
import './ui-grid-settings/index.scss';
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/app/primitives/modal/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/modal/index.scss b/modules/web-console/frontend/app/primitives/modal/index.scss
new file mode 100644
index 0000000..dc0dfee
--- /dev/null
+++ b/modules/web-console/frontend/app/primitives/modal/index.scss
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ */
+
+@import '../../../public/stylesheets/variables';
+
+.modal {
+ display: block;
+ overflow: hidden;
+}
+
+.modal .close {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ float: none;
+}
+
+.modal-header {
+ border-top-left-radius: 6px;
+ border-top-right-radius: 6px;
+}
+
+// Close icon
+.modal-header .close {
+ margin-right: -2px;
+}
+
+// Modal icon
+.modal-header h4 > i.fa {
+ cursor: default;
+ float: left;
+ line-height: $modal-title-line-height;
+}
+
+.modal .modal-dialog {
+ width: 650px;
+}
+
+.modal .modal-content {
+ background-color: $gray-lighter;
+
+ .input-tip {
+ padding-top: 1px;
+ }
+}
+
+.modal .modal-content .modal-header {
+ background-color: $ignite-background-color;
+ text-align: center;
+ color: $ignite-header-color;
+ padding: 15px 25px 15px 15px;
+}
+
+.modal .modal-content .modal-header h4 {
+ font-size: 22px;
+}
+
+.modal .modal-content .modal-footer {
+ margin-top: 0;
+}
+
+.modal-footer {
+ label {
+ float: left;
+ margin: 0;
+ }
+
+ .btn:last-child {
+ margin-right: 0;
+ }
+
+ .checkbox {
+ margin: 0;
+ }
+}
+
+.modal-body {
+ margin-left: 20px;
+ margin-right: 20px;
+}
+
+.modal-body-with-scroll {
+ max-height: 420px;
+ overflow-y: overlay;
+ margin: 0;
+}
+
+.modal.center .modal-dialog {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ -webkit-transform: translateX(-50%) translateY(-50%);
+ transform: translateX(-50%) translateY(-50%);
+}
+
+.modal--ignite {
+ .close {
+ position: absolute;
+ top: 23px;
+ right: 20px;
+
+ display: block;
+ width: 16px;
+ height: 16px;
+
+ opacity: 1;
+ background-image: url('/images/icons/cross.svg');
+ background-repeat: no-repeat;
+ background-position: center;
+
+ &:hover, &:focus {
+ outline: none;
+ filter: hue-rotate(1deg) brightness(.49);
+ }
+ }
+
+ .modal-content {
+ border: none;
+ border-radius: 4px;
+ background-color: white;
+
+ box-shadow: 0 2px 4px 0 rgba(35, 36, 40, 0.5);
+
+ .modal-header {
+ display: flex;
+ align-items: center;
+
+ padding: 10px 20px;
+
+ text-align: left;
+
+ border-top-left-radius: 4px;
+ border-top-right-radius: 4px;
+ border-bottom: 1px solid $table-border-color;
+
+ h4 {
+ color: $text-color;
+ font-size: 16px;
+ font-family: Roboto;
+ font-weight: 400;
+ line-height: 36px;
+ margin-top: 1px;
+ margin-bottom: -1px;
+
+ i {
+ margin-right: 8px;
+
+ color: #424242;
+ font-size: 18px;
+ line-height: inherit;
+ }
+ }
+ }
+
+ .modal-body {
+ padding: 20px;
+ }
+
+ .modal-footer {
+ padding: 10px 20px;
+
+ border-top: 1px solid $table-border-color;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/app/primitives/table/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/table/index.scss b/modules/web-console/frontend/app/primitives/table/index.scss
new file mode 100644
index 0000000..451e50d
--- /dev/null
+++ b/modules/web-console/frontend/app/primitives/table/index.scss
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+
+@import '../../../public/stylesheets/variables';
+
+table.table--ignite {
+ width: 100%;
+
+ font-family: Roboto;
+ line-height: 46px;
+
+ th, td {
+ padding: 0 20px;
+
+ border: solid $table-border-color;
+ border-width: 0;
+
+ &:first-child {
+ border-left-width: 1px;
+ }
+
+ &:last-child {
+ border-right-width: 1px;
+ }
+ }
+
+ th {
+ border-right-width: 1px;
+ }
+
+ td {
+ border-bottom-width: 1px;
+ }
+
+ thead {
+ border: solid $table-border-color;
+ border-width: 1px 0;
+
+ th {
+ color: $gray-light;
+ font-weight: 400;
+ }
+ }
+
+ tbody {
+ tr {
+ &:nth-child(even) {
+ background-color: $body-bg;
+ }
+ }
+
+ td {
+ color: $text-color;
+
+ .text-overflow {
+ overflow: hidden;
+ max-width: 220px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ }
+ }
+
+ .st-sort-ascent:after,
+ .st-sort-descent:after {
+ margin-left: 5px;
+ font-family: "ui-grid";
+ }
+
+ .st-sort-ascent:after {
+ content: '\C359';
+ }
+
+ .st-sort-descent:after {
+ content: '\C358';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/public/stylesheets/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/style.scss b/modules/web-console/frontend/public/stylesheets/style.scss
index 7907e4c..7549549 100644
--- a/modules/web-console/frontend/public/stylesheets/style.scss
+++ b/modules/web-console/frontend/public/stylesheets/style.scss
@@ -37,16 +37,6 @@ hr {
outline: none;
}
-
-
-.modal.center .modal-dialog {
- position: fixed;
- top: 50%;
- left: 50%;
- -webkit-transform: translateX(-50%) translateY(-50%);
- transform: translateX(-50%) translateY(-50%);
-}
-
.border-left {
box-shadow: 1px 0 0 0 $gray-lighter inset;
}
@@ -300,63 +290,17 @@ h1, h2, h3, h4, h5, h6 {
}
/* Modal */
-.modal {
- display: block;
- overflow: hidden;
-}
-
-.modal .close {
- position: absolute;
- top: 10px;
- right: 10px;
- float: none;
-}
-
-.modal-header {
- border-top-left-radius: 6px;
- border-top-right-radius: 6px;
-}
-
-// Close icon
-.modal-header .close {
- margin-right: -2px;
-}
-
-// Modal icon
-.modal-header h4 > i.fa {
- cursor: default;
- float: left;
- line-height: $modal-title-line-height;
-}
-
-.modal .modal-dialog {
- width: 650px;
-}
-
-.modal .modal-content {
- background-color: $gray-lighter;
-
- .input-tip {
- padding-top: 1px;
- }
-}
-
-.modal .modal-content .modal-header {
- background-color: $ignite-background-color;
- text-align: center;
- color: $ignite-header-color;
- padding: 15px 25px 15px 15px;
-}
-
-.modal .modal-content .modal-header h4 {
- font-size: 22px;
-}
-
-.modal .modal-content .modal-footer {
+.login-header {
margin-top: 0;
+ margin-bottom: 20px;
+ font-size: 2em;
}
-.modal-footer {
+.login-footer {
+ padding: 15px 0;
+ text-align: right;
+ border-top: 1px solid #e5e5e5;
+
label {
float: left;
margin: 0;
@@ -369,38 +313,23 @@ h1, h2, h3, h4, h5, h6 {
.checkbox {
margin: 0;
}
-}
-
-.login-header {
- margin-top: 0;
- margin-bottom: 20px;
- font-size: 2em;
-}
-
-.login-footer {
- @extend .modal-footer;
-
- padding-left: 0;
- padding-right: 0;
.btn {
margin-right: 0;
}
}
-.modal-body {
- margin-left: 20px;
- margin-right: 20px;
+.greedy {
+ min-height: 100%;
+ height: #{"calc(100vh - 270px)"};
}
-.modal-body-with-scroll {
- max-height: 420px;
- overflow-y: auto;
- margin: 0;
+.signin-greedy {
+ height: #{"calc(100vh - 300px)"};
}
body > .wrapper,
-// Nested ui-view, like on password reset state
+ // Nested ui-view, like on password reset state
body > .wrapper > ui-view {
display: flex;
flex-direction: column;
http://git-wip-us.apache.org/repos/asf/ignite/blob/865eed71/modules/web-console/frontend/views/signin.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/signin.tpl.pug b/modules/web-console/frontend/views/signin.tpl.pug
index 6f8f6ad..a32733d 100644
--- a/modules/web-console/frontend/views/signin.tpl.pug
+++ b/modules/web-console/frontend/views/signin.tpl.pug
@@ -27,7 +27,7 @@ web-console-header
.signin-greedy
.col-xs-12.col-md-6
form(name='form' novalidate)
- .modal-body.row(style='padding: 0 0 10px 0; margin: 0')
+ .row(style='padding: 0 0 10px 0; margin: 0')
.settings-row(ng-if='action == "signup"')
h3.login-header Sign Up
.settings-row(ng-if='action == "signin"')
[3/7] ignite git commit: IGNITE-5207 .NET: Support non-Int32 enums
Posted by sb...@apache.org.
IGNITE-5207 .NET: Support non-Int32 enums
This closes #1933
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ed4a7a13
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ed4a7a13
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ed4a7a13
Branch: refs/heads/ignite-5075-cacheStart
Commit: ed4a7a131ee92143f7dec003c445142af207ee96
Parents: 4b2b684
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri May 12 13:56:25 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri May 12 13:56:25 2017 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Binary/BinarySelfTest.cs | 7 +-
.../Binary/EnumsTest.cs | 274 +++++++++++++++++++
.../Compute/ComputeApiTest.cs | 2 +-
.../Impl/Binary/BinaryObject.cs | 2 +-
.../Impl/Binary/BinaryReflectiveActions.cs | 6 +-
.../Impl/Binary/BinarySystemHandlers.cs | 271 +++++++++---------
.../Impl/Binary/BinaryUtils.cs | 30 --
.../Impl/Binary/BinaryWriter.cs | 48 +++-
9 files changed, 441 insertions(+), 200 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 7adbbbe..1c84a4d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -80,6 +80,7 @@
<Compile Include="Binary\Serializable\CallbacksTest.cs" />
<Compile Include="Binary\Serializable\DelegatesTest.cs" />
<Compile Include="Binary\Serializable\BasicSerializableObjectsTest.cs" />
+ <Compile Include="Binary\EnumsTest.cs" />
<Compile Include="Binary\Serializable\ObjectReferenceTests.cs" />
<Compile Include="Binary\Serializable\PrimitivesTest.cs" />
<Compile Include="Binary\Serializable\SqlDmlTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index bdc0d65..01f108e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -2436,12 +2436,7 @@ namespace Apache.Ignite.Core.Tests.Binary
}
}
- public enum TestEnum
- {
- Val1, Val2, Val3 = 10
- }
-
- public enum TestEnum2
+ public enum TestEnum : short
{
Val1, Val2, Val3 = 10
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
new file mode 100644
index 0000000..f896ef4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/EnumsTest.cs
@@ -0,0 +1,274 @@
+/*
+ * 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.Tests.Binary
+{
+ using System;
+ using System.Runtime.Serialization;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+ using Apache.Ignite.Core.Impl.Common;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests enums serialization.
+ /// </summary>
+ public class EnumsTest
+ {
+ /// <summary>
+ /// Tests direct enum value serialization.
+ /// </summary>
+ [Test]
+ public void TestDirectValue()
+ {
+ CheckValue(ByteEnum.Foo);
+ CheckValue(ByteEnum.Bar);
+
+ CheckValue(SByteEnum.Foo);
+ CheckValue(SByteEnum.Bar);
+
+ CheckValue(ShortEnum.Foo);
+ CheckValue(ShortEnum.Bar);
+
+ CheckValue(UShortEnum.Foo);
+ CheckValue(UShortEnum.Bar);
+
+ CheckValue(IntEnum.Foo);
+ CheckValue(IntEnum.Bar);
+
+ CheckValue(UIntEnum.Foo);
+ CheckValue(UIntEnum.Bar);
+
+ CheckValue(LongEnum.Foo, false);
+ CheckValue(LongEnum.Bar, false);
+
+ CheckValue(ULongEnum.Foo, false);
+ CheckValue(ULongEnum.Bar, false);
+ }
+
+ /// <summary>
+ /// Checks the enum value serialization.
+ /// </summary>
+ private static void CheckValue<T>(T val, bool isBinaryEnum = true)
+ {
+ var marsh = new Marshaller(null) {CompactFooter = false};
+ var bytes = marsh.Marshal(val);
+ var res = marsh.Unmarshal<T>(bytes);
+ var binRes = marsh.Unmarshal<IBinaryObject>(bytes, BinaryMode.ForceBinary);
+
+ Assert.AreEqual(val, res);
+ Assert.AreEqual(val, binRes.Deserialize<T>());
+
+ if (isBinaryEnum)
+ {
+ Assert.AreEqual(TypeCaster<int>.Cast(val), binRes.EnumValue);
+ }
+ else
+ {
+ Assert.AreEqual(val, binRes.GetField<T>("value__"));
+ }
+
+ // Check array.
+ var arr = new[] {val, val};
+ var arrRes = TestUtils.SerializeDeserialize(arr);
+
+ Assert.AreEqual(arr, arrRes);
+ }
+
+ /// <summary>
+ /// Tests enums as a field in binarizable object.
+ /// </summary>
+ [Test]
+ public void TestBinarizableField()
+ {
+ // Min values.
+ var val = new EnumsBinarizable();
+
+ var res = TestUtils.SerializeDeserialize(val);
+ Assert.AreEqual(val, res);
+
+ // Max values.
+ val = new EnumsBinarizable
+ {
+ Byte = ByteEnum.Bar,
+ Int = IntEnum.Bar,
+ Long = LongEnum.Bar,
+ SByte = SByteEnum.Bar,
+ Short = ShortEnum.Bar,
+ UInt = UIntEnum.Bar,
+ ULong = ULongEnum.Bar,
+ UShort = UShortEnum.Bar
+ };
+
+ res = TestUtils.SerializeDeserialize(val);
+ Assert.AreEqual(val, res);
+ }
+
+ /// <summary>
+ /// Tests enums as a field in ISerializable object.
+ /// </summary>
+ [Test]
+ public void TestSerializableField()
+ {
+ // Min values.
+ var val = new EnumsSerializable();
+
+ var res = TestUtils.SerializeDeserialize(val);
+ Assert.AreEqual(val, res);
+
+ // Max values.
+ val = new EnumsSerializable
+ {
+ Byte = ByteEnum.Bar,
+ Int = IntEnum.Bar,
+ Long = LongEnum.Bar,
+ SByte = SByteEnum.Bar,
+ Short = ShortEnum.Bar,
+ UInt = UIntEnum.Bar,
+ ULong = ULongEnum.Bar,
+ UShort = UShortEnum.Bar
+ };
+
+ res = TestUtils.SerializeDeserialize(val);
+ Assert.AreEqual(val, res);
+ }
+
+ private enum ByteEnum : byte
+ {
+ Foo = byte.MinValue,
+ Bar = byte.MaxValue
+ }
+
+ private enum SByteEnum : sbyte
+ {
+ Foo = sbyte.MinValue,
+ Bar = sbyte.MaxValue
+ }
+
+ private enum ShortEnum : short
+ {
+ Foo = short.MinValue,
+ Bar = short.MaxValue
+ }
+
+ private enum UShortEnum : ushort
+ {
+ Foo = ushort.MinValue,
+ Bar = ushort.MaxValue
+ }
+
+ private enum IntEnum
+ {
+ Foo = int.MinValue,
+ Bar = int.MaxValue
+ }
+
+ private enum UIntEnum : uint
+ {
+ Foo = uint.MinValue,
+ Bar = uint.MaxValue
+ }
+
+ private enum LongEnum : long
+ {
+ Foo = long.MinValue,
+ Bar = long.MaxValue
+ }
+
+ private enum ULongEnum : ulong
+ {
+ Foo = ulong.MinValue,
+ Bar = ulong.MaxValue
+ }
+
+ private class EnumsBinarizable
+ {
+ public ByteEnum Byte { get; set; }
+ public SByteEnum SByte { get; set; }
+ public ShortEnum Short { get; set; }
+ public UShortEnum UShort { get; set; }
+ public IntEnum Int { get; set; }
+ public UIntEnum UInt { get; set; }
+ public LongEnum Long { get; set; }
+ public ULongEnum ULong { get; set; }
+
+ private bool Equals(EnumsBinarizable other)
+ {
+ return Byte == other.Byte && SByte == other.SByte && Short == other.Short
+ && UShort == other.UShort && Int == other.Int && UInt == other.UInt
+ && Long == other.Long && ULong == other.ULong;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != GetType()) return false;
+ return Equals((EnumsBinarizable) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ var hashCode = (int) Byte;
+ hashCode = (hashCode * 397) ^ (int) SByte;
+ hashCode = (hashCode * 397) ^ (int) Short;
+ hashCode = (hashCode * 397) ^ (int) UShort;
+ hashCode = (hashCode * 397) ^ (int) Int;
+ hashCode = (hashCode * 397) ^ (int) UInt;
+ hashCode = (hashCode * 397) ^ Long.GetHashCode();
+ hashCode = (hashCode * 397) ^ ULong.GetHashCode();
+ return hashCode;
+ }
+ }
+ }
+
+ [Serializable]
+ private class EnumsSerializable : EnumsBinarizable, ISerializable
+ {
+ public EnumsSerializable()
+ {
+ // No-op.
+ }
+
+ protected EnumsSerializable(SerializationInfo info, StreamingContext context)
+ {
+ Byte = (ByteEnum) info.GetValue("byte", typeof(ByteEnum));
+ SByte = (SByteEnum) info.GetValue("sbyte", typeof(SByteEnum));
+ Short = (ShortEnum) info.GetValue("short", typeof(ShortEnum));
+ UShort = (UShortEnum) info.GetValue("ushort", typeof(UShortEnum));
+ Int = (IntEnum) info.GetValue("int", typeof(IntEnum));
+ UInt = (UIntEnum) info.GetValue("uint", typeof(UIntEnum));
+ Long = (LongEnum) info.GetValue("long", typeof(LongEnum));
+ ULong = (ULongEnum) info.GetValue("ulong", typeof(ULongEnum));
+ }
+
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("byte", Byte);
+ info.AddValue("sbyte", SByte);
+ info.AddValue("short", Short);
+ info.AddValue("ushort", UShort);
+ info.AddValue("int", Int);
+ info.AddValue("uint", UInt);
+ info.AddValue("long", Long);
+ info.AddValue("ulong", ULong);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index e403d93..b9b7a04 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -1532,7 +1532,7 @@ namespace Apache.Ignite.Core.Tests.Compute
}
}
- public enum PlatformComputeEnum
+ public enum PlatformComputeEnum : ushort
{
Foo,
Bar,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
index 690a0a4..480e0e6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryObject.cs
@@ -132,7 +132,7 @@ namespace Apache.Ignite.Core.Impl.Binary
get
{
throw new NotSupportedException("IBinaryObject.Value is only supported for enums. " +
- "Check IBinaryObject.IsEnum property before accessing Value.");
+ "Check IBinaryObject.GetBinaryType().IsEnum property before accessing Value.");
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
index 907b465..6aaf5f9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryReflectiveActions.cs
@@ -476,7 +476,7 @@ namespace Apache.Ignite.Core.Impl.Binary
: GetWriter<Guid?>(field, (f, w, o) => w.WriteGuid(f, o));
readAction = raw ? GetRawReader(field, r => r.ReadGuid()) : GetReader(field, (f, r) => r.ReadGuid(f));
}
- else if (type.IsEnum)
+ else if (type.IsEnum && !new[] {typeof(long), typeof(ulong)}.Contains(Enum.GetUnderlyingType(type)))
{
writeAction = raw
? GetRawWriter<object>(field, (w, o) => w.WriteEnum(o), true)
@@ -503,7 +503,7 @@ namespace Apache.Ignite.Core.Impl.Binary
? GetRawReader(field, r => r.ReadCollection())
: GetReader(field, (f, r) => r.ReadCollection(f));
}
- else if (type == typeof (DateTime) && IsQueryField(field) && !raw)
+ else if (type == typeof(DateTime) && IsQueryField(field) && !raw)
{
// Special case for DateTime and query fields.
// If a field is marked with [QuerySqlField], write it as TimeStamp so that queries work.
@@ -514,7 +514,7 @@ namespace Apache.Ignite.Core.Impl.Binary
writeAction = GetWriter<DateTime>(field, (f, w, o) => w.WriteTimestamp(f, o));
readAction = GetReader(field, (f, r) => r.ReadObject<DateTime>(f));
}
- else if (nullableType == typeof (DateTime) && IsQueryField(field) && !raw)
+ else if (nullableType == typeof(DateTime) && IsQueryField(field) && !raw)
{
writeAction = GetWriter<DateTime?>(field, (f, w, o) => w.WriteTimestamp(f, o));
readAction = GetReader(field, (f, r) => r.ReadTimestamp(f));
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
index a30b981..1dfc3b6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySystemHandlers.cs
@@ -31,8 +31,8 @@ namespace Apache.Ignite.Core.Impl.Binary
internal static class BinarySystemHandlers
{
/** Write handlers. */
- private static readonly CopyOnWriteConcurrentDictionary<Type, BinarySystemWriteHandler> WriteHandlers =
- new CopyOnWriteConcurrentDictionary<Type, BinarySystemWriteHandler>();
+ private static readonly CopyOnWriteConcurrentDictionary<Type, IBinarySystemWriteHandler> WriteHandlers =
+ new CopyOnWriteConcurrentDictionary<Type, IBinarySystemWriteHandler>();
/** Read handlers. */
private static readonly IBinarySystemReader[] ReadHandlers = new IBinarySystemReader[255];
@@ -160,15 +160,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
- public static BinarySystemWriteHandler GetWriteHandler(Type type)
+ public static IBinarySystemWriteHandler GetWriteHandler(Type type)
{
return WriteHandlers.GetOrAdd(type, t =>
{
- bool supportsHandles;
-
- var handler = FindWriteHandler(t, out supportsHandles);
-
- return handler == null ? null : new BinarySystemWriteHandler(handler, supportsHandles);
+ return FindWriteHandler(t);
});
}
@@ -176,37 +172,49 @@ namespace Apache.Ignite.Core.Impl.Binary
/// Find write handler for type.
/// </summary>
/// <param name="type">Type.</param>
- /// <param name="supportsHandles">Flag indicating whether returned delegate supports handles.</param>
/// <returns>
/// Write handler or NULL.
/// </returns>
- private static Action<BinaryWriter, object> FindWriteHandler(Type type, out bool supportsHandles)
+ private static IBinarySystemWriteHandler FindWriteHandler(Type type)
{
- supportsHandles = false;
-
// 1. Well-known types.
if (type == typeof(string))
- return WriteString;
+ return new BinarySystemWriteHandler<string>(WriteString, false);
if (type == typeof(decimal))
- return WriteDecimal;
+ return new BinarySystemWriteHandler<decimal>(WriteDecimal, false);
if (type == typeof(Guid))
- return WriteGuid;
+ return new BinarySystemWriteHandler<Guid>(WriteGuid, false);
if (type == typeof (BinaryObject))
- return WriteBinary;
+ return new BinarySystemWriteHandler<BinaryObject>(WriteBinary, false);
if (type == typeof (BinaryEnum))
- return WriteBinaryEnum;
+ return new BinarySystemWriteHandler<BinaryEnum>(WriteBinaryEnum, false);
if (type.IsEnum)
- return WriteEnum;
+ {
+ var underlyingType = Enum.GetUnderlyingType(type);
+
+ if (underlyingType == typeof(int))
+ return new BinarySystemWriteHandler<int>((w, i) => w.WriteEnum(i, type), false);
+ if (underlyingType == typeof(uint))
+ return new BinarySystemWriteHandler<uint>((w, i) => w.WriteEnum(unchecked((int) i), type), false);
+ if (underlyingType == typeof(byte))
+ return new BinarySystemWriteHandler<byte>((w, i) => w.WriteEnum(i, type), false);
+ if (underlyingType == typeof(sbyte))
+ return new BinarySystemWriteHandler<sbyte>((w, i) => w.WriteEnum(i, type), false);
+ if (underlyingType == typeof(short))
+ return new BinarySystemWriteHandler<short>((w, i) => w.WriteEnum(i, type), false);
+ if (underlyingType == typeof(ushort))
+ return new BinarySystemWriteHandler<ushort>((w, i) => w.WriteEnum(i, type), false);
+
+ return null; // Other enums, such as long and ulong, can't be expressed as int.
+ }
if (type == typeof(Ignite))
- return WriteIgnite;
+ return new BinarySystemWriteHandler<object>(WriteIgnite, false);
// All types below can be written as handles.
- supportsHandles = true;
-
if (type == typeof (ArrayList))
- return WriteArrayList;
+ return new BinarySystemWriteHandler<ICollection>(WriteArrayList, true);
if (type == typeof (Hashtable))
- return WriteHashtable;
+ return new BinarySystemWriteHandler<IDictionary>(WriteHashtable, true);
if (type.IsArray)
{
@@ -215,49 +223,66 @@ namespace Apache.Ignite.Core.Impl.Binary
// Primitives.
if (elemType == typeof (bool))
- return WriteBoolArray;
+ return new BinarySystemWriteHandler<bool[]>(WriteBoolArray, true);
if (elemType == typeof(byte))
- return WriteByteArray;
+ return new BinarySystemWriteHandler<byte[]>(WriteByteArray, true);
if (elemType == typeof(short))
- return WriteShortArray;
+ return new BinarySystemWriteHandler<short[]>(WriteShortArray, true);
if (elemType == typeof(char))
- return WriteCharArray;
+ return new BinarySystemWriteHandler<char[]>(WriteCharArray, true);
if (elemType == typeof(int))
- return WriteIntArray;
+ return new BinarySystemWriteHandler<int[]>(WriteIntArray, true);
if (elemType == typeof(long))
- return WriteLongArray;
+ return new BinarySystemWriteHandler<long[]>(WriteLongArray, true);
if (elemType == typeof(float))
- return WriteFloatArray;
+ return new BinarySystemWriteHandler<float[]>(WriteFloatArray, true);
if (elemType == typeof(double))
- return WriteDoubleArray;
+ return new BinarySystemWriteHandler<double[]>(WriteDoubleArray, true);
// Non-CLS primitives.
if (elemType == typeof(sbyte))
- return WriteSbyteArray;
+ return new BinarySystemWriteHandler<byte[]>(WriteByteArray, true);
if (elemType == typeof(ushort))
- return WriteUshortArray;
+ return new BinarySystemWriteHandler<short[]>(WriteShortArray, true);
if (elemType == typeof(uint))
- return WriteUintArray;
+ return new BinarySystemWriteHandler<int[]>(WriteIntArray, true);
if (elemType == typeof(ulong))
- return WriteUlongArray;
+ return new BinarySystemWriteHandler<long[]>(WriteLongArray, true);
// Special types.
if (elemType == typeof (decimal?))
- return WriteDecimalArray;
+ return new BinarySystemWriteHandler<decimal?[]>(WriteDecimalArray, true);
if (elemType == typeof(string))
- return WriteStringArray;
+ return new BinarySystemWriteHandler<string[]>(WriteStringArray, true);
if (elemType == typeof(Guid?))
- return WriteGuidArray;
+ return new BinarySystemWriteHandler<Guid?[]>(WriteGuidArray, true);
// Enums.
- if (elemType.IsEnum || elemType == typeof(BinaryEnum))
- return WriteEnumArray;
+ if (IsIntEnum(elemType) || elemType == typeof(BinaryEnum))
+ return new BinarySystemWriteHandler<object>(WriteEnumArray, true);
// Object array.
- return WriteArray;
+ return new BinarySystemWriteHandler<object>(WriteArray, true);
}
return null;
}
/// <summary>
+ /// Determines whether specified type is an enum which fits into Int32.
+ /// </summary>
+ private static bool IsIntEnum(Type type)
+ {
+ if (!type.IsEnum)
+ return false;
+
+ var underlyingType = Enum.GetUnderlyingType(type);
+
+ return underlyingType == typeof(int)
+ || underlyingType == typeof(short)
+ || underlyingType == typeof(ushort)
+ || underlyingType == typeof(byte)
+ || underlyingType == typeof(sbyte);
+ }
+
+ /// <summary>
/// Find write handler for type.
/// </summary>
/// <param name="type">Type.</param>
@@ -300,11 +325,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteDecimal(BinaryWriter ctx, object obj)
+ private static void WriteDecimal(BinaryWriter ctx, decimal obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeDecimal);
- BinaryUtils.WriteDecimal((decimal)obj, ctx.Stream);
+ BinaryUtils.WriteDecimal(obj, ctx.Stream);
}
/// <summary>
@@ -312,11 +337,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Object.</param>
- private static void WriteString(BinaryWriter ctx, object obj)
+ private static void WriteString(BinaryWriter ctx, string obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeString);
- BinaryUtils.WriteString((string)obj, ctx.Stream);
+ BinaryUtils.WriteString(obj, ctx.Stream);
}
/// <summary>
@@ -324,11 +349,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteGuid(BinaryWriter ctx, object obj)
+ private static void WriteGuid(BinaryWriter ctx, Guid obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeGuid);
- BinaryUtils.WriteGuid((Guid)obj, ctx.Stream);
+ BinaryUtils.WriteGuid(obj, ctx.Stream);
}
/// <summary>
@@ -336,11 +361,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteBoolArray(BinaryWriter ctx, object obj)
+ private static void WriteBoolArray(BinaryWriter ctx, bool[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayBool);
- BinaryUtils.WriteBooleanArray((bool[])obj, ctx.Stream);
+ BinaryUtils.WriteBooleanArray(obj, ctx.Stream);
}
/// <summary>
@@ -348,23 +373,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteByteArray(BinaryWriter ctx, object obj)
- {
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayByte);
-
- BinaryUtils.WriteByteArray((byte[])obj, ctx.Stream);
- }
-
- /// <summary>
- /// Write sbyte array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteSbyteArray(BinaryWriter ctx, object obj)
+ private static void WriteByteArray(BinaryWriter ctx, byte[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayByte);
- BinaryUtils.WriteByteArray((byte[]) obj, ctx.Stream);
+ BinaryUtils.WriteByteArray(obj, ctx.Stream);
}
/// <summary>
@@ -372,26 +385,14 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteShortArray(BinaryWriter ctx, object obj)
+ private static void WriteShortArray(BinaryWriter ctx, short[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayShort);
- BinaryUtils.WriteShortArray((short[])obj, ctx.Stream);
+ BinaryUtils.WriteShortArray(obj, ctx.Stream);
}
/// <summary>
- /// Write ushort array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteUshortArray(BinaryWriter ctx, object obj)
- {
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayShort);
-
- BinaryUtils.WriteShortArray((short[]) obj, ctx.Stream);
- }
-
- /// <summary>
/// Write char array.
/// </summary>
/// <param name="ctx">Context.</param>
@@ -408,23 +409,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteIntArray(BinaryWriter ctx, object obj)
+ private static void WriteIntArray(BinaryWriter ctx, int[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayInt);
- BinaryUtils.WriteIntArray((int[])obj, ctx.Stream);
- }
-
- /// <summary>
- /// Write uint array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteUintArray(BinaryWriter ctx, object obj)
- {
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayInt);
-
- BinaryUtils.WriteIntArray((int[]) obj, ctx.Stream);
+ BinaryUtils.WriteIntArray(obj, ctx.Stream);
}
/// <summary>
@@ -432,23 +421,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteLongArray(BinaryWriter ctx, object obj)
- {
- ctx.Stream.WriteByte(BinaryUtils.TypeArrayLong);
-
- BinaryUtils.WriteLongArray((long[])obj, ctx.Stream);
- }
-
- /// <summary>
- /// Write ulong array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteUlongArray(BinaryWriter ctx, object obj)
+ private static void WriteLongArray(BinaryWriter ctx, long[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayLong);
- BinaryUtils.WriteLongArray((long[]) obj, ctx.Stream);
+ BinaryUtils.WriteLongArray(obj, ctx.Stream);
}
/// <summary>
@@ -456,11 +433,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteFloatArray(BinaryWriter ctx, object obj)
+ private static void WriteFloatArray(BinaryWriter ctx, float[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayFloat);
- BinaryUtils.WriteFloatArray((float[])obj, ctx.Stream);
+ BinaryUtils.WriteFloatArray(obj, ctx.Stream);
}
/// <summary>
@@ -468,11 +445,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteDoubleArray(BinaryWriter ctx, object obj)
+ private static void WriteDoubleArray(BinaryWriter ctx, double[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayDouble);
- BinaryUtils.WriteDoubleArray((double[])obj, ctx.Stream);
+ BinaryUtils.WriteDoubleArray(obj, ctx.Stream);
}
/// <summary>
@@ -480,11 +457,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteDecimalArray(BinaryWriter ctx, object obj)
+ private static void WriteDecimalArray(BinaryWriter ctx, decimal?[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayDecimal);
- BinaryUtils.WriteDecimalArray((decimal?[])obj, ctx.Stream);
+ BinaryUtils.WriteDecimalArray(obj, ctx.Stream);
}
/// <summary>
@@ -492,11 +469,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteStringArray(BinaryWriter ctx, object obj)
+ private static void WriteStringArray(BinaryWriter ctx, string[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayString);
- BinaryUtils.WriteStringArray((string[])obj, ctx.Stream);
+ BinaryUtils.WriteStringArray(obj, ctx.Stream);
}
/// <summary>
@@ -504,11 +481,11 @@ namespace Apache.Ignite.Core.Impl.Binary
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteGuidArray(BinaryWriter ctx, object obj)
+ private static void WriteGuidArray(BinaryWriter ctx, Guid?[] obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeArrayGuid);
- BinaryUtils.WriteGuidArray((Guid?[])obj, ctx.Stream);
+ BinaryUtils.WriteGuidArray(obj, ctx.Stream);
}
/// <summary>
@@ -534,47 +511,39 @@ namespace Apache.Ignite.Core.Impl.Binary
/**
* <summary>Write ArrayList.</summary>
*/
- private static void WriteArrayList(BinaryWriter ctx, object obj)
+ private static void WriteArrayList(BinaryWriter ctx, ICollection obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeCollection);
- BinaryUtils.WriteCollection((ICollection)obj, ctx, BinaryUtils.CollectionArrayList);
+ BinaryUtils.WriteCollection(obj, ctx, BinaryUtils.CollectionArrayList);
}
/**
* <summary>Write Hashtable.</summary>
*/
- private static void WriteHashtable(BinaryWriter ctx, object obj)
+ private static void WriteHashtable(BinaryWriter ctx, IDictionary obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeDictionary);
- BinaryUtils.WriteDictionary((IDictionary)obj, ctx, BinaryUtils.MapHashMap);
+ BinaryUtils.WriteDictionary(obj, ctx, BinaryUtils.MapHashMap);
}
/**
* <summary>Write binary object.</summary>
*/
- private static void WriteBinary(BinaryWriter ctx, object obj)
+ private static void WriteBinary(BinaryWriter ctx, BinaryObject obj)
{
ctx.Stream.WriteByte(BinaryUtils.TypeBinary);
- BinaryUtils.WriteBinary(ctx.Stream, (BinaryObject)obj);
+ BinaryUtils.WriteBinary(ctx.Stream, obj);
}
/// <summary>
/// Write enum.
/// </summary>
- private static void WriteEnum(BinaryWriter ctx, object obj)
+ private static void WriteBinaryEnum(BinaryWriter ctx, BinaryEnum obj)
{
- ctx.WriteEnum(obj);
- }
-
- /// <summary>
- /// Write enum.
- /// </summary>
- private static void WriteBinaryEnum(BinaryWriter ctx, object obj)
- {
- var binEnum = (BinaryEnum) obj;
+ var binEnum = obj;
ctx.Stream.WriteByte(BinaryUtils.TypeEnum);
@@ -790,20 +759,38 @@ namespace Apache.Ignite.Core.Impl.Binary
/// <summary>
/// Write delegate + handles flag.
/// </summary>
- internal class BinarySystemWriteHandler
+ internal interface IBinarySystemWriteHandler
+ {
+ /// <summary>
+ /// Gets a value indicating whether this handler supports handles.
+ /// </summary>
+ bool SupportsHandles { get; }
+
+ /// <summary>
+ /// Writes object to a specified writer.
+ /// </summary>
+ /// <param name="writer">The writer.</param>
+ /// <param name="obj">The object.</param>
+ void Write<T>(BinaryWriter writer, T obj);
+ }
+
+ /// <summary>
+ /// Write delegate + handles flag.
+ /// </summary>
+ internal class BinarySystemWriteHandler<T1> : IBinarySystemWriteHandler
{
/** */
- private readonly Action<BinaryWriter, object> _writeAction;
+ private readonly Action<BinaryWriter, T1> _writeAction;
/** */
private readonly bool _supportsHandles;
/// <summary>
- /// Initializes a new instance of the <see cref="BinarySystemWriteHandler" /> class.
+ /// Initializes a new instance of the <see cref="BinarySystemWriteHandler{T1}" /> class.
/// </summary>
/// <param name="writeAction">The write action.</param>
/// <param name="supportsHandles">Handles flag.</param>
- public BinarySystemWriteHandler(Action<BinaryWriter, object> writeAction, bool supportsHandles)
+ public BinarySystemWriteHandler(Action<BinaryWriter, T1> writeAction, bool supportsHandles)
{
Debug.Assert(writeAction != null);
@@ -811,19 +798,13 @@ namespace Apache.Ignite.Core.Impl.Binary
_supportsHandles = supportsHandles;
}
- /// <summary>
- /// Writes object to a specified writer.
- /// </summary>
- /// <param name="writer">The writer.</param>
- /// <param name="obj">The object.</param>
- public void Write(BinaryWriter writer, object obj)
+ /** <inheritdoc /> */
+ public void Write<T>(BinaryWriter writer, T obj)
{
- _writeAction(writer, obj);
+ _writeAction(writer, TypeCaster<T1>.Cast(obj));
}
- /// <summary>
- /// Gets a value indicating whether this handler supports handles.
- /// </summary>
+ /** <inheritdoc /> */
public bool SupportsHandles
{
get { return _supportsHandles; }
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index dee0a80..5bc68fe 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -1440,36 +1440,6 @@ namespace Apache.Ignite.Core.Impl.Binary
}
/// <summary>
- /// Write enum.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="val">Value.</param>
- public static void WriteEnum<T>(BinaryWriter writer, T val)
- {
- writer.WriteInt(GetEnumTypeId(val.GetType(), writer.Marshaller));
- writer.WriteInt(TypeCaster<int>.Cast(val));
- }
-
- /// <summary>
- /// Gets the enum type identifier.
- /// </summary>
- /// <param name="enumType">The enum type.</param>
- /// <param name="marshaller">The marshaller.</param>
- /// <returns>Enum type id.</returns>
- private static int GetEnumTypeId(Type enumType, Marshaller marshaller)
- {
- if (Enum.GetUnderlyingType(enumType) == TypInt)
- {
- var desc = marshaller.GetDescriptor(enumType);
-
- return desc.TypeId;
- }
-
- throw new BinaryObjectException("Only Int32 underlying type is supported for enums: " +
- enumType.Name);
- }
-
- /// <summary>
/// Gets the enum value by type id and int representation.
/// </summary>
/// <typeparam name="T">Result type.</typeparam>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4a7a13/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index 12cc026..56774d4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -858,19 +858,47 @@ namespace Apache.Ignite.Core.Impl.Binary
WriteNullField();
else
{
- var desc = _marsh.GetDescriptor(val.GetType());
+ var type = val.GetType();
- var metaHnd = _marsh.GetBinaryTypeHandler(desc);
-
- _stream.WriteByte(BinaryUtils.TypeEnum);
+ if (!type.IsEnum)
+ {
+ throw new BinaryObjectException("Type is not an enum: " + type);
+ }
- BinaryUtils.WriteEnum(this, val);
+ var handler = BinarySystemHandlers.GetWriteHandler(type);
- SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
+ if (handler != null)
+ {
+ // All enums except long/ulong.
+ handler.Write(this, val);
+ }
+ else
+ {
+ throw new BinaryObjectException(string.Format("Enum '{0}' has unsupported underlying type '{1}'. " +
+ "Use WriteObject instead of WriteEnum.",
+ type, Enum.GetUnderlyingType(type)));
+ }
}
}
/// <summary>
+ /// Write enum value.
+ /// </summary>
+ /// <param name="val">Enum value.</param>
+ /// <param name="type">Enum type.</param>
+ internal void WriteEnum(int val, Type type)
+ {
+ var desc = _marsh.GetDescriptor(type);
+
+ _stream.WriteByte(BinaryUtils.TypeEnum);
+ _stream.WriteInt(desc.TypeId);
+ _stream.WriteInt(val);
+
+ var metaHnd = _marsh.GetBinaryTypeHandler(desc);
+ SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
+ }
+
+ /// <summary>
/// Write named enum array.
/// </summary>
/// <typeparam name="T"></typeparam>
@@ -1120,14 +1148,6 @@ namespace Apache.Ignite.Core.Impl.Binary
return;
}
- // Handle enums.
- if (type.IsEnum)
- {
- WriteEnum(obj);
-
- return;
- }
-
// Handle special case for builder.
if (WriteBuilderSpecials(obj))
return;
[7/7] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5075-cacheStart
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5075-cacheStart
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f5a5fa02
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f5a5fa02
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f5a5fa02
Branch: refs/heads/ignite-5075-cacheStart
Commit: f5a5fa020e424a6b5cd7a16d2f6c5cfc05809b44
Parents: 5a024a5 330d9ef
Author: sboikov <sb...@gridgain.com>
Authored: Mon May 15 13:12:34 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon May 15 13:12:34 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 71 +----
.../cache/GridCacheConcurrentMap.java | 5 -
.../cache/GridCacheConcurrentMapImpl.java | 28 --
.../processors/cache/GridCacheProxyImpl.java | 60 ----
.../processors/cache/GridNoStorageCacheMap.java | 5 -
.../processors/cache/IgniteInternalCache.java | 61 -----
.../dht/GridCachePartitionedConcurrentMap.java | 9 -
.../distributed/dht/GridDhtCacheAdapter.java | 162 -----------
.../distributed/near/GridNearCacheAdapter.java | 17 --
.../GridCachePartitionedFullApiSelfTest.java | 18 --
.../cache/eviction/EvictionAbstractTest.java | 13 +-
.../hadoop/jobtracker/HadoopJobTracker.java | 20 +-
.../cache/hibernate/HibernateCacheProxy.java | 25 --
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Binary/BinarySelfTest.cs | 7 +-
.../Binary/EnumsTest.cs | 274 +++++++++++++++++++
.../Compute/ComputeApiTest.cs | 2 +-
.../Impl/Binary/BinaryObject.cs | 2 +-
.../Impl/Binary/BinaryReflectiveActions.cs | 6 +-
.../Impl/Binary/BinarySystemHandlers.cs | 271 +++++++++---------
.../Impl/Binary/BinaryUtils.cs | 30 --
.../Impl/Binary/BinaryWriter.cs | 48 +++-
.../activities-user-dialog.tpl.pug | 33 ++-
.../components/web-console-footer/style.scss | 4 +
.../components/web-console-header/style.scss | 9 -
.../frontend/app/primitives/btn/index.scss | 235 ++++++++++++++++
.../frontend/app/primitives/index.js | 2 +
.../frontend/app/primitives/modal/index.scss | 179 ++++++++++++
.../frontend/app/primitives/table/index.scss | 91 ++++++
.../frontend/public/stylesheets/style.scss | 99 +------
.../frontend/public/stylesheets/variables.scss | 4 +
.../frontend/views/includes/footer.pug | 23 --
.../frontend/views/includes/header-right.pug | 4 +-
.../web-console/frontend/views/signin.tpl.pug | 2 +-
parent/pom.xml | 3 +-
35 files changed, 1022 insertions(+), 801 deletions(-)
----------------------------------------------------------------------