Commit 11e8d0fa authored by Nikhil Rane's avatar Nikhil Rane
Browse files

Initial commit for AutoStudio.

parents
autostudio
==========
Readme is being updated yet.
{
"_comment" : "***I hold config data for whole app. Make sure there is no error here, else app won't start and I will not be able to help!***",
"database" : {
"url" : "mongodb://",
"host" : "localhost",
"port": 27017,
"name" : "autostudio_db"
}
}
\ No newline at end of file
{
"_comment": "***I hold all config data for ---PipeStudio--- app.***",
"dbName": "pstudio",
"example.shape.Aggregate": {
"operator": "aggregate",
"type": "example.shape.Aggregate",
"noOfInputs": 1,
"parameters": {
"on": {
"required": true,
"bracketsRequired": false
},
"generate": {
"required": true,
"bracketsRequired": false
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": true,
"bracketsRequired": false
}
}
},
"example.shape.DBJoin": {
"operator": "db_join",
"type": "example.shape.DBJoin",
"noOfInputs": 0,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.DBSource": {
"operator": "db_source",
"type": "example.shape.DBSource",
"noOfInputs": 0,
"parameters": {
"with": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.DBWriter": {
"operator": "db_writer",
"type": "example.shape.DBWriter",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.FileSource": {
"operator": "file_source",
"type": "example.shape.FileSource",
"noOfInputs": 0,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Filter": {
"operator": "filter",
"type": "example.shape.Filter",
"noOfInputs": 1,
"parameters": {
"by": {
"required": true,
"bracketsRequired": false
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Macro_Def": {
"operator": "define",
"type": "example.shape.Macro_Def",
"noOfInputs": 1,
"parameters": {
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Map": {
"operator": "map",
"type": "example.shape.Map",
"noOfInputs": 1,
"parameters": {
"on": {
"required": true,
"bracketsRequired": false
},
"do": {
"required": true,
"bracketsRequired": false
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Matcher": {
"operator": "matcher",
"type": "example.shape.Matcher",
"noOfInputs": 1,
"parameters": {
"event": {
"required": true,
"bracketsRequired": false
},
"where": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.MemorySource": {
"operator": "memory_source",
"type": "example.shape.MemorySource",
"noOfInputs": 0,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Project": {
"operator": "project",
"type": "example.shape.Project",
"noOfInputs": 1,
"parameters": {
"generate": {
"required": true,
"bracketsRequired": false
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.RelationHashJoin": {
"operator": "relation_hash_join",
"type": "example.shape.RelationHashJoin",
"noOfInputs": 2,
"parameters": {
"on": {
"required": true,
"bracketsRequired": false
},
"by": {
"required": true,
"bracketsRequired": false
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.RScript": {
"operator": "rscript",
"type": "example.shape.RScript",
"noOfInputs": 1,
"parameters": {
"on": {
"required": true,
"bracketsRequired": false
},
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.SlidingWindow": {
"operator": "sliding_window",
"type": "example.shape.SlidingWindow",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.SocketSink": {
"operator": "socket_sink",
"type": "example.shape.SocketSink",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.SocketSource": {
"operator": "socket_source",
"type": "example.shape.SocketSource",
"noOfInputs": 0,
"parameters": {
"with": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.SPARQLJoin": {
"operator": "sparql_join",
"type": "example.shape.SPARQLJoin",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.StreamWriter": {
"operator": "stream_writer",
"type": "example.shape.StreamWriter",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.SymmetricHashJoin": {
"operator": "symmetric_hash_join",
"type": "example.shape.SymmetricHashJoin",
"noOfInputs": 2,
"parameters": {
"on": {
"required": true,
"bracketsRequired": false
},
"by": {
"required": true,
"bracketsRequired": false
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Triplifier": {
"operator": "triplifier",
"type": "example.shape.Triplifier",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Tuplifier": {
"operator": "tuplifier",
"type": "example.shape.Tuplifier",
"noOfInputs": 1,
"parameters": {
"with": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.TwitterReader": {
"operator": "twitter_reader",
"type": "example.shape.TwitterReader",
"noOfInputs": 0,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Union": {
"operator": "union",
"type": "example.shape.Union",
"noOfInputs": 2,
"parameters": {
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.User_Defined": {
"operator": "user_defined",
"type": "example.shape.User_Defined",
"noOfInputs": 0,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"with": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.Use_Predefined": {
"operator": "use_predefined",
"type": "example.shape.Use_Predefined",
"noOfInputs": 1,
"parameters": {
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.ZmqPublisher": {
"operator": "zmq_publisher",
"type": "example.shape.ZmqPublisher",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.ZmqPull": {
"operator": "zmq_pull",
"type": "example.shape.ZmqPull",
"noOfInputs": 0,
"parameters": {
"with": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.ZmqPush": {
"operator": "zmq_push",
"type": "example.shape.ZmqPush",
"noOfInputs": 1,
"parameters": {
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"example.shape.ZmqSubscriber": {
"operator": "zmq_subscriber",
"type": "example.shape.ZmqSubscriber",
"noOfInputs": 0,
"parameters": {
"with": {
"required": true,
"bracketsRequired": true
},
"using": {
"required": true,
"bracketsRequired": true
},
"comment": {
"required": false,
"bracketsRequired": false
}
}
},
"_comment": "***Below are properties for execution of ---PipeStudio--- app.***",
"pflow_compiler": "/home/nikhilrane/git_rep/autostudio/executions/scripts/compiler.ini"
}
\ No newline at end of file
/*
* Define the URLs and methods for authentication purposes
*/
module.exports = function(app, mongo) {
// This is a middleware that we will use on routes where
// we _require_ that a user is logged in
function requireUser(req, res, next){
if (!req.user) {
res.redirect('/not_allowed');
} else {
next();
}
}
// This middleware checks if the user is logged in and sets
// req.user and res.locals.user appropriately if so.
function checkIfLoggedIn(req, res, next){
if (req.session.username) {
var coll = mongo.collection('users');
coll.findOne({username: req.session.username}, function(err, user){
if (user) {
// set a 'user' property on req
// so that the 'requireUser' middleware can check if the user is
// logged in
req.user = user;
// Set a res.locals variable called 'user' so that it is available
// to every handlebars template.
res.locals.user = user;
}
next();
});
} else {
next();
}
}
// We must use this middleware _after_ the expressSession middleware,
// because checkIfLoggedIn checks the `req.session.username` value,
// which will not be available until after the session middleware runs.
app.use(checkIfLoggedIn);
app.get('/login', function(req, res){
res.status(200).sendfile('./public/login.html');
});
// Returns the user's data so we can greet the client nicely!
app.get('/userData', function(req, res){
var user = req.query.username;
var coll = mongo.collection('users');
// make sure this username does not exist already
coll.findOne({username: user}, {fullName: 1, _id:0}, function(err, fullName){
if (err) {
throw new Error("Error while getting user's full name: " + err);
}
res.end(JSON.stringify(fullName));
});
});
app.get('/logout', function(req, res){
delete req.session.username;