Search in sources :

Example 1 with ISOCountryCode

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);
}
Also used : Privacy(org.iobserve.common.record.Privacy) ISOCountryCode(org.iobserve.common.record.ISOCountryCode) EJBDeployedEvent(org.iobserve.common.record.EJBDeployedEvent) ServletDeployedEvent(org.iobserve.common.record.ServletDeployedEvent)

Example 2 with ISOCountryCode

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);
}
Also used : ISOCountryCode(org.iobserve.common.record.ISOCountryCode) IMonitoringRecord(kieker.common.record.IMonitoringRecord)

Example 3 with ISOCountryCode

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));
}
Also used : ISOCountryCode(org.iobserve.common.record.ISOCountryCode) Privacy_ServletDeployedEvent(org.iobserve.common.record.Privacy_ServletDeployedEvent) ServletContext(javax.servlet.ServletContext)

Example 4 with ISOCountryCode

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;
}
Also used : Random(java.util.Random) ISOCountryCode(org.iobserve.common.record.ISOCountryCode) Service(org.iobserve.simulate.petstore.data.Service) SimulationModel(org.iobserve.simulate.petstore.data.SimulationModel)

Aggregations

ISOCountryCode (org.iobserve.common.record.ISOCountryCode)4 Random (java.util.Random)1 ServletContext (javax.servlet.ServletContext)1 IMonitoringRecord (kieker.common.record.IMonitoringRecord)1 EJBDeployedEvent (org.iobserve.common.record.EJBDeployedEvent)1 Privacy (org.iobserve.common.record.Privacy)1 Privacy_ServletDeployedEvent (org.iobserve.common.record.Privacy_ServletDeployedEvent)1 ServletDeployedEvent (org.iobserve.common.record.ServletDeployedEvent)1 Service (org.iobserve.simulate.petstore.data.Service)1 SimulationModel (org.iobserve.simulate.petstore.data.SimulationModel)1