use of org.iobserve.common.record.ISOCountryCode in project iobserve-analysis by research-iobserve.
the class DeployPCMMapperStage method execute.
@Override
protected void execute(final IDeployedEvent event) throws InvocationException, DBException {
// ExperimentLoggingUtils.measureDeploymentEvent(event, ObservationPoint.CODE_TO_MODEL_ENTRY);
this.logger.debug("Received deployment event {}", event);
final ISOCountryCode countryCode;
if (event instanceof Privacy) {
countryCode = ((Privacy) event).getCountryCode();
} else {
countryCode = ISOCountryCode.EVIL_EMPIRE;
}
if (event instanceof ServletDeployedEvent) {
final ServletDeployedEvent servletEvent = (ServletDeployedEvent) event;
final String service = servletEvent.getService();
final String context = servletEvent.getContext();
this.performMapping(EServiceTechnology.SERVLET, service, context, countryCode, event.getTimestamp());
} else if (event instanceof EJBDeployedEvent) {
final EJBDeployedEvent ejbEvent = (EJBDeployedEvent) event;
final String service = ejbEvent.getService();
final String context = ejbEvent.getContext();
this.performMapping(EServiceTechnology.EJB, service, context, countryCode, event.getTimestamp());
} else {
throw new InternalError("Deployment event type " + event.getClass().getCanonicalName() + " not supported.");
}
// ExperimentLoggingUtils.measureDeploymentEvent(event, ObservationPoint.CODE_TO_MODEL_EXIT);
}
use of org.iobserve.common.record.ISOCountryCode in project iobserve-analysis by research-iobserve.
the class AbstractGeoLocationSampler method sample.
/**
* Perform one measurement with potential multiple records.
*
* @param monitoringController
* The monitoring controller for this probe.
*
* @throws Exception
* depending on the concrete sampler different exceptions can be raised
*/
@Override
public void sample(final IMonitoringController monitoringController) throws Exception {
if (!monitoringController.isMonitoringEnabled()) {
return;
}
final long timestamp = monitoringController.getTimeSource().getTime();
final String hostname = monitoringController.getHostname();
final ISOCountryCode countryCode = this.countryInvestigator.getServerGeoLocationCountry();
final IMonitoringRecord geoLocationRecord = this.getGeoLocationRecord(timestamp, hostname, countryCode, monitoringController);
monitoringController.newMonitoringRecord(geoLocationRecord);
}
use of org.iobserve.common.record.ISOCountryCode in project iobserve-analysis by research-iobserve.
the class DeploymentGeolocationContextListener method triggerDeployedEvent.
@Override
protected void triggerDeployedEvent(final ServletContextEvent event) {
final ServletContext servletContext = event.getServletContext();
final String service = this.getServiceIdentifier(servletContext);
final String context = servletContext.getServletContextName();
final String deploymentId = servletContext.getInitParameter(AbstractDeploymentContextListener.DEPLOYMENT_ID);
final ISOCountryCode countryCode = this.readCountryCode();
this.monitoringCtrl.newMonitoringRecord(new Privacy_ServletDeployedEvent(this.timeSource.getTime(), service, context, deploymentId, countryCode));
}
use of org.iobserve.common.record.ISOCountryCode in project iobserve-analysis by research-iobserve.
the class SimulatePetStoreMain method createModel.
private static SimulationModel createModel(final Settings configuration) {
final SimulationModel model = new SimulationModel(configuration.getDelay(), configuration.getLocations(), configuration.getIterations());
final Random random = new Random();
model.getServices().add(new Service("jpetstore-account-database", SimulatePetStoreMain.createIP(0), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-catalog-database", SimulatePetStoreMain.createIP(1), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-order-database", SimulatePetStoreMain.createIP(2), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-order-service", SimulatePetStoreMain.createIP(3), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-catalog-service", SimulatePetStoreMain.createIP(4), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-frontend-service", SimulatePetStoreMain.createIP(5), ISOCountryCode.GERMANY));
for (int i = 0; i < configuration.getAccounting(); i++) {
final ISOCountryCode countryCode = configuration.getLocations().get(random.nextInt(configuration.getLocations().size()));
model.getServices().add(new Service("jpetstore-account-service", SimulatePetStoreMain.createIP(i + 6), countryCode));
}
return model;
}
Aggregations