X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fgeneral%2FBeanKernel.java;h=80976de1e0da69a7d02fb74af30e533ea733c766;hb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;hp=36d2e9b286355873a81ca3e77133e4366d5f220f;hpb=89c06d4d52b46c154128c97d6e758fa1f4fc7a6e;p=utils diff --git a/support/general/src/main/java/org/wamblee/general/BeanKernel.java b/support/general/src/main/java/org/wamblee/general/BeanKernel.java index 36d2e9b2..80976de1 100644 --- a/support/general/src/main/java/org/wamblee/general/BeanKernel.java +++ b/support/general/src/main/java/org/wamblee/general/BeanKernel.java @@ -26,18 +26,14 @@ import java.io.InputStream; import java.util.Properties; - /** * The standard means to obtain the bean factory. This works by reading a - * property {@value #BEAN_FACTORY_CLASS} from a property file named {@value - * #BEAN_KERNEL_PROP_FILE} from the class path. This property identifies the - * bean factory implementation to use. The configured bean factory must have a - * no-arg constructor. + * property {@value #BEAN_FACTORY_CLASS} from a property file named + * {@value #BEAN_KERNEL_PROP_FILE} from the class path. This property identifies + * the bean factory implementation to use. The configured bean factory must have + * a no-arg constructor. */ public final class BeanKernel { - /** - * DOCUMENT ME! - */ private static final Log LOG = LogFactory.getLog(BeanKernel.class); /** @@ -46,8 +42,8 @@ public final class BeanKernel { private static final String BEAN_KERNEL_PROP_FILE = "org.wamblee.beanfactory.properties"; /** - * Name of the property to define the name of the bean factory - * class to use. THis class must have a public default constructor. + * Name of the property to define the name of the bean factory class to use. + * THis class must have a public default constructor. */ private static final String BEAN_FACTORY_CLASS = "org.wamblee.beanfactory.class"; @@ -56,19 +52,20 @@ public final class BeanKernel { */ private static BeanFactory BEAN_FACTORY; -/** + /** * Disabled constructor. - * + * */ private BeanKernel() { // Empty } /** - * Overrides the default mechanism for looking up the bean factory - * by specifying it yourself. - * - * @param aOverride Override bean factory. + * Overrides the default mechanism for looking up the bean factory by + * specifying it yourself. + * + * @param aOverride + * Override bean factory. */ public static void overrideBeanFactory(BeanFactory aOverride) { BEAN_FACTORY = aOverride; @@ -76,7 +73,7 @@ public final class BeanKernel { /** * Gets the bean factory. - * + * * @return Bean factory. */ public static BeanFactory getBeanFactory() { @@ -91,34 +88,33 @@ public final class BeanKernel { /** * Lookup the bean factory based on the properties file. - * - * @param aPropertyFilename DOCUMENT ME! - * + * + * * @return Bean factory. - * - * @throws BeanFactoryException DOCUMENT ME! + * */ static BeanFactory lookupBeanFactory(String aPropertyFilename) { InputResource resource = new ClassPathResource(aPropertyFilename); - InputStream is; + InputStream is; try { - is = resource.getInputStream(); + is = resource.getInputStream(); } catch (IOException e) { - throw new BeanFactoryException("Cannot open resource " + resource, e); + throw new BeanFactoryException("Cannot open resource " + resource, + e); } try { Properties props = new Properties(); props.load(is); - String className = props.getProperty(BEAN_FACTORY_CLASS); - Class beanFactory = Class.forName(className); + String className = props.getProperty(BEAN_FACTORY_CLASS); + Class beanFactory = Class.forName(className); return (BeanFactory) beanFactory.newInstance(); } catch (Exception e) { - throw new BeanFactoryException("Cannot read from resource " - + resource, e); + throw new BeanFactoryException("Cannot read from resource " + + resource, e); } finally { try { is.close();