Skip to content

Commit

Permalink
fix bug injected by NE-242
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickoswald committed Sep 14, 2017
1 parent 6837ca0 commit 6cccd84
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 99 deletions.
2 changes: 1 addition & 1 deletion CIMConnector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ch.ninecode.cim</groupId>
<artifactId>CIMApplication</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>CIMConnector</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion CIMEar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<groupId>ch.ninecode.cim</groupId>
<artifactId>CIMApplication</artifactId>
<relativePath>../pom.xml</relativePath>
<version>2.3.0</version>
<version>2.3.1</version>
</parent>
<artifactId>CIMEar</artifactId>
<packaging>ear</packaging>
Expand Down
2 changes: 1 addition & 1 deletion CIMWeb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>ch.ninecode.cim</groupId>
<artifactId>CIMApplication</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</parent>
<artifactId>CIMWeb</artifactId>
<packaging>war</packaging>
Expand Down
5 changes: 2 additions & 3 deletions CIMWeb/src/main/scala/ch/ninecode/cim/cimweb/Ping.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ class Ping extends RESTful
if (try { debug.toBoolean } catch { case _: Throwable => false })
{
val environment = Json.createObjectBuilder
val env: util.Map[String, String] = System.getenv
for (xx <- env)
environment.add (xx._1, xx._2)
for (pair <- System.getenv)
environment.add (pair._1, pair._2)
val ret = Json.createObjectBuilder
ret.add ("environment", environment)
result.setResult (ret.build)
Expand Down
44 changes: 40 additions & 4 deletions CIMWeb/src/main/webapp/js/cimapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,38 @@ define
xmlhttp.send ();
}

/**
* @summary Browser independent CORS setup.
* @description Creates the CORS request and opens it.
* @param {string} method The method type, e.g. "GET" or "POST"
* @param {string} url the URL to open the request on
* @param {boolean} synchronous optional parameter for open() call, default <em>true</em>
* @returns {object} the request object or <code>null</code> if CORS isn't supported
* @memberOf module:instancetype
*/
function createCORSRequest (method, url, synchronous)
{
var ret;

if ("undefined" == typeof (synchronous))
synchronous = true;
ret = new XMLHttpRequest ();
if ("withCredentials" in ret) // "withCredentials" only exists on XMLHTTPRequest2 objects
{
ret.open (method, url, synchronous);
ret.withCredentials = true;
}
else if (typeof XDomainRequest != "undefined") // IE
{
ret = new XDomainRequest ();
ret.open (method, url);
}
else
ret = null; // CORS is not supported by the browser

return (ret);
}

/**
* @summary Connect to the server and read the list of files.
* @description Invoke the server-side function to list files.
Expand All @@ -225,10 +257,14 @@ define
var url;
var xmlhttp;

url = window.location.origin + window.location.pathname + "cim/list/";
xmlhttp = new XMLHttpRequest ();
xmlhttp.open ("GET", url, true);
xmlhttp.setRequestHeader ("Accept", "application/json");
if (true)
url = window.location.origin + window.location.pathname + "cim/list/";
else
url = "http://localhost:9080/cimweb/cim/list/data/"
// xmlhttp = new XMLHttpRequest ();
// xmlhttp.open ("GET", url, true);
xmlhttp = createCORSRequest ("GET", url, false);
//xmlhttp.setRequestHeader ("Accept", "application/json");
xmlhttp.onreadystatechange = function ()
{
var resp;
Expand Down
2 changes: 1 addition & 1 deletion GeoVis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>ch.ninecode.cim</groupId>
<artifactId>CIMApplication</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</parent>
<groupId>ch.ninecode.geo</groupId>
<artifactId>GeoVis</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion GridLAB-D/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>CIMApplication</artifactId>
<groupId>ch.ninecode.cim</groupId>
<version>2.3.0</version>
<version>2.3.1</version>
</parent>
<artifactId>GridLAB-D</artifactId>
<groupId>ch.ninecode.gl</groupId>
Expand Down
12 changes: 8 additions & 4 deletions GridLAB-D/src/main/scala/ch/ninecode/esl/Einspeiseleistung.scala
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,14 @@ case class Einspeiseleistung (session: SparkSession, options: EinspeiseleistungO
case _ => StorageLevel.fromString ("MEMORY_AND_DISK_SER")
}

// identify topological nodes
val ntp = new CIMNetworkTopologyProcessor (session, storage_level)
val ele = ntp.process (false)
log.info (ele.count () + " elements")
// identify topological nodes if necessary
val tns = session.sparkContext.getPersistentRDDs.filter(_._2.name == "TopologicalNode")
if (tns.isEmpty || tns.head._2.isEmpty)
{
val ntp = new CIMNetworkTopologyProcessor (session, storage_level)
val ele = ntp.process (false)
log.info (ele.count () + " elements")
}

val topo = System.nanoTime ()
log.info ("topology: " + (topo - read) / 1e9 + " seconds")
Expand Down
12 changes: 8 additions & 4 deletions GridLAB-D/src/main/scala/ch/ninecode/export/Export.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,14 @@ case class Export (session: SparkSession, storage_level: StorageLevel, options:
case _ => StorageLevel.fromString ("MEMORY_AND_DISK_SER")
}

// identify topological nodes
val ntp = new CIMNetworkTopologyProcessor (session, storage_level)
val ele = ntp.process (false)
log.info (ele.count () + " elements")
// identify topological nodes if necessary
val tns = session.sparkContext.getPersistentRDDs.filter(_._2.name == "TopologicalNode")
if (tns.isEmpty || tns.head._2.isEmpty)
{
val ntp = new CIMNetworkTopologyProcessor (session, storage_level)
val ele = ntp.process (false)
log.info (ele.count () + " elements")
}

val topo = System.nanoTime ()
log.info ("topology: " + (topo - read) / 1e9 + " seconds")
Expand Down
Loading

0 comments on commit 6cccd84

Please sign in to comment.