Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Removed references to metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Clark Dorman committed Jan 21, 2016
1 parent e05d879 commit 81539e0
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 201 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ classes/
.settings
.classpath
target/
metadata/bin
neon-server/bin

*.*~
Expand Down
3 changes: 0 additions & 3 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ <h2>Neon Examples</h2>
<li><a href="filter.html">Filters</a>: Dynamically add and remove filters and observe the changes in the result set</li>
<li><a href="simple_query.html">Aggregate query</a>: Example query of the earthquake database, showing a count of earthquakes, grouped by Magnitude Type </li>
<li><a href="dataExplorer.html">Data Explorer</a>: A simple data explorer for MongoDB</li>

<!--<li><a href="metadata.html">Metadata</a>: Get and set metadata for a widget.</li> -->

</ul>

For a larger example, see the <a href="https://github.com/NextCenturyCorporation/neon-gtd">Neon GeoTemporal Dashboard</a>
Expand Down
2 changes: 0 additions & 2 deletions neon-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ dependencies {
exclude module: 'groovy'
}
compile "commons-lang:commons-lang:$commonsLangVersion"
compile project(":metadata")


providedCompile "javax.servlet:javax.servlet-api:$javaxServletVersion"

Expand Down
35 changes: 0 additions & 35 deletions neon-server/src/acceptanceTest/javascript/spec/query/query.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,41 +590,6 @@ describe('query mapping', function() {
});
});

it('gets column metadata', function() {
var expected =
[{
columnName: "field1",
numeric: true,
logical: true,
temporal: true,
array: true,
object: true,
text: true,
heterogeneous: true,
nullable: true
},{
columnName: "field2",
numeric: false,
logical: false,
temporal: false,
array: false,
object: false,
text: false,
heterogeneous: false,
nullable: false
}];
var actual;
connection.getColumnMetadata('database1', 'table1', function(columnMetadata) {
actual = columnMetadata;
});
waitsFor(function() {
return 'undefined' !== typeof actual;
});
runs(function() {
expect(actual).toEqual(expected);
});
});

