Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved LuceneKernelExtension out of the public API
- Loading branch information
Showing
6 changed files
with
208 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...ity/lucene-index/src/main/java/org/neo4j/kernel/api/impl/index/LuceneKernelExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2002-2017 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* 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.kernel.api.impl.index; | ||
|
||
import java.io.File; | ||
import java.util.function.Supplier; | ||
|
||
import org.neo4j.index.impl.lucene.explicit.LuceneIndexImplementation; | ||
import org.neo4j.io.fs.FileSystemAbstraction; | ||
import org.neo4j.kernel.configuration.Config; | ||
import org.neo4j.kernel.impl.factory.OperationalMode; | ||
import org.neo4j.kernel.impl.index.IndexConfigStore; | ||
import org.neo4j.kernel.lifecycle.LifecycleAdapter; | ||
import org.neo4j.kernel.spi.explicitindex.IndexProviders; | ||
|
||
public class LuceneKernelExtension extends LifecycleAdapter | ||
{ | ||
private final File storeDir; | ||
private final Config config; | ||
private final Supplier<IndexConfigStore> indexStore; | ||
private final FileSystemAbstraction fileSystemAbstraction; | ||
private final IndexProviders indexProviders; | ||
private final OperationalMode operationalMode; | ||
|
||
public LuceneKernelExtension( File storeDir, Config config, Supplier<IndexConfigStore> indexStore, | ||
FileSystemAbstraction fileSystemAbstraction, IndexProviders indexProviders, OperationalMode operationalMode ) | ||
{ | ||
this.storeDir = storeDir; | ||
this.config = config; | ||
this.indexStore = indexStore; | ||
this.fileSystemAbstraction = fileSystemAbstraction; | ||
this.indexProviders = indexProviders; | ||
this.operationalMode = operationalMode; | ||
} | ||
|
||
@Override | ||
public void init() | ||
{ | ||
|
||
LuceneIndexImplementation indexImplementation = | ||
new LuceneIndexImplementation( storeDir, config, indexStore, fileSystemAbstraction, operationalMode ); | ||
indexProviders.registerIndexProvider( LuceneIndexImplementation.SERVICE_NAME, indexImplementation ); | ||
} | ||
|
||
@Override | ||
public void shutdown() | ||
{ | ||
indexProviders.unregisterIndexProvider( LuceneIndexImplementation.SERVICE_NAME ); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...ene-index/src/main/java/org/neo4j/kernel/api/impl/index/LuceneKernelExtensionFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (c) 2002-2017 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* 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.kernel.api.impl.index; | ||
|
||
import org.neo4j.index.impl.lucene.explicit.LuceneIndexImplementation; | ||
import org.neo4j.io.fs.FileSystemAbstraction; | ||
import org.neo4j.kernel.configuration.Config; | ||
import org.neo4j.kernel.extension.KernelExtensionFactory; | ||
import org.neo4j.kernel.impl.index.IndexConfigStore; | ||
import org.neo4j.kernel.impl.spi.KernelContext; | ||
import org.neo4j.kernel.lifecycle.Lifecycle; | ||
import org.neo4j.kernel.spi.explicitindex.IndexProviders; | ||
|
||
public class LuceneKernelExtensionFactory extends KernelExtensionFactory<LuceneKernelExtensionFactory.Dependencies> | ||
{ | ||
public interface Dependencies | ||
{ | ||
Config getConfig(); | ||
|
||
IndexProviders getIndexProviders(); | ||
|
||
IndexConfigStore getIndexStore(); | ||
|
||
FileSystemAbstraction fileSystem(); | ||
} | ||
|
||
public LuceneKernelExtensionFactory() | ||
{ | ||
super( LuceneIndexImplementation.SERVICE_NAME ); | ||
} | ||
|
||
@Override | ||
public Lifecycle newInstance( KernelContext context, Dependencies dependencies ) throws Throwable | ||
{ | ||
return new LuceneKernelExtension( | ||
context.storeDir(), | ||
dependencies.getConfig(), | ||
dependencies::getIndexStore, | ||
dependencies.fileSystem(), | ||
dependencies.getIndexProviders(), | ||
context.databaseInfo().operationalMode ); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
community/lucene-index/src/main/java/org/neo4j/kernel/spi/legacyindex/IndexProviders.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.neo4j.kernel.spi.legacyindex; | ||
|
||
|
||
import org.neo4j.kernel.spi.explicitindex.IndexImplementation; | ||
|
||
/** | ||
* Registry of currently active index implementations. Indexing extensions should register the implementation | ||
* here on startup, and unregister it on stop. | ||
* @deprecated removed in 4.0 | ||
*/ | ||
@Deprecated | ||
public interface IndexProviders | ||
{ | ||
void registerIndexProvider( String name, IndexImplementation index ); | ||
|
||
boolean unregisterIndexProvider( String name ); | ||
} |
2 changes: 1 addition & 1 deletion
2
...ex/src/main/resources/META-INF/services/org.neo4j.kernel.extension.KernelExtensionFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
org.neo4j.index.lucene.LuceneKernelExtensionFactory | ||
org.neo4j.kernel.api.impl.index.LuceneKernelExtensionFactory | ||
org.neo4j.kernel.api.impl.schema.LuceneSchemaIndexProviderFactory | ||
org.neo4j.kernel.api.impl.schema.NativeLuceneFusionSchemaIndexProviderFactory |