SIGMOD Demo Version
parent
cc6be2fbfb
commit
9c7a1b135c
|
@ -73,12 +73,12 @@ public class DatabaseServer {
|
|||
/*
|
||||
* Uncomment for local web server
|
||||
*/
|
||||
//_urls = new URLFactory("http://localhost:8080/vizier-db/api/v1");
|
||||
_urls = new URLFactory("http://localhost:8080/vizier-db/api/v1");
|
||||
|
||||
/*
|
||||
* Uncomment for current AWS deployment
|
||||
*/
|
||||
_urls = new URLFactory("http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com/api/v1");
|
||||
//_urls = new URLFactory("http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com/api/v1");
|
||||
|
||||
_resources = new ResourceManager(new File(context.getRealPath("/WEB-INF/resources")));
|
||||
_vdb = new SimpleVizierDBM(_resources);
|
||||
|
@ -318,7 +318,12 @@ public class DatabaseServer {
|
|||
throw new WebApplicationException(500);
|
||||
}
|
||||
if (script != null) {
|
||||
return Response.ok().entity(new ScriptSQLStatementStream(script)).type(MediaType.APPLICATION_JSON).build();
|
||||
try {
|
||||
return Response.ok().entity(new ScriptSQLStatementStream(_vdb.getNotebook(notebookIdentifier), script)).type(MediaType.APPLICATION_JSON).build();
|
||||
} catch (org.vizierdb.VizirDBException vizierException ){
|
||||
Logger.getLogger(DatabaseServer.class.getName()).log(Level.SEVERE, null, vizierException);
|
||||
throw new WebApplicationException(500);
|
||||
}
|
||||
} else {
|
||||
throw new WebApplicationException(404);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,16 @@
|
|||
package org.vizierdb.server.io;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
import org.vizierdb.database.Column;
|
||||
import org.vizierdb.database.ColumnList;
|
||||
import org.vizierdb.database.Notebook;
|
||||
import org.vizierdb.database.script.VizUALScript;
|
||||
import org.vizierdb.sql.MimirAdaptor;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,11 +31,13 @@ import org.vizierdb.database.script.VizUALScript;
|
|||
*/
|
||||
public class ScriptSQLStatementStream implements StreamingOutput{
|
||||
|
||||
private final Notebook _notebook;
|
||||
private final VizUALScript _script;
|
||||
|
||||
public ScriptSQLStatementStream(VizUALScript script) {
|
||||
public ScriptSQLStatementStream(Notebook notebook, VizUALScript script) {
|
||||
|
||||
_script = script;
|
||||
_notebook = notebook;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,6 +52,11 @@ public class ScriptSQLStatementStream implements StreamingOutput{
|
|||
writer.getWriter().endObject();
|
||||
}
|
||||
writer.getWriter().endArray();
|
||||
try {
|
||||
writer.getWriter().name("mimir").value(MimirAdaptor.compileToSQL(_notebook));
|
||||
} catch (org.vizierdb.VizirDBException ex) {
|
||||
writer.getWriter().name("mimir").value(ex.getMessage());
|
||||
}
|
||||
writer.getWriter().endObject();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,22 @@ p.panel-subheadline {
|
|||
}
|
||||
|
||||
p.sql-statement {
|
||||
font-weight: bold;
|
||||
color: #00313C;
|
||||
font-size: 1.05em;
|
||||
color: #004b87;
|
||||
padding-left: 10px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
p.mimir-statement {
|
||||
font-size: 1.05em;
|
||||
color: #004b87;
|
||||
padding-left: 10px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
h4.modal-subheadline {
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
if (url && url.length > 1) {
|
||||
url = decodeURIComponent(url[1]);
|
||||
} else {
|
||||
//url = "http://localhost:8080/vizier-db/doc/vizier-db.yaml";
|
||||
url = "http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com/doc/vizier-db.yaml";
|
||||
url = "http://localhost:8080/vizier-db/doc/vizier-db.yaml";
|
||||
//url = "http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com/doc/vizier-db.yaml";
|
||||
}
|
||||
|
||||
hljs.configure({
|
||||
|
|
|
@ -11,8 +11,8 @@ info:
|
|||
|
||||
schemes:
|
||||
- http
|
||||
host: vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com
|
||||
#host: localhost:8080/vizier-db
|
||||
#host: vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com
|
||||
host: localhost:8080/vizier-db
|
||||
basePath: /api/v1
|
||||
|
||||
paths:
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
*
|
||||
* @type String
|
||||
*/
|
||||
var apiUrl = 'http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com//api/v1';
|
||||
//var apiUrl = 'http://localhost:8080/vizier-db/api/v1';
|
||||
//var apiUrl = 'http://vizirdb.7mi5uspdsy.us-west-2.elasticbeanstalk.com//api/v1';
|
||||
var apiUrl = 'http://localhost:8080/vizier-db/api/v1';
|
||||
|
||||
/**
|
||||
* Maintains global variables for the current notebook
|
||||
|
@ -612,10 +612,22 @@ function showSQL() {
|
|||
if (url) {
|
||||
$.get(url, function(data, status) {
|
||||
if (status === 'success') {
|
||||
var innerHtml = '<div class="sql-statement">';
|
||||
//var innerHtml = '<div class="sql-statement"><h4 class="modal-subheadline">SQL Statements</h4>';
|
||||
var sql = '';
|
||||
for (var iOp = 0; iOp < data.operations.length; iOp++) {
|
||||
innerHtml += '<p class="sql-statement">' + data.operations[iOp].sql + '</p>';
|
||||
sql += '<p class="sql-statement">' + data.operations[iOp].sql + '</p>';
|
||||
}
|
||||
//innerHtml += '<h4 class="modal-subheadline">Table Statement</h4><p class="mimir-statement">' + data.mimir + '</p>';
|
||||
//innerHtml += '</div>';
|
||||
var innerHtml = '<div class="sql-statement"><ul class="nav nav-tabs" role="tablist">';
|
||||
innerHtml += '<li role="presentation" class="active"><a href="#sql-script" aria-controls="sql-script" role="tab" data-toggle="tab">SQL Statements</a></li>';
|
||||
innerHtml += '<li role="presentation"><a href="#sql-table" aria-controls="sql-table" role="tab" data-toggle="tab">Table statement</a></li>';
|
||||
innerHtml += '</ul>';
|
||||
innerHtml += '<div class="tab-content">';
|
||||
innerHtml += '<div role="tabpanel" class="tab-pane active" id="sql-script">' + sql + '</div>';
|
||||
innerHtml += '<div role="tabpanel" class="tab-pane" id="sql-table"><p class="mimir-statement">' + data.mimir + '</p></div>';
|
||||
innerHtml += '</div>';
|
||||
|
||||
innerHtml += '</div>';
|
||||
$("#modal-show-sql-body").html(innerHtml);
|
||||
$('#modal-show-sql').modal('show');
|
||||
|
|
Loading…
Reference in New Issue