Package it.eng.spagobi.engines.config.bo

Examples of it.eng.spagobi.engines.config.bo.Engine


            super.checkUserPermissionForFunctionality(SpagoBIConstants.ENGINES_MANAGEMENT, "User cannot see engines congifuration.");
            if (engineId == null) {
              logger.warn("Engine identifier in input is null!");
              return null;
            }
          Engine engine = DAOFactory.getEngineDAO().loadEngineByID(engineId);
          if (engine == null) {
            logger.warn("Engine with identifier [" + engineId + "] not existing.");
            return null;
          }
          toReturn = new SDKObjectsConverter().fromEngineToSDKEngine(engine);
View Full Code Here


          super.checkUserPermissionForFunctionality(SpagoBIConstants.ENGINES_MANAGEMENT, "User cannot see engines congifuration.");
          List enginesList = DAOFactory.getEngineDAO().loadAllEngines();
          List sdkEnginesList = new ArrayList();
        if (enginesList != null && enginesList.size() > 0) {
                for (Iterator it = enginesList.iterator(); it.hasNext();) {
                    Engine engine = (Engine) it.next();
                    SDKEngine sdkEngine = new SDKObjectsConverter().fromEngineToSDKEngine(engine);
                    sdkEnginesList.add(sdkEngine);
                }
        }
        toReturn = new SDKEngine[sdkEnginesList.size()];
