public class SchemaHelper extends AbstractLogEnabled implements Component, Serviceable
Modifier and Type | Field and Description |
---|---|
protected DOMParser |
_domParser
A DOM parser.
|
protected SourceResolver |
_sourceResolver
The source resolver.
|
protected XPathProcessor |
_xPathProcessor
A XPath processor.
|
static String |
ROLE
The component role.
|
Constructor and Description |
---|
SchemaHelper() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.solr.client.solrj.request.schema.AnalyzerDefinition |
getAnalyzer(Node analyzerNode)
Get an analyzer definition from the corresponding DOM node.
|
protected Map<String,Object> |
getAttributes(Node node)
Extract a DOM node attributes as a Map.
|
protected org.apache.solr.client.solrj.request.schema.FieldTypeDefinition |
getFieldType(Node fieldTypeNode)
Get a field type definition from the corresponding DOM node.
|
protected List<org.apache.solr.client.solrj.request.schema.FieldTypeDefinition> |
getFieldTypes(NodeList fieldTypeNodes)
Get the field type definitions from the corresponding DOM nodes.
|
protected List<Map<String,Object>> |
getList(NodeList nodeList)
Extract the list of DOM node attributes.
|
org.apache.solr.client.solrj.response.schema.SchemaRepresentation |
getSchema(String location)
Get the schema at the corresponding location (source URI).
|
static String |
getSchemaType(MetadataType metaType)
Get the solr schema type from the metadata type.
|
org.apache.solr.client.solrj.response.schema.SchemaRepresentation |
readSchema(InputStream is)
Read the static schema.
|
void |
service(ServiceManager manager) |
getLogger, setLogger
protected SourceResolver _sourceResolver
protected DOMParser _domParser
protected XPathProcessor _xPathProcessor
public SchemaHelper()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public static String getSchemaType(MetadataType metaType)
metaType
- The metadata type.public org.apache.solr.client.solrj.response.schema.SchemaRepresentation getSchema(String location)
location
- The location, as a source URI.public org.apache.solr.client.solrj.response.schema.SchemaRepresentation readSchema(InputStream is) throws IOException, SAXException
is
- An input stream on the schema XML.IOException
- If an error occurs reading the stream.SAXException
- If an error occurs parsing the XML.protected List<org.apache.solr.client.solrj.request.schema.FieldTypeDefinition> getFieldTypes(NodeList fieldTypeNodes)
fieldTypeNodes
- The field type nodes.protected org.apache.solr.client.solrj.request.schema.FieldTypeDefinition getFieldType(Node fieldTypeNode)
fieldTypeNode
- The field type DOM node.protected org.apache.solr.client.solrj.request.schema.AnalyzerDefinition getAnalyzer(Node analyzerNode)
analyzerNode
- The analyzer node.protected Map<String,Object> getAttributes(Node node)
node
- The node.