示例#1
0
 private void invokeEventListener(String className) {
   try {
     EventListener listener =
         (EventListener) loadClass(className, dataImporter.getCore()).newInstance();
     notifyListener(listener);
   } catch (Exception e) {
     wrapAndThrow(SEVERE, e, "Unable to load class : " + className);
   }
 }
示例#2
0
 public VariableResolverImpl getVariableResolver() {
   try {
     VariableResolverImpl resolver = null;
     if (dataImporter != null && dataImporter.getCore() != null) {
       resolver =
           new VariableResolverImpl(
               dataImporter.getCore().getResourceLoader().getCoreProperties());
     } else resolver = new VariableResolverImpl();
     Map<String, Object> indexerNamespace = new HashMap<String, Object>();
     if (persistedProperties.getProperty(LAST_INDEX_TIME) != null) {
       indexerNamespace.put(LAST_INDEX_TIME, persistedProperties.getProperty(LAST_INDEX_TIME));
     } else {
       // set epoch
       indexerNamespace.put(LAST_INDEX_TIME, DataImporter.DATE_TIME_FORMAT.get().format(EPOCH));
     }
     indexerNamespace.put(INDEX_START_TIME, dataImporter.getIndexStartTime());
     indexerNamespace.put("request", requestParameters.requestParams);
     indexerNamespace.put("functions", functionsNamespace);
     for (DataConfig.Entity entity : dataImporter.getConfig().document.entities) {
       String key = entity.name + "." + SolrWriter.LAST_INDEX_KEY;
       String lastIndex = persistedProperties.getProperty(key);
       if (lastIndex != null) {
         indexerNamespace.put(key, lastIndex);
       } else {
         indexerNamespace.put(key, DataImporter.DATE_TIME_FORMAT.get().format(EPOCH));
       }
     }
     resolver.addNamespace(DataConfig.IMPORTER_NS_SHORT, indexerNamespace);
     resolver.addNamespace(DataConfig.IMPORTER_NS, indexerNamespace);
     return resolver;
   } catch (Exception e) {
     wrapAndThrow(SEVERE, e);
     // unreachable statement
     return null;
   }
 }
示例#3
0
 private EntityProcessorWrapper getEntityProcessor(DataConfig.Entity entity) {
   if (entity.processor != null) return entity.processor;
   EntityProcessor entityProcessor = null;
   if (entity.proc == null) {
     entityProcessor = new SqlEntityProcessor();
   } else {
     try {
       entityProcessor =
           (EntityProcessor) loadClass(entity.proc, dataImporter.getCore()).newInstance();
     } catch (Exception e) {
       wrapAndThrow(
           SEVERE, e, "Unable to load EntityProcessor implementation for entity:" + entity.name);
     }
   }
   return entity.processor = new EntityProcessorWrapper(entityProcessor, this);
 }