Skip to content

Commit

Permalink
Safety commit before pulling in graph-matching and sunshin
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed May 31, 2011
1 parent 6557273 commit eb55169
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 77 deletions.
10 changes: 10 additions & 0 deletions neo4j-community/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
<groupId>org.neo4j</groupId>
<artifactId>neo4j-udc</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-graph-matching</artifactId>
<version>0.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-sunshine</artifactId>
<version>0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<module>udc</module>
<module>lucene-index</module>
<module>graph-algo</module>
<module>graph-matching</module>
<module>sunshine</module>
<module>neo4j</module>
<module>neo4j-community</module>
<module>shell</module>
Expand Down
10 changes: 5 additions & 5 deletions server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ the relevant Commercial Agreement.
<version>1.4-SNAPSHOT</version>
</dependency>

<!--<dependency>-->
<!--<groupId>org.neo4j</groupId>-->
<!--<artifactId>neo4j-sunshine</artifactId>-->
<!--<version>0.2-SNAPSHOT</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-sunshine</artifactId>
<version>0.2-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//
//package org.neo4j.server.webadmin.console;
//
//import org.junit.Assert;
//import org.junit.Test;
//import org.neo4j.kernel.ImpermanentGraphDatabase;
//
//import static org.hamcrest.text.StringContains.containsString;
//
///**
// * Created by Andres Taylor
// * Date: 5/30/11
// * Time: 21:58
// */
//public class SunshineSessionTest
//{
// @Test
// public void testHelloWorld() throws Exception
// {
// SunshineSession session = new SunshineSession(new ImpermanentGraphDatabase());
// String result = session.evaluate("start a=(0) return a");
// Assert.assertThat(result, containsString("Node[0]"));
// }
//}

package org.neo4j.server.webadmin.console;

import org.junit.Assert;
import org.junit.Test;
import org.neo4j.kernel.ImpermanentGraphDatabase;

import static org.hamcrest.text.StringContains.containsString;

/**
* Created by Andres Taylor
* Date: 5/30/11
* Time: 21:58
*/
public class SunshineSessionTest
{
@Test
public void testHelloWorld() throws Exception
{
SunshineSession session = new SunshineSession(new ImpermanentGraphDatabase());
String result = session.evaluate("start a=(0) return a");
Assert.assertThat(result, containsString("Node[0]"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,45 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//package org.neo4j.server.webadmin.console;
//
//import org.neo4j.graphdb.GraphDatabaseService;
//import org.neo4j.sunshine.ExecutionEngine;
//import org.neo4j.sunshine.Projection;
//import org.neo4j.sunshine.SunshineParser;
//import org.neo4j.sunshine.SyntaxError;
//import org.neo4j.sunshine.commands.Query;
//
///**
// * Created by Andres Taylor
// * Date: 5/30/11
// * Time: 21:54
// */
//public class SunshineSession implements ScriptSession
//{
// private GraphDatabaseService graph;
// private final ExecutionEngine engine;
// private final SunshineParser parser;
//
// public SunshineSession(GraphDatabaseService graph)
// {
// this.graph = graph;
// parser = new SunshineParser();
// engine = new ExecutionEngine(graph);
// }
//
// @Override
// public String evaluate(String script)
// {
// try
// {
// Query query = parser.parse(script);
// Projection result = engine.execute(query);
//
// return result.toString();
// } catch (SyntaxError error)
// {
// return error.getMessage();
// }
// }
//}
package org.neo4j.server.webadmin.console;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.sunshine.ExecutionEngine;
import org.neo4j.sunshine.Projection;
import org.neo4j.sunshine.SunshineParser;
import org.neo4j.sunshine.SyntaxError;
import org.neo4j.sunshine.commands.Query;

/**
* Created by Andres Taylor
* Date: 5/30/11
* Time: 21:54
*/
public class SunshineSession implements ScriptSession
{
private GraphDatabaseService graph;
private final ExecutionEngine engine;
private final SunshineParser parser;

public SunshineSession(GraphDatabaseService graph)
{
this.graph = graph;
parser = new SunshineParser();
engine = new ExecutionEngine(graph);
}

@Override
public String evaluate(String script)
{
try
{
Query query = parser.parse(script);
Projection result = engine.execute(query);

return result.toString();
} catch (SyntaxError error)
{
return error.getMessage();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.neo4j.server.database.Database;
import org.neo4j.server.webadmin.console.GremlinSession;
import org.neo4j.server.webadmin.console.ScriptSession;
import org.neo4j.server.webadmin.console.SunshineSession;

import javax.servlet.http.HttpSession;

Expand All @@ -37,18 +38,18 @@ public SessionFactoryImpl(HttpSession httpSession)
@Override
public ScriptSession createSession( String engineName, Database database )
{
// if(engineName.equals("sunshine"))
// {
// return new SunshineSession(database.graph);
// } else
// {
if(engineName.equals("sunshine"))
{
return new SunshineSession(database.graph);
} else
{
Object session = httpSession.getAttribute( "consoleSession" );
if ( session == null )
{
session = new GremlinSession( database );
httpSession.setAttribute( "consoleSession", session );
}
return (ScriptSession) session;
// }
}
}
}

0 comments on commit eb55169

Please sign in to comment.