http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java deleted file mode 100644 index df0c96a..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java +++ /dev/null @@ -1,50 +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.elasticsearch; - -import org.apache.polygene.api.common.Optional; -import org.apache.polygene.api.common.UseDefaults; -import org.apache.polygene.api.property.Property; - -// START SNIPPET: config -public interface ElasticSearchConfiguration -{ - - /** - * Cluster name. - * Defaults to 'polygene_cluster'. - */ - @Optional Property<String> clusterName(); - - /** - * Index name. - * Defaults to 'polygene_index'. - */ - @Optional Property<String> index(); - - /** - * Set to true to index non aggregated associations as if they were aggregated. - * WARN: Don't use this if your domain model contains circular dependencies. - * Defaults to 'FALSE'. - */ - @UseDefaults Property<Boolean> indexNonAggregatedAssociations(); - -} -// END SNIPPET: config
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java deleted file mode 100644 index b792a17..0000000 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexException.java +++ /dev/null @@ -1,36 +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.elasticsearch; - -public class ElasticSearchIndexException - extends RuntimeException -{ - - public ElasticSearchIndexException( String string ) - { - super( string ); - } - - public ElasticSearchIndexException( String string, Throwable thrwbl ) - { - super( string, thrwbl ); - } - -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java index 41ba67a..3796deb 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexExporter.java @@ -26,10 +26,8 @@ import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.spi.query.IndexExporter; @Mixins( ElasticSearchIndexExporter.Mixin.class ) -public interface ElasticSearchIndexExporter - extends IndexExporter +public interface ElasticSearchIndexExporter extends IndexExporter { - class Mixin implements ElasticSearchIndexExporter { @@ -49,5 +47,4 @@ public interface ElasticSearchIndexExporter } } - } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java index c8caa7d..0737f86 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexer.java @@ -149,7 +149,7 @@ public interface ElasticSearchIndexer extends StateChangeListener // Handle errors if( bulkResponse.hasFailures() ) { - throw new ElasticSearchIndexException( bulkResponse.buildFailureMessage() ); + throw new ElasticSearchIndexingException( bulkResponse.buildFailureMessage() ); } LOGGER.debug( "Indexing changed Entity states took {}ms", bulkResponse.getTookInMillis() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java new file mode 100644 index 0000000..27ba86d --- /dev/null +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingConfiguration.java @@ -0,0 +1,49 @@ +/* + * 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.elasticsearch; + +import org.apache.polygene.api.common.Optional; +import org.apache.polygene.api.common.UseDefaults; +import org.apache.polygene.api.property.Property; + +// START SNIPPET: config +public interface ElasticSearchIndexingConfiguration +{ + /** + * Cluster name. + * Defaults to 'polygene_cluster'. + */ + @Optional Property<String> clusterName(); + + /** + * Index name. + * Defaults to 'polygene_index'. + */ + @Optional Property<String> index(); + + /** + * Set to true to index non aggregated associations as if they were aggregated. + * WARN: Don't use this if your domain model contains circular dependencies. + * Defaults to 'FALSE'. + */ + @UseDefaults Property<Boolean> indexNonAggregatedAssociations(); + +} +// END SNIPPET: config http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java new file mode 100644 index 0000000..b578c6a --- /dev/null +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchIndexingException.java @@ -0,0 +1,35 @@ +/* + * 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.elasticsearch; + +public class ElasticSearchIndexingException extends RuntimeException +{ + + public ElasticSearchIndexingException( String string ) + { + super( string ); + } + + public ElasticSearchIndexingException( String string, Throwable thrwbl ) + { + super( string, thrwbl ); + } + +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java index 36331d8..c62e0d6 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchSupport.java @@ -19,11 +19,10 @@ */ package org.apache.polygene.index.elasticsearch; -import org.elasticsearch.client.Client; import org.apache.polygene.api.service.ServiceActivation; +import org.elasticsearch.client.Client; -public interface ElasticSearchSupport - extends ServiceActivation +public interface ElasticSearchSupport extends ServiceActivation { Client client(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java index c6a0bdc..e1ad4cf 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESClientIndexQueryAssembler.java @@ -19,7 +19,7 @@ package org.apache.polygene.index.elasticsearch.assembly; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration; +import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration; import org.apache.polygene.index.elasticsearch.client.ESClientIndexQueryService; import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler; import org.elasticsearch.client.Client; @@ -46,7 +46,7 @@ public class ESClientIndexQueryAssembler if( hasConfig() ) { - configModule().entities( ElasticSearchConfiguration.class ) + configModule().entities( ElasticSearchIndexingConfiguration.class ) .visibleIn( configVisibility() ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java index 1998fd8..cb7da97 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/assembly/ESFilesystemIndexQueryAssembler.java @@ -21,7 +21,7 @@ package org.apache.polygene.index.elasticsearch.assembly; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration; +import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration; import org.apache.polygene.index.elasticsearch.filesystem.ESFilesystemIndexQueryService; import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchAssembler; @@ -40,7 +40,7 @@ public class ESFilesystemIndexQueryAssembler if( hasConfig() ) { - configModule().entities( ElasticSearchConfiguration.class ). + configModule().entities( ElasticSearchIndexingConfiguration.class ). visibleIn( configVisibility() ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java index 24ee996..229e7c3 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/client/ESClientSupport.java @@ -21,14 +21,14 @@ import org.apache.polygene.api.configuration.Configuration; import org.apache.polygene.api.injection.scope.This; import org.apache.polygene.api.injection.scope.Uses; import org.apache.polygene.api.service.ServiceDescriptor; -import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration; +import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration; import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchSupport; import org.elasticsearch.client.Client; public class ESClientSupport extends AbstractElasticSearchSupport { @This - private Configuration<ElasticSearchConfiguration> configuration; + private Configuration<ElasticSearchIndexingConfiguration> configuration; @Uses private ServiceDescriptor descriptor; @@ -37,7 +37,7 @@ public class ESClientSupport extends AbstractElasticSearchSupport protected void activateElasticSearch() throws Exception { configuration.refresh(); - ElasticSearchConfiguration config = configuration.get(); + ElasticSearchIndexingConfiguration config = configuration.get(); index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get(); indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java index 99d581f..d7a1f54 100644 --- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java +++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/filesystem/ESFilesystemSupport.java @@ -26,7 +26,7 @@ import org.apache.polygene.api.identity.HasIdentity; import org.apache.polygene.api.identity.Identity; import org.apache.polygene.api.injection.scope.Service; import org.apache.polygene.api.injection.scope.This; -import org.apache.polygene.index.elasticsearch.ElasticSearchConfiguration; +import org.apache.polygene.index.elasticsearch.ElasticSearchIndexingConfiguration; import org.apache.polygene.index.elasticsearch.internal.AbstractElasticSearchSupport; import org.apache.polygene.library.fileconfig.FileConfiguration; import org.elasticsearch.common.settings.Settings; @@ -36,7 +36,7 @@ public class ESFilesystemSupport extends AbstractElasticSearchSupport { @This - private Configuration<ElasticSearchConfiguration> configuration; + private Configuration<ElasticSearchIndexingConfiguration> configuration; @This private HasIdentity hasIdentity; @@ -51,7 +51,7 @@ public class ESFilesystemSupport throws Exception { configuration.refresh(); - ElasticSearchConfiguration config = configuration.get(); + ElasticSearchIndexingConfiguration config = configuration.get(); String clusterName = config.clusterName().get() == null ? DEFAULT_CLUSTER_NAME : config.clusterName().get(); index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java index 8dcea1b..65e9280 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchComplexQueryTest.java @@ -70,7 +70,7 @@ public class ElasticSearchComplexQueryTest new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() ) .withConfig( config, Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java index 61d26dd..66a6eab 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchFinderTest.java @@ -68,7 +68,7 @@ public class ElasticSearchFinderTest new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() ) .withConfig( config, Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java index a55ff31..fb25e39 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryMultimoduleTest.java @@ -53,7 +53,7 @@ public class ElasticSearchQueryMultimoduleTest extends ElasticSearchQueryTest .withConfig( config, Visibility.application ) .visibleIn( Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java index 6b6feab..7843c26 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java @@ -73,7 +73,7 @@ public class ElasticSearchQueryTest extends AbstractQueryTest new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() ) .withConfig( config, Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java index a52babb..c6578f0 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchTest.java @@ -137,7 +137,7 @@ public class ElasticSearchTest new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() ) .withConfig( config, Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java index a8bd09b..8e48aeb 100644 --- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java +++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ImmenseTermTest.java @@ -103,7 +103,7 @@ public class ImmenseTermTest new ESClientIndexQueryAssembler( ELASTIC_SEARCH.client() ) .withConfig( config, Visibility.layer ) .assemble( module ); - ElasticSearchConfiguration esConfig = config.forMixin( ElasticSearchConfiguration.class ).declareDefaults(); + ElasticSearchIndexingConfiguration esConfig = config.forMixin( ElasticSearchIndexingConfiguration.class ).declareDefaults(); esConfig.index().set( ELASTIC_SEARCH.indexName( ElasticSearchQueryTest.class.getName(), testName.getMethodName() ) ); esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java deleted file mode 100644 index 089c255..0000000 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingEngineService.java +++ /dev/null @@ -1,30 +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.rdf; - -import org.apache.polygene.index.rdf.indexing.RdfExporter; -import org.apache.polygene.index.rdf.indexing.RdfIndexingService; -import org.apache.polygene.index.rdf.query.RdfQueryService; - -public interface RdfIndexingEngineService - extends RdfQueryService, RdfIndexingService, RdfExporter -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java new file mode 100644 index 0000000..aefd780 --- /dev/null +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/RdfIndexingService.java @@ -0,0 +1,30 @@ +/* + * 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.rdf; + +import org.apache.polygene.index.rdf.indexing.RdfIndexExporter; +import org.apache.polygene.index.rdf.indexing.RdfIndexerService; +import org.apache.polygene.index.rdf.query.RdfQueryService; + +public interface RdfIndexingService + extends RdfQueryService, RdfIndexerService, RdfIndexExporter +{ +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java index b4738db..351b2f9 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfMemoryStoreAssembler.java @@ -23,7 +23,7 @@ package org.apache.polygene.index.rdf.assembly; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.rdf.RdfIndexingEngineService; +import org.apache.polygene.index.rdf.RdfIndexingService; import org.apache.polygene.index.rdf.query.RdfQueryParserFactory; import org.apache.polygene.library.rdf.entity.EntityStateSerializer; import org.apache.polygene.library.rdf.entity.EntityTypeSerializer; @@ -51,7 +51,7 @@ public class RdfMemoryStoreAssembler extends AbstractRdfIndexingAssembler<RdfNat module.services( MemoryRepositoryService.class ) .visibleIn( repositoryVisibility ) .instantiateOnStartup(); - module.services( RdfIndexingEngineService.class ) + module.services( RdfIndexingService.class ) .taggedWith( "rdf", "query", "indexing" ) .visibleIn( visibility() ) .instantiateOnStartup(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java index 57173db..f9e7724 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfNativeSesameStoreAssembler.java @@ -22,7 +22,7 @@ package org.apache.polygene.index.rdf.assembly; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.rdf.RdfIndexingEngineService; +import org.apache.polygene.index.rdf.RdfIndexingService; import org.apache.polygene.index.rdf.query.RdfQueryParserFactory; import org.apache.polygene.library.rdf.entity.EntityStateSerializer; import org.apache.polygene.library.rdf.entity.EntityTypeSerializer; @@ -52,7 +52,7 @@ public class RdfNativeSesameStoreAssembler extends AbstractRdfIndexingAssembler< module.services( NativeRepositoryService.class ) .visibleIn( repositoryVisibility ) .instantiateOnStartup(); - module.services( RdfIndexingEngineService.class ) + module.services( RdfIndexingService.class ) .taggedWith( "rdf", "query", "indexing" ) .visibleIn( visibility() ) .instantiateOnStartup(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java index 5629697..6462e4f 100644 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/assembly/RdfRdbmsSesameStoreAssembler.java @@ -22,7 +22,7 @@ package org.apache.polygene.index.rdf.assembly; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.index.rdf.RdfIndexingEngineService; +import org.apache.polygene.index.rdf.RdfIndexingService; import org.apache.polygene.index.rdf.query.RdfQueryParserFactory; import org.apache.polygene.library.rdf.entity.EntityStateSerializer; import org.apache.polygene.library.rdf.entity.EntityTypeSerializer; @@ -52,7 +52,7 @@ public class RdfRdbmsSesameStoreAssembler extends AbstractRdfIndexingAssembler< module.services( RdbmsRepositoryService.class ) .visibleIn( repositoryVisibility ) .instantiateOnStartup(); - module.services( RdfIndexingEngineService.class ) + module.services( RdfIndexingService.class ) .taggedWith( "rdf", "query", "indexing" ) .visibleIn( visibility() ) .instantiateOnStartup(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java deleted file mode 100644 index a69c017..0000000 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfExporter.java +++ /dev/null @@ -1,106 +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.rdf.indexing; - -import java.io.IOException; -import java.io.PrintStream; -import java.io.PrintWriter; -import org.openrdf.repository.Repository; -import org.openrdf.repository.RepositoryConnection; -import org.openrdf.repository.RepositoryException; -import org.openrdf.rio.RDFFormat; -import org.openrdf.rio.RDFWriter; -import org.openrdf.rio.Rio; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.spi.query.IndexExporter; - -/** - * JAVADOC - */ -@Mixins( RdfExporter.RdfExporterMixin.class ) -public interface RdfExporter - extends IndexExporter -{ - /** - * JAVADOC - */ - class RdfExporterMixin - implements IndexExporter - { - @Service - private Repository repository; - - @Override - public void exportReadableToStream( PrintStream out ) - throws IOException - { - RDFWriter rdfWriter = Rio.createWriter( RDFFormat.TRIG, out ); - try - { - final RepositoryConnection connection = repository.getConnection(); - try - { - connection.export( rdfWriter ); - } - catch( Exception e ) - { - e.printStackTrace(); - } - finally - { - connection.close(); - } - } - catch( RepositoryException e ) - { - throw new IOException( e ); - } - } - - @Override - public void exportFormalToWriter( PrintWriter out ) - throws IOException - { - RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out ); - try - { - final RepositoryConnection connection = repository.getConnection(); - try - { - connection.export( rdfWriter ); - } - catch( Exception e ) - { - e.printStackTrace(); - } - finally - { - connection.close(); - } - } - catch( RepositoryException e ) - { - throw new IOException( e ); - } - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java new file mode 100644 index 0000000..ad0e599 --- /dev/null +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexExporter.java @@ -0,0 +1,92 @@ +/* + * 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.rdf.indexing; + +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import org.apache.polygene.api.injection.scope.Service; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.spi.query.IndexExporter; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryException; +import org.openrdf.rio.RDFFormat; +import org.openrdf.rio.RDFWriter; +import org.openrdf.rio.Rio; + +/** + * JAVADOC + */ +@Mixins( RdfIndexExporter.RdfExporterMixin.class ) +public interface RdfIndexExporter extends IndexExporter +{ + /** + * JAVADOC + */ + class RdfExporterMixin + implements IndexExporter + { + @Service + private Repository repository; + + @Override + public void exportReadableToStream( PrintStream out ) + throws IOException + { + RDFWriter rdfWriter = Rio.createWriter( RDFFormat.TRIG, out ); + exportToWriter( rdfWriter ); + } + + @Override + public void exportFormalToWriter( PrintWriter out ) + throws IOException + { + RDFWriter rdfWriter = Rio.createWriter( RDFFormat.RDFXML, out ); + exportToWriter( rdfWriter ); + } + + private void exportToWriter( RDFWriter rdfWriter ) + throws IOException + { + try + { + final RepositoryConnection connection = repository.getConnection(); + try + { + connection.export( rdfWriter ); + } + catch( Exception e ) + { + e.printStackTrace(); + } + finally + { + connection.close(); + } + } + catch( RepositoryException e ) + { + throw new IOException( e ); + } + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java new file mode 100644 index 0000000..d47a7f7 --- /dev/null +++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexerService.java @@ -0,0 +1,239 @@ +/* + * 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.rdf.indexing; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.polygene.api.activation.ActivatorAdapter; +import org.apache.polygene.api.activation.Activators; +import org.apache.polygene.api.entity.EntityDescriptor; +import org.apache.polygene.api.entity.EntityReference; +import org.apache.polygene.api.injection.scope.Service; +import org.apache.polygene.api.injection.scope.Uses; +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.api.service.ServiceReference; +import org.apache.polygene.api.util.Classes; +import org.apache.polygene.library.rdf.entity.EntityStateSerializer; +import org.apache.polygene.library.rdf.entity.EntityTypeSerializer; +import org.apache.polygene.spi.entity.EntityState; +import org.apache.polygene.spi.entity.EntityStatus; +import org.apache.polygene.spi.entitystore.StateChangeListener; +import org.openrdf.model.Graph; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.ValueFactory; +import org.openrdf.model.impl.GraphImpl; +import org.openrdf.repository.Repository; +import org.openrdf.repository.RepositoryConnection; +import org.openrdf.repository.RepositoryException; + +@Mixins( RdfIndexerService.RdfEntityIndexerMixin.class ) +@Activators( RdfIndexerService.Activator.class ) +public interface RdfIndexerService extends StateChangeListener +{ + void initialize(); + + File dataDir(); + + class Activator extends ActivatorAdapter<ServiceReference<RdfIndexerService>> + { + + @Override + public void afterActivation( ServiceReference<RdfIndexerService> activated ) + throws Exception + { + activated.get().initialize(); + } + } + + /** + * JAVADOC Add JavaDoc + */ + abstract class RdfEntityIndexerMixin + implements RdfIndexerService + { + @Service + private ServiceReference<Repository> repository; + + @Uses + private EntityStateSerializer stateSerializer; + + @Uses + private EntityTypeSerializer typeSerializer; + + private Set<EntityDescriptor> indexedEntityTypes; + private ValueFactory valueFactory; + + @Override + public void initialize() + { + indexedEntityTypes = new HashSet<>(); + } + + @Override + public void notifyChanges( Iterable<EntityState> entityStates ) + { + try + { + if( repository == null || !repository.isActive() ) // has been shut down, or not yet started... + { + return; + } + final RepositoryConnection connection = repository.get().getConnection(); + // The Repository is being initialized and not ready yet. + // This happens when the Repository is being initialized and it is accessing its own configuration. + if( connection == null ) + { + return; + } + connection.setAutoCommit( false ); + try + { + removeEntityStates( entityStates, connection ); + connection.commit(); + final Set<EntityDescriptor> entityTypes = indexUpdates( entityStates, connection ); + indexNewTypes( connection, entityTypes ); + } + finally + { + connection.commit(); + connection.close(); + } + } + catch( Throwable e ) + { + e.printStackTrace(); + //TODO What shall we do with the exception? + } + } + + private void indexNewTypes( RepositoryConnection connection, Set<EntityDescriptor> entityTypes ) + throws RepositoryException + { + // Index new types + for( EntityDescriptor entityType : entityTypes ) + { + if( !indexedEntityTypes.contains( entityType ) ) + { + indexEntityType( entityType, connection ); + indexedEntityTypes.add( entityType ); + } + } + } + + private Set<EntityDescriptor> indexUpdates( Iterable<EntityState> entityStates, + RepositoryConnection connection + ) + throws RepositoryException + { + // Figure out what to update + final Set<EntityDescriptor> entityTypes = new HashSet<>(); + for( EntityState entityState : entityStates ) + { + if( entityState.status().equals( EntityStatus.UPDATED ) ) + { + indexEntityState( entityState, connection ); + entityTypes.add( entityState.entityDescriptor() ); + } + else if( entityState.status().equals( EntityStatus.NEW ) ) + { + indexEntityState( entityState, connection ); + entityTypes.add( entityState.entityDescriptor() ); + } + } + return entityTypes; + } + + private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection ) + throws RepositoryException + { + List<URI> removedStates = new ArrayList<>(); + for( EntityState entityState : entityStates ) + { + if( entityState.status().equals( EntityStatus.REMOVED ) ) + { + removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); + } + else if( entityState.status().equals( EntityStatus.UPDATED ) ) + { + removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); + } + } + + if( !removedStates.isEmpty() ) + { + Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] ); + connection.remove( null, null, null, resources ); + } + } + + private void indexEntityState( final EntityState entityState, + final RepositoryConnection connection + ) + throws RepositoryException + { + if( entityState.entityDescriptor().queryable() ) + { + EntityReference reference = entityState.entityReference(); + final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference); + Graph graph = new GraphImpl(); + stateSerializer.serialize( entityState, false, graph ); + connection.add( graph, entityURI ); + } + } + + private void indexEntityType( final EntityDescriptor entityType, + final RepositoryConnection connection + ) + throws RepositoryException + { + if( entityType.queryable() ) + { + String uri = Classes.toURI(entityType.types().findFirst().orElse(null)); + final URI compositeURI = getValueFactory().createURI( uri ); + // remove composite type if already present + connection.clear( compositeURI ); + + Iterable<Statement> statements = typeSerializer.serialize( entityType ); + connection.add( statements, compositeURI ); + } + } + + private ValueFactory getValueFactory() + { + if( valueFactory == null ) + { + valueFactory = repository.get().getValueFactory(); + } + return valueFactory; + } + + @Override + public File dataDir() + { + return repository.get().getDataDir(); + } + } +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java deleted file mode 100644 index 11c5ce7..0000000 --- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/indexing/RdfIndexingService.java +++ /dev/null @@ -1,240 +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.rdf.indexing; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import org.apache.polygene.api.activation.ActivatorAdapter; -import org.apache.polygene.api.activation.Activators; -import org.apache.polygene.api.entity.EntityDescriptor; -import org.apache.polygene.api.entity.EntityReference; -import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.api.injection.scope.Uses; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.service.ServiceReference; -import org.apache.polygene.api.util.Classes; -import org.apache.polygene.library.rdf.entity.EntityStateSerializer; -import org.apache.polygene.library.rdf.entity.EntityTypeSerializer; -import org.apache.polygene.spi.entity.EntityState; -import org.apache.polygene.spi.entity.EntityStatus; -import org.apache.polygene.spi.entitystore.StateChangeListener; -import org.openrdf.model.Graph; -import org.openrdf.model.Resource; -import org.openrdf.model.Statement; -import org.openrdf.model.URI; -import org.openrdf.model.ValueFactory; -import org.openrdf.model.impl.GraphImpl; -import org.openrdf.repository.Repository; -import org.openrdf.repository.RepositoryConnection; -import org.openrdf.repository.RepositoryException; - -@Mixins( RdfIndexingService.RdfEntityIndexerMixin.class ) -@Activators( RdfIndexingService.Activator.class ) -public interface RdfIndexingService - extends StateChangeListener -{ - void initialize(); - - File dataDir(); - - class Activator extends ActivatorAdapter<ServiceReference<RdfIndexingService>> - { - - @Override - public void afterActivation( ServiceReference<RdfIndexingService> activated ) - throws Exception - { - activated.get().initialize(); - } - } - - /** - * JAVADOC Add JavaDoc - */ - abstract class RdfEntityIndexerMixin - implements RdfIndexingService - { - @Service - private ServiceReference<Repository> repository; - - @Uses - private EntityStateSerializer stateSerializer; - - @Uses - private EntityTypeSerializer typeSerializer; - - private Set<EntityDescriptor> indexedEntityTypes; - private ValueFactory valueFactory; - - @Override - public void initialize() - { - indexedEntityTypes = new HashSet<>(); - } - - @Override - public void notifyChanges( Iterable<EntityState> entityStates ) - { - try - { - if( repository == null || !repository.isActive() ) // has been shut down, or not yet started... - { - return; - } - final RepositoryConnection connection = repository.get().getConnection(); - // The Repository is being initialized and not ready yet. - // This happens when the Repository is being initialized and it is accessing its own configuration. - if( connection == null ) - { - return; - } - connection.setAutoCommit( false ); - try - { - removeEntityStates( entityStates, connection ); - connection.commit(); - final Set<EntityDescriptor> entityTypes = indexUpdates( entityStates, connection ); - indexNewTypes( connection, entityTypes ); - } - finally - { - connection.commit(); - connection.close(); - } - } - catch( Throwable e ) - { - e.printStackTrace(); - //TODO What shall we do with the exception? - } - } - - private void indexNewTypes( RepositoryConnection connection, Set<EntityDescriptor> entityTypes ) - throws RepositoryException - { - // Index new types - for( EntityDescriptor entityType : entityTypes ) - { - if( !indexedEntityTypes.contains( entityType ) ) - { - indexEntityType( entityType, connection ); - indexedEntityTypes.add( entityType ); - } - } - } - - private Set<EntityDescriptor> indexUpdates( Iterable<EntityState> entityStates, - RepositoryConnection connection - ) - throws RepositoryException - { - // Figure out what to update - final Set<EntityDescriptor> entityTypes = new HashSet<>(); - for( EntityState entityState : entityStates ) - { - if( entityState.status().equals( EntityStatus.UPDATED ) ) - { - indexEntityState( entityState, connection ); - entityTypes.add( entityState.entityDescriptor() ); - } - else if( entityState.status().equals( EntityStatus.NEW ) ) - { - indexEntityState( entityState, connection ); - entityTypes.add( entityState.entityDescriptor() ); - } - } - return entityTypes; - } - - private void removeEntityStates( Iterable<EntityState> entityStates, RepositoryConnection connection ) - throws RepositoryException - { - List<URI> removedStates = new ArrayList<>(); - for( EntityState entityState : entityStates ) - { - if( entityState.status().equals( EntityStatus.REMOVED ) ) - { - removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); - } - else if( entityState.status().equals( EntityStatus.UPDATED ) ) - { - removedStates.add( stateSerializer.createEntityURI( getValueFactory(), entityState.entityReference() ) ); - } - } - - if( !removedStates.isEmpty() ) - { - Resource[] resources = removedStates.toArray( new Resource[ removedStates.size() ] ); - connection.remove( null, null, null, resources ); - } - } - - private void indexEntityState( final EntityState entityState, - final RepositoryConnection connection - ) - throws RepositoryException - { - if( entityState.entityDescriptor().queryable() ) - { - EntityReference reference = entityState.entityReference(); - final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference); - Graph graph = new GraphImpl(); - stateSerializer.serialize( entityState, false, graph ); - connection.add( graph, entityURI ); - } - } - - private void indexEntityType( final EntityDescriptor entityType, - final RepositoryConnection connection - ) - throws RepositoryException - { - if( entityType.queryable() ) - { - String uri = Classes.toURI(entityType.types().findFirst().orElse(null)); - final URI compositeURI = getValueFactory().createURI( uri ); - // remove composite type if already present - connection.clear( compositeURI ); - - Iterable<Statement> statements = typeSerializer.serialize( entityType ); - connection.add( statements, compositeURI ); - } - } - - private ValueFactory getValueFactory() - { - if( valueFactory == null ) - { - valueFactory = repository.get().getValueFactory(); - } - return valueFactory; - } - - @Override - public File dataDir() - { - return repository.get().getDataDir(); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java index 31c2d3c..63ca3fd 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfComplexQueryTest.java @@ -37,7 +37,7 @@ public class RdfComplexQueryTest throws AssemblyException { super.assemble( module ); - module.services( RdfIndexingEngineService.class ).instantiateOnStartup(); + module.services( RdfIndexingService.class ).instantiateOnStartup(); module.objects( EntityStateSerializer.class, EntityTypeSerializer.class ); module.services( MemoryRepositoryService.class ).identifiedBy( "rdf-indexing" ).instantiateOnStartup(); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java index 86723ce..73bde3b 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfEntityFinderTest.java @@ -34,7 +34,7 @@ public class RdfEntityFinderTest extends AbstractEntityFinderTest { super.assemble( module ); module.objects( EntityStateSerializer.class, EntityTypeSerializer.class ); - module.services( RdfIndexingEngineService.class ).instantiateOnStartup(); + module.services( RdfIndexingService.class ).instantiateOnStartup(); module.services( MemoryRepositoryService.class ).identifiedBy( "rdf-indexing" ).instantiateOnStartup(); // module.services( NativeRdfRepositoryService.class ).identifiedBy( "rdf-indexing" ); // module.addComposites( NativeRdfConfiguration.class ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java index 2694153..5e6dd79 100644 --- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java +++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java @@ -41,7 +41,7 @@ import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.Energy4Java; import org.apache.polygene.bootstrap.LayerAssembly; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.entitystore.jdbm.JdbmConfiguration; +import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration; import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler; import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler; import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler; @@ -307,8 +307,8 @@ public class Qi95IssueTest .dataDirectory() .set( rdfDirectory().getAbsolutePath() ); - module.entities( JdbmConfiguration.class ).visibleIn( Visibility.application ); - module.forMixin( JdbmConfiguration.class ) + module.entities( JdbmEntityStoreConfiguration.class ).visibleIn( Visibility.application ); + module.forMixin( JdbmEntityStoreConfiguration.class ) .declareDefaults() .file() .set( jdbmDirectory().getAbsolutePath() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java index 445f7ea..13daa9f 100644 --- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java +++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/SolrQueryService.java @@ -33,8 +33,7 @@ import org.apache.polygene.spi.query.EntityFinder; */ @Mixins( { SolrEntityIndexerMixin.class, SolrEntityQueryMixin.class } ) @Activators( SolrQueryService.Activator.class ) -public interface SolrQueryService - extends EntityFinder, StateChangeListener, SolrSearch +public interface SolrQueryService extends EntityFinder, StateChangeListener, SolrSearch { void inflateSolrSchema(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java new file mode 100644 index 0000000..33e6b66 --- /dev/null +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingConfiguration.java @@ -0,0 +1,31 @@ +/* + * 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.sql; + +import org.apache.polygene.api.common.UseDefaults; +import org.apache.polygene.api.property.Property; +import org.apache.polygene.library.sql.common.SQLConfiguration; + +public interface SQLIndexingConfiguration extends SQLConfiguration +{ + @UseDefaults( "POLYGENE_INDEX" ) + @Override + Property<String> schemaName(); +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java deleted file mode 100644 index 5920ed6..0000000 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineConfiguration.java +++ /dev/null @@ -1,31 +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.sql; - -import org.apache.polygene.api.common.UseDefaults; -import org.apache.polygene.api.property.Property; -import org.apache.polygene.library.sql.common.SQLConfiguration; - -public interface SQLIndexingEngineConfiguration extends SQLConfiguration -{ - @UseDefaults( "POLYGENE_INDEX" ) - @Override - Property<String> schemaName(); -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java deleted file mode 100644 index e43d465..0000000 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingEngineService.java +++ /dev/null @@ -1,44 +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.sql; - -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.index.sql.internal.SQLEntityFinder; -import org.apache.polygene.index.sql.internal.SQLStateChangeListener; -import org.apache.polygene.spi.entitystore.StateChangeListener; -import org.apache.polygene.spi.query.EntityFinder; - -/** - * This is actual service responsible of managing indexing and queries and creating database structure. - * <p> - * The reason why all these components are in one single service is that they all require some data about - * the database structure. Rather than exposing all of that data publicly to be available via another service, - * it is stored in a state-style private mixin. Thus all the database-related data is available only to this - * service, and no one else. - * </p> - */ -@Mixins( { - SQLEntityFinder.class, - SQLStateChangeListener.class -} ) -public interface SQLIndexingEngineService - extends StateChangeListener, EntityFinder -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java new file mode 100644 index 0000000..b3bdcd4 --- /dev/null +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/SQLIndexingService.java @@ -0,0 +1,44 @@ +/* + * 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.sql; + +import org.apache.polygene.api.mixin.Mixins; +import org.apache.polygene.index.sql.internal.SQLEntityFinder; +import org.apache.polygene.index.sql.internal.SQLStateChangeListener; +import org.apache.polygene.spi.entitystore.StateChangeListener; +import org.apache.polygene.spi.query.EntityFinder; + +/** + * This is actual service responsible of managing indexing and queries and creating database structure. + * <p> + * The reason why all these components are in one single service is that they all require some data about + * the database structure. Rather than exposing all of that data publicly to be available via another service, + * it is stored in a state-style private mixin. Thus all the database-related data is available only to this + * service, and no one else. + * </p> + */ +@Mixins( { + SQLEntityFinder.class, + SQLStateChangeListener.class +} ) +public interface SQLIndexingService + extends StateChangeListener, EntityFinder +{ +} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java index 776c3c9..5708e79 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/AbstractSQLIndexQueryAssembler.java @@ -28,13 +28,12 @@ import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.index.reindexer.ReindexerConfiguration; import org.apache.polygene.index.reindexer.ReindexerService; -import org.apache.polygene.index.sql.SQLIndexingEngineConfiguration; +import org.apache.polygene.index.sql.SQLIndexingConfiguration; import org.apache.polygene.index.sql.support.common.ReindexingStrategy; import org.apache.polygene.library.sql.generator.vendor.SQLVendor; import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider; -public abstract class AbstractSQLIndexQueryAssembler<AssemblerType> - extends Assemblers.VisibilityIdentityConfig<AssemblerType> +public abstract class AbstractSQLIndexQueryAssembler<AssemblerType> extends Assemblers.VisibilityIdentityConfig<AssemblerType> { public static final Identity DEFAULT_IDENTITY = new StringIdentity( "indexing-sql" ); @@ -91,7 +90,7 @@ public abstract class AbstractSQLIndexQueryAssembler<AssemblerType> if( hasConfig() ) { - configModule().entities( SQLIndexingEngineConfiguration.class, + configModule().entities( SQLIndexingConfiguration.class, ReindexerConfiguration.class ). visibleIn( configVisibility() ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java index b5e8cc6..3d4320e 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/PostgreSQLIndexQueryAssembler.java @@ -25,10 +25,8 @@ import org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor; import org.apache.polygene.library.sql.generator.vendor.SQLVendor; import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider; -public class PostgreSQLIndexQueryAssembler - extends AbstractSQLIndexQueryAssembler<PostgreSQLIndexQueryAssembler> +public class PostgreSQLIndexQueryAssembler extends AbstractSQLIndexQueryAssembler<PostgreSQLIndexQueryAssembler> { - @Override protected SQLVendor getSQLVendor() throws IOException http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java ---------------------------------------------------------------------- diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java index 6f05878..84e367c 100644 --- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java +++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/postgresql/PostgreSQLService.java @@ -20,7 +20,7 @@ package org.apache.polygene.index.sql.support.postgresql; import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.index.sql.SQLIndexingEngineService; +import org.apache.polygene.index.sql.SQLIndexingService; import org.apache.polygene.index.sql.internal.SQLEntityFinder; import org.apache.polygene.index.sql.internal.SQLStateChangeListener; import org.apache.polygene.index.sql.support.api.SQLAppStartup; @@ -47,7 +47,7 @@ import org.apache.polygene.spi.query.IndexExporter; PostgreSQLIndexExporter.class }) public interface PostgreSQLService - extends SQLAppStartup, SQLIndexing, SQLQuerying, IndexExporter, SQLIndexingEngineService + extends SQLAppStartup, SQLIndexing, SQLQuerying, IndexExporter, SQLIndexingService { } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java index 18a5483..21b87ec 100644 --- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java +++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/CodahaleMetricsProvider.java @@ -26,8 +26,7 @@ import org.apache.polygene.api.mixin.Mixins; import org.apache.polygene.api.service.ServiceActivation; @Mixins( CodahaleMetricsMixin.class ) -public interface CodahaleMetricsProvider - extends MetricsProvider, ServiceActivation +public interface CodahaleMetricsProvider extends MetricsProvider, ServiceActivation { MetricRegistry metricRegistry(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java ---------------------------------------------------------------------- diff --git a/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java b/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java index 38c91a8..3ee1fcb 100644 --- a/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java +++ b/extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java @@ -34,7 +34,7 @@ import org.apache.polygene.api.unitofwork.UnitOfWork; import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; -import org.apache.polygene.entitystore.jdbm.JdbmConfiguration; +import org.apache.polygene.entitystore.jdbm.JdbmEntityStoreConfiguration; import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler; import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler; import org.apache.polygene.library.rdf.repository.NativeConfiguration; @@ -75,9 +75,9 @@ public class ReindexerTest // Configuration ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - config.entities( JdbmConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class ) + config.entities( JdbmEntityStoreConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class ) .visibleIn( Visibility.layer ); - config.forMixin( JdbmConfiguration.class ).declareDefaults() + config.forMixin( JdbmEntityStoreConfiguration.class ).declareDefaults() .file().set( new File( tmpDir.getRoot(), ENTITIES_DIR ).getAbsolutePath() ); config.forMixin( NativeConfiguration.class ).declareDefaults() .dataDirectory().set( new File( tmpDir.getRoot(), INDEX_DIR ).getAbsolutePath() ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea3f84a5/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java index 971b405..41798c0 100644 --- a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java +++ b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/IndexResource.java @@ -20,10 +20,14 @@ package org.apache.polygene.library.rest.admin; -import java.io.*; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintStream; +import java.io.PrintWriter; import java.util.Arrays; import org.apache.polygene.api.injection.scope.Service; -import org.apache.polygene.index.rdf.indexing.RdfExporter; +import org.apache.polygene.index.rdf.indexing.RdfIndexExporter; import org.restlet.data.MediaType; import org.restlet.representation.OutputRepresentation; import org.restlet.representation.Representation; @@ -38,7 +42,7 @@ public class IndexResource extends ServerResource { @Service - private RdfExporter exporter; + private RdfIndexExporter exporter; public IndexResource() {
