Package de.mhus.lib.config

Examples of de.mhus.lib.config.IConfig


   * @param obj
   * @param def
   * @return
   */
  public synchronized IConfig getConfig(Object obj, IConfig def) {
    IConfig out = null;
    if (obj == null) {
      // nothing
    } else
    if (obj instanceof Class) {
      out = getConfig().getConfig(((Class<?>)obj).getCanonicalName());
View Full Code Here


      res = res.substring(0, pos + 1);
    res = res + resource;
    // log.info("Load Resource: " + res);
    InputStream is = model.getTarget().getClass().getClassLoader()
        .getResourceAsStream(res);
    IConfig document = new XmlConfig(MXml.loadXml(is).getDocumentElement());
    load(document,root);
  }
View Full Code Here

            ObjectList nextList = next.getList();
            parseElements(aspectName, innerTarget, nextList);
          }       
        } else {
          FormSortId idx = method.getAnnotation(FormSortId.class);
          IConfig xmlElement = fillElement(prefix,method, toXmlString(element,methodName));
         
          ObjectList nextList = list;
          if (!MString.isEmpty(element.group())) {
            nextList = findGroupList(element, list);
          }
View Full Code Here

    if (bundle == null) throw new MException("Bundle already closed");

    synchronized (bundle) {
      DbPool pool = bundle.get(name);
      if (pool == null) {
        IConfig poolCon = config.getConfig(name);
        if (poolCon != null) {
          pool = new DbPool(poolCon, activator);
          bundle.put(name, pool);
        } else {
          throw new MException("pool config not found",name);
View Full Code Here

//    buildWithDefinitions(mainWindow);
//    buildWithPojo(mainWindow);

    try {
//      mainWindow.setSizeFull();
      IConfig deskModel = new DefRoot( new LayVertical(
          new DefAttribute(LayoutBuilder.WIDTH, "100%"),
          new DefAttribute(LayoutBuilder.HEIGHT, "400px"),

            new DskHeader(
                new DskLogin()
            ),
//            new DskBreadcrumb(),
            new LayHorizontalSplit(
                new DskNavigation(),
                new DskContent(),
                new DefAttribute(LayoutBuilder.SPLIT_MIN, "100px"),
                new DefAttribute(LayoutBuilder.SPLIT_MAX, "400px"),
                new DefAttribute(LayoutBuilder.SPLIT_POS, "200px"),
                new DefAttribute(LayoutBuilder.WIDTH, "100%"),
                new DefAttribute(LayoutBuilder.HEIGHT, "100%"),
                new DefAttribute(LayoutBuilder.EXPAND, "1")
            )
          ) ).build();
     
      ConfigUtil.dump(deskModel,System.out);
     
      Desktop desk = new Desktop(deskModel);
      mainWindow.addComponent(desk.getRoot());
      ((VerticalLayout)mainWindow.getContent()).setExpandRatio(desk.getRoot(), 1);
      mainWindow.getContent().setSizeFull();
     
      IConfig dir = MConfigFactory.getInstance().createConfigFor(MSystem.locateResource(this, "dir.xml").toURI());
      IConfig dir2 = dir.getConfig("dir1");
      desk.setSelectedPath(new ConfigNavigationNode(dir2));
//      ((VerticalLayout)mainWindow.getContent()).setExpandRatio(kill, 0);
     
      VerticalLayout form = new VerticalLayout();
      //form.setSizeFull();
View Full Code Here

   *
   * @param name
   * @return The query string or null.
   */
  public String[] getQuery(String name) {   
    IConfig query = config.getConfig("queries");
    String queryLanguage = null;
    String queryString = query.getString(name,null);
    String[] out = new String[] { queryLanguage, queryString };
   
    if (queryString == null) {
      for (IConfig q : query.getConfigBundle("query") ) {
        if (q.getString("name", "").equals(name)) {
          queryLanguage = q.getExtracted("language");
          queryString = q.getExtracted("string");
          out = new String[] { queryLanguage, queryString };
          break;
View Full Code Here

  public static String getMimeType(String extension) {
    if (extension == null) return null;
    extension = extension.trim().toLowerCase();
   
    String mime = null;
    IConfig config = MSingleton.instance().getConfig(MFile.class, null);
    if (config != null) {
      IConfig map = config.getConfig("mapping");
      if (map != null)
        mime = map.getExtracted(extension);
    }
    if (mime == null && config != null) {
      String file = config.getExtracted("file");
      if (file != null) {
        if (mimeConfigCache == null) {
View Full Code Here

    public Log4JFactory(IConfig config) {
      super();
      if (config != null) {
       
        IConfig ccc = config.getConfig("configuration");
        String configFile = config.getExtracted("configuration");
       
        if (ccc != null && ccc instanceof XmlConfig) {
          MLog.t("configure inline");
          DOMConfigurator.configure( ((XmlConfig)ccc).getXmlElement() );
View Full Code Here

  private Dialect dialect;
 
  @Override
  public synchronized Dialect getDialect() {
    if (dialect == null) {
      IConfig concon = config.getConfig("connection");
      String dialectName = concon.getExtracted("dialect");
      if (dialect != null) {
        try {
          dialect = (Dialect)activator.getObject(dialectName);
        } catch (Exception e) {
          log().t(dialect,e);
        }
      }
      if (dialect == null) {
        String driver = concon.getExtracted("driver");
        if (driver != null) {
          if (driver.indexOf("hsqldb") > 0)
            dialect = new DialectHsqldb();
          else
          if (driver.indexOf("mysql") > 0)
View Full Code Here

    return dialect;
  }

  @Override
  public InternalDbConnection createConnection() throws Exception {
    IConfig concon = config.getConfig("connection");
    String driver = concon.getExtracted("driver");
    String url = concon.getExtracted("url");
    String user = concon.getExtracted("user");
    String pass = concon.getExtracted("pass");
   
    if (!MString.isEmpty(driver)) {
//      activator.getClazz(driver);
      Class.forName(driver);
    }
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.