diff --git a/api-data-store-server-javascript/src/js/server-data-store-facade.js b/api-data-store-server-javascript/src/js/server-data-store-facade.js index 25b21092030873c8e1d1376a1f7777eee06c0df4..c2a1cb8e49fd691b58ea1ec88cf2b5a41e904b05 100644 --- a/api-data-store-server-javascript/src/js/server-data-store-facade.js +++ b/api-data-store-server-javascript/src/js/server-data-store-facade.js @@ -1,25 +1,25 @@ /** * ====================================================== - * OpenBIS Datastore facade internal code (DO NOT USE!!!) + * OpenBIS Data Store Server facade internal code (DO NOT USE!!!) * ====================================================== */ -function _datastoreInternal(datastoreUrlOrNull, httpServerUri){ +function _dataStoreServerInternal(datastoreUrlOrNull, httpServerUri){ this.init(datastoreUrlOrNull, httpServerUri); } -_datastoreInternal.prototype.init = function(datastoreUrlOrNull, httpServerUri){ +_dataStoreServerInternal.prototype.init = function(datastoreUrlOrNull, httpServerUri){ this.datastoreUrl = this.normalizeUrl(datastoreUrlOrNull, httpServerUri); this.httpServerUri = httpServerUri; } -_datastoreInternal.prototype.log = function(msg){ +_dataStoreServerInternal.prototype.log = function(msg){ if(console){ console.log(msg); } } -_datastoreInternal.prototype.normalizeUrl = function(openbisUrlOrNull, httpServerUri){ +_dataStoreServerInternal.prototype.normalizeUrl = function(openbisUrlOrNull, httpServerUri){ var parts = this.parseUri(window.location); if(openbisUrlOrNull){ @@ -37,15 +37,15 @@ _datastoreInternal.prototype.normalizeUrl = function(openbisUrlOrNull, httpServe return parts.protocol + "://" + parts.authority + httpServerUri; } -_datastoreInternal.prototype.getUrlForMethod = function(method) { +_dataStoreServerInternal.prototype.getUrlForMethod = function(method) { return this.datastoreUrl + "?method=" + method; } -_datastoreInternal.prototype.jsonRequestData = function(params) { +_dataStoreServerInternal.prototype.jsonRequestData = function(params) { return JSON.stringify(params); } -_datastoreInternal.prototype.sendHttpRequest = function(httpMethod, contentType, url, data, callback) { +_dataStoreServerInternal.prototype.sendHttpRequest = function(httpMethod, contentType, url, data, callback) { const xhr = new XMLHttpRequest(); xhr.open(httpMethod, url); xhr.setRequestHeader("content-type", contentType); @@ -72,7 +72,7 @@ _datastoreInternal.prototype.sendHttpRequest = function(httpMethod, contentType, - _datastoreInternal.prototype.buildGetUrl = function(queryParams) { + _dataStoreServerInternal.prototype.buildGetUrl = function(queryParams) { const queryString = Object.keys(queryParams) .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`) .join('&'); @@ -83,7 +83,7 @@ _datastoreInternal.prototype.sendHttpRequest = function(httpMethod, contentType, // Functions for working with cookies (see http://www.quirksmode.org/js/cookies.html) -_datastoreInternal.prototype.createCookie = function(name,value,days) { +_dataStoreServerInternal.prototype.createCookie = function(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); @@ -93,7 +93,7 @@ _datastoreInternal.prototype.createCookie = function(name,value,days) { document.cookie = name+"="+value+expires+"; path=/"; } -_datastoreInternal.prototype.readCookie = function(name) { +_dataStoreServerInternal.prototype.readCookie = function(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { @@ -104,13 +104,13 @@ _datastoreInternal.prototype.readCookie = function(name) { return null; } -_datastoreInternal.prototype.eraseCookie = function(name) { +_dataStoreServerInternal.prototype.eraseCookie = function(name) { this.createCookie(name,"",-1); } // parseUri 1.2.2 (c) Steven Levithan <stevenlevithan.com> MIT License (see http://blog.stevenlevithan.com/archives/parseuri) -_datastoreInternal.prototype.parseUri = function(str) { +_dataStoreServerInternal.prototype.parseUri = function(str) { var options = { strictMode: false, key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], @@ -160,8 +160,8 @@ function parseJsonResponse(rawResponse, action) { * The facade provides access to the DSS methods * */ -function datastore(datastoreUrlOrNull, httpServerUri) { - this._internal = new _datastoreInternal(datastoreUrlOrNull, httpServerUri); +function dataStoreServer(datastoreUrlOrNull, httpServerUri) { + this._internal = new _dataStoreServerInternal(datastoreUrlOrNull, httpServerUri); } @@ -176,8 +176,8 @@ function datastore(datastoreUrlOrNull, httpServerUri) { * * @method */ -datastore.prototype.rememberSession = function() { - this._internal.createCookie('datastore', this.getSession(), 1); +dataStoreServer.prototype.rememberSession = function() { + this._internal.createCookie('dataStoreServer', this.getSession(), 1); } /** @@ -185,8 +185,8 @@ datastore.prototype.rememberSession = function() { * * @method */ -datastore.prototype.forgetSession = function() { - this._internal.eraseCookie('datastore'); +dataStoreServer.prototype.forgetSession = function() { + this._internal.eraseCookie('dataStoreServer'); } /** @@ -194,8 +194,8 @@ datastore.prototype.forgetSession = function() { * * @method */ -datastore.prototype.restoreSession = function() { - this._internal.sessionToken = this._internal.readCookie('datastore'); +dataStoreServer.prototype.restoreSession = function() { + this._internal.sessionToken = this._internal.readCookie('dataStoreServer'); } /** @@ -203,7 +203,7 @@ datastore.prototype.restoreSession = function() { * * @method */ -datastore.prototype.useSession = function(sessionToken){ +dataStoreServer.prototype.useSession = function(sessionToken){ this._internal.sessionToken = sessionToken; } @@ -212,7 +212,7 @@ datastore.prototype.useSession = function(sessionToken){ * * @method */ -datastore.prototype.getSession = function(){ +dataStoreServer.prototype.getSession = function(){ return this._internal.sessionToken; } @@ -221,7 +221,7 @@ datastore.prototype.getSession = function(){ * * @method */ -datastore.prototype.setInteractiveSessionKey = function(interactiveSessionKey){ +dataStoreServer.prototype.setInteractiveSessionKey = function(interactiveSessionKey){ this._internal.interactiveSessionKey = interactiveSessionKey; } @@ -230,7 +230,7 @@ datastore.prototype.setInteractiveSessionKey = function(interactiveSessionKey){ * * @method */ -datastore.prototype.getInteractiveSessionKey = function(){ +dataStoreServer.prototype.getInteractiveSessionKey = function(){ return this._internal.interactiveSessionKey; } @@ -239,7 +239,7 @@ datastore.prototype.getInteractiveSessionKey = function(){ * * @method */ -datastore.prototype.setTransactionManagerKey = function(transactionManagerKey){ +dataStoreServer.prototype.setTransactionManagerKey = function(transactionManagerKey){ this._internal.transactionManagerKey = transactionManagerKey; } @@ -248,11 +248,11 @@ datastore.prototype.setTransactionManagerKey = function(transactionManagerKey){ * * @method */ -datastore.prototype.getTransactionManagerKey = function(){ +dataStoreServer.prototype.getTransactionManagerKey = function(){ return this._internal.transactionManagerKey; } -datastore.prototype.fillCommonParameters = function(params) { +dataStoreServer.prototype.fillCommonParameters = function(params) { if(this.getSession()) { params["sessionToken"] = this.getSession(); } @@ -272,7 +272,7 @@ const encodeParams = p => Object.entries(p).map(kv => kv.map(encodeURIComponent * * @method */ -datastore.prototype.login = function(userId, userPassword, action) { +dataStoreServer.prototype.login = function(userId, userPassword, action) { var datastoreObj = this const data = this.fillCommonParameters({ "method": "login", @@ -298,7 +298,7 @@ datastore.prototype.login = function(userId, userPassword, action) { * Checks whether the current session is still active. * */ -datastore.prototype.isSessionValid = function(action) { +dataStoreServer.prototype.isSessionValid = function(action) { if(this.getSession()){ const data = this.fillCommonParameters({"method":"isSessionValid"}); this._internal.sendHttpRequest( @@ -321,7 +321,7 @@ datastore.prototype.isSessionValid = function(action) { * @see isSessionActive() * @method */ -datastore.prototype.ifRestoredSessionActive = function(action) { +dataStoreServer.prototype.ifRestoredSessionActive = function(action) { this.restoreSession(); this.isSessionValid(function(data) { if (data.result) action(data) }); } @@ -331,7 +331,7 @@ datastore.prototype.ifRestoredSessionActive = function(action) { * * @method */ -datastore.prototype.logout = function(action) { +dataStoreServer.prototype.logout = function(action) { this.forgetSession(); if(this.getSession()){ @@ -358,7 +358,7 @@ datastore.prototype.logout = function(action) { /** * List files in the DSS for given owner and source */ -datastore.prototype.list = function(owner, source, recursively, action){ +dataStoreServer.prototype.list = function(owner, source, recursively, action){ const data = this.fillCommonParameters({ "method": "list", "owner" : owner, @@ -382,7 +382,7 @@ datastore.prototype.list = function(owner, source, recursively, action){ * @param {int} limit how many characters to read * @param {*} action post-processing action */ -datastore.prototype.read = function(owner, source, offset, limit, action){ +dataStoreServer.prototype.read = function(owner, source, offset, limit, action){ const data = this.fillCommonParameters({ "method": "read", "owner" : owner, @@ -416,7 +416,7 @@ function hex2a(hexx) { * @param {str} data data to write * @param {*} action post-processing action */ -datastore.prototype.write = function(owner, source, offset, data, action){ +dataStoreServer.prototype.write = function(owner, source, offset, data, action){ const params = this.fillCommonParameters({ "method": "write", "owner" : owner, @@ -441,7 +441,7 @@ datastore.prototype.write = function(owner, source, offset, data, action){ * @param {str} source path to file * @param {*} action post-processing action */ -datastore.prototype.delete = function(owner, source, action){ +dataStoreServer.prototype.delete = function(owner, source, action){ const data = this.fillCommonParameters({ "method": "delete", "owner" : owner, @@ -459,7 +459,7 @@ datastore.prototype.delete = function(owner, source, action){ /** * Copy file within DSS */ -datastore.prototype.copy = function(sourceOwner, source, targetOwner, target, action){ +dataStoreServer.prototype.copy = function(sourceOwner, source, targetOwner, target, action){ const data = this.fillCommonParameters({ "method": "copy", "sourceOwner" : sourceOwner, @@ -479,7 +479,7 @@ datastore.prototype.copy = function(sourceOwner, source, targetOwner, target, ac /** * Move file within DSS */ -datastore.prototype.move = function(sourceOwner, source, targetOwner, target, action){ +dataStoreServer.prototype.move = function(sourceOwner, source, targetOwner, target, action){ const data = this.fillCommonParameters({ "method": "move", "sourceOwner" : sourceOwner, @@ -504,7 +504,7 @@ datastore.prototype.move = function(sourceOwner, source, targetOwner, target, ac * ================================================================================== */ -datastore.prototype.begin = function(transactionId, action){ +dataStoreServer.prototype.begin = function(transactionId, action){ const data = this.fillCommonParameters({ "method": "begin", "transactionId" : transactionId @@ -519,7 +519,7 @@ datastore.prototype.begin = function(transactionId, action){ } -datastore.prototype.prepare = function(action){ +dataStoreServer.prototype.prepare = function(action){ const data = this.fillCommonParameters({ "method": "prepare" }); @@ -533,7 +533,7 @@ datastore.prototype.prepare = function(action){ } -datastore.prototype.commit = function(action){ +dataStoreServer.prototype.commit = function(action){ const data = this.fillCommonParameters({ "method": "commit" }); @@ -548,7 +548,7 @@ datastore.prototype.commit = function(action){ } -datastore.prototype.rollback = function(action){ +dataStoreServer.prototype.rollback = function(action){ const data = this.fillCommonParameters({ "method": "rollback" }); @@ -561,7 +561,7 @@ datastore.prototype.rollback = function(action){ ); } -datastore.prototype.recover = function(action){ +dataStoreServer.prototype.recover = function(action){ const data = this.fillCommonParameters({ "method": "recover" }); diff --git a/api-openbis-javascript/src/v3/openbis.js b/api-openbis-javascript/src/v3/openbis.js index 354ee23ff2b50676f68cc0b1252497d5e4470a74..faa8c1f5d2bcac3d607a5c76eb1730201887f018 100644 --- a/api-openbis-javascript/src/v3/openbis.js +++ b/api-openbis-javascript/src/v3/openbis.js @@ -94,7 +94,11 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria } } - var dataStoreFacade = function(facade, dataStoreCodes) { + var dataStoreServerFacade = function() { + + } + + var originalDataStoreServerFacade = function(facade, dataStoreCodes) { this._getDataStores = function() { if (this._dataStores) { @@ -413,7 +417,7 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria } } - var facade = function(openbisUrl) { + var applicationServerFacade = function(openbisUrl) { if (!openbisUrl) { openbisUrl = "/openbis/openbis/rmi-application-server-v3.json"; @@ -2352,7 +2356,7 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria for (var i = 0; i < arguments.length; i++) { dataStoreCodes.push(arguments[i]); } - return new dataStoreFacade(this, dataStoreCodes); + return new originalDataStoreServerFacade(this, dataStoreCodes); } this.getMajorVersion = function() { @@ -2439,6 +2443,6 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria } } - return facade; + return applicationServerFacade; }); \ No newline at end of file diff --git a/core-plugin-openbis/build.gradle b/core-plugin-openbis/build.gradle index 5918280fb0ccd3091643274639f71428c33d0125..d2f670e07fbd77e8971cd72cb353a1c7a71ba428 100644 --- a/core-plugin-openbis/build.gradle +++ b/core-plugin-openbis/build.gradle @@ -212,6 +212,7 @@ task copyOpenbisStaticResources(type: Copy) { task copyV3ApiResources(type: Copy, dependsOn: [copyOpenbisStaticResources, ':api-openbis-javascript:bundleOpenbisStaticResources']) { from("${project(':api-openbis-javascript').projectDir}/src/v3") + from("${project(':api-data-store-server-javascript').projectDir}/src/js") into "${gwtModuleBuildDir}/resources/api/v3" } diff --git a/server-application-server/gwtdev.gradle b/server-application-server/gwtdev.gradle index 1e330d220c161b418b96133fa5c33201c713e042..7615cf2cd54f7a70589eeae4a3ec574c4ba63c32 100644 --- a/server-application-server/gwtdev.gradle +++ b/server-application-server/gwtdev.gradle @@ -97,7 +97,12 @@ task copyV3Api(type: Copy, dependsOn: [compileGWTToTempJDK11, ':api-openbis-java into "${gwtTempPath}/ch.systemsx.cisd.openbis.OpenBIS/resources/api/v3" } -task openBISDevelopmentEnvironmentASPrepare(type: Copy, dependsOn: copyV3Api) { +task copyDSSApi(type: Copy) { + from("${project(':api-data-store-server-javascript').projectDir}/src/js") + into "${gwtTempPath}/ch.systemsx.cisd.openbis.OpenBIS/resources/api/v3" +} + +task openBISDevelopmentEnvironmentASPrepare(type: Copy, dependsOn: [copyV3Api, copyDSSApi]) { from "${gwtTempPath}/ch.systemsx.cisd.openbis.OpenBIS" into "targets/www/openbis-test" } diff --git a/server-data-store/src/main/resources/server-data-store-config.properties b/server-data-store/src/main/resources/server-data-store-config.properties index 850f4ccd20ba0a4e0b757b8b9d41bb324ed2a2dc..5717f55f1a53bcd6482de856a067c409f184513b 100755 --- a/server-data-store/src/main/resources/server-data-store-config.properties +++ b/server-data-store/src/main/resources/server-data-store-config.properties @@ -8,7 +8,7 @@ writeAheadLogRoot=./target/tests/transactions storageRoot=./target/tests/storage httpServerClass=ch.ethz.sis.afsserver.http.impl.NettyHttpServer -httpServerUri=/fileserver +httpServerUri=/data-store-server httpServerPort=8085 httpMaxContentLength=1024 diff --git a/ui-admin/index.html b/ui-admin/index.html index 1352563f9eeb4115673d0282f6c453d622f18c61..2793a6673f6e67a8ac60a8d60eb1eb507584898b 100644 --- a/ui-admin/index.html +++ b/ui-admin/index.html @@ -40,6 +40,7 @@ onerror="loadError()" ></script> <script src="/openbis/resources/api/v3/require.js"></script> + <script src="/openbis/resources/api/data-store-server/server-data-store-facade.js"></script> </head> <body> <div id="app"></div>