org.apache.solr.handler.dataimport.ContextImpl Maven / Gradle / Ivy
package org.apache.solr.handler.dataimport;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.solr.core.SolrCore;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* An implementation for the Context
*
* This API is experimental and subject to change
*
* @version $Id: ContextImpl.java 949884 2010-05-31 22:53:26Z hossman $
* @since solr 1.3
*/
public class ContextImpl extends Context {
private DataConfig.Entity entity;
private ContextImpl parent;
private VariableResolverImpl resolver;
private DataSource ds;
private String currProcess;
private Map requestParams;
private DataImporter dataImporter;
private Map entitySession, globalSession;
DocBuilder.DocWrapper doc;
DocBuilder docBuilder;
public ContextImpl(DataConfig.Entity entity, VariableResolverImpl resolver,
DataSource ds, String currProcess,
Map global, ContextImpl parentContext, DocBuilder docBuilder) {
this.entity = entity;
this.docBuilder = docBuilder;
this.resolver = resolver;
this.ds = ds;
this.currProcess = currProcess;
if (docBuilder != null) {
this.requestParams = docBuilder.requestParameters.requestParams;
dataImporter = docBuilder.dataImporter;
}
globalSession = global;
parent = parentContext;
}
public String getEntityAttribute(String name) {
return entity == null ? null : entity.allAttributes.get(name);
}
public String getResolvedEntityAttribute(String name) {
return entity == null ? null : resolver.replaceTokens(entity.allAttributes.get(name));
}
public List