List of usage examples for org.apache.commons.configuration Configuration getList
List getList(String key);
From source file:com.appeligo.captions.CaptionListener.java
/** * /*from www . j a v a 2 s. c om*/ * */ @SuppressWarnings("unchecked") public CaptionListener() throws MalformedURLException { if (log.isInfoEnabled()) { log.info("Instantiated a " + this.getClass().getName()); } Configuration config = ConfigUtils.getSystemConfig(); programIndexLocation = config.getString("luceneIndex"); compositeIndexLocation = config.getString("compositeIndex"); liveIndexLocation = config.getString("luceneLiveIndex"); liveLineup = config.getString("liveLineup"); //Set the optimization duraction of the live index to 30 minutes. int liveIndexOptimization = config.getInt("luceneLiveIndexOptimization", 30); LuceneIndexer liveIndex = LuceneIndexer.getInstance(liveIndexLocation); liveIndex.setOptimizeDuration(liveIndexOptimization); epg = DefaultEpg.getInstance(); captions = new HashMap<String, ProgramCaptions>(); //PENDING(CE): We should probably get this list form the EPG? Seems like we should. Configuration lineupConfiguration = ConfigurationService.getConfiguration("lineups"); lineupIds = (List<String>) lineupConfiguration.getList("lineups.lineup.id"); DeleteOldProgramsThread.startThread(); }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public StopTest createStopTest() { Configuration conf = EAFConfiguration.getInstance().subset("StopTests"); List stptsts = conf.getList("StopTest.Class"); if (stptsts.size() > 1) { CompositeStopTest compSt = new CompositeStopTest(); for (int i = 0; i < stptsts.size(); i++) { try { StopTest st = (StopTest) Class.forName((String) stptsts.get(i)).newInstance(); st.configure(conf.subset("StopTest(" + i + ")")); compSt.addStopTest(st);// ww w . ja va2 s .co m // return compSt; } catch (Exception ex) { throw new ConfigurationException("Wrong stop test configuration for " + (String) stptsts.get(i) + " ?" + " \n Thrown exception: \n" + ex); } } return compSt; } else if (stptsts.size() == 1) { try { StopTest st = (StopTest) Class.forName((String) stptsts.get(0)).newInstance(); st.configure(conf.subset("StopTest")); return st; } catch (Exception ex) { throw new ConfigurationException("Wrong stop test configuration for " + (String) stptsts.get(0) + " ?" + " \n Thrown exception: \n" + ex); } } else if (stptsts.isEmpty()) { return null; } throw new ConfigurationException("No stop test class specified."); }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public OperatorChain<SelectionOperator> createSelectionChain() { OperatorChain<SelectionOperator> oChain = null; Configuration conf = EAFConfiguration.getInstance().subset("OperatorChains.SelectionChain"); List ops = conf.getList("Operator.Class"); if (ops.size() > 0) { oChain = new OperatorChain<SelectionOperator>(); for (int i = 0; i < ops.size(); i++) { try { SelectionOperator op = (SelectionOperator) Class.forName((String) ops.get(i)).newInstance(); op.configure(conf.subset("Operator(" + i + ")")); oChain.addOperators(op); } catch (Exception ex) { throw new ConfigurationException("Wrong selection operator configuration for " + (String) ops.get(i) + " ?" + " \n Thrown exception: \n" + ex); }/*from w w w . ja va 2 s .co m*/ } } return oChain; }
From source file:es.juntadeandalucia.framework.ticket.impl.DefaultTicket.java
public DefaultTicket(Configuration config) throws Exception { try {/* w w w. j av a 2 s . c om*/ ticketLifeTime = config.getLong(TIME_TICKET_LIFETIME, 0); } catch (Exception e) { e = new Exception(msg.getString("ticket.error.lifetimeerror")); //$NON-NLS-1$ log.warn(e); throw e; } List<?> textKey = config.getList(TICKET_KEY); try { SecretKeyFactory kf = SecretKeyFactory.getInstance("DESede"); key = kf.generateSecret(new DESedeKeySpec(hexToByte(textKey))); } catch (Exception e) { e = new Exception(msg.getString("ticket.error.keycreationerror")); //$NON-NLS-1$ log.warn(e); throw e; } }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public StopTest createRestartTest() { //01 - 07 - 2011: se aaden los test de reinicio, pueden existir o no. if (EAFConfiguration.getInstance().containsKey("RestartTests.RestartTest.Class")) { Configuration conf = EAFConfiguration.getInstance().subset("RestartTests"); List rststs = conf.getList("RestartTest.Class"); if (rststs.size() > 1) { CompositeStopTest compSt = new CompositeStopTest(); for (int i = 0; i < rststs.size(); i++) { try { StopTest st = (StopTest) Class.forName((String) rststs.get(i)).newInstance(); st.configure(conf.subset("RestartTest(" + i + ")")); compSt.addStopTest(st); // return compSt; } catch (Exception ex) { throw new ConfigurationException("Wrong restart test configuration for " + (String) rststs.get(i) + " ?" + " \n Thrown exception: \n" + ex); }/* w w w. j a va 2s . c o m*/ } return compSt; } else if (rststs.size() == 1) { try { StopTest st = (StopTest) Class.forName((String) rststs.get(0)).newInstance(); st.configure(conf.subset("RestartTest")); return st; } catch (Exception ex) { throw new ConfigurationException("Wrong restart test configuration for " + (String) rststs.get(0) + " ?" + " \n Thrown exception: \n" + ex); } } } return null; }
From source file:com.knowbout.cc2nlp.server.CCEventServiceImpl.java
private List<String> getConfigStrings(String name) { Configuration config = Config.getConfiguration(); return config.getList(name); }
From source file:net.sf.jclal.classifier.WekaComitteClassifier.java
/** * * @param configuration The configuration of Weka committee classifier. *The XML labels supported are:// w w w . j a va 2s.co m * <ul> * <li> * <b>classifier type= class</b> * <p> * More than one classifier tag can be specified * * Package: * weka.classifiers</p> * <p> * Class: All</p> * </li> * </ul> */ @Override public void configure(Configuration configuration) { String classifierError = "classifier type= "; try { // Number of defined classifiers int numberOfClassifiers = configuration.getList("classifier[@type]").size(); Classifier[] currentClassifiers = new Classifier[numberOfClassifiers]; // For each classifier in list for (int i = 0; i < numberOfClassifiers; i++) { String header = "classifier(" + i + ")"; // classifier classname String classifierClassname = configuration.getString(header + "[@type]"); classifierError += classifierClassname; // classifier class Class<? extends Classifier> classifierClass = (Class<? extends Classifier>) Class .forName(classifierClassname); // classifier instance Classifier currentClassifier = classifierClass.newInstance(); // Configure classifier (if necessary) if (currentClassifier instanceof IConfigure) { ((IConfigure) currentClassifier).configure(configuration.subset(header)); } currentClassifiers[i] = currentClassifier; } // Add this classifier to the strategy setClassifiers(currentClassifiers); } catch (ClassNotFoundException e) { throw new ConfigurationRuntimeException("\nIllegal classifier classname: " + classifierError, e); } catch (InstantiationException e) { throw new ConfigurationRuntimeException("\nIllegal classifier classname: " + classifierError, e); } catch (IllegalAccessException e) { throw new ConfigurationRuntimeException("\nIllegal classifier classname: " + classifierError, e); } }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public List<LogTool> createLogs() { Configuration conf = EAFConfiguration.getInstance().subset("LogTool"); List<LogTool> listLogs = new ArrayList<LogTool>(); List logs = conf.getList("Log.Class"); for (int i = 0; i < logs.size(); i++) { try {/*from w ww . ja v a 2s .c o m*/ LogTool log = (LogTool) Class.forName((String) logs.get(i)).newInstance(); log.configure(conf.subset("Log(" + i + ")")); listLogs.add(log); } catch (Exception ex) { throw new ConfigurationException("Wrong log tool configuration for " + (String) logs.get(i) + " ?" + " \n Thrown exception: \n" + ex); } } return listLogs; }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public OperatorChain<ReplaceOperator> createReplaceChain() { Configuration conf = EAFConfiguration.getInstance().subset("OperatorChains.ReplaceChain"); OperatorChain<ReplaceOperator> oChain = null; List ops = conf.getList("Operator.Class"); if (ops.size() > 0) { oChain = new OperatorChain<ReplaceOperator>(); for (int i = 0; i < ops.size(); i++) { try { ReplaceOperator op = (ReplaceOperator) Class.forName((String) ops.get(i)).newInstance(); op.configure(conf.subset("Operator(" + i + ")")); oChain.addOperators(op); } catch (Exception ex) { throw new ConfigurationException("Wrong replace operator configuration for " + (String) ops.get(i) + " ?" + " \n Thrown exception: \n" + ex); }//from www. j a v a 2s . co m } } return oChain; }
From source file:es.udc.gii.common.eaf.factory.XMLSimpleFactory.java
@Override public OperatorChain<EvaluationOperator> createEvaluationChain() { Configuration conf = EAFConfiguration.getInstance().subset("OperatorChains.EvaluationChain"); OperatorChain<EvaluationOperator> oChain = null; List ops = conf.getList("Operator.Class"); if (ops.size() > 0) { oChain = new OperatorChain<EvaluationOperator>(); for (int i = 0; i < ops.size(); i++) { try { EvaluationOperator op = (EvaluationOperator) Class.forName((String) ops.get(i)).newInstance(); op.configure(conf.subset("Operator(" + i + ")")); oChain.addOperators(op); } catch (Exception ex) { throw new ConfigurationException("Wrong evaluation operator configuration for " + (String) ops.get(i) + " ?" + " \n Thrown exception: \n" + ex); }/*from w ww .ja va2s.c o m*/ } } return oChain; }