Commit 7ae1bf86 authored by priit's avatar priit
Browse files

Logimise parendamine

parent c9d5bb69
......@@ -5,7 +5,7 @@ var config = require(__base + 'config');
var DaoService = function(){
var self = this;
var prefix = config.wrapper.port + ':';
var prefix = config.wrapper.id + ':';
this.client = redis.createClient(config.redis.port, config.redis.host, {});
......
......@@ -43,6 +43,15 @@ var FileUtil = {
rmdir: function(path, callback){
return rimraf(path, callback);
},
getExtension: function ( filename ) {
var dotIndex = filename.lastIndexOf('.');
if(dotIndex > -1){
return filename.substr(filename.lastIndexOf('.')+1);
}
return null;
}
};
......
......@@ -6,6 +6,7 @@ var CommandModel = require('../src/mapper/commandModel');
var fs = require('fs');
var mime = require('mime');
var path = require('path');
var FileUtil = require('./../src/util/file');
function SimpleLocalCommand(){
......@@ -29,7 +30,7 @@ function SimpleLocalCommand(){
session.addOutputFile('output', {
type: 'output',
fileName: path.basename(response.stdOutPath),
fileName: config.wrapper.id + '_output.' + FileUtil.getExtension( response.stdOutPath ),
filePath: response.stdOutPath,
contentType: mime.lookup(response.stdOutPath)
});
......
......@@ -8,6 +8,7 @@ var CommandModel = require('../src/mapper/commandModel');
var fs = require('fs');
var mime = require('mime');
var path = require('path');
var FileUtil = require('./../src/util/file');
function Tokenizer(){
......@@ -72,7 +73,7 @@ function Tokenizer(){
session.addOutputFile('output', {
type: 'output',
fileName: path.basename(model.outputPaths.outputPath1),
fileName: config.wrapper.id + '_output.' + FileUtil.getExtension( model.outputPaths.outputPath1 ),
filePath: model.outputPaths.outputPath1,
contentType: mime.lookup(model.outputPaths.outputPath1)
});
......@@ -80,20 +81,16 @@ function Tokenizer(){
SessionService.storeToFile(session.id, mapping, { extension:'txt' }, function (error, mappingPath) {
session.addOutputFile('mapping', {
type: 'mapping',
fileName: path.basename(mappingPath),
fileName: config.wrapper.id + '_mapping.' + FileUtil.getExtension( mappingPath ),
filePath: mappingPath,
contentType: mime.lookup(mappingPath)
});
return callback( error, session );
});
});
});
});
});
};
......
......@@ -165,6 +165,7 @@ config.availableWappers = {
LAUSESTAJA : {
title: 'Lausestaja',
id: 'lau',
port: 3001,
class: 'simpleLocalCommand',
command: config.availableCommands.LAUSESTAJA,
......@@ -172,6 +173,7 @@ config.availableWappers = {
},
MORFANALYSAATOR : {
title: 'Morfoloogiline analüüs',
id: 'moa',
port: 3002,
class: 'simpleLocalCommand',
command: config.availableCommands.MORFANALYSAATOR,
......@@ -179,6 +181,7 @@ config.availableWappers = {
},
OSALAUSESTAJA : {
title: 'Osalausestaja',
id: 'osl',
port: 3003,
class: 'simpleLocalCommand',
command: config.availableCommands.OSALAUSESTAJA,
......@@ -186,6 +189,7 @@ config.availableWappers = {
},
MORFYHESTAJA: {
title: 'Morfoloogiline ühestamine (kitsenduste grammatika)',
id: 'moy',
port: 3004,
class: 'simpleLocalCommand',
command: config.availableCommands.MORFYHESTAJA,
......@@ -193,6 +197,7 @@ config.availableWappers = {
},
PIND_SYN: {
title: 'Pindsüntaktiline analüüs',
id: 'pia',
port: 3005,
class: 'simpleLocalCommand',
command: config.availableCommands.PIND_SYN,
......@@ -200,21 +205,23 @@ config.availableWappers = {
},
S6LT_SYN: {
title: 'Sõltuvussüntaktiline analüüs (ja järeltöötlus)',
id: 's6a',
port: 3006,
class: 'simpleLocalCommand',
command: config.availableCommands.S6LT_SYN,
requestConf: simpleCommandRequest
},
ARCHIVE_EXTRACTOR: {
title: 'Arhiivi lahtipakkija',
id: 'uzip',
port: 3007,
class: 'archiveExtractor',
requestConf: simpleCommandRequest
},
TOKENIZER : {
title: 'Sõnestaja',
id: 's6n',
port: 3008,
class: 'tokenizer',
command: config.availableCommands.TOKENIZER,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment