Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

new alpha version

  • Loading branch information...
commit 1c6cb2b3dab758e87029ad717d9afb5076ac7bb1 1 parent b295f1b
tomek authored
Showing with 881 additions and 262 deletions.
  1. +3 −1 .gitignore
  2. +2 −0  README.md
  3. +1 −1  src/main/frontend/config.json
  4. +1 −1  src/main/frontend/contribs/dialog/Manifest.json
  5. +1 −2  src/main/frontend/contribs/dialog/source/class/dialog/Dialog.js
  6. +3 −0  src/main/frontend/source/class/helenos/Application.js
  7. +2 −1  src/main/frontend/source/class/helenos/components/Footer.js
  8. +9 −8 src/main/frontend/source/class/helenos/components/menu/ColumnFamilyContextMenu.js
  9. +15 −12 src/main/frontend/source/class/helenos/components/tab/browse/AbstractBrowsePage.js
  10. +0 −75 src/main/frontend/source/class/helenos/components/tab/browse/GetSlicePage.js
  11. +207 −0 src/main/frontend/source/class/helenos/components/tab/browse/PredicatePage.js
  12. +18 −3 src/main/frontend/source/class/helenos/components/tab/browse/SingleColumnPage.js
  13. +30 −2 src/main/frontend/source/class/helenos/theme/Appearance.js
  14. +2 −1  src/main/frontend/source/class/helenos/theme/Color.js
  15. +1 −1  src/main/frontend/source/class/helenos/theme/Decoration.js
  16. +1 −1  src/main/frontend/source/class/helenos/theme/Font.js
  17. +20 −0 src/main/frontend/source/class/helenos/ui/BoldLabel.js
  18. +21 −0 src/main/frontend/source/class/helenos/ui/CompositeH.js
  19. +1 −1  src/main/frontend/source/class/helenos/ui/CompositeV.js
  20. +18 −0 src/main/frontend/source/class/helenos/ui/GroupBoxH.js
  21. +18 −0 src/main/frontend/source/class/helenos/ui/GroupBoxV.js
  22. +18 −0 src/main/frontend/source/class/helenos/ui/table/Table.js
  23. +12 −12 src/main/frontend/source/class/helenos/util/GuiObserver.js
  24. +1 −1  src/main/frontend/source/class/helenos/util/Rpc.js
  25. +43 −6 src/main/frontend/source/class/helenos/util/RpcActionsProvider.js
  26. BIN  src/main/frontend/source/resource/helenos/tree.png
  27. +21 −1 src/main/java/com/kuprowski/helenos/Converter.java
  28. +17 −0 src/main/java/com/kuprowski/helenos/service/QueryProvider.java
  29. +6 −4 src/main/java/com/kuprowski/helenos/service/StandardQueryProvider.java
  30. +7 −4 src/main/java/com/kuprowski/helenos/service/SuperQueryProvider.java
  31. +5 −0 src/main/java/com/kuprowski/helenos/service/impl/AbstractProvider.java
  32. +58 −0 src/main/java/com/kuprowski/helenos/service/impl/AbstractQueryProvider.java
  33. +45 −12 src/main/java/com/kuprowski/helenos/service/impl/StandardQueryProviderImpl.java
  34. +47 −22 src/main/java/com/kuprowski/helenos/service/impl/SuperQueryProviderImpl.java
  35. +24 −16 src/main/java/com/kuprowski/helenos/types/{SliceResult.java → Column.java}
  36. +43 −0 src/main/java/com/kuprowski/helenos/types/Slice.java
  37. +13 −13 ...main/java/com/kuprowski/helenos/types/qx/query/{AbstractSliceQuery.java → AbstractPredicateQuery.java}
  38. +35 −0 src/main/java/com/kuprowski/helenos/types/qx/query/AbstractRangeQuery.java
  39. +74 −0 src/main/java/com/kuprowski/helenos/types/qx/query/RangeQuery.java
  40. +0 −54 src/main/java/com/kuprowski/helenos/types/qx/query/SliceQuery.java
  41. +6 −4 src/main/java/com/kuprowski/helenos/types/qx/query/{SubSliceQuery.java → SubRangeQuery.java}
  42. +21 −0 src/main/resources/xml-bean-mappings.xml
  43. +10 −0 src/main/webapp/gui/index.html
  44. +1 −1  src/main/webapp/index.html
  45. +0 −2  src/test/resources/helenos.properties
