The only reason for me to throw an exception is that I wanted to have
minimal impact on code, as it is not my code but yours.
I simply wanted to replace usage of proprietary class by the interface
suited for the need.
Beside, the @Deprecated  seems to me to be more there as a warning sign
than anything else : considering neo4j history, it seems to me this
interface was marked as @Deprecated from day 1.


On Sun, Apr 14, 2013 at 1:36 PM, stephen mallette
<notifications@github.com>wrote:

> In
> blueprints-neo4j-graph/src/main/java/com/tinkerpop/blueprints/impls/neo4j/Neo4jGraph.java:
>
> > +	private <T extends Element> void createInternalIndexKey(final String key, final Class<T> elementClass) {
> > +		final String propertyName = elementClass.getSimpleName() + INDEXED_KEYS_POSTFIX;
> > +		if (rawGraph instanceof GraphDatabaseAPI) {
> > +			final PropertyContainer pc = ((GraphDatabaseAPI) this.rawGraph).getNodeManager().getGraphProperties();
> > +			try {
> > +				final String[] keys = (String[]) pc.getProperty(propertyName);
> > +				final Set<String> temp = new HashSet<String>(Arrays.asList(keys));
> > +				temp.add(key);
> > +				pc.setProperty(propertyName, temp.toArray(new String[temp.size()]));
> > +			} catch (Exception e) {
> > +				// no indexed_keys kernel data property
> > +				pc.setProperty(propertyName, new String[] { key });
> > +
> > +			}
> > +		} else {
> > +			throw new UnsupportedOperationException(
>
> @Riduidel <https://github.com/Riduidel>
>
> I'm finally starting to understand this pull request. I think that casting
> to the GraphDatabaseAPI is the correct call...better to go against the
> interface than the concrete class.
>
> @okram <https://github.com/okram>
>
> I don't know the history here on Neo4jGraph...GraphDatabaseAPI is largely
> deprecated:
>
> http://api.neo4j.org/current/org/neo4j/kernel/GraphDatabaseAPI.html
>
>
> But those were the methods we were using on the
> InternalAbstractGraphDatabase we were casting to before so using the
> deprecated methods on GraphDatabaseAPI is not new and obviously works. I
> assume we just do that to maintain compatibility with older neo4j versions.
> Of course, I don't think we to to do that consistently:
>
> @Riduidel <https://github.com/Riduidel>
>
> Right now you throw exceptions or simply log that the Neo4j instance isn't
> of type GraphDatabaseAPI. Any reason we don't just try to implement in the
> non-deprecated methods instead?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/tinkerpop/blueprints/pull/380/files#r3785643>
>
> .
>
>


-- 
Nicolas Delsaux