Class Context

  • Direct Known Subclasses:

    public abstract class Context
    extends Object

    This abstract class gives access to all available objects. So any component implemented by a user can have the full power of DataImportHandler

    Refer to for more details.

    This API is experimental and subject to change

    solr 1.3
    • Constructor Detail

    • Method Detail

      • getEntityAttribute

        public abstract String getEntityAttribute(String name)
        Get the value of any attribute put into this entity
        name - name of the attribute eg: 'name'
        value of named attribute in entity
      • getResolvedEntityAttribute

        public abstract String getResolvedEntityAttribute(String name)
        Get the value of any attribute put into this entity after resolving all variables found in the attribute value
        name - name of the attribute
        value of the named attribute after resolving all variables
      • getAllEntityFields

        public abstract List<Map<String,String>> getAllEntityFields()
        Returns all the fields put into an entity. each item (which is a map ) in the list corresponds to one field. each if the map contains the attribute names and values in a field
        all fields in an entity
      • getDataSource

        public abstract DataSource getDataSource()
        Gets the datasource instance defined for this entity. Do not close() this instance. Transformers should use the getDataSource(String name) method.
        a new DataSource instance as configured for the current entity
        See Also:
        DataSource, getDataSource(String)
      • getDataSource

        public abstract DataSource getDataSource(String name)
        Gets a new DataSource instance with a name. Ensure that you close() this after use because this is created just for this method call.
        name - Name of the dataSource as defined in the dataSource tag
        a new DataSource instance
        See Also:
      • setSessionAttribute

        public abstract void setSessionAttribute(String name,
                                                 Object val,
                                                 String scope)
        Store values in a certain name and scope (entity, document,global)
        name - the key
        val - the value
        scope - the scope in which the given key, value pair is to be stored
      • getSessionAttribute

        public abstract Object getSessionAttribute(String name,
                                                   String scope)
        get a value by name in the given scope (entity, document,global)
        name - the key
        scope - the scope from which the value is to be retrieved
        the object stored in the given scope with the given key
      • getParentContext

        public abstract Context getParentContext()
        Get the context instance for the parent entity. works only in the full dump If the current entity is rootmost a null is returned
        parent entity's Context
      • getRequestParameters

        public abstract Map<String,ObjectgetRequestParameters()
        The request parameters passed over HTTP for this command the values in the map are either String(for single valued parameters) or List<String> (for multi-valued parameters)
        the request parameters passed in the URL to initiate this process
      • isRootEntity

        public abstract boolean isRootEntity()
        Returns if the current entity is the root entity
        true if current entity is the root entity, false otherwise
      • currentProcess

        public abstract String currentProcess()
        Returns the current process FULL_DUMP, DELTA_DUMP, FIND_DELTA
        the type of the current running process
      • getSolrCore

        public abstract SolrCore getSolrCore()
        Exposing the actual SolrCore to the components
        the core
      • getStats

        public abstract Map<String,ObjectgetStats()
        Makes available some basic running statistics such as "docCount", "deletedDocCount", "rowCount", "queryCount" and "skipDocCount"
        a Map containing running statistics of the current import
      • getScript

        public abstract String getScript()
        Returns the text specified in the script tag in the data-config.xml
      • getScriptLanguage

        public abstract String getScriptLanguage()
        Returns the language of the script as specified in the script tag in data-config.xml
      • deleteDoc

        public abstract void deleteDoc(String id)
        delete a document by id
      • resolve

        public abstract Object resolve(String var)
        Use this directly to resolve variable
        var - the variable name
        the resolved value
      • replaceTokens

        public abstract String replaceTokens(String template)
        Resolve variables in a template
        The string w/ variables resolved