KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > client > ReportManagerFactory


1 package com.calipso.reportgenerator.client;
2
3 import com.calipso.reportgenerator.common.*;
4 import com.calipso.reportgenerator.common.InfoException;
5
6 /**
7  * Esta clase se encarga de instanciar el RemortManager correspondiente dependiendo de la configuración y el uso que se le desee realizar
8  */

9 public class ReportManagerFactory implements IReportManagerFactory {
10
11   /**
12    * Crea un ReportManager EJB si la configuración del ReportManagerConfiguracion es is Distributed, si no crea un RemportManaget.
13    * Si adicionalmente el Distributed y es isStateFul el EJB es StateFul, de lo contratrio crea un StateLess
14    * @param reportGeneratorConfiguration
15    * @param isStateFul
16    * @return
17    */

18   public IReportManager newReportManager(ReportGeneratorConfiguration reportGeneratorConfiguration, boolean isStateFul, String JavaDoc distributedHost) throws InfoException {
19     IReportManager reportManager = null;
20     if (reportGeneratorConfiguration.getIsDistributed()) {
21       reportManager = RemoteReportManager.newRemoteReportManager(reportGeneratorConfiguration, isStateFul, distributedHost);
22     }
23     else {
24       try {
25         Class JavaDoc reportManagerFactoryClass = Class.forName("com.calipso.reportgenerator.reportmanager.LocalReportManagerFactory");
26         IReportManagerFactory factory = (IReportManagerFactory) reportManagerFactoryClass.newInstance();
27         reportManager = factory.newReportManager(reportGeneratorConfiguration,false, distributedHost);
28       } catch (Exception JavaDoc e) {
29         throw new InfoException(LanguageTraslator.traslate("466"),e);
30       }
31     }
32     return reportManager;
33   }
34
35
36 }
37
Popular Tags