Package com.anthonyeden.lib.config

Examples of com.anthonyeden.lib.config.Configuration


    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>();
View Full Code Here


    }
    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 {
        List<InstitutionPortletSupervisorEntry> supervisors = new ArrayList<InstitutionPortletSupervisorEntry>(1); // there may be more than one supervisor
        for (Iterator it = instConfigEntry.getChildren(SUPERVISOR).iterator(); it.hasNext();) {
          Configuration supervisorElement = (Configuration) it.next(); // one supervisor element
          InstitutionPortletSupervisorEntry ipse = new InstitutionPortletSupervisorEntry(getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_PERSON)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_PHONE)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_EMAIL)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_URL)),
                getSupervisorElementChild(supervisorElement.getChild(SUPERVISOR_BLOG)));
          supervisors.add(ipse); // save it
        }

        //get polymorph links
        List<Configuration> polymorphConfs = instConfigEntry.getChildren(POLYMORPHLINK);
        List<PolymorphLink> polyList = new ArrayList<PolymorphLink>();
        if (polymorphConfs != null && polymorphConfs.size() > 0) {
          for(Configuration polymorphConf: polymorphConfs) {
            List<PolymorphLinkElement> elemList = new ArrayList<PolymorphLinkElement>();
            for (Iterator<Configuration> it = polymorphConf.getChildren(POLYMORPHLINK_ELEMENT).iterator(); it.hasNext();) {
              Configuration tmp = it.next();
              elemList.add(new PolymorphLinkElement(tmp.getAttribute(POLYMORPHLINK_ELEMENT_ATTRIBUT), tmp
                  .getAttribute(POLYMORPHLINK_ELEMENT_VALUE), tmp.getAttribute(POLYMORPHLINK_ELEMENT_ID), tmp
                  .getAttribute(POLYMORPHLINK_ELEMENT_CONDITION)));
             
            }
            PolymorphLink polyLink = new PolymorphLink(polymorphConf.getAttribute(POLYMORPHLINK_TARGETID), polymorphConf.getAttribute(POLYMORPHLINK_TYPE),
                polymorphConf.getAttribute(POLYMORPHLINK_TEXT), elemList);
View Full Code Here

      log.info("JMX support disabled.");
      return;
    }
   
    log.info("JMX support enabled.");
    Configuration jmxServer = moduleConfig.getChild("jmxserver");
    try {
      port = Integer.parseInt(jmxServer.getAttribute("port"));
    } catch (NumberFormatException nfe) {
      throw new StartupException("Invalid JMX server port. Please fix!");
    }
    user = jmxServer.getAttribute("user");
    pass = jmxServer.getAttribute("pass");
    if (user != null && user.length() == 0) user = null;
    if (pass != null && pass.length() == 0) pass = null;

    // expose MBeans
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    List beans = moduleConfig.getChildren("bean");
    for (Iterator iter = beans.iterator(); iter.hasNext();) {
      Configuration bean = (Configuration) iter.next();
      String clazz = bean.getAttribute("class");
      Class beanClass;
      try {
        beanClass = cl.loadClass(clazz);
        ObjectName name = new ObjectName(JMXHelper.buildRegisteredObjectName(beanClass, WebappHelper.getServletContextPath()));
        if (!mbs.isRegistered(name))
View Full Code Here

     * extract course chat availability
     */
    setCourseChat(configuration);
   
    // Deploy demo courses
    Configuration deployCourses = configuration.getChild(CONFIG_DEPLOY_COURSE);
    if (deployCourses != null) {
      String enabled = deployCourses.getAttribute("enabled");
      if (enabled != null && (enabled.equals("true") || enabled.equals("yes"))) {
        Tracing.logInfo("Deploying course exports.", CourseModule.class);
        List courseExportFileConfigs = deployCourses.getChildren(CONFIG_COURSE_EXPORT_FILE);
        for (Iterator iter = courseExportFileConfigs.iterator(); iter.hasNext();) {
          Configuration courseExportFile = (Configuration) iter.next();
          String access = courseExportFile.getAttribute("access");
          int acc = 1;
          try {
            acc = Integer.parseInt(access);
            if (0 < acc && acc < 5) {
              deployCourse(courseExportFile.getValue(), acc);             
            } else {
              Tracing.logInfo("Skipping deployment of course::"
                  + courseExportFile.getValue() + " ; access attribute must be 1,2,3 or 4 but values is::"
                  + access, CourseModule.class);             
            }
          } catch (NumberFormatException e) {
            Tracing.logInfo("Skipping deployment of course::"
                + courseExportFile.getValue() + " ; access attribute must be 1,2,3 or 4 but values is::"
                + access, CourseModule.class);             
          }
        }
      } else {
        Tracing.logInfo("Skipping deployment of course exports. To deploy course exports, please enable in the configuration file.", CourseModule.class);
View Full Code Here

   */
  private void setLogVisibilitiesForMigrationOnly(Configuration configuration) {
    String adminLogVisible = "INVISIBLE";
    String userLogVisible = "INVISIBLE";
    String statisticLogVisible = "INVISIBLE";
    Configuration logVisibilityConfig = configuration.getChild("LogVisibilityForCourseAuthor");
    if (logVisibilityConfig != null) {
      adminLogVisible = logVisibilityConfig.getChildValue("AdminLog");
      userLogVisible = logVisibilityConfig.getChildValue("UserLog");
      statisticLogVisible = logVisibilityConfig.getChildValue("StatisticLog");
    }
    adminLogIsVisibleForMigrationOnly = adminLogVisible.equals("VISIBLE");
    userLogIsVisibleForMigrationOnly = userLogVisible.equals("VISIBLE");
    statisticLogIsVisibleForMigrationOnly = statisticLogVisible.equals("VISIBLE");
  }
View Full Code Here

  public static boolean isStatisticLogVisibleForMigrationOnly() {
    return statisticLogIsVisibleForMigrationOnly;
  }

  private void setCourseChat(Configuration configuration){
    Configuration courseChatConfig = configuration.getChild("enableCourseChat");
    courseChatEnabled = false;//default value false
    if(courseChatConfig != null){
      courseChatEnabled = courseChatConfig.getValue().equals("true");
    }
  }
View Full Code Here

      upgradeManager.doPreSystemInitUpgrades();
     
      // initialize modules
      modules = new ArrayList<OLATModule>(10);
      for (Iterator<Configuration> iter = configuration.getChildren("module").iterator(); iter.hasNext();) {
        Configuration moduleConfig = iter.next();
        String className = moduleConfig.getAttribute("classname");
        try {
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
          OLATModule olatmodule = (OLATModule) cl.loadClass(className).newInstance();
          log.info("*** INIT: Initializing module '" + olatmodule.getClass().getName() + "'.");
          olatmodule.init(moduleConfig);
View Full Code Here

    } else {
      Tracing.logInfo("Selfregistration is turned OFF", RegistrationModule.class);
    }

    // Check for registration email notification configuration
    Configuration regNoti = configuration.getChild(CONFIG_REGISTRATION_NOTIFICATION);
    registrationNotificationEmail = null; // default is not set
    if (regNoti != null) {
      String enabled = regNoti.getAttribute("enabled");
      String email = regNoti.getAttribute("email");
      if (!StringHelper.containsNonWhitespace(enabled)) {
        Tracing.logWarn("Missing parameter 'enabled' in registrationNotification configuration element. Assuming false.", RegistrationModule.class);
      } else {
        if (enabled.equalsIgnoreCase("true")) {
          if (!StringHelper.containsNonWhitespace(email) || email.indexOf("@") == -1) {
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();
            renderer.setSiteContext(siteContext);
            renderer.loadConfiguration(viewRendererConfiguration);
            renderer.init();
            Debug.logInfo("Added renderer [" + renderName + "] - [" + className + "]", module);
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();
            renderer.setSiteContext(siteContext);
            renderer.loadConfiguration(viewRendererConfiguration);
            renderer.init();
            Debug.logInfo("Added renderer [" + renderName + "] - [" + className + "]", module);
View Full Code Here

TOP

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

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.