Package com.bleujin.framework.configuration

Examples of com.bleujin.framework.configuration.Configuration


            // ������ ���� ������ �׸�...
            try {

                // add index query at existing query..
                Configuration configOfPServant = config.getChild("primary-servant.configured-object");
                if (configOfPServant != null){
                    pservant = (PrimaryServant) InstanceCreator.createConfiguredInstance(configOfPServant) ;
                }

            } catch (NotFoundXmlTagException ignore) {
View Full Code Here


            // ������ ���� ������ �׸�...
            try {

                // add index query at existing query..
                Configuration configOfPServant = config.getChild("primary-servant.configured-object");
                if (configOfPServant != null){
                    pservant = (PrimaryServant) InstanceCreator.createConfiguredInstance(configOfPServant) ;
                }

            } catch (NotFoundXmlTagException ignore) {
View Full Code Here

      // make handlers
      try {
        Configuration[] handlerConfigs = config.getChildren("handler");

        for (int i = 0; i < handlerConfigs.length; ++i) {
          Configuration handlerConfig = handlerConfigs[i];

          String handlerName = handlerConfig.getChild("handler-name")
              .getValue();

          // create handler
          Handler handler = (Handler) InstanceCreator
              .createConfiguredInstance(handlerConfig
                  .getChild("configured-object"));

          // set level if necessary
          try {
            String level = handlerConfig.getChild("level")
                .getValue();
            handler.setLevel(Level.parse(level));
          } catch (NotFoundXmlTagException notFoundEx) {
            out.println("handler:" + handlerName
                + " :skipped setting level.");
          }

          // set formatter if necessary
          try {
            String formatterName = handlerConfig.getChild(
                "formatter").getValue();
            java.util.logging.Formatter formatter = (java.util.logging.Formatter) Class
                .forName(formatterName).newInstance();
            handler.setFormatter(formatter);
          } catch (NotFoundXmlTagException notFoundEx) {
            out.println("handler:" + handlerName
                + " :skipped setting formatter.");
          }

          // set encoding if necessary
          try {
            String encoding = handlerConfig.getChild("encoding")
                .getValue();
            handler.setEncoding(encoding);
          } catch (NotFoundXmlTagException notFoundEx) {
            out.println("handler:" + handlerName
                + ":skipped setting encoding charset.");
          }

          // ���̺� ��� ���ѵд�.
          handlers.put(handlerName, handler);
        }
      } catch (NotFoundXmlTagException noTag) {
        out.println("skipped making handlers.");
      }

      // loggers
      try {
        Configuration[] loggerConfigs = config.getChildren("logger");

        for (int i = 0; i < loggerConfigs.length; ++i) {
          Configuration loggerConfig = loggerConfigs[i];

          String loggerName = loggerConfig.getChild("logger-name")
              .getValue();
          Logger logger = Logger.getLogger(loggerName);

          Configuration[] handlerNameConfigs = loggerConfig
              .getChildren("handler-name");
          for (int j = 0; j < handlerNameConfigs.length; ++j) {
            String handlerName = handlerNameConfigs[j].getValue();
            Handler handler = (Handler) handlers.get(handlerName);

            if (handler == null)
              throw new InvalidSetupException(
                  "not found handler:" + handlerName);

            logger.addHandler(handler);
          }
        }
      } catch (NotFoundXmlTagException noTag) {
        out.println("skipped setting loggers.");
      }

      // mapping
      try {
        Configuration[] loggerMappingConfigs = config
            .getChildren("logger-mapping");
        for (int i = 0; i < loggerMappingConfigs.length; ++i) {
          Configuration loggerMappingConfig = loggerMappingConfigs[i];

          String pattern = loggerMappingConfig.getChild("pattern")
              .getValue();
          String loggerName = loggerMappingConfig.getChild(
              "logger-name").getValue();

          addMapping(pattern, loggerName);
        }
      } catch (NotFoundXmlTagException noTag) {
View Full Code Here

          methodMap.put(propertyName, method);
        }

        for (int i = 0; i < properties.length; ++i) {
          Configuration property = properties[i];
          String name = property.getChild("name").getValue(); // .toLowerCase();
                                    // ����!!!!!!!

          Method setter = (Method) methodMap.get(name);
          if (setter == null) {
            throw new InstanceCreationException("could not find setter method of property name:" + name);
          }

          if (setter.getParameterTypes().length != 1) {
            throw new InstanceCreationException("unknown parameter for property setter:propery name=" + name);
          }

          Object paramObject = null;
          try {
            // value�� �ٽ� <configured-object/> �� ������ object �� ��� ���
            // ȣ��!!
            paramObject = InstanceCreator.createConfiguredInstance(property.getChild("value.configured-object"));
          } catch (NotFoundXmlTagException nx) {
            try {
              // value�� �ٽ� <null/> �� ��� null
              if (property.getChild("value.null") != null)
                paramObject = null;
            } catch (NotFoundXmlTagException nx2) {
              // value�� <null/> �� �ƴ� ���
              String value = property.getChild("value").getValue();
              paramObject = getObjectInstance(setter.getParameterTypes()[0], value);
            }
          }

          setter.invoke(object, new Object[] { paramObject });
View Full Code Here

TOP

Related Classes of com.bleujin.framework.configuration.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.