Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/*
* Copyright (c) 2010-2018 SAP and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* SAP - initial API and implementation
*/
const LOGGER = require('log/logging').getLogger('http.rs.tests');
var rs = require('http/v3/rs').get();
rs.addResourceHandler("", "get", function(ctx, io){
io.response.println('OK');
}, undefined, undefined, function(){
LOGGER.info('Handling resource with GET');
})
rs.addResourceHandler("", "put", function(ctx, io){
io.response.println('OK');
}, undefined, undefined, function(){
LOGGER.info('Handling resource with PUT');
})
rs.addResourceHandler("", "post", function(ctx, io){
io.response.println('OK');
}, undefined, undefined, function(){
var HttpController = exports.HttpController = function(oMappings){
this.logger = require('log/logging').getLogger('http.rs.controller');
//var xss = require("utils/xss");
var self =this;
var matchRequestUrl = function(requestPath, method, cfg){
var pathDefs = Object.keys(cfg);
var matches = [];
for(var i=0; i
var ProtocolHandlerAdapter = function(oDataProtocolMappings){
this.logger = require('log/logging').getLogger('rs.data.dao.provider.default');
var protocolDef = oDataProtocolMappings || new DataProtocolDefinition().mappings;
var _self = this;
var parseIntStrict = function (value) {
if(/^(\-|\+)?([0-9]+|Infinity)$/.test(value))
return Number(value);
return NaN;
};
this.adapt = function(){
var protocolFunctionNames = ["query", "create", "update", "remove", "get", "count", "metadata", "associationList", "associationCreate"];
for(var i = 0; i < protocolFunctionNames.length; i++){
var functionName = protocolFunctionNames[i];
if(protocolDef[functionName]){
var resourceVerbHandlerDef;
var conn = database.getConnection(databaseType, dataSourceName);
try{
this.ormstatements = require('db/v3/ormstatements').create(this.orm, conn);
} finally {
conn.close();
}
//setup loggerName
var loggerName = logCtxName;
if(!loggerName){
loggerName = 'db.dao';
if(this.orm.table)
loggerName = 'db.dao.'+(this.orm.table.toLowerCase());
}
this.$log = require('log/logging').getLogger(loggerName);
var execQuery = require('db/v3/query');
var execUpdate = require('db/v3/update');
this.execute = function(sqlBuilder, parameterBindings){
var sql = sqlBuilder.build();
if(sql === undefined || sql.length<1)
throw Error("Illegal argument: sql from statement builder is invalid["+sql+"]");
this.$log.info('Executing SQL Statement: {}', sql);
var parameters = sqlBuilder.parameters && sqlBuilder.parameters();
var _parameterBindings;
if(parameters && parameters.length>0){
_parameterBindings = [];
for(var i = 0; i< parameters.length; i++){
var val;
var ORMStatements = function(orm, dialect){
this.$log = require('log/logging').getLogger('db.dao.ormstatements');
this.orm = orm;
this.dialect = dialect || require('db/v3/sql').getDialect();
};
ORMStatements.prototype.constructor = ORMStatements;
var Statements = exports.Statements = function(){
this.$log = require('log/logging').getLogger('org. eclipse.dirigible.db.dao.statements');
};
exports.get = function(){