Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some test with json-rpc and named params

  • Loading branch information...
commit 67981438d219f4196cb5f0d969a5f81c23663fe0 1 parent d8e50da
tomek authored
View
2  src/main/frontend/source/class/helenos/util/Rpc.js
@@ -19,7 +19,7 @@ qx.Class.define('helenos.util.Rpc',
members : {
__getRemoteUri : function(serviceName) {
- return window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/' + serviceName + '.json';
+ return window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + serviceName;
}
}
});
View
18 src/main/frontend/source/class/helenos/util/RpcActionsProvider.js
@@ -9,38 +9,42 @@ Authors:
qx.Class.define('helenos.util.RpcActionsProvider', {
statics : {
+
+ _SCHEMA : '/Schema.json',
+ _QUERY : '/Query.json',
+
dropKeyspace : function(keyspaceName) {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
rpc.callSync('dropKeyspace', keyspaceName);
},
describeClusterName : function() {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('describeClusterName');
},
describeKeyspaces : function() {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('describeKeyspaces');
},
describeColumnFamily : function(keyspaceName, columnFamily) {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('describeColumnFamily', keyspaceName, columnFamily);
},
truncateColumnFamily : function(keyspaceName, columnFamily) {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('truncateColumnFamily', keyspaceName, columnFamily);
},
dropColumnFamily : function(keyspaceName, columnFamily) {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('dropColumnFamily', keyspaceName, columnFamily);
},
createColumnFamily : function(formData) {
- var rpc = new helenos.util.Rpc('Cluster');
+ var rpc = new helenos.util.Rpc(this._SCHEMA);
return rpc.callSync('createColumnFamily', formData);
}
}
View
24 src/main/java/com/kuprowski/helenos/service/QueryProvider.java
@@ -0,0 +1,24 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.kuprowski.helenos.service;
+
+import com.googlecode.jsonrpc4j.JsonRpcParam;
+import com.kuprowski.helenos.types.JsonColumnFamilyDefinition;
+import com.kuprowski.helenos.types.JsonKeyspaceDefinition;
+import com.kuprowski.helenos.types.qx.QxJsonColumnFamilyDefinition;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ *
+ * @author tomek
+ */
+public interface QueryProvider {
+
+ String get(String columnFamily, UUID uuidKey, String column);
+ String get(String columnFamily, String stringKey, String column);
+
+ String getUK(@JsonRpcParam("cf") String columnFamily, @JsonRpcParam("key") UUID key, @JsonRpcParam("column") String column);
+}
View
35 src/main/java/com/kuprowski/helenos/service/impl/QueryProviderImpl.java
@@ -0,0 +1,35 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.kuprowski.helenos.service.impl;
+
+import com.googlecode.jsonrpc4j.JsonRpcParam;
+import com.kuprowski.helenos.service.QueryProvider;
+import java.util.UUID;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author tomek
+ */
+@Component("queryProvider")
+public class QueryProviderImpl extends AbstractProvider implements QueryProvider {
+
+ @Override
+ public String get(String columnFamily, UUID uuidKey, String column) {
+ return "UUID xxx";
+ }
+
+ @Override
+ public String get(String columnFamily, String stringKey, String column) {
+ return "String xxx";
+ }
+
+
+
+ @Override
+ public String getUK(@JsonRpcParam("cf") String columnFamily, UUID key, String column) {
+ return "UUID yyy";
+ }
+}
View
5 src/main/webapp/WEB-INF/helenos-servlet.xml
@@ -11,7 +11,10 @@
<property name="serviceInterface" value="com.kuprowski.helenos.service.SchemaProvider"/>
</bean>
-
+ <bean name="/Query.json" class="com.googlecode.jsonrpc4j.spring.JsonServiceExporter">
+ <property name="service" ref="queryProvider"/>
+ <property name="serviceInterface" value="com.kuprowski.helenos.service.QueryProvider"/>
+ </bean>
<mvc:resources mapping="/helenos/**" location="/helenos/" />
</beans>
Please sign in to comment.
Something went wrong with that request. Please try again.