Commit 720957e8 by Suma Shivaprasad

Improvements to pass a set of type change listeners through Guice

parent 8f9dec9d
......@@ -90,7 +90,7 @@
<log4j.version>1.2.17</log4j.version>
<akka.version>2.3.7</akka.version>
<spray.version>1.3.1</spray.version>
<guava.version>11.0.2</guava.version>
<guava.version>14.0</guava.version>
<fastutil.version>6.5.16</fastutil.version>
<PermGen>64m</PermGen>
......@@ -317,25 +317,25 @@
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-throwingproviders</artifactId>
<version>3.0</version>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
<version>3.0</version>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>3.0</version>
<version>4.0</version>
</dependency>
<dependency>
......
......@@ -45,7 +45,6 @@ import org.apache.atlas.services.MetadataService;
* Guice module for Repository module.
*/
public class RepositoryMetadataModule extends com.google.inject.AbstractModule {
private Multibinder<Provider<TypesChangeListener>> typesChangeListenerBinder;
@Override
protected void configure() {
......@@ -63,13 +62,8 @@ public class RepositoryMetadataModule extends com.google.inject.AbstractModule {
// bind the ITypeStore interface to an implementation
bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton();
// bind the GraphService interface to an implementation
// bind(GraphService.class).to(graphServiceClass);
typesChangeListenerBinder = Multibinder.newSetBinder(binder(), new TypeLiteral<TypesChangeListener>());
typesChangeListenerBinder.addBinding().to(GraphBackedSearchIndexer.class);
bind(TypesChangeListener.class).to(GraphBackedSearchIndexer.class);
Multibinder<TypesChangeListener> typesChangeListenerBinder = Multibinder.newSetBinder(binder(), TypesChangeListener.class);
typesChangeListenerBinder.addBinding().toProvider(GraphBackedSearchIndexer.class);
// bind the MetadataService interface to an implementation
bind(MetadataService.class).to(DefaultMetadataService.class).asEagerSingleton();
......
......@@ -18,6 +18,7 @@
package org.apache.atlas.repository.graph;
import com.google.inject.Provider;
import com.thinkaurelius.titan.core.Cardinality;
import com.thinkaurelius.titan.core.PropertyKey;
import com.thinkaurelius.titan.core.TitanGraph;
......@@ -28,6 +29,7 @@ import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex;
import org.apache.atlas.MetadataException;
import org.apache.atlas.discovery.SearchIndexer;
import org.apache.atlas.listener.TypesChangeListener;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.IndexCreationException;
import org.apache.atlas.repository.IndexException;
......@@ -51,7 +53,7 @@ import java.util.Map;
/**
* Adds index for properties of a given type when its added before any instances are added.
*/
public class GraphBackedSearchIndexer implements SearchIndexer {
public class GraphBackedSearchIndexer implements SearchIndexer, Provider<TypesChangeListener> {
private static final Logger LOG = LoggerFactory.getLogger(GraphBackedSearchIndexer.class);
......@@ -368,6 +370,11 @@ public class GraphBackedSearchIndexer implements SearchIndexer {
}
}
@Override
public TypesChangeListener get() {
return this;
}
/* Commenting this out since we do not need an index for edge label here
private void createEdgeMixedIndex(String propertyName) {
EdgeLabel edgeLabel = management.getEdgeLabel(propertyName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment