Permalink
Browse files

- upgrade to Neo4j 2.1.4

- add run script to be included in the OSX distro root in order to run with java 7
- remove dependency on XML parsing, move to JSON instead
  • Loading branch information...
peterneubauer committed Sep 11, 2014
1 parent 5d6f9a5 commit a57c359318e84d511d48999a034bf588c2ec1d4f
@@ -2,8 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Neoclipse Documentation
Bundle-SymbolicName: org.neo4j.neoclipse.doc; singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Version: 2.1.4.qualifier
Bundle-Localization: plugin
Bundle-Vendor: Neo4j.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.help;bundle-version="3.3.100"
@@ -5,7 +5,7 @@
<parent>
<artifactId>neoclipse</artifactId>
<groupId>org.neo4j</groupId>
<version>2.0.0-SNAPSHOT</version>
<version>2.1.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>org.neo4j.neoclipse.doc</artifactId>
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.neo4j.neoclipse.dependencies"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
@@ -2,30 +2,31 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Neoclipse
Bundle-SymbolicName: org.neo4j.neoclipse;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Version: 2.1.4.qualifier
Bundle-Activator: org.neo4j.neoclipse.Activator
Bundle-Vendor: Neo4j.org
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .
Require-Bundle: org.eclipse.zest.core;bundle-version="1.3.0",
org.eclipse.zest.layouts;bundle-version="1.1.0",
org.eclipse.search;bundle-version="3.7.0",
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
org.eclipse.gef;bundle-version="3.7.1",
org.eclipse.core.runtime;bundle-version="3.7.0"
org.eclipse.core.runtime;bundle-version="3.7.0",
org.apache.xerces;bundle-version="2.9.0"
Import-Package: com.google.gson;version="[2.1.0,2.2.0)",
org.dom4j;version="1.6.1",
org.dom4j.io;version="1.6.1",
org.dom4j.tree;version="1.6.1",
org.json;version="1.0.0",
org.neo4j.cypher.javacompat;version="2.0.0",
org.neo4j.graphdb;version="2.0.0",
org.neo4j.graphdb.config;version="2.0.0",
org.neo4j.graphdb.factory;version="2.0.0",
org.neo4j.graphdb.index;version="2.0.0",
org.neo4j.graphdb.traversal;version="2.0.0",
org.neo4j.kernel;version="2.0.0",
org.neo4j.rest.graphdb;version="2.0.0",
org.neo4j.rest.graphdb.query;version="2.0.0",
org.neo4j.rest.graphdb.traversal;version="2.0.0"
org.neo4j.cypher.javacompat;version="2.1.4",
org.neo4j.graphdb;version="2.1.4",
org.neo4j.graphdb.config;version="2.1.4",
org.neo4j.graphdb.factory;version="2.1.4",
org.neo4j.graphdb.index;version="2.1.4",
org.neo4j.graphdb.traversal;version="2.1.4",
org.neo4j.kernel;version="2.1.4",
org.neo4j.rest.graphdb;version="2.1.4",
org.neo4j.rest.graphdb.query;version="2.1.4",
org.neo4j.rest.graphdb.traversal;version="2.1.4"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<?eclipse version="4.4"?>
<plugin>
<extension
point="org.eclipse.ui.views">
@@ -5,7 +5,7 @@
<parent>
<artifactId>neoclipse</artifactId>
<groupId>org.neo4j</groupId>
<version>2.0.0-SNAPSHOT</version>
<version>2.1.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>org.neo4j.neoclipse</artifactId>
@@ -104,13 +104,13 @@ public Alias( String aliasName, String dbPath, String user, String pass )
*
* @param root
*/
public Alias( Element root )
public Alias( Map root )
{
name = root.elementText( NAME );
uri = root.elementText( URI );
name = (String) root.get( NAME );
uri = (String) root.get( URI );
connectionMode = ConnectionMode.getValue( uri );
String user = root.elementText( USER_NAME );
String pass = root.elementText( PASSWORD );
String user = (String) root.get( USER_NAME );
String pass = (String) root.get( PASSWORD );
if ( !ApplicationUtil.isBlank( user ) )
{
userName = user;
@@ -120,15 +120,13 @@ public Alias( Element root )
password = pass;
}
Element configurationsElement = root.element( CONFIGURATIONS );
Map configurationsElement = (Map) root.get( CONFIGURATIONS );
if ( configurationsElement != null )
{
List<Element> elements = configurationsElement.elements( CONFIG );
for ( Element config : elements )
Set elements = configurationsElement.keySet();
for ( Object key : elements )
{
String configName = config.attributeValue( CONFIG_NAME );
String configValue = config.attributeValue( CONFIG_VALUE );
addConfiguration( configName, configValue );
addConfiguration( (String)key, (String)configurationsElement.get(key) );
}
}
}
@@ -169,25 +167,24 @@ public ConnectionMode getConnectionMode()
*
* @return
*/
public Element describeAsXml()
public Map describeAsXml()
{
DefaultElement root = new DefaultElement( ALIAS );
root.addElement( NAME ).setText( ApplicationUtil.returnEmptyIfBlank( name ) );
root.addElement( URI ).setText( ApplicationUtil.returnEmptyIfBlank( uri ) );
root.addElement( USER_NAME ).setText( ApplicationUtil.returnEmptyIfBlank( userName ) );
root.addElement( PASSWORD ).setText( ApplicationUtil.returnEmptyIfBlank( password ) );
Map root = new HashMap();
root.put( NAME, ApplicationUtil.returnEmptyIfBlank( name ) );
root.put( URI, ApplicationUtil.returnEmptyIfBlank( uri ) );
root.put( USER_NAME , ApplicationUtil.returnEmptyIfBlank( userName ) );
root.put( PASSWORD, ApplicationUtil.returnEmptyIfBlank( password ) );
if ( !configurationMap.isEmpty() )
{
Element configElement = root.addElement( CONFIGURATIONS );
Map configElement = new HashMap();
Set<Entry<String, String>> entrySet = configurationMap.entrySet();
for ( Entry<String, String> entry : entrySet )
{
DefaultElement config = new DefaultElement( CONFIG );
config.addAttribute( CONFIG_NAME, ApplicationUtil.returnEmptyIfBlank( entry.getKey() ) );
config.addAttribute( CONFIG_VALUE, ApplicationUtil.returnEmptyIfBlank( entry.getValue() ) );
configElement.add( config );
configElement.put(ApplicationUtil.returnEmptyIfBlank( entry.getKey() ), ApplicationUtil.returnEmptyIfBlank( entry.getValue() ));
}
root.put( CONFIGURATIONS, configElement );
}
return root;
}
@@ -20,8 +20,10 @@
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.dom4j.Element;
@@ -42,7 +44,7 @@
public class AliasManager
{
private static final String ALIAS_FILE_NAME = "NeoDbAliases.xml";
private static final String ALIAS_FILE_NAME = "NeoDbAliases.json";
private final Set<Alias> aliases = new HashSet<Alias>();
private final NeoclipseListenerList connectionListeners = new NeoclipseListenerList();
@@ -52,18 +54,16 @@ public void loadAliases()
File aliasSettings = new File( ApplicationUtil.NEOCLIPSE_SETTINGS_DIR, ALIAS_FILE_NAME );
Element root = XMLUtils.readRoot( aliasSettings );
Map root = XMLUtils.readRoot( aliasSettings );
if ( root != null )
{
List<Element> elements = root.elements( Alias.ALIAS );
if ( root.getName().equals( Alias.ALIASES ) )
Set aliasKeys = root.keySet();
for ( Object aliaskey : aliasKeys )
{
for ( Element aliasElement : elements )
{
addAlias( new Alias( aliasElement ) );
}
addAlias( new Alias( (Map) root.get(aliaskey) ) );
}
}
}
@@ -73,10 +73,10 @@ public void loadAliases()
*/
public void saveAliases()
{
DefaultElement root = new DefaultElement( Alias.ALIASES );
Map root = new HashMap( );
for ( Alias alias : aliases )
{
root.add( alias.describeAsXml() );
root.put( alias.getName(), alias.describeAsXml() );
}
File aliasSettings = new File( ApplicationUtil.NEOCLIPSE_SETTINGS_DIR, ALIAS_FILE_NAME );
XMLUtils.save( root, aliasSettings );
@@ -18,16 +18,16 @@
*/
package org.neo4j.neoclipse.util;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.util.Map;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.neo4j.neoclipse.view.ErrorMessage;
import com.google.gson.Gson;
/**
* Helper class for reading and writing XML files
*
@@ -36,19 +36,17 @@
*/
public class XMLUtils
{
public static void save( Element pRoot, File pFile )
public static Gson gson = new Gson();
public static void save( Object pRoot, File pFile )
{
try
{
pFile.getParentFile().mkdirs();
FileOutputStream fileOutputStream = new FileOutputStream( pFile );
XMLWriter xmlWriter = new XMLWriter( fileOutputStream, OutputFormat.createPrettyPrint() );
xmlWriter.startDocument();
xmlWriter.write( pRoot );
xmlWriter.endDocument();
xmlWriter.flush();
xmlWriter.close();
pFile.getParentFile().mkdirs();
BufferedOutputStream fileOutputStream = new BufferedOutputStream(new FileOutputStream( pFile ));
fileOutputStream.write(gson.toJson(pRoot).getBytes());
fileOutputStream.close();
}
catch ( Exception e )
{
@@ -57,18 +55,18 @@ public static void save( Element pRoot, File pFile )
}
public static Element readRoot( File pFile )
public static Map<String, Object> readRoot( File pFile )
{
System.out.println(String.format("Loading settings from file %s" , pFile));
if ( !pFile.exists() )
{
return null;
}
try
{
SAXReader reader = new SAXReader();
return reader.read( pFile ).getRootElement();
return gson.fromJson(new FileReader(pFile), Map.class);
}
catch ( DocumentException e )
catch ( Exception e )
{
ErrorMessage.showDialog( "Cannot load: " + pFile.getAbsolutePath(), e );
}
View
@@ -11,7 +11,7 @@
<groupId>org.neo4j.neoclipse</groupId>
<artifactId>org.neo4j.neoclipse.dependencies</artifactId>
<packaging>bundle</packaging>
<version>2.0.0</version>
<version>2.1.4</version>
<name>Neo4J OSGi Wrapper</name>
<repositories>
@@ -60,11 +60,11 @@
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.6</version>
@@ -86,6 +86,12 @@
<artifactId>relaxngDatatype</artifactId>
<version>20020414</version>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
@@ -118,7 +124,7 @@
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-rest-graphdb</artifactId>
<version>1.9</version>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
@@ -1,2 +1 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-BundleShape: dir
Oops, something went wrong.

0 comments on commit a57c359

Please sign in to comment.