Example #1
0
  /**
   * Creates an instance of the given bean. This version deserializes the bean from the given file.
   *
   * @param beanFile the filename of the serialized file
   * @return a new instance of the serialized bean
   * @throws BeanInstantiationException if the bean cannot be istantiated
   * @throws BeanInitializationException if an initialization error occurred
   * @throws BeanNotFoundException if the bean does not exist
   */
  public static Object getBeanInstance(File beanFile)
      throws BeanInstantiationException, BeanInitializationException, BeanNotFoundException {

    Object bean = getNoInitBeanInstance(beanFile);

    if (bean instanceof LazyInitBean) {
      ((LazyInitBean) bean).init();
    }
    return bean;
  }
Example #2
0
  /**
   * Creates an instance of the given bean. <code>config</code> is the server bean configuration.
   *
   * @param beanConfig configuration of the server bean to create - NOT NULL
   * @return a new instance of the serialized bean
   * @throws BeanInstantiationException if the bean cannot be istantiated
   * @throws BeanInitializationException if an initialization error occurred
   * @throws BeanNotFoundException if the bean does not exist
   */
  public static Object getBeanInstanceFromConfig(String beanConfig)
      throws BeanInstantiationException, BeanInitializationException, BeanException {

    Object bean = null;

    bean = unmarshal(beanConfig);

    if (bean instanceof LazyInitBean) {
      ((LazyInitBean) bean).init();
    }

    return bean;
  }