private static void registerJebProp(String attrName, String methodBaseName) throws Exception {
    Class<JEBackendCfg> configClass = JEBackendCfg.class;
    JEBackendCfgDefn defn = JEBackendCfgDefn.getInstance();
    Class<? extends JEBackendCfgDefn> defClass = defn.getClass();

    String propName = "get" + methodBaseName + "PropertyDefinition";
    PropertyDefinition<?> propDefn =
        (PropertyDefinition<?>) defClass.getMethod(propName).invoke(defn);

    String methodPrefix = propDefn instanceof BooleanPropertyDefinition ? "is" : "get";
    String methodName = methodPrefix + methodBaseName;

    jebDefnMap.put(attrName, propDefn);
    jebMethodMap.put(attrName, configClass.getMethod(methodName));
  }
  private RotationPolicy getRotationPolicy(LogRotationPolicyCfg config) throws ConfigException {
    String className = config.getJavaClass();
    LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance();
    ClassPropertyDefinition pd = d.getJavaClassPropertyDefinition();
    // Load the class and cast it to a RotationPolicy.
    Class<? extends RotationPolicy> theClass;
    RotationPolicy rotationPolicy;
    try {
      theClass = pd.loadClass(className, RotationPolicy.class);
      rotationPolicy = theClass.newInstance();

      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method =
          theClass.getMethod("initializeLogRotationPolicy", config.configurationClass());
      method.invoke(rotationPolicy, config);
    } catch (InvocationTargetException ite) {
      // Rethrow the exceptions thrown be the invoked method.
      Throwable e = ite.getTargetException();
      Message message =
          ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(
              className, config.dn().toString(), stackTraceToSingleLineString(e));
      throw new ConfigException(message, e);
    } catch (Exception e) {
      Message message =
          ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(
              className, config.dn().toString(), String.valueOf(e));
      throw new ConfigException(message, e);
    }

    // The connection handler has been successfully initialized.
    return rotationPolicy;
  }
 private boolean isJavaClassAcceptable(
     LogRotationPolicyCfg config, List<Message> unacceptableReasons) {
   String className = config.getJavaClass();
   LogRotationPolicyCfgDefn d = LogRotationPolicyCfgDefn.getInstance();
   ClassPropertyDefinition pd = d.getJavaClassPropertyDefinition();
   // Load the class and cast it to a RotationPolicy.
   Class<? extends RotationPolicy> theClass;
   try {
     theClass = pd.loadClass(className, RotationPolicy.class);
     theClass.newInstance();
   } catch (Exception e) {
     Message message =
         ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(
             className, config.dn().toString(), String.valueOf(e));
     unacceptableReasons.add(message);
     return false;
   }
   // Check that the implementation class implements the correct interface.
   try {
     // Determine the initialization method to use: it must take a
     // single parameter which is the exact type of the configuration
     // object.
     theClass.getMethod("initializeLogRotationPolicy", config.configurationClass());
   } catch (Exception e) {
     Message message =
         ERR_CONFIG_ROTATION_POLICY_INVALID_CLASS.get(
             className, config.dn().toString(), String.valueOf(e));
     unacceptableReasons.add(message);
     return false;
   }
   // The class is valid as far as we can tell.
   return true;
 }