Java Code Examples for com.jamonapi.MonitorFactory#start()
The following examples show how to use
com.jamonapi.MonitorFactory#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetamodelServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Returns the last modification date of the metamodel specified * * @param token The token. * @param user The user. * @param name The metamodel's name. * * @return the last modification date of the metamodel specified */ public long getMetamodelContentLastModified(String token, String user, String name) { logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.metamodel.getMetamodelContentByName"); try { long lastModified = -1; validateTicket(token, user); this.setTenantByUserId(user); MetamodelServiceImplSupplier supplier = new MetamodelServiceImplSupplier(); lastModified = supplier.getMetamodelContentLastModified(name); return lastModified; } catch (Exception e) { logger.error("Exception", e); return -1; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 2
Source File: DatasetManagementAPI.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public IDataStore getDataStore(IDataSet dataSet, boolean isNearRealtime, Map<String, String> parametersValues, List<AbstractSelectionField> projections, Filter filter, List<AbstractSelectionField> list, List<Sorting> sortings, List<List<AbstractSelectionField>> summaryRowProjections, int offset, int fetchSize, int maxRowCount, Set<String> indexes) throws JSONException { Monitor totalTiming = MonitorFactory.start("Knowage.DatasetManagementAPI.getDataStore"); try { dataSet.setParametersMap(parametersValues); dataSet.resolveParameters(); IDatasetEvaluationStrategy strategy = DatasetEvaluationStrategyFactory.get(dataSet.getEvaluationStrategy(isNearRealtime), dataSet, userProfile); return strategy.executeQuery(projections, filter, list, sortings, summaryRowProjections, offset, fetchSize, maxRowCount, indexes); } finally { totalTiming.stop(); logger.debug("OUT"); } }
Example 3
Source File: SchedulerServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Gets the job definition. * * @param token * the token * @param user * the user * @param jobName * the job name * @param jobGroup * the job group * * @return the job definition */ public String getJobDefinition(String token, String user, String jobName, String jobGroup) { logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.scheduler.getJobDefinition"); try { validateTicket(token, user); this.setTenantByUserId(user); return supplier.getJobDefinition(jobName, jobGroup); } catch (SecurityException e) { logger.error("SecurityException", e); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 4
Source File: SchedulerServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Gets the job schedulation definition. * * @param token * the token * @param user * the user * @param triggerName * the trigger name * @param triggerGroup * the trigger group * * @return the job schedulation definition */ public String getJobSchedulationDefinition(String token, String user, String triggerName, String triggerGroup) { logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.scheduler.getJobSchedulationDefinition"); try { validateTicket(token, user); this.setTenantByUserId(user); return supplier.getJobSchedulationDefinition(triggerName, triggerGroup); } catch (SecurityException e) { logger.error("SecurityException", e); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 5
Source File: ArtifactServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * return the artifact by the id * @param token. The token. * @param user. The user. * @param id. The artifact's id. * @return the content of the artifact. */ public DataHandler getArtifactContentById(String token, String user, Integer id){ logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.artifact.getArtifactContentById"); try { validateTicket(token, user); this.setTenantByUserId(user); ArtifactServiceImplSupplier supplier = new ArtifactServiceImplSupplier(); return supplier.getArtifactContentById(id); } catch (Exception e) { logger.error("Exception", e); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 6
Source File: AbstractAllocationAlgorithm.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public void apply(SpagoBICellWrapper cell, Object oldValue, Object newValue, SpagoBICellSetWrapper cellSetWrapper) { Monitor totalTimeMonitor = null; Monitor errorHitsMonitor = null; logger.debug("IN"); try { totalTimeMonitor = MonitorFactory.start(getMonitorName() + ".apply.totalTime"); this.applyInternal(cell, oldValue, newValue, cellSetWrapper); } catch (Exception e) { errorHitsMonitor = MonitorFactory.start(getMonitorName() + ".apply.errorHits"); errorHitsMonitor.stop(); logger.error("Error while applying transformation", e); throw new SpagoBIRuntimeException("Error while applying transformation", e); } finally { if (totalTimeMonitor != null) { totalTimeMonitor.stop(); } logger.debug("OUT"); } }
Example 7
Source File: ObjectsAccessVerifier.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Control if the current user can test new object into the functionality identified by its id. * * @param folderId * The id of the lowFunctionality * @param profile * user profile * @return A boolean control value */ public static boolean canTest(Integer folderId, IEngUserProfile profile) { Monitor monitor = MonitorFactory.start("spagobi.core.ObjectAccessVerifier.canTest"); logger.debug("IN"); LowFunctionality folder = null; try { folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(folderId, false); } catch (Exception e) { logger.error("Exception in loadLowFunctionalityByID", e); return false; } finally { monitor.stop(); logger.debug("OUT"); } return canTestInternal(folder, profile); }
Example 8
Source File: SchedulerServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * Exist job definition. * * @param token * the token * @param user * the user * @param jobName * the job name * @param jobGroup * the job group * * @return the string */ public String existJobDefinition(String token, String user, String jobName, String jobGroup) { logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.scheduler.existJobDefinition"); try { validateTicket(token, user); this.setTenantByUserId(user); return supplier.existJobDefinition(jobName, jobGroup); } catch (SecurityException e) { logger.error("SecurityException", e); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 9
Source File: ArtifactServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * return the artifacts list of the given type * @param token. The token. * @param user. The user. * @param type. The artifact's type. * @return the list of the artifacts of the given type. */ public SpagoBIArtifact[] getArtifactsByType(String token, String user, String type){ logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.artifact.getArtifactsByType"); try { validateTicket(token, user); this.setTenantByUserId(user); ArtifactServiceImplSupplier supplier = new ArtifactServiceImplSupplier(); return supplier.getArtifactsByType(type); } catch (Exception e) { logger.error("An error occurred while getting artifacts of type [" + type + "]", e); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 10
Source File: DefaultScrollableDataResult.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Questo metodo ritorna la riga corrente su cui il cursore è posizionato * * @return <B>DataRow</B> - l'oggetto rappresentante la riga del resultset su cui il cursore è posizionato * @throws <B>EMFInternalError</B> - Se qualche errore si verifica */ public DataRow getDataRow() throws EMFInternalError { Monitor monitor = MonitorFactory.start("model.data-access.default-scrollable-data-result.get-data-row"); try { DataRow dataRow = new DataRow(_resultSetColumnsNames.length); SQLMapper mapper = null; // Verify that the connection is still valid if (_sqlCommand != null) { DataConnection conn = _sqlCommand.getDataConnection(); if (conn != null) { mapper = conn.getSQLMapper(); if (conn.isClosed()) { TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.WARNING, "DataConnection::createDataField: connessione già chiusa"); return null; } // if (_closed) } } for (int i = 0; i < _columnCount; i++) { dataRow.addColumn(i, new DataField(_resultSetColumnsNames[i], _resultSetColumnsTypes[i], _rs.getObject(_resultSetColumnsNames[i]), mapper)); } // for (int i = 0; i < _columnCount; i++) _rs.next(); return dataRow; } // try catch (SQLException sqle) { throw Utils.generateInternalError(sqle, "DefaultScrollableDataResult::getDataRow: "); } // catch (SQLException sqle) finally { monitor.stop(); } // finally }
Example 11
Source File: ObjectsAccessVerifier.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Private method called by the corrispondent public method canTest. Executes roles functionalities control . * * @param folderId * The id of the lowFunctionality * @param profile * user profile * @return A boolean control value */ private static boolean canTestInternal(LowFunctionality folder, IEngUserProfile profile) { Monitor monitor = MonitorFactory.start("spagobi.core.ObjectAccessVerifier.canTestInternal"); logger.debug("IN"); Collection roles = null; try { roles = ((UserProfile) profile).getRolesForUse(); } catch (EMFInternalError emfie) { logger.error("EMFInternalError in profile.getRoles", emfie); monitor.stop(); return false; } Role[] testRoles = folder.getTestRoles(); List testRoleNames = new ArrayList(); for (int i = 0; i < testRoles.length; i++) { Role role = testRoles[i]; testRoleNames.add(role.getName()); } Iterator iterRoles = roles.iterator(); String roleName = ""; while (iterRoles.hasNext()) { roleName = (String) iterRoles.next(); if (testRoleNames.contains(roleName)) { logger.debug("OUT. return true"); monitor.stop(); return true; } } logger.debug("OUT. return false"); monitor.stop(); return false; }
Example 12
Source File: RoleDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Load by id. * * @param roleID * the role id * @return the role * @throws EMFUserError * the EMF user error * @see it.eng.spagobi.commons.dao.IRoleDAO#loadByID(java.lang.Integer) */ @Override public Role loadByID(Integer roleID) throws EMFUserError { Monitor m = MonitorFactory.start("knowage_loadByID"); Role toReturn = null; Session aSession = null; Transaction tx = null; toReturn = getFromCache(String.valueOf(roleID)); if (toReturn == null) { logger.debug("Not found a Role [ " + roleID + " ] into the cache"); try { aSession = getSession(); tx = aSession.beginTransaction(); SbiExtRoles hibRole = (SbiExtRoles) aSession.load(SbiExtRoles.class, roleID); toReturn = toRole(hibRole); putIntoCache(String.valueOf(toReturn.getId()), toReturn); tx.commit(); } catch (HibernateException he) { logException(he); if (tx != null) tx.rollback(); throw new EMFUserError(EMFErrorSeverity.ERROR, 100); } finally { if (aSession != null) { if (aSession.isOpen()) aSession.close(); } } } m.stop(); return toReturn; }
Example 13
Source File: SbiMetaSourceDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public List<SbiMetaTable> loadMetaTables(Session aSession, Integer sourceId) throws EMFUserError { Monitor monitorGeneral = MonitorFactory.start("metasource.dao.loadMetaTables.business.all"); LogMF.debug(logger, "IN: id = [{0}]", sourceId); List<SbiMetaTable> toReturn = new ArrayList<SbiMetaTable>(); Session session = aSession; try { if (sourceId == null) { throw new IllegalArgumentException("Input parameter [sourceId] cannot be null"); } Query query = session.createQuery(" from SbiMetaTable smt where smt.sbiMetaSource.sourceId = ? "); query.setInteger(0, sourceId); List<SbiMetaTable> list = query.list(); Iterator<SbiMetaTable> it = list.iterator(); while (it.hasNext()) { toReturn.add(toMetaTable(it.next())); } logger.debug("Contents loaded"); } catch (Throwable t) { logException(t); throw new SpagoBIDAOException("An unexpected error occured while loading meta tables of meta source with sourceId [" + sourceId + "]", t); } finally { monitorGeneral.stop(); LogMF.debug(logger, "OUT: returning [{0}]", toReturn); } return toReturn; }
Example 14
Source File: BIObjectDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Load bi object for detail. * * @param id the id * @return the BI object * @throws EMFUserError the EMF user error * @see it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO#loadBIObjectForDetail(java.lang.Integer) */ @Override public BIObject loadBIObjectForDetail(Integer id) throws EMFUserError { Monitor monitor = MonitorFactory.start("it.eng.spagobi.analiticalmodel.document.dao.BIObjectDAOHibImpl.loadBIObjectForDetail(Integer id)"); logger.debug("IN"); BIObject biObject = null; Session aSession = null; Transaction tx = null; try { aSession = getSession(); tx = aSession.beginTransaction(); // String hql = " from SbiObjects where biobjId = " + id; String hql = " from SbiObjects where biobjId = ?"; Query hqlQuery = aSession.createQuery(hql); hqlQuery.setInteger(0, id.intValue()); SbiObjects hibObject = (SbiObjects) hqlQuery.uniqueResult(); if (hibObject != null) { biObject = toBIObject(hibObject, aSession); } else { logger.warn("Unable to load document whose id is equal to [" + id + "]"); } tx.commit(); } catch (HibernateException he) { logger.error(he); if (tx != null) tx.rollback(); throw new EMFUserError(EMFErrorSeverity.ERROR, 100); } finally { if (aSession != null) { if (aSession.isOpen()) aSession.close(); } } logger.debug("OUT"); monitor.stop(); return biObject; }
Example 15
Source File: ContentServiceImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * Save object template. * * @param token * the token * @param user * the user * @param documentiId * the documenti id * @param templateName * the template name * @param content * the content * * @return the string */ public String saveObjectTemplate(String token, String user, String documentiId, String templateName, String content) { logger.debug("IN"); Monitor monitor = MonitorFactory .start("spagobi.service.content.saveObjectTemplate"); try { validateTicket(token, user); IEngUserProfile profile = GeneralUtilities .createNewUserProfile(user); if (!profile.getFunctionalities().contains( SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)) { logger.debug("KO - User " + user + " cannot save templates"); return "KO - You cannot save templates"; } this.setTenantByUserProfile(profile); return saveObjectTemplate(user, documentiId, templateName, content); } catch (Throwable t) { logger.error("Error while saving object template", t); return null; } finally { this.unsetTenant(); monitor.stop(); logger.debug("OUT"); } }
Example 16
Source File: SPARQLDataProxy.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
private IDataStore readResultSet(IDataReader dataReader, IDataStore dataStore, ResultSet resultSet) { Monitor monitor = MonitorFactory.start("Knowage.SPARQLDataProxy.readResultSet"); try { dataStore = dataReader.read(resultSet); } catch (Exception t) { throw new SpagoBIRuntimeException("An error occurred while parsing resultset", t); } finally { monitor.stop(); } return dataStore; }
Example 17
Source File: DataSetResource.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
@POST @Path("/{label}/data") @Produces(MediaType.APPLICATION_JSON) @UserConstraint(functionalities = { SpagoBIConstants.SELF_SERVICE_DATASET_MANAGEMENT }) public String getDataStorePostWithJsonInBody(@PathParam("label") String label, String body, @DefaultValue("-1") @QueryParam("limit") int maxRowCount, @DefaultValue("-1") @QueryParam("offset") int offset, @DefaultValue("-1") @QueryParam("size") int fetchSize, @QueryParam("nearRealtime") boolean isNearRealtime) { try { Monitor timing = MonitorFactory.start("Knowage.DataSetResource.getDataStorePostWithJsonInBody:parseInputs"); String parameters = null; String selections = null; String likeSelections = null; String aggregations = null; String summaryRow = null; String options = null; JSONArray jsonIndexes = null; if (StringUtilities.isNotEmpty(body)) { JSONObject jsonBody = new JSONObject(body); JSONObject jsonParameters = jsonBody.optJSONObject("parameters"); parameters = jsonParameters != null ? jsonParameters.toString() : null; JSONObject jsonSelections = jsonBody.optJSONObject("selections"); selections = jsonSelections != null ? jsonSelections.toString() : null; JSONObject jsonLikeSelections = jsonBody.optJSONObject("likeSelections"); likeSelections = jsonLikeSelections != null ? jsonLikeSelections.toString() : null; JSONObject jsonAggregations = jsonBody.optJSONObject("aggregations"); aggregations = jsonAggregations != null ? jsonAggregations.toString() : null; JSONObject jsonSummaryRow = jsonBody.optJSONObject("summaryRow"); if (jsonSummaryRow != null) { summaryRow = jsonSummaryRow != null ? jsonSummaryRow.toString() : null; } else { JSONArray jsonSummaryRowArray = jsonBody.optJSONArray("summaryRow"); summaryRow = jsonSummaryRowArray != null ? jsonSummaryRowArray.toString() : null; } JSONObject jsonOptions = jsonBody.optJSONObject("options"); options = jsonOptions != null ? jsonOptions.toString() : null; jsonIndexes = jsonBody.optJSONArray("indexes"); } Set<String> columns = null; if (jsonIndexes != null && jsonIndexes.length() > 0) { columns = new HashSet<String>(); for (int k = 0; k < jsonIndexes.length(); k++) { JSONArray columnsArrayTemp = jsonIndexes.getJSONObject(k).getJSONArray("fields"); JSONObject columnsArray = columnsArrayTemp.getJSONObject(0); if (columnsArray.getString("store").equals(label)) { columns.add(columnsArray.getString("column")); } } } timing.stop(); return getDataStore(label, parameters, null, selections, likeSelections, maxRowCount, aggregations, summaryRow, offset, fetchSize, isNearRealtime, options, columns); } catch (Exception e) { logger.error("Error loading dataset data from " + label, e); throw new SpagoBIRestServiceException(buildLocaleFromSession(), e); } }
Example 18
Source File: SaveDatasetUserAction.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
@Override public void service(SourceBean request, SourceBean response) { Monitor totalTimeMonitor = null; Monitor errorHitsMonitor = null; logger.debug("IN"); try { totalTimeMonitor = MonitorFactory.start("QbeEngine.saveDatasetUserAction.totalTime"); super.handleTimeFilter = false; super.service(request, response); Assert.assertNotNull(getEngineInstance(), "It's not possible to execute " + this.getActionName() + " service before having properly created an instance of EngineInstance class"); validateLabel(); validateInput(); IDataSet dataset = getEngineInstance().getActiveQueryAsDataSet(); int datasetId = -1; // if (dataset instanceof HQLDataSet || dataset instanceof JPQLDataSet) { // dataset defined on a model --> save it as a Qbe dataset datasetId = this.saveQbeDataset(dataset); // } else { // // dataset defined on another dataset --> save it as a flat dataset // datasetId = this.saveFlatDataset(dataset); // } try { JSONObject obj = new JSONObject(); obj.put("success", "true"); obj.put("id", String.valueOf(datasetId)); JSONSuccess success = new JSONSuccess(obj); writeBackToClient(success); } catch (IOException e) { String message = "Impossible to write back the responce to the client"; throw new SpagoBIEngineServiceException(getActionName(), message, e); } } catch (Throwable t) { errorHitsMonitor = MonitorFactory.start("QbeEngine.errorHits"); errorHitsMonitor.stop(); throw SpagoBIEngineServiceExceptionHandler.getInstance().getWrappedException(getActionName(), getEngineInstance(), t); } finally { if (totalTimeMonitor != null) totalTimeMonitor.stop(); logger.debug("OUT"); } }
Example 19
Source File: VersionDAO.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public String increaseActualVersion(Connection connection, Integer lastVersion, Integer newVersion, String name, String descr) throws SpagoBIEngineException { logger.debug("IN"); Monitor increaseActualVersionDAO = MonitorFactory.start("WhatIfEngine/it.eng.spagobi.engines.whatif.WhatIfEngineInstance.VersionDAO.increaseVersion.increaseActualVersionDAO.all"); Monitor increaseActualVersionDAOBuild = MonitorFactory.start("WhatIfEngine.increaseVersion.increaseActualVersionDAO.buildSQL"); if (descr == null) { name = "" + newVersion; descr = "" + newVersion; } String sqlInsertIntoVirtual = null; String insertIntoVersion = "insert into " + getVersionTableName() + " ( " + getVersionColumnName() + " , " + WhatIfConstants.WBVERSION_COLUMN_NAME + " , " + WhatIfConstants.WBVERSION_COLUMN_DESCRIPTION + ") values (" + newVersion + ",'" + name + "','" + descr + "')"; logger.debug("Data duplication"); try { long dateBefore = System.currentTimeMillis(); logger.debug("Inserting the new version in the dimension table"); SqlInsertStatement insertStatement = new SqlInsertStatement(insertIntoVersion); insertStatement.executeStatement(connection); logger.debug("Inserting in the cube the new version"); sqlInsertIntoVirtual = buildInserttoDuplicateDataStatment(lastVersion, newVersion); increaseActualVersionDAOBuild.stop(); Monitor increaseActualVersionDAOExe = MonitorFactory.start("WhatIfEngine/it.eng.spagobi.engines.whatif.WhatIfEngineInstance.VersionDAO.increaseVersion.increaseActualVersionDAO.executeSQL"); logger.debug("The query for the new version is " + sqlInsertIntoVirtual); insertStatement = new SqlInsertStatement(sqlInsertIntoVirtual); insertStatement.executeStatement(connection); increaseActualVersionDAOExe.stop(); long dateAfter = System.currentTimeMillis(); logger.debug("Time to insert the new version " + (dateAfter - dateBefore)); } catch (SpagoBIEngineException e) { logger.error("Error in increasing version procedure: error when duplicating data and changing version", e); throw e; } increaseActualVersionDAO.stop(); logger.debug("OUT"); return sqlInsertIntoVirtual; }
Example 20
Source File: Jamon.java From automon with Apache License 2.0 | 4 votes |
@Override public Monitor start(JoinPoint.StaticPart jp) { return MonitorFactory.start(jp.toString()); }