Examples of AuditManager

  • org.jboss.security.audit.AuditManager
    An interface that defines the Security Audit Service @author Anil Saldhana @since Nov 29, 2006 @version $Revision$

  • Examples of com.sun.enterprise.security.audit.AuditManager

                // assert(policyLoader != null);
                policyLoader.loadPolicy();

                realmsManager.createRealms();
                // start the audit mechanism
                AuditManager auditManager = secServUtil.getAuditManager();
                auditManager.loadAuditModules();

                //Audit the server started event
                auditManager.serverStarted();
               
                // initRoleMapperFactory is in J2EEServer.java and not moved to here
                // this is because a DummyRoleMapperFactory is register due
                // to invocation of ConnectorRuntime.createActiveResourceAdapter
                // initRoleMapperFactory is called after it
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

            logger.error("Execution end time = [" + end + "] not correct!", nfe);
          }
        }

        // saving modifications
        AuditManager auditManager = AuditManager.getInstance();
        auditManager.updateAudit(auditId, startTime, endTime, state, message, errorCode);
        return "";
      }   
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

          logger.debug("IN");
          freezeHttpResponse();
         
        HttpServletResponse response = getHttpResponse();
        HttpServletRequest req = getHttpRequest();
        AuditManager auditManager = AuditManager.getInstance();
        // AUDIT UPDATE
        Integer auditId = null;
        String auditIdStr = req.getParameter(AuditManager.AUDIT_ID);
        if (auditIdStr == null) {
            logger.warn("Audit record id not specified! No operations will be performed");
        } else {
            logger.debug("Audit id = [" + auditIdStr + "]");
            auditId = new Integer(auditIdStr);
        }
       
        try {
       
          if (auditId != null) {
              auditManager.updateAudit(auditId, new Long(System.currentTimeMillis()), null, "EXECUTION_STARTED", null,
                null);
          }
         
          SessionContainer sessionContainer = this.getRequestContainer().getSessionContainer();
          SessionContainer permanentContainer = sessionContainer.getPermanentContainer();
          IEngUserProfile profile = (IEngUserProfile) permanentContainer.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
          if (profile == null) {
            throw new SecurityException("User profile not found in session");
          }
         
          String documentId = (String)request.getAttribute("documentId");
          if (documentId == null)
            throw new Exception("Document id missing!!");
          logger.debug("Got parameter documentId = " + documentId);
         
          ContentServiceImplSupplier c = new ContentServiceImplSupplier();
          Content template = c.readTemplate(profile.getUserUniqueIdentifier().toString(), documentId, null);
          String templateFileName = template.getFileName();
     
          logger.debug("Template Read");
     
          if(templateFileName==null){
            logger.warn("Template has no name");
            templateFileName="";
          }
         
          response.setHeader("Cache-Control: ",""); // leave blank to avoid IE errors
          response.setHeader("Pragma: ",""); // leave blank to avoid IE errors
          response.setHeader("content-disposition","inline; filename="+templateFileName)
         
          String mimeType = MimeUtils.getMimeType(templateFileName);
          logger.debug("Mime type is = " + mimeType);
          response.setContentType(mimeType);

          BASE64Decoder bASE64Decoder = new BASE64Decoder();
          byte[] templateContent = bASE64Decoder.decodeBuffer(template.getContent());
          response.setContentLength(templateContent.length);
          response.getOutputStream().write(templateContent);
          response.getOutputStream().flush()
          response.getOutputStream().close();
         
            // AUDIT UPDATE
            auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_PERFORMED", null,
              null);
       
        } catch (Exception e) {
            logger.error("Exception", e);
            // AUDIT UPDATE
            auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
              .getMessage(), null);
        } finally {
            logger.debug("OUT");
        }
      }
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

            String executionId = uuidObj.toString();
            executionId  = executionId.replaceAll("-", "");
            mapPars.put("SBI_EXECUTION_ID", executionId);
            mapPars.put("EXECUTION_CONTEXT", "DOCUMENT_COMPOSITION");
            // Auditing
            AuditManager auditManager = AuditManager.getInstance();
            Integer executionAuditId = auditManager.insertAudit(instance.getBIObject(), null, profile, instance.getExecutionRole(), instance.getExecutionModality());
            // adding parameters for AUDIT updating
            if (executionAuditId != null) {
              mapPars.put(AuditManager.AUDIT_ID, executionAuditId.toString());
            }
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

        logger.debug("IN");

        // AUDIT UPDATE
        Integer auditId = null;
        String auditIdStr = null;
        AuditManager auditManager = AuditManager.getInstance();
       
        if(requestContainer.getServiceRequest()!=null){
          auditIdStr = (String) requestContainer.getServiceRequest().getAttribute(AuditManager.AUDIT_ID);
          if (auditIdStr == null) {
              logger.warn("Audit record id not specified! No operations will be performed");
          } else {
              logger.debug("Audit id = [" + auditIdStr + "]");
              auditId = new Integer(auditIdStr);
          }
         
          if (auditId != null) {
              auditManager.updateAudit(auditId, new Long(System.currentTimeMillis()), null, "EXECUTION_STARTED", null,
                null);
          }
        }
       
        ResponseContainer responseContainer = ResponseContainer.getResponseContainer();
        EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
        //setting locale, formats, profile, parameters, startDate, endDate
        setGeneralVariables(requestContainer);

        if (obj == null) {
          logger.error("The input object is null.");
          throw new EMFUserError(EMFErrorSeverity.ERROR, "100", messageBundle);
        }
        if (!obj.getBiObjectTypeCode().equalsIgnoreCase("KPI")) {
          logger.error("The input object is not a KPI.");
          throw new EMFUserError(EMFErrorSeverity.ERROR, "1001", messageBundle);
        }
        String userId = null;

        if(profile!=null){
          userId=(String) ((UserProfile) profile).getUserId();
        }
        else{
          userId=userIdField;
        }

        String documentId = obj.getId().toString();
        logger.debug("Loaded documentId:" + documentId);   
        ModelInstanceNode mI = null;
        try {
          // **************get the template*****************   
          SourceBean content = getTemplate(documentId);
          logger.debug("Got the template.");

          // Date for which we want to see the KpiValues
          this.dateOfKPI = new Date();
          this.parametersObject = readParameters(obj.getBiObjectParameters());
          addBIParameterDescriptions(obj, this.parametersObject);
         
          if(!parametersObject.containsKey("ParKpiDate")){
            String dateForDataset = getDateForDataset(dateOfKPI)
            parametersObject.put("ParKpiDate", dateForDataset);
          }
          logger.debug("Got the date for which the KpiValues have to be calculated. Date:" + this.dateOfKPI);

          // **************take informations on the modelInstance and its KpiValues*****************
          String modelNodeInstance = (String) content.getAttribute("model_node_instance");
          logger.info("ModelNodeInstance : " + modelNodeInstance);

          if (modelNodeInstance == null) {
            logger.error("The modelNodeInstance specified in the template is null");
            throw new EMFUserError(EMFErrorSeverity.ERROR, "10106", messageBundle);
          }
          String periodInstanceID = (String) content.getAttribute("periodicity_id");
          logger.debug("PeriodInstanceID : " + (periodInstanceID!=null ? periodInstanceID : "null"));

          if (periodInstanceID == null) {
            logger.debug("No periodInstID specified will use default one");
          }else{
            periodInstID = new Integer(periodInstanceID);
          }
          getSetConf(content);
          logger.debug("Setted the configuration of the template");

          List kpiRBlocks = new ArrayList();// List of KpiValues Trees for each Resource: it will be sent to the jsp

          // gets the ModelInstanceNode
          mI = DAOFactory.getModelInstanceDAO().loadModelInstanceByLabel(modelNodeInstance, this.dateOfKPI);
          if (mI==null) {
            logger.error("MODEL INSTANCE IS NULL, CHECK model_node_instance IN DOCUMENT TEMPLATE.!!!!!!!!!!!!!!");
          }else {
            logger.debug("ModelInstanceNode, ID=" + (mI.getModelInstanceNodeId()!=null ? mI.getModelInstanceNodeId().toString():"null"));
            modelInstanceRootId = (mI.getModelInstanceNodeId()!=null ? mI.getModelInstanceNodeId() : null );
            logger.debug("Loaded the modelInstanceNode with LABEL " + modelNodeInstance);
          }

          if(dataset_multires){//if datasets return a value for each resource
            this.resources = mI.getResources(); //Set all the Resources for the Model Instance
            logger.info("Dataset multiresource");

            calculateAndInsertKpiValueWithResources(mI.getModelInstanceNodeId(),this.resources);   
            logger.info("Inserted all values!!");
            return;     
          }

          // I set the list of resources of that specific ModelInstance
          if (this.resources == null || this.resources.isEmpty()) {
            this.resources = mI.getResources();
          }
          logger.debug("Setted the List of Resources related to the specified Model Instance");

          KpiLineVisibilityOptions options = setVisibilityOptions();

          //sets up register values
          ModelInstanceNode modI = DAOFactory.getModelInstanceDAO().loadModelInstanceById(mI.getModelInstanceNodeId(), dateOfKPI);

          logger.debug("Setted the List of Kpis that does not need to be persisted in db");
          if (this.resources == null || this.resources.isEmpty()) {
            logger.debug("There are no resources assigned to the Model Instance");
            KpiResourceBlock block = new KpiResourceBlock();
            block.setD(this.dateOfKPI);
            block.setParMap(this.parametersObject);
            KpiLine line = getBlock(mI.getModelInstanceNodeId(), null);
            block.setRoot(line);
            block.setTitle(name);
            block.setSubtitle(subName);
            block.setOptions(options);
            logger.debug("Setted the tree Root.");
            kpiRBlocks.add(block);

          }else {
            Iterator resourcesIt = this.resources.iterator();
            while (resourcesIt.hasNext()) {
              Resource r = (Resource) resourcesIt.next();
              logger.info("Resource: " + r.getName());
              KpiResourceBlock block = new KpiResourceBlock();
              block.setR(r);
              block.setD(dateOfKPI);
              block.setParMap(this.parametersObject);
              KpiLine line = getBlock(mI.getModelInstanceNodeId(), r);
              block.setRoot(line);
              block.setOptions(options);
              logger.debug("Setted the tree Root.");
              kpiRBlocks.add(block);
            }
          }

          try {
            logger.debug("Successfull kpis creation");

            response.setAttribute(ObjectsTreeConstants.SESSION_OBJ_ATTR, obj);
            response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, publisher_Name);
            response.setAttribute("metadata_publisher_Name", metadata_publisher_Name);
            response.setAttribute("trend_publisher_Name", trend_publisher_Name);

            if (name != null) {
              response.setAttribute("title", name);
              response.setAttribute("styleTitle", styleTitle);
            }
            if (subName != null) {
              response.setAttribute("subName", subName);
              response.setAttribute("styleSubTitle", styleSubTitle);
            }
            response.setAttribute("kpiRBlocks", kpiRBlocks);
            response.setAttribute(AuditManager.AUDIT_ID, auditId);
            kpiResultsList = kpiRBlocks;
          } catch (Exception eex) {
            EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 10107);
            userError.setBundle("messages");
            throw userError;
          }
          logger.debug("OUT");
        } catch (EMFUserError e) {
          logger.error("User Error", e);
          errorHandler.addError(e);
          if(auditId!=null){
            auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
                  .getMessage(), null);   
             }
        }  
        catch (Exception e) {
          EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 101);
          logger.error("Generic Error", e);
          errorHandler.addError(userError)
          if(auditId!=null){
            auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
                  .getMessage(), null);   
             }

        }
      }
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

          logger.warn("Audit record id not specified! No operations will be performed");
      } else {
          logger.debug("Audit id = [" + auditIdStr + "]");
          auditId = new Integer(auditIdStr);
      }
      AuditManager auditManager = AuditManager.getInstance();
      if (auditId != null) {
          auditManager.updateAudit(auditId, new Long(System.currentTimeMillis()), null, "EXECUTION_STARTED", null,
            null);
      }
      IEngUserProfile profile = null;
      try {
          RequestContainer reqCont = RequestContainer.getRequestContainer();
          SessionContainer sessCont = reqCont.getSessionContainer();
          SessionContainer permSess = sessCont.getPermanentContainer();
          profile = (IEngUserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
          if (profile == null) {
            logger.error("User profile not found");
            throw new SecurityException("User profile not found");
          }

          String documentId = request.getParameter("documentId");
          logger.debug("got parameter documentId=" + documentId);
      
         
       

        String result="";
          String dataName = (String)request.getParameter("datasetid");
          if((dataName==null) || dataName.trim().equals("")) {
            response.getOutputStream().write(createErrorMsg(10, "Param dataset not found"));
            response.getOutputStream().flush();
           return;
          }
          HashMap parameters=new HashMap();

            try{
          // if dataset needs parameter I must recover them from request
           IDataSet dataSet=DAOFactory.getDataSetDAO().loadActiveIDataSetByID(Integer.valueOf(dataName));
           if(dataSet!=null){ 
             Object parametersO=dataSet.getParameters();
             if(parametersO!=null){
               String parametersXML=parametersO.toString();
             DataSetParametersList dsList=new DataSetParametersList(parametersXML);
             for (Iterator iterator = dsList.getItems().iterator(); iterator.hasNext();) {
              DataSetParameterItem item = (DataSetParameterItem) iterator.next();
              String name=item.getName();
              // check if parameter is in request
              if(requestSB.getAttribute(name)!=null){
                String value=((Object)requestSB.getAttribute(name)).toString();
                parameters.put(name, value);
               
              }
             
            }
             }
              }
         
          } catch (Exception e) {
            logger.error("Exception while recovering attributes needed by dataset", e);
            response.getOutputStream().write(createErrorMsg(10, "Error while recovering attributes needed by dataset"));
          response.getOutputStream().flush();     
          return;
          }
          
         
         
          String res=DataSetAccessFunctions.getDataSetResultFromId(profile, dataName,parameters);
          if (res!=null){
            SourceBean sbRows=SourceBean.fromXMLString(res);
            //SourceBean myResultBean=(SourceBean)sbRows.getAttribute("ROW");
            result=sbRows.toString();
          }
         
          // replace special characters
          result = result.replaceAll("&lt;", "<");
          result = result.replaceAll("&gt;", ">");
          //result = result.replaceAll("\"", "'");
          result= result.replaceAll("<ROWS", "<rows");
          result= result.replaceAll("<ROW", "<row");
         
         
          // write the result into response
          response.getOutputStream().write(result.getBytes());
          response.getOutputStream().flush();
          // AUDIT UPDATE
          auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_PERFORMED", null,
            null);

      } catch (Exception e) {
          logger.error("Exception", e);
          // AUDIT UPDATE
          auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
            .getMessage(), null);
          response.getOutputStream().write(createErrorMsg(10, "Error"));
        response.getOutputStream().flush();     
        return;
      } finally {
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

        HttpServletResponse res = getHttpResponse();
        HttpServletRequest req = getHttpRequest();

        Integer auditId = null;
        String auditIdStr = req.getParameter("SPAGOBI_AUDIT_ID");
        AuditManager auditManager = AuditManager.getInstance();

        try{   
        // AUDIT UPDATE
        if (auditIdStr == null) {
            logger.warn("Audit record id not specified! No operations will be performed");
        } else {
            logger.debug("Audit id = [" + auditIdStr + "]");
            auditId = new Integer(auditIdStr);
        }
        if (auditId != null) {
            auditManager.updateAudit(auditId, new Long(System.currentTimeMillis()), null, "EXECUTION_STARTED", null,
              null);
        }
       
        if(!(this.getErrorHandler().isOKBySeverity(EMFErrorSeverity.ERROR))){
          logger.error("There are errors into the error handler!!!");
          throw new Exception("errors in error handler!");
        }

        String outputType = (serviceRequest.getAttribute(PARAM_OUTPUT_FORMAT)==null)?"JPG":(String)serviceRequest.getAttribute(PARAM_OUTPUT_FORMAT)
        String mimeType = "";
        //ChartExporter exporter = new ChartExporter();
        if ("PDF".equalsIgnoreCase(outputType)){
          //tmpFile=exporter.getChartPDF(profile, document);
          mimeType = "application/pdf";
        }
        else if ("JPG".equalsIgnoreCase(outputType)){
          //tmpFile=exporter.getChartJPG(document);
          mimeType = "image/gif";
        }
       
        HttpServletResponse response = getHttpResponse();
        ServletOutputStream out = response.getOutputStream();
      //  response.setContentType("image/gif");
        response.setContentType(mimeType);
       
        // Set Cache for print images
        java.text.SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");     
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MINUTE, 10)//Adding 10 minute to current date time
        Date date=cal.getTime();
        String dateString=dateFormat.format( date )+" GMT";
        logger.debug(dateString)
        response.setDateHeader("Expires", date.getTime());
        //response.setHeader("Expires", "Sat, 6 May 2010 12:00:00 GMT"); 
        response.setHeader("Cache-Control: max-age", "600");
       

        String filePath = (String)serviceRequest.getAttribute("path");

        String dir=System.getProperty("java.io.tmpdir");
        String path=dir+"/"+filePath+".png";

        FileInputStream fis=new FileInputStream(path);

        int avalaible = fis.available();   // Mi informo sul num. bytes.

        for(int i=0; i<avalaible; i++) {
          out.write(fis.read());
        }

        fis.close();
        out.flush()
        out.close();

        // RIMUOVO FISICAMENTE IL FILE DAL REPOSITORY
        /*
        File fileToDelete = new File(path);
        if( fileToDelete.delete() ){
          logger.debug("File deleted"); 
        }else{
          logger.error("File not correctle deleted");
        }
        */
          // AUDIT UPDATE
        if(auditId!=null){
          auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_PERFORMED", null,
            null);
        }
       
        }
        catch (Exception e) {
          logger.error("Errors in retrieving the .png content");
        // Audit Update
          if(auditId!=null){
          auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
                .getMessage(), null);   
           }
        return;   
        }
       
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

      // Auditing
      private Integer createAuditId() {
        logger.debug("IN");
        try {
          AuditManager auditManager = AuditManager.getInstance();
          Integer executionAuditId = auditManager.insertAudit(object, subObject, userProfile, executionRole, executionModality);
          return executionAuditId;
        } finally {
          logger.debug("OUT");
        }
      }
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

            executionId = executionId.replaceAll("-", "");
            mapPars.put("SBI_EXECUTION_ID", executionId);
          }

          // AUDIT
          AuditManager auditManager = AuditManager.getInstance();
          Integer auditId = auditManager.insertAudit(biObject, null, profile, "", modality != null ? modality : "");
          // adding parameters for AUDIT updating
          if (auditId != null) {
            mapPars.put(AuditManager.AUDIT_ID, auditId.toString());
          }

          // built the request to sent to the engine
          Iterator iterMapPar = mapPars.keySet().iterator();
          HttpClient client = new HttpClient();
          // get the url of the engine
          String urlEngine = getExternalEngineUrl(eng);
          PostMethod httppost = new PostMethod(urlEngine);
          while (iterMapPar.hasNext()) {
            String parurlname = (String) iterMapPar.next();
            String parvalue = "";
            if (mapPars.get(parurlname) != null)
              parvalue = mapPars.get(parurlname).toString();
            httppost.addParameter(parurlname, parvalue);
          }
          // sent request to the engine
          int statusCode = client.executeMethod(httppost);
          logger.debug("statusCode="+statusCode);
          response = httppost.getResponseBody();
          logger.debug("response="+response.toString());
          Header headContetType = httppost.getResponseHeader("Content-Type");
          if (headContetType != null) {
            returnedContentType = headContetType.getValue();
          } else {
            returnedContentType = "application/octet-stream";
          }

          auditManager.updateAudit(auditId,null , new Long(GregorianCalendar.getInstance().getTimeInMillis()), "EXECUTION_PERFORMED", null, null);
          httppost.releaseConnection();
        } catch (Exception e) {
          logger.error("Error while executing object ", e);
        }
        logger.debug("OUT");
    View Full Code Here

    Examples of it.eng.spagobi.monitoring.dao.AuditManager

      } catch (Exception e) {
        logger.error("Error during the generation of the final document", e);
          // AUDIT UPDATE
          if (contextInstance != null) {
        Integer auditId = (Integer) contextInstance.getVariable(AuditManager.AUDIT_ID);
        AuditManager auditManager = AuditManager.getInstance();
        auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
          .getMessage(), null);
          }
          // store as final document the template

      } finally {
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. 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.