Skip to content

Commit

Permalink
Deprecate OgmPluginInitializer and document it.
Browse files Browse the repository at this point in the history
  • Loading branch information
meistermeier committed Jan 3, 2019
1 parent ea9a539 commit 84ebbd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ o Removed deprecated `org.neo4j.ogm.exception.core.NotFoundException`. (#319)
o Removed deprecated `org.neo4j.ogm.exception.core.ResultErrorsException`. (#319)
o Introduced exception translator to unify exceptions of different transports into an OGM hierarchy. (#319)
o Improved hashing in IdentityMap and MappedRelationship. (#579)
o Deprecated OgmPluginInitializer.

3.1.x
o Improve documentation of type conversions. #501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@
*
* @author Frantisek Hartman
* @since 3.0
* @deprecated 3.2.0 this class implements the {@code PluginLifecycle} that is part of the Neo4j server plugins.
* Those plugins are also deprecated for removal in future releases.
* If you plan to use this in an unmanaged extension in the future, please create the Neo4j-OGM embedded driver manually
* within your extension.
*
*/
@Deprecated
public abstract class OgmPluginInitializer implements PluginLifecycle {

protected final String packages;
Expand Down
33 changes: 2 additions & 31 deletions neo4j-ogm-docs/src/main/asciidoc/reference/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,37 +235,8 @@ For Neo4j 3.4 those are `org.neo4j:neo4j-ha` and `org.neo4j:neo4j-enterprise`, f
[[reference:configuration:driver:embedded:unmanaged]]
==== Configuration of an unmanaged extension

When your application is running as unmanaged extension inside the Neo4j server itself, you will need to set up Neo4j-OGM configuration slightly differently.
Neo4j provides `PluginLifecycle` SPI that allows to initialize extensions.
Extend `OgmPluginInitializer` and list the full class name in `META-INF/services/org.neo4j.server.plugins.PluginLifecycle`:


[source, java]
----
public class MyApplicationPluginInitializer extends OGMPluginInitializer {
public MyApplicationPluginInitializer() {
super(MyDomain.class.getPackage().getName());
}
}
----

This provides `SessionFactory` as injectable in your resources:

[source, java]
----
@Path("/movies")
public static class MovieService {
@Context
private SessionFactory sessionFactory;
...
}
----
[NOTE]
Don't forget to list your resources in `dbms.unmanaged_extension_classes` property in Neo4j configuration file as you
would with any other unmanaged extension.
The `OgmPluginInitializer` class was deprecated in Neo4j-OGM 3.2 and will be removed in the next major version.
To use Neo4j-OGM within an unmanaged extension you connect to the database the usual way you would do with an embedded driver.


[[reference:configuration:driver:credentials]]
Expand Down

0 comments on commit 84ebbd0

Please sign in to comment.