Package de.mhus.lib.config

Examples of de.mhus.lib.config.IConfig$ConfigStringCompiler


  public void testHash() throws Exception {
 
    HashConfig c = new HashConfig();
    c.setString("test1", "wow");
    c.setString("test2", "alf");
    IConfig s = c.createConfig("sub");
    s.setString("test1", "wow1");
    s.setString("test2", "alf1");
    s = c.createConfig("sub");
    s.setString("test1", "wow2");
    s.setString("test2", "alf2");
    s = c.createConfig("sub");
    s.setString("test1", "wow3");
    s.setString("test2", "alf3");

    derTeschd(c, true);
  }
View Full Code Here


  }

  public BaseInfo initialize(IModConfig config) {
   
    Info info = new Info();
    IConfig cclasspath = config.getConfiguration().getConfig("classpath");
    info.classloader = new DynamicClassLoader(config.getConfiguration().getString("id", "?"));
    info.classloader.doSetupFromConfig(cclasspath);
    classloader.add(info.classloader);
   
    return info;
View Full Code Here

    MFormModel model = new MFormModel(MSingleton.instance().getActivator(),this);
    ObjectList list = model.getList();
    for (String key : config.getPropertyKeys()) {
      log().t("key",key);
      try {
        IConfig elementConfig = config.getConfig("element_" + key);
        if (elementConfig != null) {
          log().t("accept fobject",key);
          FObject element = registry.createElement(model, elementConfig.getString("type", "input"), elementConfig);
          element.setName(key);
          element.setTitle(key);
          list.add(element);
        }
      } catch (Exception e) {
View Full Code Here

    assertEquals( "sub", c.getConfigKeys()[0] );
   
    IConfig[] list = c.getConfigBundle("sub");
    assertEquals(3, list.length);
   
    IConfig sub = list[0];
    assertEquals("wow1", sub.getString("test1", "no") );
    assertEquals("alf1", sub.getString("test2", "no") );
    assertEquals("no",  sub.getString("test3", "no") );
   
    sub = list[1];
    assertEquals("wow2", sub.getString("test1", "no") );
    assertEquals("alf2", sub.getString("test2", "no") );
    assertEquals("no",  sub.getString("test3", "no") );
   
    sub = list[2];
    assertEquals("wow3", sub.getString("test1", "no") );
    assertEquals("alf3", sub.getString("test2", "no") );
    assertEquals("no",  sub.getString("test3", "no") );
   
    // change properties
   
    c.setProperty("test1", "aloa");
    c.setProperty("test3", "nix");
    assertEquals("aloa", c.getString("test1", "no") );
    assertEquals("alf", c.getString("test2", "no") );
    assertEquals("nix",  c.getString("test3", "no") );

    // change config
   
    sub = c.createConfig("sub");
    sub.setProperty("test1", "aloa4");
    sub.setProperty("test2", "alf4");
    assertEquals("aloa4", sub.getString("test1", "no") );
    assertEquals("alf4", sub.getString("test2", "no") );
    assertEquals("no",  sub.getString("test3", "no") );
   
    assertEquals( 2, c.moveConfig(sub, IConfig.MOVE_UP) );
    assertEquals( 3, c.moveConfig(sub, IConfig.MOVE_DOWN) );   
    assertEquals( 0, c.moveConfig(sub, IConfig.MOVE_FIRST) );
    assertEquals( 3, c.moveConfig(sub, IConfig.MOVE_LAST) );
View Full Code Here

    // Create Config
    HashConfig c = new HashConfig();
    c.setString("class", ClassLoaderActivator.class.getCanonicalName());
    c.setString("id", "test1");
    c.setString("name", "Loading1");
    IConfig cpath = c.createConfig("classpath");
    IConfig loader = cpath.createConfig("resource");
    loader.setString("jar", "etc/test/test.jar");
   
    // Create Bundle and ModConfig
    IBundle b1 = new ModBundle(new IModConfig[] {new ModConfig(c)}, "test1", false);
   
    // Init Bundle
View Full Code Here

    if (start != 0 && stop == 0) {
      stop = System.currentTimeMillis();
     
      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, getCurrentTimeAsString());
          persistence.save();
        }
      } catch (Throwable t) {
        log().t(t);
      }
     
View Full Code Here


public class BpmTest extends TestCase {

  public void testBpm() throws Exception {
    IConfig config = ConfigUtil.loadXmlForClass(BpmTest.class);
   
    MBpm bpm = MBpm.createBpm(config);
    bpm.setAsDefault();
    assertNotNull(bpm);
   
View Full Code Here

    doInitialize();
    open = true;
  }

  protected void doCreatePersistence() throws Exception {
    IConfig cPersistence = config.getConfig("persistence");
    if (cPersistence != null) {
      String clazz = cPersistence.getExtracted("class",DummyPersistence.class.getCanonicalName());
      persistence = (BpmPersistence) activator.getObject(clazz);
    } else
      persistence = new DummyPersistence();
   
    persistence.initialize(cPersistence);
View Full Code Here

    persistence.initialize(cPersistence);
   
  }

  protected void doCreateScheduler() throws Exception {
    IConfig cScheduler = config.getConfig("scheduler");
    if (cScheduler != null) {
      String clazz = cScheduler.getExtracted("class",TimerScheduler.class.getCanonicalName());
      scheduler = (BpmScheduler) activator.getObject(clazz);
    } else
      scheduler = new TimerScheduler();
   
    scheduler.initialize(cScheduler);
View Full Code Here

      }
     
      con.getStatement("dropblub").execute(null);
     
      HashConfig cstr = new HashConfig();
      IConfig ctable = cstr.createConfig("table");
      ctable.setProperty("name", "blub");
      IConfig cfield = ctable.createConfig("field");
      cfield.setProperty("name", "t_string");
      cfield.setProperty("type", "string");
      cfield.setProperty("size", "200");
      cfield.setProperty("default", "aloa");
     
      Dialect dialect = pool.getDialect();
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);     
      dialect.createStructure(cstr, con, null);

      cfield = ctable.createConfig("field");
      cfield.setProperty("name", "t_int");
      cfield.setProperty("type", "int");
      cfield.setProperty("default", "10");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      cfield.setProperty("type", "float");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      cfield.setProperty("default", "20");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      cfield.removeProperty("default");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      cfield.setProperty("default", "15");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);

      cfield.setProperty("notnull", "yes");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      ctable.setProperty("primary_key", "t_int");
     
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      ctable.setProperty("primary_key", "t_int,t_string");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      ctable.removeProperty("primary_key");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
     
      // index
     
      IConfig cindex = cstr.createConfig("index");
      cindex.setString("name", "blub_idx");
      cindex.setString("table", "blub");
      cindex.setString("fields", "t_string");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);

      cindex.setString("fields", "t_string,t_int");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      dialect.createStructure(cstr, con, null);
     
      // data
      IConfig cdata = cstr.createConfig("data");
      IConfig cexec = cdata.createConfig("execute");
      String tName = pool.getDialect().normalizeTableName("blub");
      cexec.setProperty("sql", "insert into " + tName + " (t_string,t_int) values ('aaa',1)");
      cexec = cdata.createConfig("execute");
      cexec.setProperty("sql", "insert into " + tName + " (t_string,t_int) values ('bbb',2)");
     
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);

      cdata.setProperty("select", "select * from " + tName + " where t_string='ccc'");
      cdata.setProperty("condition", "not found");
      cexec = cdata.createConfig("execute");
      cexec.setProperty("sql", "insert into " + tName + " (t_string,t_int) values ('ccc',3)");

      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
      System.out.println("--------------------------------------------------");
      dialect.createStructure(cstr, con, null);
View Full Code Here

TOP

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

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.