com.ibm.ia.extension
Class DataProvider<Q,R>
- java.lang.Object
-
- com.ibm.ia.extension.DataProvider<Q,R>
-
- Type Parameters:
Q
-R
-
- All Implemented Interfaces:
- Extension, SolutionComponent, com.ibm.ia.extension.spi.DataProviderService
- Direct Known Subclasses:
- ScoringDataProvider
public abstract class DataProvider<Q,R> extends java.lang.Object implements com.ibm.ia.extension.spi.DataProviderService
The abstract class for data provider implementations.
-
-
Field Summary
Fields Modifier and Type Field and Description protected com.ibm.ia.common.spi.IModelFactory
modelFactory
-
Method Summary
Methods Modifier and Type Method and Description <T extends Entity>
Relationship<T>createRelationship(java.lang.Class<T> entity, java.lang.String key)
Creates Relationship instance.<T extends Entity>
Relationship<T>createRelationship(T t)
Creates Relationship instance.org.osgi.framework.Bundle
getBundle()
<T> T
getConceptFactory(java.lang.Class<T> conceptFactoryClass)
Returns an instance of the concept factory.ModelSerializer
getModelSerializer()
Returns the model serializer instance.SolutionDescriptor
getSolutionDescriptor()
Get solution-specific information.java.util.Map<java.lang.String,java.lang.String>
getSolutionProperties(java.util.Collection<java.lang.String> propertyNames)
Reads the values of multiple solution properties for the solution to.java.lang.String
getSolutionProperty(java.lang.String propertyName)
Retrieves the value of a solution property for the solution.java.lang.String
getSolutionProperty(java.lang.String propertyName, java.lang.String defaultValue)
Retrieves the value of a solution property for the solution.abstract R
processRequest(Q request)
Data provider entry point.void
setModelFactory(com.ibm.ia.common.spi.IModelFactory f)
-
-
-
Method Detail
-
getBundle
public org.osgi.framework.Bundle getBundle()
-
processRequest
public abstract R processRequest(Q request) throws ComponentException
Data provider entry point.
- Throws:
ComponentException
- Parameters:
request
- the request object.- Returns:
- A response object.
-
getSolutionProperty
public final java.lang.String getSolutionProperty(java.lang.String propertyName)
Retrieves the value of a solution property for the solution. Returns null if the property is undefined.- Throws:
java.lang.UnsupportedOperationException
- if called outside a valid execution context.- Parameters:
propertyName
- the name of the property.- Returns:
- The value of the property.
-
getSolutionProperty
public final java.lang.String getSolutionProperty(java.lang.String propertyName, java.lang.String defaultValue)
Retrieves the value of a solution property for the solution. Returns the default value if the property is undefined.- Throws:
java.lang.UnsupportedOperationException
- if called outside a valid execution context.- Parameters:
propertyName
- the name of the property.defaultValue
- the value to use if the property is undefined.- Returns:
- The value of the property.
-
getSolutionProperties
public final java.util.Map<java.lang.String,java.lang.String> getSolutionProperties(java.util.Collection<java.lang.String> propertyNames)
Reads the values of multiple solution properties for the solution to. If a property is undefined, it is not included in the result.- Throws:
java.lang.UnsupportedOperationException
- if called outside a valid execution context.- Parameters:
propertyNames
- The names of the properties to retrieve.- Returns:
- The name and values of the requested properties.
-
getModelSerializer
public ModelSerializer getModelSerializer()
Description copied from interface:Extension
Returns the model serializer instance.- Returns:
-
getConceptFactory
public <T> T getConceptFactory(java.lang.Class<T> conceptFactoryClass)
Description copied from interface:Extension
Returns an instance of the concept factory.- Returns:
-
createRelationship
public <T extends Entity> Relationship<T> createRelationship(java.lang.Class<T> entity, java.lang.String key)
Description copied from interface:Extension
Creates Relationship instance.- Parameters:
entity
- type of entity in this relationshipkey
- entity Id for this relationship- Returns:
- created instance
-
createRelationship
public <T extends Entity> Relationship<T> createRelationship(T t)
Description copied from interface:Extension
Creates Relationship instance.- Parameters:
t
- entity instance for this relationship- Returns:
- created instance
-
setModelFactory
public void setModelFactory(com.ibm.ia.common.spi.IModelFactory f)
-
getSolutionDescriptor
public final SolutionDescriptor getSolutionDescriptor()
Get solution-specific information.- Returns:
- SolutionDescriptor containing solution details.
-
-