it('query with transform added by transform loader', function() {
var query = baseQuery();
query.transform(new neon.query.Transform("Sample"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.codehaus.jackson.annotate.JsonTypeInfo
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes([
@JsonSubTypes.Type(value = GroupByFieldClause, name = 'single'),
@JsonSubTypes.Type(value = GroupByFunctionClause, name = 'function')
@JsonSubTypes.Type(value = GroupByFunctionClause, name = 'function')
])
public interface GroupByClause {
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import org.codehaus.jackson.annotate.JsonTypeInfo
@JsonSubTypes.Type(value = WithinDistanceClause, name = 'withinDistance'),
@JsonSubTypes.Type(value = GeoIntersectionClause, name = 'geoIntersection'),
@JsonSubTypes.Type(value = GeoWithinClause, name = 'geoWithin'),
@JsonSubTypes.Type(value = AndWhereClause, name = 'and'),
@JsonSubTypes.Type(value = OrWhereClause, name = 'or')
@JsonSubTypes.Type(value = AndWhereClause, name = 'and'),
@JsonSubTypes.Type(value = OrWhereClause, name = 'or')
])
public interface WhereClause {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.ncc.neon.services
import com.ncc.neon.connect.ConnectionInfo
import com.ncc.neon.connect.ConnectionManager
import com.ncc.neon.connect.DataSources
import com.ncc.neon.metadata.model.ColumnMetadata
import com.ncc.neon.query.*
import com.ncc.neon.query.executor.QueryExecutor
import com.ncc.neon.query.clauses.WhereClause
Expand All @@ -42,9 +41,6 @@ class QueryService {
@Autowired
QueryExecutorFactory queryExecutorFactory

@Autowired
MetadataResolver metadataResolver

@Autowired
ConnectionManager connectionManager

Expand Down Expand Up @@ -142,22 +138,6 @@ class QueryService {
return tablesAndFields
}

/**
* Gets metadata associated with the columns of the table
* @param databaseName The database containing the data
* @param tableName The table containing the data
* @return The list of metadata associated with the columns
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("columnmetadata/{databaseName}/{tableName}")
List<ColumnMetadata> getColumnMetadata(
@PathParam("databaseName") String databaseName,
@PathParam("tableName") String tableName
) {
return metadataResolver.retrieve(databaseName, tableName, [] as Set)
}

/**
* Gets a list of all the databases for the database type/host pair.
* @param host The host the database is running on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

package com.ncc.neon.services
import com.ncc.neon.metadata.model.WidgetAndDatasetMetadata
import com.ncc.neon.state.StateIdGenerator
import com.ncc.neon.state.WidgetState
import com.ncc.neon.state.WidgetStates
Expand All @@ -35,9 +34,6 @@ class WidgetService {
@Autowired
WidgetStates widgetStates

@Autowired
MetadataResolver metadataResolver

@Autowired
StateIdGenerator stateIdGenerator

Expand Down Expand Up @@ -68,35 +64,6 @@ class WidgetService {
return "{}"
}

/**
* Gets any initialization data associated with a particular widget
* @param widgetId An identifier for the widget, typically a widget's name
* @return json containing information about the widget's state, or null if nothing is found.
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("widgetinitialization/{widgetId}")
String getWidgetInitialization(@PathParam("widgetId") String widgetId) {
def data = metadataResolver.getWidgetInitializationData(widgetId)
return data.initDataJson
}

/**
* Gets any information that defines how fields on a widget map to fields in the dataset
* @param databaseName
* @param tableName
* @param widgetId
* @return
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("widgetdataset/{databaseName}/{tableName}/{widgetId}/")
List<WidgetAndDatasetMetadata> getWidgetDatasetData(@PathParam("databaseName") String databaseName,
@PathParam("tableName") String tableName,
@PathParam("widgetId") String widgetId) {
return metadataResolver.getWidgetDatasetData(databaseName, tableName, widgetId)
}

/**
* Gets an id unique to the session
* @param qualifier If the qualifier is used, te id will be specific to that qualifier. If
Expand Down
17 changes: 0 additions & 17 deletions neon-server/src/main/javascript/query/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,6 @@ neon.query.Connection.prototype.executeQuery = function(query, successCallback,
return this.executeQueryService_(query, successCallback, errorCallback, 'query');
};

/**
* Gets the metadata for each of the columns in the table
* @method getColumnMetadata
* @param {String} databaseName
* @param {String} tableName The table whose metadata is being returned
* @param {Function} successCallback
* @return {neon.util.AjaxRequest}
*/
neon.query.Connection.prototype.getColumnMetadata = function(databaseName, tableName, successCallback) {
return neon.util.ajaxUtils.doGet(
neon.serviceUrl('queryservice', 'columnmetadata/' + encodeURIComponent(databaseName) + '/' + encodeURIComponent(tableName)), {
success: successCallback,
responseType: 'json'
}
);
};

/**
* Executes the specified query group (a series of queries whose results are aggregate),
* and fires the callback when complete.
Expand Down
47 changes: 1 addition & 46 deletions neon-server/src/main/javascript/widget/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,54 +117,9 @@ neon.widget = (function() {
return queryString;
}

/**
* Gets widget initialization metadata.
* @method getWidgetInitialization
* @param {String} widget an identifier of a widget, usually the widget name
* @param {Function} successCallback The callback that contains the saved data.
* @return {neon.util.AjaxRequest} The xhr request object
*/
function getWidgetInitializationData(widget, successCallback) {
return neon.util.ajaxUtils.doGet(
neon.serviceUrl('widgetservice', 'widgetinitialization/' + encodeURIComponent(widget)), {
success: successCallback
}
);
}

/**
* Gets the metadata for each of the columns in the table
* @method getWidgetDatasetMetadata
* @param {String} databaseName The name of the database whose field metadata is being returned
* @param {String} tableName The name of the table whose field metadata is being returned
* @param {String} widgetName The name of the widget whose initialization data is being returned
* @param successCallback
* @return {neon.util.AjaxRequest}
*/
function getWidgetDatasetMetadata(databaseName, tableName, widgetName, successCallback) {
return neon.util.ajaxUtils.doGet(
neon.serviceUrl('widgetservice', 'widgetdataset/' + encodeURIComponent(databaseName) + '/' + encodeURIComponent(tableName) + '/' + encodeURIComponent(widgetName)),
{
success: function(result) {
// The result is an array in the format:
// [{elementId: "name", value: "columnName"}, {elementId: "otherName", value: "column2"}]
// Turn it into the more useful object:
// {name: "columnName", otherName: "column2"}
var mappings = {};
for(var i = 0; i < result.length; ++i) {
mappings[result[i].elementId] = result[i].value;
}
successCallback(mappings);
}
}
);
}

return {
saveState: saveState,
getSavedState: getSavedState,
getInstanceId: getInstanceId,
getWidgetInitializationData: getWidgetInitializationData,
getWidgetDatasetMetadata: getWidgetDatasetMetadata
getInstanceId: getInstanceId
};
})();
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@

package com.ncc.neon.services

import com.ncc.neon.metadata.model.WidgetInitializationMetadata
import com.ncc.neon.state.WidgetState
import com.ncc.neon.state.WidgetStates
import org.junit.Before
import org.junit.Test




class WidgetServiceTest {

private WidgetService service
Expand All @@ -46,22 +42,4 @@ class WidgetServiceTest {
assert service.restoreState("invalidState") == "{}"
}

@Test
void "object is not found in metadata store"() {
def resolver = [getWidgetInitializationData: {
widgetName -> new WidgetInitializationMetadata(widgetName: widgetName)
}] as MetadataResolver
service.metadataResolver = resolver
assert !service.getWidgetInitialization("widget")
}

@Test
void "object is found in metadata store"() {
String data = "data"
def resolver = [getWidgetInitializationData: {
widgetName -> new WidgetInitializationMetadata(widgetName: widgetName, initDataJson: data)
}] as MetadataResolver
service.metadataResolver = resolver
assert service.getWidgetInitialization("widget") == data
}
}
10 changes: 1 addition & 9 deletions neon-server/src/test/javascript/spec/query/connection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ describe('neon.query.Connection', function() {
neon.query.Connection.MONGO);
});

it("should encode host, database, and tablename appropriately in getColumnMetadata request url", function() {
spyOn($, "ajax");

connection.getColumnMetadata(databaseName, tableName);
expect($.ajax.mostRecentCall.args[0].url).toEqual(server + queryService + 'columnmetadata/' +
encodedDatabaseName + '/' + encodedTableName);
});

it("should encode host and database type appropriately in executeExport request url", function() {
spyOn($, "ajax");

Expand Down Expand Up @@ -168,4 +160,4 @@ describe('neon.query.Connection', function() {
expect($.ajax.mostRecentCall.args[0].url).toEqual(server + '/services/importservice/drop/' +
'differentHost/differentDatabaseType?user=testUser&data=testData');
});
});
});
10 changes: 1 addition & 9 deletions neon-server/src/test/javascript/spec/widget/widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ describe('neon.widget', function() {
expect($.ajax.mostRecentCall.args[0].url).toEqual(server + widgetService + 'restorestate/' + encodedValue);
});

it("should encode qualifier appropriately in getWidgetDatasetMetadata request url", function() {
spyOn($, "ajax");

neon.widget.getWidgetDatasetMetadata(databaseName, tableName, value);
expect($.ajax.mostRecentCall.args[0].url).toEqual(server + widgetService + 'widgetdataset/' +
encodedDatabaseName + '/' + encodedTableName + '/' + encodedValue);
});

it("should encode qualifier appropriately in getWidgetInitializationData request url", function() {
spyOn($, "ajax");

Expand All @@ -69,4 +61,4 @@ describe('neon.widget', function() {
expect($.ajax.mostRecentCall.args[0].data.indexOf(tableName)).toBeGreaterThan(-1);
expect($.ajax.mostRecentCall.args[0].data.indexOf(JSON.stringify(JSON.stringify(value)))).toBeGreaterThan(-1);
});
});
});
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
*/

include 'neon-server', 'metadata', 'examples'
include 'neon-server', 'examples'

// the neon-server project is just output as neon.js/neon.war for simpler referencing
project(":neon-server").name = 'neon'

0 comments on commit 81539e0

Please sign in to comment.