Package de.mhus.lib.config

Examples of de.mhus.lib.config.IConfig


    config = null// force to reload config
  }
 
  public void initActivator() {
   
    IConfig cactivator = getConfig(MActivator.class,null);
    if (cactivator == null) return;
   
    log().t("Initialize Activator");
    try {
      IConfig cloader = cactivator.getConfig("loader");
      DynamicClassLoader loader = null;
      if (cloader != null) {
        loader = new DynamicClassLoader("main");
        loader.doSetupFromConfig(cloader);
      }
View Full Code Here


      log().w(t);
    }
  }

  protected void initLogger() {
    IConfig clog = getConfig(MLog.class,null);
    if (clog == null) return;
   
    log().t("Initialize Logger");
    try {
      IConfig firstLogger = clog.getConfig("logger");
      if (firstLogger != null) {
        // create a logger
        Log log = LogInitializer.createLogFactroy(firstLogger);
        if (log != null) {
          setLogFactory(log);
View Full Code Here

    }
  }
 

  protected void initPersistence() {
    IConfig conf = getConfig(MPersistenceManager.class,null);
    if (conf == null) return;
    if (!conf.getBoolean("enabled", true)) return;
    log().t("Initialize Persistence");
   
    try {
      String clazz = conf.getExtracted("class",DefaultPersistence.class.getCanonicalName());
      if (clazz != null) {
        MPersistenceManager obj = (MPersistenceManager)getActivator().createObject(clazz);
        obj.init(conf);
        if (persistence != null) persistence.close();
        persistence = obj;
View Full Code Here

    }
   
  }
 
  protected void initJMX() {
    IConfig cjmx = getConfig(MRemoteManager.class,null);
    if (cjmx == null) return;

    log().t("Initialize JMX");
    try {
      getJmxManager().open();
View Full Code Here

      log().w(t);
    }
  }

  protected void initInjection() {
    IConfig ci = getConfig().getConfig("initialize");
    if (ci == null) return;
    for (IConfig cc : ci.getConfigBundle("start")) {
      if (ConfigUtil.checkCondition(cc)) {
        String clazz = cc.getExtracted("class");
        if (clazz != null) {
          try {
            Object obj = getActivator().createObject(clazz);
View Full Code Here

    if (isClosed) return;
    isClosed = true;
    log().i("close",name,cnt,getHitsPerSecond());
    try {
      if (MSingleton.instance().isPersistence()) {
        IConfig persistence = MSingleton.instance().getPersistenceManager().sessionScope().getPersistence("de.mhus.lib");
        long uid = MSingleton.instance().nextUniqueId();
        persistence.setString(getJmxName() + "_" + name + "_" + uid, getStatusAsString());
        if (rrd != null) {
          persistence.setString(getJmxName() + "_" + name + "_rrd_" + uid, rrd.dump());
        }
        persistence.save();
      }
    } catch (Throwable t) {
      log().t(t);
    }
  }
View Full Code Here

   
    return this;
  }
 
  protected void build(XLayElement parent, IConfig layout) throws Exception {
    IConfig layoutLayout = layout.getConfig("layout");
    if (layoutLayout == null) return;
   
    for (IConfig cChild : layoutLayout.getConfigBundle()) {
      XLayElement child = activator.createObject(XLayElement.class, cChild.getName());
      parent.doAppendChild(child,cChild);
      child.setConfig(cChild);
     
      // remember if have name
View Full Code Here

          FieldRelation fr = new FieldRelation(manager, this, mName, setter, getter, ret, r);
          addField(fr);
         
        } else {
          log().t("field",mName);
          IConfig attr = MConfigFactory.getInstance().toConfig(toAttributes(p));
          boolean v = (p !=null && p.virtual());
         
          // check for doubled
          if (getField(mName) != null || getFieldRelation(mName) != null) {
            log().t("double field definition", mName);
View Full Code Here

  public void init() {
    try {
      if (configPath != null) {
        File file = new File(configPath);
        if (file.exists()) {
          IConfig config = MConfigFactory.getInstance().createConfigFor(file);
          IConfig cDb = config.getConfig("database");
          if (cDb == null) {
            cDb = config.createConfig("database");
          }
          IConfig cConnection = cDb.getConfig("connection");
          if (cConnection == null) {
            cConnection = cDb.createConfig("connection");
          }
          if (!MString.isEmpty(password)) cConnection.setString("pass", password);
          if (!MString.isEmpty(url)) cConnection.setString("url", url);
          if (!MString.isEmpty(user)) cConnection.setString("user", user);
          if (!MString.isEmpty(driver)) cConnection.setString("driver", driver);
          setConfig(config);
        }
      }
    } catch (Throwable t) {
      log.d(t);
View Full Code Here

   * @param config
   * @throws MException
   */
  public static void fillTables(MetadataBundle bundle, IConfig config) throws MException {
    for (Entry<String, CaoMetadata> meta : bundle.getBundle().entrySet()) {
      IConfig cTab = config.createConfig("table");
      cTab.setProperty("name", meta.getKey());
      fillColumns(meta.getValue(),cTab);
    }
  }
View Full Code Here

TOP

Related Classes of de.mhus.lib.config.IConfig

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.