View Full Code Here

    byte[] response = new byte[0];
    try {
      if (biObject == null)
        return response;
      // get the engine of the biobject
      Engine eng = biObject.getEngine();
      // if engine is not an external it's not possible to call it using
      // url
      if (!EngineUtilities.isExternal(eng))
        if(eng.getClassName().equals("it.eng.spagobi.engines.kpi.SpagoBIKpiInternalEngine")){
          SourceBean request = null;
          SourceBean resp = null;
          EMFErrorHandler errorHandler = null;

          try {
            request = new SourceBean("");
            resp = new SourceBean("");
          } catch (SourceBeanException e1) {
            e1.printStackTrace();
          }
          RequestContainer reqContainer = new RequestContainer();
          ResponseContainer resContainer = new ResponseContainer();
          reqContainer.setServiceRequest(request);
          resContainer.setServiceResponse(resp);
          DefaultRequestContext defaultRequestContext = new DefaultRequestContext(
              reqContainer, resContainer);
          resContainer.setErrorHandler(new EMFErrorHandler());
          RequestContainer.setRequestContainer(reqContainer);
          ResponseContainer.setResponseContainer(resContainer);
          Locale locale = new Locale("it","IT","");
          SessionContainer session = new SessionContainer(true);
          reqContainer.setSessionContainer(session);
          SessionContainer permSession = session.getPermanentContainer();
          //IEngUserProfile profile = new AnonymousCMSUserProfile();
          permSession.setAttribute(IEngUserProfile.ENG_USER_PROFILE, profile);
          errorHandler = defaultRequestContext.getErrorHandler();

          String className = eng.getClassName();
          logger.debug("Try instantiating class " + className
              + " for internal engine " + eng.getName() + "...");
          InternalEngineIFace internalEngine = null;
          // tries to instantiate the class for the internal engine
          try {
            if (className == null && className.trim().equals(""))
              throw new ClassNotFoundException();
            internalEngine = (InternalEngineIFace) Class.forName(className).newInstance();
          } catch (ClassNotFoundException cnfe) {
            logger.error("The class ['" + className
                + "'] for internal engine " + eng.getName()
                + " was not found.", cnfe);
            Vector params = new Vector();
            params.add(className);
            params.add(eng.getName());
            errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
                2001, params));
            return response;
          } catch (Exception e) {
            logger.error("Error while instantiating class " + className, e);
            errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
                100));
            return response;
          }
          try {
            reqContainer.setAttribute("scheduledExecution", "true");
            internalEngine.execute(reqContainer, biObject, resp);
          } catch (EMFUserError e) {
            logger.error("Error during engine execution", e);
            errorHandler.addError(e);
          } catch (Exception e) {
            logger.error("Error while engine execution", e);
            errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
                100));
          }
          return response;
        }
        else if(eng.getClassName().equals("it.eng.spagobi.engines.chart.SpagoBIChartInternalEngine")){
          SourceBean request = null;
          EMFErrorHandler errorHandler = null;
          try {
            request = new SourceBean("");
          } catch (SourceBeanException e1) {
            e1.printStackTrace();
          }
          RequestContainer reqContainer = new RequestContainer();
          SpagoBIChartInternalEngine sbcie=new SpagoBIChartInternalEngine();

          // Call chart engine
          File file=sbcie.executeChartCode(reqContainer, biObject, null, profile);

          // read input from file
          InputStream is = new FileInputStream(file);

          // Get the size of the file
          long length = file.length();

          if (length > Integer.MAX_VALUE) {
            logger.error("file too large");
            return null;
          }

          // Create the byte array to hold the data
          byte[] bytes = new byte[(int)length];

          // Read in the bytes
          int offset = 0;
          int numRead = 0;
          while (offset < bytes.length
              && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
            offset += numRead;
          }

          // Ensure all the bytes have been read in
          if (offset < bytes.length) {
            logger.warn("Could not read all the file");
          }
          // Close the input stream and return bytes
          is.close();
          return bytes;
        // end chart case
        else{
          return response;
        }
      // get driver class
      String driverClassName = eng.getDriverName();

      // build an instance of the driver
      IEngineDriver aEngineDriver = (IEngineDriver) Class.forName(driverClassName).newInstance();

      // get the map of parameter to send to the engine
View Full Code Here

    StringTokenizer tokenState = new StringTokenizer(stateAttr, ",");
    String stateIdStr = tokenState.nextToken();
    Integer stateId = new Integer(stateIdStr);
    String stateCode = tokenState.nextToken();
    // TRY TO LOAD THE ENGINE RELATED TO THE BIOBJECT
    Engine engine = null;
    if (engineIdStr == null || engineIdStr.equals("")) {
      // if engine id is not specified take the first engine for the biobject type
      List engines = DAOFactory.getEngineDAO().loadAllEnginesForBIObjectType(typeCode);
      if(engines.size() == 0) {
        Domain domain = DAOFactory.getDomainDAO().loadDomainById(typeIdInt);
View Full Code Here

        // recover development sbidomains
        Domain devDom = domainDAO.loadDomainByCodeAndValue("STATE", "DEV");
        // recover engine
        IEngineDAO engineDAO = DAOFactory.getEngineDAO();
        List engines = engineDAO.loadAllEnginesForBIObjectType(officeDocDom.getValueCd());
        Engine engine = (Engine)engines.get(0);
        // load the template
        UploadedFile uploadedFile = new UploadedFile();
        IDossierPresentationsDAO dpDAO = DAOFactory.getDossierPresentationDAO();
        Integer dossierId = new Integer(dossierIdStr);
        Integer versionId = new Integer(versionIdStr);
View Full Code Here

      + imgFolder + "', '" + imgFolderOp + "', '', '');\n");

    List objects = folder.getBiObjects();
    for (Iterator it = objects.iterator(); it.hasNext();) {
        BIObject obj = (BIObject) it.next();
        Engine engine = obj.getEngine();
        String objTypeCode = obj.getBiObjectTypeCode();
        ConfigSingleton config = ConfigSingleton.getInstance();
        SourceBean technologyFilterSB = (SourceBean) config
          .getAttribute(DossierConstants.DOSSIER_DRIVER_FILTER_SB);
        String technologyFilter = (String) technologyFilterSB.getAttribute("match");
        if (objTypeCode.equalsIgnoreCase(SpagoBIConstants.REPORT_TYPE_CODE)
          && engine.getDriverName().toLowerCase().indexOf(technologyFilter) != -1) {
      htmlStream.append("  treeCMS.add(" + dTreeObjects-- + ", " + idFolder + ",'" + obj.getName()
        + "', 'javascript:linkEmpty()', '', '', '', '', '', '', '"
        + DossierConstants.DOSSIER_CONFIGURED_BIOBJECT_ID + "', '" + obj.getId() + "' );\n");
        }
    }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.config.bo.Engine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.