コード例 #1
0
 private void storeAnalysis(AnalysisDescription analysisDescription) throws AnalyzerException {
   try {
     kvs.setValue(ANALYSIS, analysisDescription.getName(), analysisDescription);
   } catch (KVStoreException e) {
     throw new AnalyzerException(
         "Error while storing analysis '" + analysisDescription.getName() + "'", e);
   }
 }
コード例 #2
0
 public void registerAnalysis(AnalysisDescription analysisDescription, boolean persist)
     throws AnalyzerException {
   Class<? extends Analysis> clazz;
   try {
     clazz = (Class<? extends Analysis>) Class.forName(analysisDescription.getClassName());
   } catch (ClassNotFoundException e) {
     throw new AnalyzerException("Error while loading analysis class", e);
   }
   Constructor<? extends Analysis> constructor;
   try {
     constructor = clazz.getConstructor(ActivityLog.class, String.class, String.class);
   } catch (NoSuchMethodException e) {
     throw new AnalyzerException("Error while getting constructor", e);
   }
   Analysis analysis;
   try {
     analysis =
         constructor.newInstance(
             alog, analysisDescription.getName(), analysisDescription.getDescription());
   } catch (InstantiationException e) {
     throw new AnalyzerException("Error while instantiating analysis", e);
   } catch (IllegalAccessException e) {
     throw new AnalyzerException("Error while instantiating analysis", e);
   } catch (InvocationTargetException e) {
     throw new AnalyzerException("Error while instantiating analysis", e);
   }
   try {
     analysis.registerQuery(analysisDescription.getQuery());
   } catch (AnalysisException e) {
     throw new AnalyzerException("Error while registering query", e);
   }
   if (analyses.contains(analysis)) {
     throw new AnalyzerException(
         "Analysis '" + analysisDescription.getName() + "' already registered");
   }
   analyses.add(analysis);
   analysisDescriptions.put(analysisDescription.getName(), analysisDescription);
   if (persist) {
     storeAnalysis(analysisDescription);
   }
 }