org.apache.stanbol.enhancer.engines.entityhublinking
Class TrackingEntitySearcher<T>

java.lang.Object
  extended by org.apache.stanbol.enhancer.engines.entityhublinking.TrackingEntitySearcher<T>
All Implemented Interfaces:
org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher
Direct Known Subclasses:
EntityhubSearcher, ReferencedSiteSearcher

public abstract class TrackingEntitySearcher<T>
extends Object
implements org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher

Abstract super class for EntitySearchers that need to track the OSGI service used to lookup Entities. Used by the EntityhubSearcher and the ReferencedSiteSearcher implementation

Author:
Rupert Westenthaler

Field Summary
protected  org.osgi.framework.BundleContext bundleContext
           
 
Constructor Summary
protected TrackingEntitySearcher(org.osgi.framework.BundleContext context, Class<T> serviceClass, Map<String,String> filterEntries, org.osgi.util.tracker.ServiceTrackerCustomizer customizer)
          Creates a new instance for the parsed parameter
 
Method Summary
 void close()
          Closes the ServiceTracker used to track the service.
protected  void finalize()
           
protected  T getSearchService()
          Getter for the Service used to search for Entities.
 void open()
          Starts the tracking by calling ServiceTracker.open()
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher
get, getLimit, getOriginInformation, lookup, supportsOfflineMode
 

Field Detail

bundleContext

protected org.osgi.framework.BundleContext bundleContext
Constructor Detail

TrackingEntitySearcher

protected TrackingEntitySearcher(org.osgi.framework.BundleContext context,
                                 Class<T> serviceClass,
                                 Map<String,String> filterEntries,
                                 org.osgi.util.tracker.ServiceTrackerCustomizer customizer)
Creates a new instance for the parsed parameter

Parameters:
context - the BundleContexed used to create the ServiceTracker listening for the SearchService
serviceClass -
filterEntries -
Method Detail

open

public void open()
Starts the tracking by calling ServiceTracker.open()


getSearchService

protected T getSearchService()
Getter for the Service used to search for Entities. If the service is currently not available, than this method will return null

Returns:
The service of null if not available

close

public void close()
Closes the ServiceTracker used to track the service.


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.