com.jamonapi.MonitorFactory Java Examples

The following examples show how to use com.jamonapi.MonitorFactory. 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: DataSourceServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets the data source by label.
 *
 * @param token
 *            String
 * @param user
 *            String
 * @param id
 *            int
 *
 * @return SpagoBiDataSource
 */

@Override
public SpagoBiDataSource getDataSourceById(String token, String user,	Integer id) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.datasource.getDataSourceById");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.getDataSourceById(id);
	} catch (Exception e) {
		logger.error("Error while getting datasource with id  " + id, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}
}
 
Example #2
Source File: MapCatalogueImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
    * Map catalogue.
    * 
    * @param token the token
    * @param user the user
    * @param operation the operation
    * @param path the path
    * @param featureName the feature name
    * @param mapName the map name
    * 
    * @return the string
    */
   public String mapCatalogue(String token, String user, String operation,String path,String featureName,String mapName) {

logger.debug("IN");
Monitor monitor =MonitorFactory.start("spagobi.service.content.mapCatalogue");
try {
    validateTicket(token, user);
    this.setTenantByUserId(user);
    return mapCatalogue(user, operation, path, featureName, mapName);
} catch (SecurityException e) {
    logger.error("SecurityException", e);
    return null;
} finally {
	this.unsetTenant();
    monitor.stop();
    logger.debug("OUT");
}	

   }
 
Example #3
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Delete schedulation.
 * 
 * @param token
 *            the token
 * @param user
 *            the user
 * @param triggerName
 *            the trigger name
 * @param triggerGroup
 *            the trigger group
 * 
 * @return the string
 */
