Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this file,
   * You can obtain one at http://mozilla.org/MPL/2.0/. */
  
  package pt.webdetails.cda;
  
  import java.util.Map;
  import java.util.UUID;
 
 import  org.apache.commons.logging.Log;
 import  org.apache.commons.logging.LogFactory;
 import  org.pentaho.platform.api.engine.IPentahoSession;
 import  org.pentaho.platform.engine.core.system.PentahoSessionHolder;
 import  org.pentaho.platform.engine.core.system.PentahoSystem;
 import  org.pentaho.reporting.engine.classic.core.ClassicEngineBoot;
Main engine class that will answer to calls

Created by IntelliJ IDEA. User: pedro Date: Feb 2, 2010 Time: 2:24:16 PM

 
 public class CdaEngine
 {
 
   private static final Log logger = LogFactory.getLog(CdaEngine.class);
   private static CdaEngine _instance;
   
 
   protected CdaEngine()
   {
     .info("Initializing CdaEngine");
     init();
 
   }
 
   {
     return .remove(UUID.fromString(uuid));
   }
 
   public String wrapQuery(
       final OutputStream out,
       final CdaSettings cdaSettings,
       final QueryOptions queryOptions)
   {
     UUID uuid = UUID.randomUUID();
     .put(uuidqueryOptions);
     return uuid.toString();
   }
 
   public void doQuery(final OutputStream out,
           final CdaSettings cdaSettings,
   {
 
     .debug("Doing query on CdaSettings [ " + cdaSettings.getId() + " (" + queryOptions.getDataAccessId() + ")]");
 
     TableModel tableModel = cdaSettings.getDataAccess(queryOptions.getDataAccessId()).doQuery(queryOptions);
 
     // Handle the exports
 
     ExporterEngine.getInstance().getExporter(queryOptions.getOutputType(), queryOptions.getExtraSettings()).export(outtableModel);
 
   }
 
 
   public void listQueries(final OutputStream out,
           final CdaSettings cdaSettings,
           final DiscoveryOptions discoveryOptionsthrows UnsupportedExporterExceptionExporterException
   {
 
     .debug("Getting list of queries on CdaSettings [ " + cdaSettings.getId() + ")]");
 
 
     final TableModel tableModel = cdaSettings.listQueries(discoveryOptions);
 
     // Handle the exports
 
     ExporterEngine.getInstance().getExporter(discoveryOptions.getOutputType()).export(outtableModel);
 
   }
 
 
  public void listParameters(final OutputStream out,
          final CdaSettings cdaSettings,
          final DiscoveryOptions discoveryOptionsthrows UnknownDataAccessExceptionUnsupportedExporterExceptionExporterException
  {
    .debug("Getting list of queries on CdaSettings [ " + cdaSettings.getId() + ")]");
    final TableModel tableModel = cdaSettings.getDataAccess(discoveryOptions.getDataAccessId()).listParameters(discoveryOptions);
    // Handle the exports
    ExporterEngine.getInstance().getExporter(discoveryOptions.getOutputType()).export(outtableModel);
  }
  public void getCdaList(final OutputStream outfinal DiscoveryOptions discoveryOptionsfinal IPentahoSession userSessionthrows UnsupportedExporterExceptionExporterException
  {
    final TableModel tableModel = SolutionRepositoryUtils.getInstance().getCdaList(userSession);
    ExporterEngine.getInstance().getExporter(discoveryOptions.getOutputType()).export(outtableModel);
  }
  public static boolean isStandalone()
  {
    return "true".equals(CdaBoot.getInstance().getGlobalConfig().getConfigProperty("pt.webdetails.cda.Standalone"));
  }
  private void init()
  {
    // Start ClassicEngineBoot
    CdaBoot.getInstance().start();
    ClassicEngineBoot.getInstance().start();
  }
  public static synchronized CdaEngine getInstance()
  {
    if ( == null)
    {
       = new CdaEngine();
    }
    return ;
  }
New to GrepCode? Check out our FAQ X