comments and javadoc
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / cdm / api / application / CdmApplicationRemoteController.java
index 20f7ed744c1929acaf50b2c65ec2388cf84de0c1..2afb681918a286ced8b1350fe6157864674024c9 100644 (file)
@@ -1,3 +1,13 @@
+/**
+* Copyright (C) 2014 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+
 package eu.etaxonomy.cdm.api.application;
 
 import java.util.List;
@@ -17,6 +27,13 @@ import eu.etaxonomy.cdm.common.monitor.NullProgressMonitor;
 import eu.etaxonomy.cdm.common.monitor.SubProgressMonitor;
 import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
 
+/**
+ * CDM Application Controller class for remoting clients
+ * FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround.
+ * The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase
+ * class with {@link CdmApplicationController} and this class as subclasses
+ *
+ */
 public class CdmApplicationRemoteController  extends CdmApplicationController {
        
     private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class);
@@ -25,6 +42,16 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
     private final Resource applicationContextResource;
     private final IProgressMonitor progressMonitor;
     
+    /**
+     * Creates new instance of CdmApplicationRemoteController
+     * 
+     * @param applicationContextResource
+     * @param remoteSource
+     * @param omitTermLoading
+     * @param progressMonitor
+     * @param listeners
+     * @return
+     */
     public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource, 
                        ICdmRemoteSource remoteSource,                          
                        boolean omitTermLoading, 
@@ -38,6 +65,15 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
        
     }
     
+       /**
+        * Constructs CdmApplicationRemoteController
+        * 
+        * @param applicationContextResource
+        * @param remoteSource
+        * @param omitTermLoading
+        * @param progressMonitor
+        * @param listeners
+        */
        private CdmApplicationRemoteController(Resource applicationContextResource, 
                                ICdmRemoteSource remoteSource,                          
                                boolean omitTermLoading, 
@@ -52,14 +88,22 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
        }
        
     /**
+     * Returns classpath resource for application context config file
+     * 
      * @return
      */
     protected static ClassPathResource getClasspathResource() {
         return new ClassPathResource(DEFAULT_APPLICATION_CONTEXT_RESOURCE);
     }
+    
+    
     /**
-     * Sets the application context to a new spring ApplicationContext by using the according data source and initializes the Controller.
-     * @param dataSource
+     * Creates and starts a new spring application context
+     * 
+     * @param remoteSource object for connecting to an http-invoker server
+     * @param omitTermLoading
+     * @param listeners
+     * @return
      */
     protected boolean setNewRemoteSource(ICdmRemoteSource remoteSource, 
                boolean omitTermLoading, 
@@ -82,11 +126,6 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
         pspc.setProperties(properties);
         applicationContext.addBeanFactoryPostProcessor(pspc);
         progressMonitor.worked(1);
-        
-//        BeanDefinition remoteSourceBean = remoteSource.getRemoteSourceBean();
-//        remoteSourceBean.setAttribute("isLazy", false);
-//        applicationContext.registerBeanDefinition("dataSource", remoteSourceBean);
-
 
         XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
         progressMonitor.subTask("Registering resources.");
@@ -119,18 +158,11 @@ public class CdmApplicationRemoteController  extends CdmApplicationController {
         return true;
     }
     
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.application.CdmApplicationController#init()
+     */
     @Override
-    protected void init(){
-        logger.debug("Init " +  this.getClass().getName() + " ... ");
-        if (logger.isDebugEnabled()){for (String beanName : applicationContext.getBeanDefinitionNames()){ logger.debug(beanName);}}
-        //TODO delete next row (was just for testing)
-        if (logger.isInfoEnabled()){
-            logger.info("Registered Beans: ");
-            String[] beanNames = applicationContext.getBeanDefinitionNames();
-            for (String beanName : beanNames){
-                logger.info(beanName);
-            }
-        }
+    protected void init(){    
         configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration");
 
     }