public String deleteSchedulation(String token, String user,
		String triggerName, String triggerGroup) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.scheduler.deleteSchedulation");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.deleteSchedulation(triggerName, triggerGroup);
	} catch (SecurityException e) {
		logger.error("SecurityException", e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #4
Source File: ObjectsAccessVerifier.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Control if the current user can execute 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 canExec(Integer folderId, IEngUserProfile profile) {
	Monitor monitor = MonitorFactory.start("spagobi.core.ObjectAccessVerifier.canExec");
	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 canExecInternal(folder, profile);
}
 
Example #5
Source File: ContentServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Read sub object content.
 * 
 * @param token
 *            the token
 * @param user
 *            the user
 * @param subObjectId
 *            the sub object id
 * 
 * @return the content
 */
public Content readSubObjectContent(String token, String user,
		String subObjectId) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.content.readSubObjectContent");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return readSubObjectContent(user, subObjectId);
	} catch (SecurityException e) {
		logger.error("SecurityException", e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #6
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Define job.
 * 
 * @param token
 *            the token
 * @param user
 *            the user
 * @param xmlRequest
 *            the xml request
 * 
 * @return the string
 */
public String defineJob(String token, String user, String xmlRequest) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.scheduler.defineJob");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.defineJob(xmlRequest);
	} catch (SecurityException e) {
		logger.error("SecurityException", e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #7
Source File: DatasetManagementAPI.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
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 #8
Source File: JamonPerformanceMonitorInterceptorTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testInvokeUnderTraceWithExceptionTracking() throws Throwable {
	given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
	given(mi.proceed()).willThrow(new IllegalArgumentException());

	try {
		interceptor.invokeUnderTrace(mi, log);
		fail("Must have propagated the IllegalArgumentException");
	}
	catch (IllegalArgumentException expected) {
	}

	assertEquals("Monitors must exist for the method invocation and 2 exceptions",
			3, MonitorFactory.getNumRows());
	assertTrue("The jamon report must contain the toString method that was invoked",
			MonitorFactory.getReport().contains("toString"));
	assertTrue("The jamon report must contain the generic exception: " + MonitorFactory.EXCEPTIONS_LABEL,
			MonitorFactory.getReport().contains(MonitorFactory.EXCEPTIONS_LABEL));
	assertTrue("The jamon report must contain the specific exception: IllegalArgumentException'",
			MonitorFactory.getReport().contains("IllegalArgumentException"));
}
 
Example #9
Source File: ArtifactServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
* 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 #10
Source File: ArtifactServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
* 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 #11
Source File: JamonPerformanceMonitorInterceptor.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Wraps the invocation with a JAMon Monitor and writes the current
 * performance statistics to the log (if enabled).
 * @see com.jamonapi.MonitorFactory#start
 * @see com.jamonapi.Monitor#stop
 */
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
	String name = createInvocationTraceName(invocation);
	MonKey key = new MonKeyImp(name, name, "ms.");

	Monitor monitor = MonitorFactory.start(key);
	try {
		return invocation.proceed();
	}
	catch (Throwable ex) {
		trackException(key, ex);
		throw ex;
	}
	finally {
		monitor.stop();
		if (!this.trackAllInvocations || isLogEnabled(logger)) {
			writeToLog(logger, "JAMon performance statistics for method [" + name + "]:\n" + monitor);
		}
	}
}
 
Example #12
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Delete job.
 * 
 * @param token
 *            the token
 * @param user
 *            the user
 * @param jobName
 *            the job name
 * @param jobGroupName
 *            the job group name
 * 
 * @return the string
 */
public String deleteJob(String token, String user, String jobName,
		String jobGroupName) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.scheduler.deleteJob");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.deleteJob(jobName, jobGroupName);
	} catch (SecurityException e) {
		logger.error("SecurityException", e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #13
Source File: AbstractSvgViewerEngineResource.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
public EngineStartServletIOManager getIOManager() {
	Monitor getIOManagerMonitor = MonitorFactory.start("GeoEngine.AbstractSvgViewerEngineResource.getIOManager");

	EngineStartServletIOManager ioManager = null;

	try {
		ioManager = new EngineStartServletIOManager(request, response);
		UserProfile userProfile = (UserProfile) ioManager.getParameterFromSession(IEngUserProfile.ENG_USER_PROFILE);
		if (userProfile == null) {
			String userId = request.getHeader("user");
			userProfile = (UserProfile) UserUtilities.getUserProfile(userId);
			ioManager.setUserProfile(userProfile);
		}
	} catch (Exception e) {
		throw new RuntimeException("An unexpected error occured while inizializing ioManager", e);
	}
	getIOManagerMonitor.stop();

	return ioManager;
}
 
Example #14
Source File: MetamodelServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
* return the metamodel by the id
* @param token. The token.
* @param user. The user.
* @param id. The metamodel's name.
* @return the content of the metamodel.
*/
  public DataHandler getMetamodelContentByName(String token, String user, String name){
logger.debug("IN");
Monitor monitor = MonitorFactory
		.start("spagobi.service.metamodel.getMetamodelContentByName");
try {
	DataHandler dataHandler = null;
	validateTicket(token, user);
	this.setTenantByUserId(user);
	MetamodelServiceImplSupplier supplier = new MetamodelServiceImplSupplier();			
	dataHandler = supplier.getMetamodelContentByName(name);
	return dataHandler;
} catch (Exception e) {
	logger.error("Exception", e);
	return null;
} finally {
	this.unsetTenant();
	monitor.stop();
	logger.debug("OUT");
}				
  }
 
Example #15
Source File: ObjectsAccessVerifier.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * returns the list of correct roles of the input profile for the execution of the document with the specified input
 *
 * @param objectId
 *            the document id
 * @param profile
 *            the user profile
 * @return the list of correct roles of the input profile for the execution of the document with the specified input
 * @throws EMFUserError
 * @throws EMFInternalError
 */
public static List getCorrectRolesForExecution(Integer objectId, IEngUserProfile profile) throws EMFInternalError, EMFUserError {
	Monitor monitor = MonitorFactory.start("spagobi.core.ObjectAccessVerifier.getCorrectRolesForExecution");
	logger.debug("IN");
	List correctRoles = null;
	if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV) || profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_USER)
			|| profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
		logger.debug("User is able to execute action");
		correctRoles = DAOFactory.getBIObjectDAO().getCorrectRolesForExecution(objectId, profile);
	} else {
		logger.debug("User is NOT able to execute action");
		correctRoles = DAOFactory.getBIObjectDAO().getCorrectRolesForExecution(objectId);
	}
	logger.debug("OUT");
	monitor.stop();
	return correctRoles;
}
 
Example #16
Source File: DataSourceServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets the all data source.
 *
 * @param token
 *            String
 * @param user
 *            String
 *
 * @return SpagoBiDataSource[]
 */
@Override
public SpagoBiDataSource[] getAllDataSource(String token, String user) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.datasource.getAllDataSource");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.getAllDataSource();
	} catch (Exception e) {
		logger.error("Error while getting all datasources", e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #17
Source File: DataSourceServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets the data source by label.
 *
 * @param token
 *            String
 * @param user
 *            String
 * @param label
 *            String
 *
 * @return SpagoBiDataSource
 */
@Override
public SpagoBiDataSource getDataSourceByLabel(String token, String user,
		String label) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.datasource.getDataSourceByLabel");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);
		return supplier.getDataSourceByLabel(label);
	} catch (Exception e) {
		logger.error("Error while getting datasource with label  " + label, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}
}
 
Example #18
Source File: DataSourceServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Gets the data source.
 *
 * @param token
 *            String
 * @param user
 *            String
 * @param documentId
 *            String
 *
 * @return SpagoBiDataSource
 */
@Override
public SpagoBiDataSource getDataSource(String token, String user,
		String documentId) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory
			.start("spagobi.service.datasource.getDataSource");
	try {
		validateTicket(token, user);
		IEngUserProfile profile = this.setTenantByUserId(user);
		return supplier.getDataSource(documentId, (UserProfile)profile);
	} catch (Exception e) {
		logger.error("Error while getting datasource for document with id " + documentId, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}

}
 
Example #19
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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 #20
Source File: DataSetServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public SpagoBiDataSet saveDataSet(String token, String user, SpagoBiDataSet dataset) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory.start("spagobi.service.dataset.saveDataSet");
	try {
		validateTicket(token, user);
		this.setTenantByUserId(user);

		IEngUserProfile profile = GeneralUtilities.createNewUserProfile(user);
		Assert.assertNotNull(profile, "Impossible to find the user profile");

		return supplier.saveDataSet(dataset, profile, null);
	} catch (Exception e) {
		logger.error("Errors saving dataset " + dataset, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}
}
 
Example #21
Source File: DataSetServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public SpagoBiDataSet getDataSetByLabel(String token, String user, String label) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory.start("spagobi.service.dataset.getDataSetByLabel");
	try {
		validateTicket(token, user);
		IEngUserProfile profile = this.setTenantByUserId(user);
		return supplier.getDataSetByLabel(label,profile);
	} catch (Exception e) {
		logger.error("Error while getting dataset with label " + label, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}
}
 
Example #22
Source File: DataSetServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public SpagoBiDataSet getDataSet(String token, String user, String documentId) {
	logger.debug("IN");
	Monitor monitor = MonitorFactory.start("spagobi.service.dataset.getDataSet");
	try {
		validateTicket(token, user);
		IEngUserProfile profile = this.setTenantByUserId(user);
		return supplier.getDataSet(documentId, (UserProfile)profile);
	} catch (Exception e) {
		logger.error("Error while getting dataset for document with id " + documentId, e);
		return null;
	} finally {
		this.unsetTenant();
		monitor.stop();
		logger.debug("OUT");
	}
}
 
Example #23
Source File: SbiDocumentServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
public String getDocumentAnalyticalDriversJSON(String token, String user, Integer id, String language, String country){
	logger.debug("IN");
	Monitor monitor = MonitorFactory.start("spagobi.service.sbidocument.getDocumentParametersJSON");
	try {
	    validateTicket(token, user);
	    this.setTenantByUserId(user);
	    return supplier.getDocumentAnalyticalDriversJSON(id, language, country);
	} catch (SecurityException e) {
	    logger.error("SecurityException", e);
	    return null;
	} finally {
		this.unsetTenant();
	    monitor.stop();
	    logger.debug("OUT");
	}	
}
 
Example #24
Source File: JamonPerformanceMonitorInterceptorTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void testInvokeUnderTraceWithExceptionTracking() throws Throwable {
	given(mi.getMethod()).willReturn(String.class.getMethod("toString"));
	given(mi.proceed()).willThrow(new IllegalArgumentException());

	try {
		interceptor.invokeUnderTrace(mi, log);
		fail("Must have propagated the IllegalArgumentException");
	}
	catch (IllegalArgumentException expected) {
	}

	assertEquals("Monitors must exist for the method invocation and 2 exceptions",
			3, MonitorFactory.getNumRows());
	assertTrue("The jamon report must contain the toString method that was invoked",
			MonitorFactory.getReport().contains("toString"));
	assertTrue("The jamon report must contain the generic exception: " + MonitorFactory.EXCEPTIONS_LABEL,
			MonitorFactory.getReport().contains(MonitorFactory.EXCEPTIONS_LABEL));
	assertTrue("The jamon report must contain the specific exception: IllegalArgumentException'",
			MonitorFactory.getReport().contains("IllegalArgumentException"));
}
 
Example #25
Source File: JDBCDataProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public ResultSet getData(IDataReader dataReader, Object... resources) {
	logger.debug("IN");
	Statement stmt = (Statement) resources[0];
	ResultSet resultSet = null;
	try {
		if (getMaxResults() > 0) {
			stmt.setMaxRows(getMaxResults());
		}
		String sqlQuery = getStatement();
		LogMF.info(logger, "Executing query:\n{0}", sqlQuery);
		Monitor timeToExecuteStatement = MonitorFactory.start("Knowage.JDBCDataProxy.executeStatement:" + sqlQuery);
		try {
			resultSet = stmt.executeQuery(sqlQuery);
		} finally {
			timeToExecuteStatement.stop();
		}
		LogMF.debug(logger, "Executed query:\n{0}", sqlQuery);
		return resultSet;
	} catch (SQLException e) {
		throw new SpagoBIRuntimeException(e);
	} finally {
		logger.debug("OUT");
	}
}
 
Example #26
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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 #27
Source File: SchedulerServiceImpl.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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 #28
Source File: VersionDAO.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
public void deleteVersions(Connection connection, String versionIds) throws Exception {
	logger.debug("IN");
	logger.debug("Deleting the versions " + versionIds + " from the cube");
	String editCubeTableName = getEditCubeName();
	Monitor deleteSQL = MonitorFactory.start("WhatIfEngine/it.eng.spagobi.engines.whatif.WhatIfEngineInstance.VersionDAO.deleteVersion.deleteMethodDAO.all");
	String sqlQuery = "delete from " + editCubeTableName + " where " + getVersionColumnName() + " in (" + versionIds + ")";

	Monitor deleteSQLExeCube = MonitorFactory.start("WhatIfEngine/it.eng.spagobi.engines.whatif.WhatIfEngineInstance.VersionDAO.deleteVersion.deleteMethodDAO.executeSQL.cube");
	SqlUpdateStatement queryStatement = new SqlUpdateStatement(sqlQuery);
	queryStatement.executeStatement(connection);
	deleteSQLExeCube.stop();
	
	
	logger.debug("Deleting the versions " + versionIds + " from the version dimension");
	sqlQuery = "delete from " + getVersionTableName() + " where " + getVersionColumnName() + " in (" + versionIds + ")";
	
	
	Monitor deleteSQLExeVersion = MonitorFactory.start("WhatIfEngine/it.eng.spagobi.engines.whatif.WhatIfEngineInstance.VersionDAO.deleteVersion.deleteMethodDAO.executeSQL.version");
	queryStatement = new SqlUpdateStatement(sqlQuery);
	queryStatement.executeStatement(connection);
	deleteSQLExeVersion.stop();
	
	logger.debug("Version deleted");
	logger.debug("OUT");
	deleteSQL.stop();
}
 
Example #29
Source File: AbstractAllocationAlgorithm.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
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 #30
Source File: ChartEngineDataUtil.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
private static IDataStore loadDatastore(IQuery query, IDataSet dataSet, Map analyticalDrivers, Map userProfile, Locale locale, String dateFormatJava)
		throws JSONException {

	analyticalDrivers.put("LOCALE", locale);
	dataSet.setParamsMap(analyticalDrivers);
	dataSet.setUserProfileAttributes(userProfile);

	Monitor monitorLD = MonitorFactory.start("SpagoBI_Chart.GetChartDataAction.service.LoadData");

	dataSet.loadData();// start, limit, rowsLimit); //
						// ??????????????????????????

	monitorLD.stop();

	IDataStore dataStore = dataSet.getDataStore().aggregateAndFilterRecords(query, dateFormatJava);
	return dataStore;
}