View
4 .gitignore
@@ -5,4 +5,6 @@
/src/main/frontend/source/script/
/src/main/webapp/helenos/
/src/main/frontend/contribs/dialog/build/
-/src/main/webapp/WEB-INF/logs/
+/src/main/webapp/WEB-INF/logs/
+/src/main/webapp/gui/resource/
+/src/main/webapp/gui/script/
View
2  README.md
@@ -47,6 +47,8 @@ You can build manually with Maven but first install all prerequisities:
* Qooxdoo SDK 2.0.1
* Python 2.x
+... and checkout this repository [SilverBlueTheme] (https://qooxdoo-contrib.svn.sourceforge.net/svnroot/qooxdoo-contrib/trunk/qooxdoo-contrib/SilverBlueTheme/) to folder src/main/frontend
+
## Wish list
* Browse with indexed slice and range slices
View
2  src/main/frontend/config.json
@@ -45,7 +45,7 @@
"LOCALES" : [ "en" ],
"CACHE" : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache",
"ROOT" : ".",
- "BUILD_PATH" : "../../../target/helenos-${HELENOS_VER}/helenos/",
+ "BUILD_PATH" : "../../../target/helenos-${HELENOS_VER}/gui/",
"HELENOS_VER" : "1.1"
},
View
2  src/main/frontend/contribs/dialog/Manifest.json
@@ -18,7 +18,7 @@
],
"version" : "trunk",
- "qooxdoo-versions": ["2.0"]
+ "qooxdoo-versions": ["2.0.1"]
},
"provides" :
View
3  src/main/frontend/contribs/dialog/source/class/dialog/Dialog.js
@@ -216,8 +216,7 @@ qx.Class.define("dialog.Dialog",
* basic settings
*/
this.set({
- 'visibility' : "hidden",
- 'decorator' : "shadow-popup"
+ 'visibility' : "hidden"
});
this.setLayout( new qx.ui.layout.Grow() );
View
3  src/main/frontend/source/class/helenos/Application.js
@@ -24,6 +24,9 @@ qx.Class.define("helenos.Application",
members :
{
+ /**
+ * @lint ignoreUndefined(silverbluetheme)
+ */
main : function()
{
// Call super class
View
3  src/main/frontend/source/class/helenos/components/Footer.js
@@ -18,7 +18,8 @@ qx.Class.define("helenos.components.Footer",
alignX : 'right',
alignY : 'middle'
}),
- padding : 2
+ padding : 2,
+ appearance : 'app-footer-dark'
});
this.__createComponents();
View
17 src/main/frontend/source/class/helenos/components/menu/ColumnFamilyContextMenu.js
@@ -60,14 +60,15 @@ qx.Class.define('helenos.components.menu.ColumnFamilyContextMenu',
byKeyButton.setUserData('KSNAME', ksName);
byKeyButton.setUserData('CFNAME', cfName);
byKeyButton.addListener('execute', this.__showBrowseBySingleColumnPane);
-
- var sliceButton = new qx.ui.menu.Button('Slice', 'icon/16/apps/office-spreadsheet.png');
- sliceButton.setUserData('KSNAME', ksName);
- sliceButton.setUserData('CFNAME', cfName);
- sliceButton.addListener('execute', this.__showBrowseBySlicePane);
+
+ var predicateButton = new qx.ui.menu.Button('Predicate', 'icon/16/apps/office-spreadsheet.png');
+ predicateButton.setUserData('KSNAME', ksName);
+ predicateButton.setUserData('CFNAME', cfName);
+ predicateButton.addListener('execute', this.__showBrowseByPredicatePane);
menu.add(byKeyButton);
- menu.add(sliceButton);
+ menu.add(predicateButton);
+ //menu.add(keyRangeButton);
return menu;
},
@@ -91,10 +92,10 @@ qx.Class.define('helenos.components.menu.ColumnFamilyContextMenu',
helenos.util.GuiObserver.showBrowseBySingleColumnTab(ksName, cfName);
},
- __showBrowseBySlicePane : function(e) {
+ __showBrowseByPredicatePane : function(e) {
var ksName = e.getTarget().getUserData('KSNAME');
var cfName = e.getTarget().getUserData('CFNAME');
- helenos.util.GuiObserver.showBrowseBySliceTab(ksName, cfName);
+ helenos.util.GuiObserver.showBrowseByPredicateTab(ksName, cfName);
},
/**
View
27 src/main/frontend/source/class/helenos/components/tab/browse/AbstractBrowsePage.js
@@ -15,7 +15,7 @@ qx.Class.define("helenos.components.tab.browse.AbstractBrowsePage",
extend : helenos.components.tab.AbstractCloseablePage,
construct : function(ksName, cfName)
- {;
+ {
this.base(arguments);
this._manager = new qx.ui.form.validation.Manager();
this._ksName = ksName;
@@ -23,16 +23,17 @@ qx.Class.define("helenos.components.tab.browse.AbstractBrowsePage",
this._cfDef = helenos.util.RpcActionsProvider.describeColumnFamily(this._ksName, this._cfName);
this.set({
- layout : new qx.ui.layout.VBox(3, 'top'),
+ layout : new qx.ui.layout.VBox(8, 'top'),
label: (ksName + ' : ' + cfName)
});
- this._resultView = new qx.ui.container.Composite(new qx.ui.layout.VBox());
+ this._resultView = new qx.ui.container.Composite(new qx.ui.layout.VBox(8));
this._rajCB = new qx.ui.form.CheckBox('Parse results to JSON');
- this.add(this._getCriteriaPane());
- this.add(this.__getSearchActionPane());
- this.add(this._resultView, {flex: 1});
+ var pane = new qx.ui.splitpane.Pane("horizontal");
+ pane.add(this._getCriteriaPane(),0);
+ pane.add(this._resultView, 1);
+ this.add(pane, {flex:1});
},
members : {
@@ -48,7 +49,7 @@ qx.Class.define("helenos.components.tab.browse.AbstractBrowsePage",
__getSearchActionPane : function() {
var pane = new qx.ui.container.Composite(new qx.ui.layout.HBox(3, 'left'));
pane.add(this._getSearchButton());
- pane.add(this._rajCB);
+ //pane.add(this._rajCB);
return pane;
},
@@ -56,14 +57,16 @@ qx.Class.define("helenos.components.tab.browse.AbstractBrowsePage",
_getCriteriaPane : function() {
var components = this._getCriteriaComponents();
- var criteriaGB = new qx.ui.groupbox.GroupBox('Criteria');
- criteriaGB.setLayout(new qx.ui.layout.HBox(8).set({alignY : 'middle'}));
+ var container = new qx.ui.container.Composite(new qx.ui.layout.VBox(5).set({alignX : 'left'}));
+ container.setAppearance('criteria-pane');
for (var i = 0; i < components.length; i++) {
- criteriaGB.add(components[i]);
- criteriaGB.add(new qx.ui.core.Spacer(3));
+ container.add(components[i]);
}
- return criteriaGB;
+ container.add(this._getSearchButton());
+ var pane = new qx.ui.core.scroll.ScrollPane();
+ pane.add(container);
+ return pane;
},
_getTreeFromJson : function(name, data) {
View
75 src/main/frontend/source/class/helenos/components/tab/browse/GetSlicePage.js
@@ -1,75 +0,0 @@
-/* ************************************************************************
-Copyright:
- 2012 Tomek Kuprowski
-License:
- GPLv2: http://www.gnu.org/licences/gpl.html
-Authors:
- Tomek Kuprowski (tomekkuprowski at gmail dot com)
- ************************************************************************ */
-qx.Class.define("helenos.components.tab.browse.GetSlicePage",
-{
- extend : helenos.components.tab.browse.AbstractBrowsePage,
-
- construct : function(ksName, cfName)
- {
- this.base(arguments, ksName, cfName);
- this.set({
- icon : 'icon/16/apps/office-spreadsheet.png'
- });
- },
-
- members :
- {
- __keyTF : null,
- __nameStartTF : null,
- __nameEndTF : null,
- __sNameTF : null,
- __reversedCB : null,
-
- _performSearch : function(e) {
- var key = this.__keyTF.getValue();
- var nameStart = this.__nameStartTF.getValue();
- var nameEnd = this.__nameEndTF.getValue();
- var sName = (this.__sNameTF == null ? null : this.__sNameTF.getValue());
- var reversed = this.__reversedCB.getValue();
- var result = helenos.util.RpcActionsProvider.querySlice(this._cfDef, key, nameStart, nameEnd, sName, reversed );
-
- this._resultView.removeAll();
- this._resultView.add(this._getResultComponent(result), {flex: 1});
- },
-
- _getResultComponent : function(result) {
- var tableModel = new helenos.ui.table.model.EditableSimple();
- tableModel.setColumns(['Column','Value'],['name','value']);
- tableModel.setDataAsMapArray(result);
-
- var tablePane = new qx.ui.core.scroll.ScrollPane();
- tablePane.set({allowGrowX : true, allowGrowY : true});
- tablePane.add(new qx.ui.table.Table(tableModel));
- return tablePane;
- },
-
- _getCriteriaComponents : function() {
- var ret = new Array();
- this.__keyTF = new helenos.ui.RequiredTextField(this._cfDef.keyValidationClass);
- this.__nameStartTF = new helenos.ui.RequiredTextField(this._cfDef.comparatorType.className);
- this.__nameEndTF = new helenos.ui.TextField(this._cfDef.comparatorType.className);
- this.__reversedCB = new qx.ui.form.CheckBox('Reversed');
-
- this._manager.add(this.__keyTF);
- this._manager.add(this.__nameStartTF);
-
- ret.push(new helenos.ui.CompositeV([new qx.ui.basic.Label('Key:'), this.__keyTF]));
-
- if (this._cfDef.columnType == 'Super') {
- this.__sNameTF = new helenos.ui.TextField(this._cfDef.subComparatorType.className);
- ret.push(new helenos.ui.CompositeV([new qx.ui.basic.Label('Super column name:'), this.__sNameTF]));
- }
-
- ret.push(new helenos.ui.CompositeV([new qx.ui.basic.Label('Range from:'), this.__nameStartTF]));
- ret.push(new helenos.ui.CompositeV([new qx.ui.basic.Label('Range to:'), this.__nameEndTF]));
- ret.push(this.__reversedCB);
- return ret;
- }
- }
-});
View
207 src/main/frontend/source/class/helenos/components/tab/browse/PredicatePage.js
@@ -0,0 +1,207 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define("helenos.components.tab.browse.PredicatePage",
+{
+ extend : helenos.components.tab.browse.AbstractBrowsePage,
+
+ construct : function(ksName, cfName)
+ {
+ this.base(arguments, ksName, cfName);
+ this.set({
+ icon : 'icon/16/apps/office-spreadsheet.png'
+ });
+ },
+
+ members :
+ {
+ __keyModeRBG : null,
+ __columnsByRBG : null,
+
+ __keyFromTF : null,
+ __keyToTF : null,
+ __keyMode : null,
+
+ __nameStartTF : null,
+ __nameEndTF : null,
+ __sNameTF : null,
+
+ __columnNamesTF : null,
+ __rangeColNamesCP : null,
+ __rangeFromToCP : null,
+ __reversedCB : null,
+
+ _performSearch : function(e) {
+ var keyFrom = this.__keyFromTF.getValue();
+ var keyTo = this.__keyToTF.getValue();
+ var sName = (this.__sNameTF == null ? null : this.__sNameTF.getValue());
+
+ var nameStart, nameEnd, reversed, columnNames;
+ if (this.__columnsByRBG.getSelection()[0].getLabel() == 'range') {
+ nameStart = this.__nameStartTF.getValue();
+ nameEnd = this.__nameEndTF.getValue();
+ reversed = this.__reversedCB.getValue();
+ } else {
+ columnNames = this.__columnNamesTF.getValue().split(',');
+ }
+ var result;
+ if (this.__keyMode == 'predicate') {
+ result = helenos.util.RpcActionsProvider.queryPredicate(this._cfDef, keyFrom, keyTo, columnNames, nameStart, nameEnd, sName, reversed);
+ } else {
+ result = helenos.util.RpcActionsProvider.queryKeyRange(this._cfDef, keyFrom, keyTo, columnNames, nameStart, nameEnd, sName, reversed);
+ }
+ this._resultView.removeAll();
+ this._resultView.add(this._getResultComponent(result), {flex: 1});
+ },
+
+ _getResultComponent : function(result) {
+ var tree = new qx.ui.treevirtual.TreeVirtual(["Name", "Value", "Clock", "TTL"]);
+ tree.setAlwaysShowOpenCloseSymbol(true);
+ tree.setUseTreeLines(true);
+ var tablePane = new qx.ui.core.scroll.ScrollPane().set({allowGrowX : true, allowGrowY : true});
+ var i;
+ var dataModel = tree.getDataModel();
+
+ //var branch = dataModel.addBranch(null, this.__keyTF.getValue(), true);
+ for(i = 0; i < result.length; i++) {
+ var row = result[i];
+ var branch = dataModel.addBranch(null, row.key, true);
+ var j;
+ for (j = 0; j < row.columns.length; j++) {
+ var col = row.columns[j];
+ var leaf = dataModel.addLeaf(branch, col.name);
+ dataModel.setColumnData(leaf, 1, col.value);
+ dataModel.setColumnData(leaf, 2, col.clock);
+ dataModel.setColumnData(leaf, 3, col.ttl);
+ }
+ }
+ dataModel.setData();
+
+ tablePane.add(tree);
+ return tablePane;
+ },
+
+ _getCriteriaComponents : function() {
+ var ret = new Array();
+
+ ret.push(this.__getKeysGB());
+ ret.push(this.__getColumnsGB());
+
+ return ret;
+ },
+
+ __getColumnsGB : function() {
+ var columnsGB = new helenos.ui.GroupBoxV('Columns');
+
+ if (this._cfDef.columnType == 'Super') {
+ this.__nameStartTF = new helenos.ui.TextField(this._cfDef.subComparatorType.className);
+ this.__nameEndTF = new helenos.ui.TextField(this._cfDef.subComparatorType.className);
+ } else {
+ this.__nameStartTF = new helenos.ui.TextField(this._cfDef.comparatorType.className);
+ this.__nameEndTF = new helenos.ui.TextField(this._cfDef.comparatorType.className);
+ }
+
+ columnsGB.add(this.__getRangeFromToBox());
+ columnsGB.add(this.__getRangeColNamesBox());
+
+ if (this._cfDef.columnType == 'Super') {
+ this.__sNameTF = new helenos.ui.TextField(this._cfDef.comparatorType.className);
+ columnsGB.add(new qx.ui.basic.Label('Super column name:'));
+ columnsGB.add(this.__sNameTF);
+ }
+
+ columnsGB.add(new qx.ui.basic.Label('Columns mode:'));
+ columnsGB.add(this.__getRangeModeBG());
+
+ return columnsGB;
+ },
+
+ __getKeysGB : function() {
+ this.__keyFromTF = new helenos.ui.TextField(this._cfDef.keyValidationClass);
+ this.__keyToTF = new helenos.ui.TextField(this._cfDef.keyValidationClass);
+ this.__keyToTF.setEnabled(false);
+
+ var keysGB = new helenos.ui.GroupBoxV('Keys');
+ keysGB.add(new qx.ui.basic.Label('From:'));
+ keysGB.add(this.__keyFromTF);
+ keysGB.add(new qx.ui.basic.Label('To:'));
+ keysGB.add(this.__keyToTF);
+
+ keysGB.add(new qx.ui.basic.Label('Key mode:'));
+ keysGB.add(this.__getKeyModeBG());
+
+ return keysGB;
+ },
+
+ __getRangeModeBG : function() {
+ var byNameBT = new qx.ui.form.RadioButton('name');
+ var byRangeBT = new qx.ui.form.RadioButton('range');
+
+ this.__columnsByRBG = new qx.ui.form.RadioButtonGroup(new qx.ui.layout.HBox(8));
+ this.__columnsByRBG.add(byNameBT);
+ this.__columnsByRBG.add(byRangeBT);
+ this.__columnsByRBG.setSelection([byRangeBT]);
+ this.__columnsByRBG.addListener("changeSelection", this._onRangeModeChanged, this);
+ return this.__columnsByRBG;
+ },
+
+ __getKeyModeBG : function() {
+ var predicateBT = new qx.ui.form.RadioButton('predicate');
+ var keyRangeBT = new qx.ui.form.RadioButton('key range');
+
+ this.__keyModeRBG = new qx.ui.form.RadioButtonGroup(new qx.ui.layout.HBox(5));
+ this.__keyModeRBG.add(predicateBT);
+ this.__keyModeRBG.add(keyRangeBT);
+ this.__keyModeRBG.setSelection([predicateBT]);
+ this.__keyModeRBG.addListener("changeSelection", this._onKeyModeChanged, this);
+ return this.__keyModeRBG;
+ },
+
+ __getRangeFromToBox : function() {
+ this.__rangeFromToCP = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)).set({padding : 0});
+
+ this.__rangeFromToCP.add(new qx.ui.basic.Label('From:'));
+ this.__rangeFromToCP.add(this.__nameStartTF);
+ this.__rangeFromToCP.add(new qx.ui.basic.Label('To:'));
+ this.__rangeFromToCP.add(this.__nameEndTF);
+
+ this.__reversedCB = new qx.ui.form.CheckBox('Reversed');
+ this.__rangeFromToCP.add(this.__reversedCB);
+
+ return this.__rangeFromToCP;
+ },
+
+ __getRangeColNamesBox : function() {
+ this.__rangeColNamesCP = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)).set({padding : 0, visibility : 'excluded'});
+
+ this.__columnNamesTF = new qx.ui.form.TextArea().set({placeholder : 'comma separated list'});
+ this.__rangeColNamesCP.add(new qx.ui.basic.Label('Column names:'));
+ this.__rangeColNamesCP.add(this.__columnNamesTF);
+
+ return this.__rangeColNamesCP;
+ },
+
+ _onRangeModeChanged : function(e) {
+ var selectedBtnLabel = e.getData()[0].getLabel();
+ if (selectedBtnLabel == 'name') {
+ this.__rangeFromToCP.setVisibility('excluded');
+ this.__rangeColNamesCP.setVisibility('visible');
+ } else {
+ this.__rangeFromToCP.setVisibility('visible');
+ this.__rangeColNamesCP.setVisibility('excluded');
+ }
+ },
+
+ _onKeyModeChanged : function(e) {
+ var selectedBtnLabel = e.getData()[0].getLabel();
+ this.__keyToTF.resetValue();
+ this.__keyToTF.setEnabled(selectedBtnLabel != 'predicate');
+ this.__keyMode = selectedBtnLabel;
+ }
+ }
+});
View
21 src/main/frontend/source/class/helenos/components/tab/browse/SingleColumnPage.js
@@ -28,14 +28,29 @@ qx.Class.define("helenos.components.tab.browse.SingleColumnPage",
var key = this.__keyTF.getValue();
var name = this.__nameTF.getValue();
var sName = (this.__sNameTF == null ? null : this.__sNameTF.getValue());
- var result = helenos.util.RpcActionsProvider.querySingleColumn(this._cfDef, key, name, sName );
+ var column = helenos.util.RpcActionsProvider.querySingleColumn(this._cfDef, key, name, sName );
this._resultView.removeAll();
if (this._rajCB.getValue()) {
- this._resultView.add(this._getTreeFromJson(key, result), {flex: 1});
+ this._resultView.add(this._getTreeFromJson(key, column.value), {flex: 1});
+
} else {
- this._resultView.add(new qx.ui.form.TextArea(result), {flex: 1});
+ this._resultView.add(new helenos.ui.CompositeH([new qx.ui.basic.Label('Value'),
+ new qx.ui.form.TextArea(column.value)]), {flex: 1});
}
+
+ this._resultView.add(this._getDetailsBox(column));
+ },
+
+ _getDetailsBox : function(column) {
+ return new helenos.ui.CompositeH([
+ new helenos.ui.BoldLabel('Column name:'),
+ new qx.ui.form.TextField('' + column.name).set({width: 180}),
+ new helenos.ui.BoldLabel('Clock:'),
+ new qx.ui.form.TextField('' + column.clock).set({width: 150}),
+ new helenos.ui.BoldLabel('TTL:'),
+ new qx.ui.form.TextField('' + column.ttl).set({width: 150})
+ ]);
},
_getCriteriaComponents : function() {
View
32 src/main/frontend/source/class/helenos/theme/Appearance.js
@@ -8,7 +8,7 @@ Authors:
************************************************************************ */
qx.Theme.define("helenos.theme.Appearance",
{
- extend : qx.theme.modern.Appearance,
+ extend : qx.theme.simple.Appearance,
title : 'Helenos app theme',
appearances : {
@@ -21,7 +21,35 @@ qx.Theme.define("helenos.theme.Appearance",
decorator : "app-header-black"
};
}
+ },
+
+ 'app-footer-dark' : {
+ style : function(states) {
+ return {
+ backgroundColor : "#6c727b",
+ textColor : "#FFFFFF",
+ padding : [ 2, 2, 2, 2]
+ };
+ }
+ },
+
+ 'criteria-pane' : {
+ style : function(states) {
+ return {
+ backgroundColor : '#E0ECFF'
+ }
+ }
+ },
+
+ 'groupbox/frame' : {
+ style : function(states) {
+ return {
+ backgroundColor : 'background',
+ padding : [6, 9],
+ margin: [18, 2, 2, 2],
+ decorator : "white-box"
+ }
+ }
}
-
}
});
View
3  src/main/frontend/source/class/helenos/theme/Color.js
@@ -8,9 +8,10 @@ Authors:
************************************************************************ */
qx.Theme.define("helenos.theme.Color",
{
- extend : qx.theme.modern.Color,
+ extend : qx.theme.simple.Color,
colors :
{
+ "background" : "#f0f3f9"
}
});
View
2  src/main/frontend/source/class/helenos/theme/Decoration.js
@@ -8,7 +8,7 @@ Authors:
************************************************************************ */
qx.Theme.define('helenos.theme.Decoration',
{
- extend : qx.theme.modern.Decoration,
+ extend : qx.theme.simple.Decoration,
decorations :
{
View
2  src/main/frontend/source/class/helenos/theme/Font.js
@@ -8,7 +8,7 @@ Authors:
************************************************************************ */
qx.Theme.define("helenos.theme.Font",
{
- extend : qx.theme.modern.Font,
+ extend : qx.theme.simple.Font,
fonts :
{
View
20 src/main/frontend/source/class/helenos/ui/BoldLabel.js
@@ -0,0 +1,20 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define("helenos.ui.BoldLabel",
+{
+ extend : qx.ui.basic.Label,
+
+ construct : function(label)
+ {
+ this.base(arguments, '<b>' + label + '</b>');
+ this.set({
+ rich: true
+ });
+ }
+});
View
21 src/main/frontend/source/class/helenos/ui/CompositeH.js
@@ -0,0 +1,21 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define('helenos.ui.CompositeH',
+{
+ extend : qx.ui.container.Composite,
+
+ construct : function(objects)
+ {
+ this.base(arguments);
+ this.setLayout(new qx.ui.layout.HBox(6).set({alignY : 'middle'}));
+ for (var i = 0; i < objects.length; i++) {
+ this.add(objects[i]);
+ }
+ }
+});
View
2  src/main/frontend/source/class/helenos/ui/CompositeV.js
@@ -13,7 +13,7 @@ qx.Class.define('helenos.ui.CompositeV',
construct : function(objects)
{
this.base(arguments);
- this.setLayout(new qx.ui.layout.VBox(2));
+ this.setLayout(new qx.ui.layout.VBox(6));
for (var i = 0; i < objects.length; i++) {
this.add(objects[i]);
}
View
18 src/main/frontend/source/class/helenos/ui/GroupBoxH.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define('helenos.ui.GroupBoxH',
+{
+ extend : qx.ui.groupbox.GroupBox,
+
+ construct : function(label)
+ {
+ this.base(arguments, label);
+ this.setLayout(new qx.ui.layout.HBox(5).set({alignY : 'middle'}));
+ }
+});
View
18 src/main/frontend/source/class/helenos/ui/GroupBoxV.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define('helenos.ui.GroupBoxV',
+{
+ extend : qx.ui.groupbox.GroupBox,
+
+ construct : function(label)
+ {
+ this.base(arguments, label);
+ this.setLayout(new qx.ui.layout.VBox(5).set({alignX : 'left'}));
+ }
+});
View
18 src/main/frontend/source/class/helenos/ui/table/Table.js
@@ -0,0 +1,18 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define("helenos.ui.table.Table",
+{
+ extend : qx.ui.table.Table,
+
+ construct : function(tableModel)
+ {
+ this.base(arguments, tableModel);
+ this.setToolTipText('Double click to edit and copy values');
+ }
+});
View
24 src/main/frontend/source/class/helenos/util/GuiObserver.js
@@ -25,43 +25,43 @@ qx.Class.define("helenos.util.GuiObserver",
qx.core.Assert.assertNotNull(this.__tabbedPane,'tabbed pane not registered yet');
var page = new helenos.components.tab.ConnectionsEditorPage();
- this.__tabbedPane.add(page);
- this.__tabbedPane.setSelection([page]);
+ this._addPageToTab(page);
},
showKeyspaceInfoTab : function(keyspaceName) {
qx.core.Assert.assertNotNull(this.__tabbedPane,'tabbed pane not registered yet');
var ksPage = new helenos.components.tab.KeyspaceInfoPage(keyspaceName);
- this.__tabbedPane.add(ksPage);
- this.__tabbedPane.setSelection([ksPage]);
+ this._addPageToTab(ksPage);
},
showBrowseBySingleColumnTab : function(keyspaceName, columnFamily) {
qx.core.Assert.assertNotNull(this.__tabbedPane,'tabbed pane not registered yet');
var dataPage = new helenos.components.tab.browse.SingleColumnPage(keyspaceName, columnFamily);
- this.__tabbedPane.add(dataPage);
- this.__tabbedPane.setSelection([dataPage]);
+ this._addPageToTab(dataPage);
},
- showBrowseBySliceTab : function(keyspaceName, columnFamily) {
+ showBrowseByPredicateTab : function(keyspaceName, columnFamily) {
qx.core.Assert.assertNotNull(this.__tabbedPane,'tabbed pane not registered yet');
- var dataPage = new helenos.components.tab.browse.GetSlicePage(keyspaceName, columnFamily);
- this.__tabbedPane.add(dataPage);
- this.__tabbedPane.setSelection([dataPage]);
+ var dataPage = new helenos.components.tab.browse.PredicatePage(keyspaceName, columnFamily);
+ this._addPageToTab(dataPage);
},
showColumnFamilyInfoTab : function(keyspaceName, columnFamilyName) {
qx.core.Assert.assertNotNull(this.__tabbedPane,'tabbed pane not registered yet');
var cfPage = new helenos.components.tab.ColumnFamilyInfoPage(keyspaceName, columnFamilyName);
- this.__tabbedPane.add(cfPage);
- this.__tabbedPane.setSelection([cfPage]);
+ this._addPageToTab(cfPage);
},
refreshSchemaTree : function() {
qx.core.Assert.assertNotNull(this.__schemaPane,'cluster pane not registered yet');
this.__schemaPane.refreshSchemaTree();
+ },
+
+ _addPageToTab : function(page) {
+ this.__tabbedPane.add(page);
+ this.__tabbedPane.setSelection([page]);
}
}
});
View
2  src/main/frontend/source/class/helenos/util/Rpc.js
@@ -29,7 +29,7 @@ qx.Class.define('helenos.util.Rpc',
__getRemoteUri : function(serviceName) {
if (helenos.util.Rpc.serverPath == undefined) {
- var pathIdx = window.location.href.indexOf('/helenos/index.html');
+ var pathIdx = window.location.href.indexOf('/gui/index.html');
helenos.util.Rpc.serverPath = window.location.href.substr(0, pathIdx);
}
View
49 src/main/frontend/source/class/helenos/util/RpcActionsProvider.js
@@ -139,27 +139,64 @@ qx.Class.define('helenos.util.RpcActionsProvider', {
return rpc.callSync('singleColumn', query );
},
- querySlice : function(cfDef, key, nameStart, nameEnd, sName, reversed ) {
+ queryPredicate : function(cfDef, keyFrom, keyTo, columnNames, nameStart, nameEnd, sName, reversed ) {
var query = {};
query.keyClass = this.__findParamClass(cfDef.keyValidationClass);
- query.nameClass = this.__findParamClass(cfDef.comparatorType.className);
+
+ if (cfDef.columnType == 'Standard') {
+ query.nameClass = this.__findParamClass(cfDef.comparatorType.className);
+ } else {
+ query.nameClass = this.__findParamClass(cfDef.subComparatorType.className);
+ }
query.keyspace = cfDef.keyspaceName;
query.columnFamily = cfDef.name;
- query.key = key;
+ query.keyFrom = keyFrom;
+ query.keyTo = keyTo;
+ query.columnNames = columnNames;
query.nameStart = nameStart;
query.nameEnd = nameEnd;
query.reversed = reversed;
- var rpc = null;
+ var rpc;
if (cfDef.columnType == 'Standard') {
rpc = new helenos.util.Rpc(this._STANDARDQUERY);
} else {
rpc = new helenos.util.Rpc(this._SUPERQUERY);
- query.sNameClass = this.__findParamClass(cfDef.subComparatorType.className);
+ query.sNameClass = this.__findParamClass(cfDef.comparatorType.className);
+ query.sName = sName;
+ }
+ return rpc.callSync('predicate', query );
+ },
+
+ queryKeyRange : function(cfDef, keyFrom, keyTo, columnNames, nameStart, nameEnd, sName, reversed ) {
+ var query = {};
+
+ query.keyClass = this.__findParamClass(cfDef.keyValidationClass);
+
+ if (cfDef.columnType == 'Standard') {
+ query.nameClass = this.__findParamClass(cfDef.comparatorType.className);
+ } else {
+ query.nameClass = this.__findParamClass(cfDef.subComparatorType.className);
+ }
+ query.keyspace = cfDef.keyspaceName;
+ query.columnFamily = cfDef.name;
+ query.keyFrom = keyFrom;
+ query.keyTo = keyTo;
+ query.columnNames = columnNames;
+ query.nameStart = nameStart;
+ query.nameEnd = nameEnd;
+ query.reversed = reversed;
+
+ var rpc;
+ if (cfDef.columnType == 'Standard') {
+ rpc = new helenos.util.Rpc(this._STANDARDQUERY);
+ } else {
+ rpc = new helenos.util.Rpc(this._SUPERQUERY);
+ query.sNameClass = this.__findParamClass(cfDef.comparatorType.className);
query.sName = sName;
}
- return rpc.callSync('slice', query );
+ return rpc.callSync('keyRange', query );
}
}
});
View
BIN  src/main/frontend/source/resource/helenos/tree.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
22 src/main/java/com/kuprowski/helenos/Converter.java
@@ -1,5 +1,6 @@
package com.kuprowski.helenos;
+import java.util.List;
import java.util.UUID;
/**
@@ -30,5 +31,24 @@
throw new IllegalArgumentException("class not recognized: " + clazz);
}
-
+ public static <T> T[] toValue(List<String> arrayVal, Class<T> clazz) {
+ if (arrayVal == null) {
+ return null;
+ }
+ if (String.class.equals(clazz)) {
+ return (T[]) arrayVal.toArray(new String[0]);
+ }
+ if (Long.class.equals(clazz)) {
+ return (T[]) arrayVal.toArray(new Long[0]);
+ }
+ if (UUID.class.equals(clazz)) {
+ UUID[] temp = new UUID[arrayVal.size()];
+ for (int i = 0; i < arrayVal.size(); i++) {
+ temp[i] = UUID.fromString(arrayVal.get(i));
+ }
+ return (T[]) temp;
+ }
+
+ throw new IllegalArgumentException("class not recognized: " + clazz);
+ }
}
View
17 src/main/java/com/kuprowski/helenos/service/QueryProvider.java
@@ -0,0 +1,17 @@
+package com.kuprowski.helenos.service;
+
+import java.util.List;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public interface QueryProvider {
+
+ //<K, N> List<K> keyRange(com.kuprowski.helenos.types.qx.query.KeyRangeQuery<K, N> query);
+}
View
10 src/main/java/com/kuprowski/helenos/service/StandardQueryProvider.java
@@ -1,9 +1,10 @@
package com.kuprowski.helenos.service;
import com.googlecode.jsonrpc4j.JsonRpcParam;
-import com.kuprowski.helenos.types.SliceResult;
+import com.kuprowski.helenos.types.Column;
+import com.kuprowski.helenos.types.Slice;
import com.kuprowski.helenos.types.qx.query.SingleColumnQuery;
-import com.kuprowski.helenos.types.qx.query.SliceQuery;
+import com.kuprowski.helenos.types.qx.query.RangeQuery;
import java.util.List;
/**
@@ -19,6 +20,7 @@
//<K, N> String singleColumn(@JsonRpcParam("keyClass") Class<K> keyClass, @JsonRpcParam("valueClass") Class<N> valueClass, @JsonRpcParam("columnFamily") String keyspaceName, @JsonRpcParam("columnFamily") String columnFamily, @JsonRpcParam("key") String keyStr, @JsonRpcParam("name") String nameStr);
- <K, N> String singleColumn(@JsonRpcParam("query") SingleColumnQuery<K,N> query);
- <K, N> List<SliceResult<N>> slice(@JsonRpcParam("query") SliceQuery<K,N> query);
+ <K, N> Column<N> singleColumn(@JsonRpcParam("query") SingleColumnQuery<K,N> query);
+ <K, N> List<Slice<K,N>> predicate(@JsonRpcParam("query") RangeQuery<K,N> query);
+ <K, N> List<Slice<K,N>> keyRange(com.kuprowski.helenos.types.qx.query.RangeQuery<K, N> query);
}
View
11 src/main/java/com/kuprowski/helenos/service/SuperQueryProvider.java
@@ -1,9 +1,10 @@
package com.kuprowski.helenos.service;
import com.googlecode.jsonrpc4j.JsonRpcParam;
-import com.kuprowski.helenos.types.SliceResult;
+import com.kuprowski.helenos.types.Column;
+import com.kuprowski.helenos.types.Slice;
import com.kuprowski.helenos.types.qx.query.SingleSubColumnQuery;
-import com.kuprowski.helenos.types.qx.query.SubSliceQuery;
+import com.kuprowski.helenos.types.qx.query.SubRangeQuery;
import java.util.List;
/**
@@ -17,7 +18,9 @@
*/
public interface SuperQueryProvider {
- <K, SN, N> String singleColumn(@JsonRpcParam("query") SingleSubColumnQuery<K, SN, N> query);
+ <K, SN, N> Column<N> singleColumn(@JsonRpcParam("query") SingleSubColumnQuery<K, SN, N> query);
- <K, SN, N> List<SliceResult<N>> slice(@JsonRpcParam("query") SubSliceQuery<K, SN, N> query);
+ <K, SN, N> List<Slice<K,N>> predicate(@JsonRpcParam("query") SubRangeQuery<K, SN, N> query);
+
+ <K, SN, N> List<Slice<K,N>> keyRange(com.kuprowski.helenos.types.qx.query.SubRangeQuery<K, SN, N> query);
}
View
5 src/main/java/com/kuprowski/helenos/service/impl/AbstractProvider.java
@@ -1,6 +1,10 @@
package com.kuprowski.helenos.service.impl;
import com.kuprowski.helenos.ClusterConfiguration;
+import com.kuprowski.helenos.types.Column;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import me.prettyprint.cassandra.serializers.ObjectSerializer;
import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
import me.prettyprint.cassandra.service.CassandraHost;
@@ -10,6 +14,7 @@
import me.prettyprint.hector.api.ConsistencyLevelPolicy;
import me.prettyprint.hector.api.Keyspace;
import me.prettyprint.hector.api.Serializer;
+import me.prettyprint.hector.api.beans.HColumn;
import me.prettyprint.hector.api.factory.HFactory;
import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
View
58 src/main/java/com/kuprowski/helenos/service/impl/AbstractQueryProvider.java
@@ -0,0 +1,58 @@
+package com.kuprowski.helenos.service.impl;
+
+import com.kuprowski.helenos.Converter;
+import com.kuprowski.helenos.service.QueryProvider;
+import com.kuprowski.helenos.types.Column;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import me.prettyprint.cassandra.serializers.StringSerializer;
+import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.beans.OrderedRows;
+import me.prettyprint.hector.api.beans.Row;
+import me.prettyprint.hector.api.factory.HFactory;
+import me.prettyprint.hector.api.query.QueryResult;
+import me.prettyprint.hector.api.query.RangeSlicesQuery;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public abstract class AbstractQueryProvider extends AbstractProvider implements QueryProvider {
+
+ protected <N> List<Column<N>> toJsonColumns(List<HColumn<N, String>> columns) {
+ List<Column<N>> retColumns = new ArrayList<Column<N>>(1);
+ Iterator<HColumn<N,String>> iterator = columns.iterator();
+ while(iterator.hasNext()) {
+ retColumns.add(mapper.map(iterator.next(), Column.class));
+ }
+ return retColumns;
+ }
+
+ /*
+ @Override
+ public <K, N> List<K> keyRange(com.kuprowski.helenos.types.qx.query.KeyRangeQuery<K, N> query) {
+ RangeSlicesQuery<K, N, String> cq = HFactory.createRangeSlicesQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getNameClass()), StringSerializer.get());
+ cq.setColumnFamily(query.getColumnFamily());
+ cq.setKeys(Converter.toValue(query.getKeyFrom(), query.getKeyClass()), Converter.toValue(query.getKeyTo(), query.getKeyClass()));
+ //cq.setReturnKeysOnly();
+ cq.setRowCount(query.getMaxResults());
+
+ QueryResult<OrderedRows<K, N, String>> qr = cq.execute();
+
+ List<K> ret = new ArrayList<K>();
+ if (qr != null) {
+ List<Row<K, N, String>> items = qr.get().getList();
+ for (Row<K, N, String> item : items) {
+ ret.add(item.getKey());
+ }
+ }
+
+ return ret;
+ }*/
+}
View
57 src/main/java/com/kuprowski/helenos/service/impl/StandardQueryProviderImpl.java
@@ -4,18 +4,23 @@
import com.kuprowski.helenos.Converter;
import com.kuprowski.helenos.service.ClusterConfigAware;
import com.kuprowski.helenos.service.StandardQueryProvider;
-import com.kuprowski.helenos.types.SliceResult;
+import com.kuprowski.helenos.types.Column;
+import com.kuprowski.helenos.types.Slice;
import com.kuprowski.helenos.types.qx.query.SingleColumnQuery;
import java.util.ArrayList;
import java.util.List;
import me.prettyprint.cassandra.serializers.StringSerializer;
import me.prettyprint.hector.api.beans.ColumnSlice;
import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.beans.OrderedRows;
+import me.prettyprint.hector.api.beans.Row;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.query.ColumnQuery;
import me.prettyprint.hector.api.query.QueryResult;
+import me.prettyprint.hector.api.query.RangeSlicesQuery;
import me.prettyprint.hector.api.query.SliceQuery;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
/**
* ********************************************************
@@ -27,36 +32,64 @@
* *******************************************************
*/
@Component("standardQueryProvider")
-public class StandardQueryProviderImpl extends AbstractProvider implements StandardQueryProvider, ClusterConfigAware {
+public class StandardQueryProviderImpl extends AbstractQueryProvider implements StandardQueryProvider, ClusterConfigAware {
@Override
- public <K, N> String singleColumn(@JsonRpcParam("query") SingleColumnQuery<K, N> query) {
+ public <K, N> Column<N> singleColumn(@JsonRpcParam("query") SingleColumnQuery<K, N> query) {
ColumnQuery<K, N, String> cq = HFactory.createColumnQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getNameClass()), StringSerializer.get());
cq.setColumnFamily(query.getColumnFamily());
cq.setKey(Converter.toValue(query.getKey(), query.getKeyClass()));
cq.setName(Converter.toValue(query.getName(), query.getNameClass()));
HColumn<N, String> column = cq.execute().get();
- return column != null ? column.getValue() : null;
+ return mapper.map(column, Column.class);
}
@Override
- public <K, N> List<SliceResult<N>> slice(com.kuprowski.helenos.types.qx.query.SliceQuery<K, N> query) {
+ public <K, N> List<Slice<K,N>> predicate(com.kuprowski.helenos.types.qx.query.RangeQuery<K, N> query) {
+ K key = Converter.toValue(query.getKeyFrom(), query.getKeyClass());
SliceQuery<K, N, String> cq = HFactory.createSliceQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getNameClass()), StringSerializer.get());
cq.setColumnFamily(query.getColumnFamily());
- cq.setKey(Converter.toValue(query.getKey(), query.getKeyClass()));
- cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMax());
+ cq.setKey(key);
+ if (CollectionUtils.isEmpty(query.getColumnNames())) {
+ cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMaxResults());
+ } else {
+ cq.setColumnNames(Converter.toValue(query.getColumnNames(),query.getNameClass()));
+ }
QueryResult<ColumnSlice<N, String>> qr = cq.execute();
- List<SliceResult<N>> ret = new ArrayList<SliceResult<N>>();
+ List<Slice<K,N>> ret = new ArrayList<Slice<K,N>>(1);
+ if (qr != null) {
+ ret.add(new Slice(key, toJsonColumns(qr.get().getColumns())));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public <K, N> List<Slice<K,N>> keyRange(com.kuprowski.helenos.types.qx.query.RangeQuery<K, N> query) {
+ RangeSlicesQuery<K, N, String> cq = HFactory.createRangeSlicesQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getNameClass()), StringSerializer.get());
+ cq.setColumnFamily(query.getColumnFamily());
+ cq.setKeys(Converter.toValue(query.getKeyFrom(), query.getKeyClass()), Converter.toValue(query.getKeyTo(), query.getKeyClass()));
+
+ if (CollectionUtils.isEmpty(query.getColumnNames())) {
+ cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMaxResults());
+ } else {
+ cq.setColumnNames(Converter.toValue(query.getColumnNames(),query.getNameClass()));
+ }
+
+ QueryResult<OrderedRows<K, N, String>> qr = cq.execute();
+
+ List<Slice<K,N>> ret = new ArrayList<Slice<K,N>>(1);
if (qr != null) {
- List<HColumn<N, String>> columns = qr.get().getColumns();
- for (HColumn<N, String> column : columns) {
- ret.add(new SliceResult(column));
+ List<Row<K, N, String>> rows = qr.get().getList();
+ for (Row<K, N, String> row : rows) {
+ ColumnSlice<N, String> colSlice = row.getColumnSlice();
+ ret.add(new Slice(row.getKey(), toJsonColumns(colSlice.getColumns())));
}
}
-
+
return ret;
}
}
View
69 src/main/java/com/kuprowski/helenos/service/impl/SuperQueryProviderImpl.java
@@ -3,25 +3,21 @@
import com.googlecode.jsonrpc4j.JsonRpcParam;
import com.kuprowski.helenos.Converter;
import com.kuprowski.helenos.service.ClusterConfigAware;
-import com.kuprowski.helenos.service.StandardQueryProvider;
import com.kuprowski.helenos.service.SuperQueryProvider;
-import com.kuprowski.helenos.types.SliceResult;
-import com.kuprowski.helenos.types.qx.query.SingleColumnQuery;
+import com.kuprowski.helenos.types.Column;
+import com.kuprowski.helenos.types.Slice;
import com.kuprowski.helenos.types.qx.query.SingleSubColumnQuery;
import java.util.ArrayList;
import java.util.List;
-import java.util.UUID;
-import me.prettyprint.cassandra.serializers.SerializerTypeInferer;
import me.prettyprint.cassandra.serializers.StringSerializer;
-import me.prettyprint.cassandra.service.template.ColumnFamilyTemplate;
-import me.prettyprint.cassandra.service.template.ThriftColumnFamilyTemplate;
-import me.prettyprint.hector.api.Keyspace;
-import me.prettyprint.hector.api.Serializer;
import me.prettyprint.hector.api.beans.ColumnSlice;
import me.prettyprint.hector.api.beans.HColumn;
+import me.prettyprint.hector.api.beans.OrderedRows;
+import me.prettyprint.hector.api.beans.Row;
import me.prettyprint.hector.api.factory.HFactory;
import me.prettyprint.hector.api.query.*;
import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
/**
* ********************************************************
@@ -33,10 +29,10 @@
* *******************************************************
*/
@Component("superQueryProvider")
-public class SuperQueryProviderImpl extends AbstractProvider implements SuperQueryProvider, ClusterConfigAware {
+public class SuperQueryProviderImpl extends AbstractQueryProvider implements SuperQueryProvider, ClusterConfigAware {
@Override
- public <K, SN, N> String singleColumn(@JsonRpcParam("query") SingleSubColumnQuery<K, SN, N> query) {
+ public <K, SN, N> Column<N> singleColumn(@JsonRpcParam("query") SingleSubColumnQuery<K, SN, N> query) {
SubColumnQuery<K, SN, N, String> cq = HFactory.createSubColumnQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getsNameClass()), getSerializer(query.getNameClass()), StringSerializer.get());
cq.setColumnFamily(query.getColumnFamily());
cq.setKey(Converter.toValue(query.getKey(), query.getKeyClass()));
@@ -44,27 +40,56 @@
cq.setColumn(Converter.toValue(query.getName(), query.getNameClass()));
HColumn<N, String> column = cq.execute().get();
- return column != null ? column.getValue() : null;
+ return mapper.map(column, Column.class);
}
@Override
- public <K, SN, N> List<SliceResult<N>> slice(com.kuprowski.helenos.types.qx.query.SubSliceQuery<K, SN, N> query) {
+ public <K, SN, N> List<Slice<K,N>> predicate(com.kuprowski.helenos.types.qx.query.SubRangeQuery<K, SN, N> query) {
+ K key = Converter.toValue(query.getKeyFrom(), query.getKeyClass());
SubSliceQuery<K, SN, N, String> cq = HFactory.createSubSliceQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getsNameClass()), getSerializer(query.getNameClass()), StringSerializer.get());
cq.setColumnFamily(query.getColumnFamily());
- cq.setKey(Converter.toValue(query.getKey(), query.getKeyClass()));
+ cq.setKey(key);
cq.setSuperColumn(Converter.toValue(query.getsName(), query.getsNameClass()));
- cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMax());
-
- QueryResult<ColumnSlice<N, String>> qr = cq.execute();
+ if (CollectionUtils.isEmpty(query.getColumnNames())) {
+ cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMaxResults());
+ } else {
+ cq.setColumnNames(Converter.toValue(query.getColumnNames(), query.getNameClass()));
+ }
+
+ QueryResult<ColumnSlice<N, String>> qr = cq.execute();
+
+ List<Slice<K,N>> ret = new ArrayList<Slice<K,N>>(1);
+ if (qr != null) {
+ ret.add(new Slice(key, toJsonColumns(qr.get().getColumns())));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public <K, SN, N> List<Slice<K,N>> keyRange(com.kuprowski.helenos.types.qx.query.SubRangeQuery<K, SN, N> query) {
+ RangeSubSlicesQuery<K, SN, N, String> cq = HFactory.createRangeSubSlicesQuery(getKeyspace(query.getKeyspace()), getSerializer(query.getKeyClass()), getSerializer(query.getsNameClass()), getSerializer(query.getNameClass()), StringSerializer.get());
+ cq.setColumnFamily(query.getColumnFamily());
- List<SliceResult<N>> ret = new ArrayList<SliceResult<N>>();
+ cq.setKeys(Converter.toValue(query.getKeyFrom(), query.getKeyClass()), Converter.toValue(query.getKeyTo(), query.getKeyClass()));
+ cq.setSuperColumn(Converter.toValue(query.getsName(), query.getsNameClass()));
+ if (CollectionUtils.isEmpty(query.getColumnNames())) {
+ cq.setRange(Converter.toValue(query.getNameStart(), query.getNameClass()), Converter.toValue(query.getNameEnd(), query.getNameClass()), query.isReversed(), query.getMaxResults());
+ } else {
+ cq.setColumnNames(Converter.toValue(query.getColumnNames(),query.getNameClass()));
+ }
+
+ QueryResult<OrderedRows<K, N, String>> qr = cq.execute();
+
+ List<Slice<K,N>> ret = new ArrayList<Slice<K,N>>(1);
if (qr != null) {
- List<HColumn<N, String>> columns = qr.get().getColumns();
- for (HColumn<N, String> column : columns) {
- ret.add(new SliceResult(column));
+ List<Row<K, N, String>> rows = qr.get().getList();
+ for (Row<K, N, String> row : rows) {
+ ColumnSlice<N, String> colSlice = row.getColumnSlice();
+ ret.add(new Slice(row.getKey(), toJsonColumns(colSlice.getColumns())));
}
}
-
+
return ret;
}
}
View
40 .../kuprowski/helenos/types/SliceResult.java → ...a/com/kuprowski/helenos/types/Column.java
@@ -1,7 +1,5 @@
package com.kuprowski.helenos.types;
-import me.prettyprint.hector.api.beans.HColumn;
-
/**
* ********************************************************
* Copyright: 2012 Tomek Kuprowski
@@ -11,35 +9,45 @@
* @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
* *******************************************************
*/
+public class Column<N> {
-/* TODO change name */
-public class SliceResult<N> {
-
private N name;
private String value;
+ private long clock;
+ private int ttl;
- public SliceResult() {
-
+ public Column() {
}
-
- public SliceResult(HColumn<N, String> column) {
- setName(column.getName());
- setValue(column.getValue());
+
+ public N getName() {
+ return name;
}
-
+
public void setName(N name) {
this.name = name;
}
- public N getName() {
- return name;
+ public String getValue() {
+ return value;
}
public void setValue(String value) {
this.value = value;
}
- public String getValue() {
- return value;
+ public long getClock() {
+ return clock;
+ }
+
+ public void setClock(long clock) {
+ this.clock = clock;
+ }
+
+ public int getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(int ttl) {
+ this.ttl = ttl;
}
}
View
43 src/main/java/com/kuprowski/helenos/types/Slice.java
@@ -0,0 +1,43 @@
+package com.kuprowski.helenos.types;
+
+import java.util.List;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public class Slice<K, N> {
+
+ private K key;
+ private List<Column<N>> columns;
+
+ public Slice() {
+ super();
+ }
+
+ public Slice(K key, List<Column<N>> columns) {
+ setKey(key);
+ setColumns(columns);
+ }
+
+ public K getKey() {
+ return key;
+ }
+
+ public void setKey(K key) {
+ this.key = key;
+ }
+
+ public List<Column<N>> getColumns() {
+ return columns;
+ }
+
+ public void setColumns(List<Column<N>> columns) {
+ this.columns = columns;
+ }
+}
View
26 ...os/types/qx/query/AbstractSliceQuery.java → ...ypes/qx/query/AbstractPredicateQuery.java
@@ -9,25 +9,18 @@
* @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
* *******************************************************
*/
-public abstract class AbstractSliceQuery<K,N> extends AbstractQuery<K,N> {
+public abstract class AbstractPredicateQuery<K,N> extends AbstractRangeQuery<K,N> {
- private int max = 20;
+ private static final int DEFAULT_MAX_KEYS = 10;
private boolean reversed = true;
+ private int maxKeys = DEFAULT_MAX_KEYS;
- public AbstractSliceQuery() {
+ public AbstractPredicateQuery() {
}
- public AbstractSliceQuery(Class<K> keyClass, Class<N> nameClass, String keyspace, String columnFamily) {
+ public AbstractPredicateQuery(Class<K> keyClass, Class<N> nameClass, String keyspace, String columnFamily) {
super(keyClass, nameClass, keyspace, columnFamily);
}
-
- public void setMax(int max) {
- this.max = max;
- }
-
- public int getMax() {
- return max;
- }
public boolean isReversed() {
return reversed;
@@ -36,5 +29,12 @@ public boolean isReversed() {
public void setReversed(boolean reversed) {
this.reversed = reversed;
}
-
+
+ public void setMaxKeys(int maxKeys) {
+ this.maxKeys = maxKeys;
+ }
+
+ public int getMaxKeys() {
+ return maxKeys;
+ }
}
View
35 src/main/java/com/kuprowski/helenos/types/qx/query/AbstractRangeQuery.java
@@ -0,0 +1,35 @@
+package com.kuprowski.helenos.types.qx.query;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public abstract class AbstractRangeQuery<K,N> extends AbstractQuery<K,N> {
+
+ private static final int DEFAULT_MAX_RESULTS = 20;
+ protected int maxResults = DEFAULT_MAX_RESULTS;
+
+ public AbstractRangeQuery() {
+ }
+
+ public AbstractRangeQuery(Class<K> keyClass, Class<N> nameClass, String keyspace, String columnFamily) {
+ super(keyClass, nameClass, keyspace, columnFamily);
+ }
+
+ public AbstractRangeQuery(int maxResults) {
+ setMaxResults(maxResults);
+ }
+
+ public void setMaxResults(int maxResults) {
+ this.maxResults = maxResults;
+ }
+
+ public int getMaxResults() {
+ return maxResults;
+ }
+}
View
74 src/main/java/com/kuprowski/helenos/types/qx/query/RangeQuery.java
@@ -0,0 +1,74 @@
+package com.kuprowski.helenos.types.qx.query;
+
+import java.util.List;
+
+/**
+ * ********************************************************
+ * Copyright: 2012 Tomek Kuprowski
+ *
+ * License: GPLv2: http://www.gnu.org/licences/gpl.html
+ *
+ * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ * *******************************************************
+ */
+public class RangeQuery<K, N> extends AbstractPredicateQuery<K, N> {
+
+ private String keyFrom;
+ private String keyTo;
+ private String nameStart;
+ private String nameEnd;
+ private List<String> columnNames;
+
+ public RangeQuery() {
+ super();
+ }
+
+ public RangeQuery(Class<K> keyClass, Class<N> nameClass, String keyspace, String columnFamily, String keyFrom, String keyTo, List<String> columnNames, String nameStart, String nameEnd) {
+ super(keyClass, nameClass, keyspace, columnFamily);
+ setKeyFrom(keyFrom);
+ setKeyTo(keyTo);
+ setColumnNames(columnNames);
+ setNameStart(nameStart);
+ setNameEnd(nameEnd);
+ }
+
+ public void setKeyFrom(String keyFrom) {
+ this.keyFrom = keyFrom;
+ }
+
+ public String getKeyFrom() {
+ return keyFrom;
+ }
+
+ public void setKeyTo(String keyTo) {
+ this.keyTo = keyTo;
+ }
+
+ public String getKeyTo() {
+ return keyTo;
+ }
+
+ public String getNameStart() {
+ return nameStart;
+ }
+
+ public void setNameStart(String nameStart) {
+ this.nameStart = nameStart;
+ }
+
+ public String getNameEnd() {
+ return nameEnd;
+ }
+
+ public void setNameEnd(String nameEnd) {
+ this.nameEnd = nameEnd;
+ }
+
+ public void setColumnNames(List<String> columnNames) {
+ this.columnNames = columnNames;
+ }
+
+ public List<String> getColumnNames() {
+ return columnNames;
+ }
+}
View
54 src/main/java/com/kuprowski/helenos/types/qx/query/SliceQuery.java
@@ -1,54 +0,0 @@
-package com.kuprowski.helenos.types.qx.query;
-
-/**
- * ********************************************************
- * Copyright: 2012 Tomek Kuprowski
- *
- * License: GPLv2: http://www.gnu.org/licences/gpl.html
- *
- * @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
- * *******************************************************
- */
-public class SliceQuery<K, N> extends AbstractSliceQuery<K, N> {
-
- private String key;
- private String nameStart;
- private String nameEnd;
-
- public SliceQuery() {
- super();
- }
-
- public SliceQuery(Class<K> keyClass, Class<N> nameClass, String keyspace, String columnFamily, String key, String nameStart, String nameEnd) {
- super(keyClass, nameClass, keyspace, columnFamily);
- setKey(key);
- setNameStart(nameStart);
- setNameEnd(nameEnd);
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getNameStart() {
- return nameStart;
- }
-
- public void setNameStart(String nameStart) {
- this.nameStart = nameStart;
- }
-
- public String getNameEnd() {
- return nameEnd;
- }
-
- public void setNameEnd(String nameEnd) {
- this.nameEnd = nameEnd;
- }
-
-
-}
View
10 ...helenos/types/qx/query/SubSliceQuery.java → ...helenos/types/qx/query/SubRangeQuery.java
@@ -1,5 +1,7 @@
package com.kuprowski.helenos.types.qx.query;
+import java.util.List;
+
/**
* ********************************************************
* Copyright: 2012 Tomek Kuprowski
@@ -9,18 +11,18 @@
* @author Tomek Kuprowski (tomekkuprowski at gmail dot com)
* *******************************************************
*/
-public class SubSliceQuery<K,SN,N> extends SliceQuery<K, N> {
+public class SubRangeQuery<K,SN,N> extends RangeQuery<K, N> {
private Class<SN> sNameClass;
private String sName;
- public SubSliceQuery() {
+ public SubRangeQuery() {
super();
}
- public SubSliceQuery(Class<K> keyClass, Class<SN> sNameClass, Class<N> nameClass, String keyspace, String columnFamily, String key, String sName, String nameStart, String nameEnd) {
- super(keyClass, nameClass, keyspace, columnFamily, key, nameStart, nameEnd);
+ public SubRangeQuery(Class<K> keyClass, Class<SN> sNameClass, Class<N> nameClass, String keyspace, String columnFamily, String keyFrom, String keyTo, List<String> columnNames, String sName, String nameStart, String nameEnd) {
+ super(keyClass, nameClass, keyspace, columnFamily, keyFrom, keyTo, columnNames, nameStart, nameEnd);
setsNameClass(sNameClass);
setsName(sName);;
}
View
21 src/main/resources/xml-bean-mappings.xml
@@ -184,5 +184,26 @@
</field>
</mapping>
+ <mapping type="one-way">
+ <class-a>me.prettyprint.hector.api.beans.HColumn</class-a>
+ <class-b>com.kuprowski.helenos.types.Column</class-b>
+ <field>
+ <a>name</a>
+ <b>name</b>
+ </field>
+ <field>
+ <a>value</a>
+ <b>value</b>
+ </field>
+ <field>
+ <a>clock</a>
+ <b>clock</b>
+ </field>
+ <field>
+ <a>ttl</a>
+ <b>ttl</b>
+ </field>
+ </mapping>
+
</mappings>
View
10 src/main/webapp/gui/index.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Helenos</title>
+ <link rel="icon" type="image/ico" href="/helenos/resource/favicon.ico"/>
+ <script type="text/javascript" src="script/helenos.js"></script>
+</head>
+<body></body>
+</html>
View
2  src/main/webapp/index.html
@@ -5,7 +5,7 @@
<title>Helenos</title>
<body>
<script language='javascript' type='text/javascript'>
- window.location.href='helenos/index.html';
+ window.location.href='gui/index.html';
</script>
</body>
</html>
View
2  src/test/resources/helenos.properties
@@ -1,2 +0,0 @@
-hosts=localhost:9160
-cluster.name=FooCluster
Please sign in to comment.
Something went wrong with that request. Please try again.