Package com.anthonyeden.lib.config

Examples of com.anthonyeden.lib.config.XMLConfiguration


   */
  public void init() {

    File configurationFile = new File(WebappHelper.getContextRoot() + CONFIG_FILE);

    XMLConfiguration instConfigSection = null;
    try {
      instConfigSection = new XMLConfiguration(configurationFile);
    } catch (ConfigurationException ce) {
      throw new StartupException("Error loading institution portlet configuration file!", ce);
    }
    if (instConfigSection == null) { throw new StartupException("Error loading institution portlet configuration file!"); }

    institutions = new FastHashMap();
    for (Iterator iter = instConfigSection.getChildren("institution").iterator(); iter.hasNext();) {
      Configuration instConfigEntry = (Configuration) iter.next(); // the institutions config entry
      String shortName = instConfigEntry.getAttribute("shortname"); // short name of inst

      if (shortName == null) { throw new StartupException("Institution portlet startup: No shortname given for one entry!"); }
      try {
View Full Code Here


  public void importGroups(BGContext context, File fGroupExportXML) {
    if (!fGroupExportXML.exists()) return;

    Configuration groupConfig = null;
    try {
      groupConfig = new XMLConfiguration(fGroupExportXML);
    } catch (ConfigurationException ce) {
      throw new OLATRuntimeException("Error importing group config.", ce);
    }
    if (!groupConfig.getName().equals(EXPORT_KEY_ROOT)) throw new AssertException("Invalid group export file. Root does not match.");
View Full Code Here

      }
    }
  }

  private String readPatchesXml(File patchesNewest, List<Map> patches) {
    XMLConfiguration patchConfig = null;
    Map<String, String> m;
    try {
      patchConfig = new XMLConfiguration(patchesNewest);
      for (Iterator<Configuration> it = patchConfig.getChildren().iterator(); it.hasNext();) {
        Configuration aPatchConfig = it.next();
        m = new HashMap<String, String>();
        m.put("id", aPatchConfig.getAttribute("patch-id"));
        m.put("enabled", aPatchConfig.getAttribute("enabled"));
        m.put("jira", aPatchConfig.getAttribute("jira"));
        m.put("tag", aPatchConfig.getAttribute("tag"));
        m.put("title", aPatchConfig.getChildValue("description"));
        patches.add(m);
      }
      return patchConfig.getAttribute("basetag");
    } catch (ConfigurationException e) {
      m = new HashMap<String, String>();
      m.put("id", "Problems reading patches.xml.newest: "+e);
      m.put("enabled", "");
      m.put("jira", "");
View Full Code Here

  /**
   * Read previousely exported Propertiesproperties
   */
  private void loadConfiguration() {
    try {
      repositoryProperties = new XMLConfiguration(new File(baseDirectory, PROPERTIES_FILE));
    } catch (ConfigurationException ce) {
      throw new OLATRuntimeException("Error importing repository entry properties.", ce);
    }
    if (!repositoryProperties.getName().equals(PROP_ROOT))
      throw new AssertException("Invalid repository entry properties export file. Root does not match.");
View Full Code Here

        }
      } else {
        log.info("parsing configuration file now: "+configurationFile.getAbsolutePath());
      }
      try {
        configuration = new XMLConfiguration(configurationFile);
      } catch (ConfigurationException ce) {
        log.warn("Error loading config file: '" + CONFIG_FILE + "'.");
        abort(ce);
      }
 
View Full Code Here

    }

    private void loadCustom() throws Exception {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        InputStream in = new FileInputStream(siteContext.getConfigurationFile());
        Configuration configuration = new XMLConfiguration(in);

        Iterator renderElements = configuration.getChildren("page-renderer").iterator();
        while (renderElements.hasNext()) {
            Configuration viewRendererConfiguration = (Configuration) renderElements.next();
            String renderName = viewRendererConfiguration.getAttribute("name");
            String className = viewRendererConfiguration.getAttribute("classname");
            ViewRenderer renderer = (ViewRenderer) cl.loadClass(className).newInstance();
View Full Code Here

    }
   
    private void loadCustom() throws Exception {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        InputStream in = new FileInputStream(siteContext.getConfigurationFile());
        Configuration configuration = new XMLConfiguration(in);
       
        Iterator renderElements = configuration.getChildren("page-renderer").iterator();
        while (renderElements.hasNext()) {
            Configuration viewRendererConfiguration = (Configuration) renderElements.next();
            String renderName = viewRendererConfiguration.getAttribute("name");
            String className = viewRendererConfiguration.getAttribute("classname");
            ViewRenderer renderer = (ViewRenderer) cl.loadClass(className).newInstance();
View Full Code Here

TOP

Related Classes of com.anthonyeden.lib.config.XMLConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.