POLYGENE-234 : Adding the use of Assemblers in Solr indexing
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/32492c0f Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/32492c0f Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/32492c0f Branch: refs/heads/develop Commit: 32492c0f82738036da2636adcb8229c0ba934d2e Parents: d9be964 Author: niclas <[email protected]> Authored: Sun Mar 5 13:26:57 2017 +0800 Committer: niclas <[email protected]> Committed: Sun Mar 5 13:26:57 2017 +0800 ---------------------------------------------------------------------- .../polygene/index/solr/SolrAssembler.java | 49 -------------------- .../index/solr/assembly/SolrAssembler.java | 48 +++++++++++++++++++ .../index/solr/SolrEntityFinderTest.java | 1 + .../polygene/index/solr/SolrNamedQueryTest.java | 1 + .../index/solr/SolrQueryServiceTest.java | 1 + .../polygene/index/solr/SolrQueryTest.java | 1 + 6 files changed, 52 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java deleted file mode 100644 index 84d2a79..0000000 --- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrAssembler.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.polygene.index.solr; - -import org.apache.polygene.api.common.Visibility; -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.bootstrap.Assembler; -import org.apache.polygene.bootstrap.AssemblyException; -import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.library.rdf.entity.EntityStateSerializer; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService; - -/** - * JAVADOC - */ -public class SolrAssembler - implements Assembler -{ - @Override - public void assemble( ModuleAssembly module ) throws AssemblyException - { - module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup(); - - module.services( SolrQueryService.class ). - taggedWith( "solr", "search" ). - identifiedBy( "solrquery" ). - visibleIn( Visibility.application ); - module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); - module.objects( EntityStateSerializer.class ); - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java new file mode 100644 index 0000000..38b97e3 --- /dev/null +++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.apache.polygene.index.solr.assembly; + +import org.apache.polygene.api.value.ValueSerialization; +import org.apache.polygene.bootstrap.Assemblers; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.ServiceDeclaration; +import org.apache.polygene.index.solr.EmbeddedSolrService; +import org.apache.polygene.index.solr.SolrQueryService; +import org.apache.polygene.library.rdf.entity.EntityStateSerializer; +import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService; + +public class SolrAssembler extends Assemblers.VisibilityIdentity +{ + @Override + public void assemble( ModuleAssembly module ) throws AssemblyException + { + module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup(); + ServiceDeclaration queryService = module.services( SolrQueryService.class ); + queryService. + taggedWith( "solr", "search", "indexing", "query" ). + identifiedBy( identity() ). + visibleIn( visibility() ). + instantiateOnStartup(); + module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON ); + module.objects( EntityStateSerializer.class ); + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java index bc56528..d51ca13 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.index.solr; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.index.solr.assembly.SolrAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractEntityFinderTest; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java index eb3a9a0..fab66ac 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java @@ -23,6 +23,7 @@ import java.util.function.Predicate; import org.apache.polygene.api.composite.Composite; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.index.solr.assembly.SolrAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractNamedQueryTest; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java index f752eba..c5b06f9 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.index.solr; import java.util.ArrayList; import java.util.List; +import org.apache.polygene.index.solr.assembly.SolrAssembler; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/32492c0f/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java index 8f6d28a..376574c 100644 --- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java +++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java @@ -21,6 +21,7 @@ package org.apache.polygene.index.solr; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.index.solr.assembly.SolrAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.indexing.AbstractQueryTest;
