Java 类org.glassfish.jersey.server.monitoring.ApplicationEvent 实例源码

项目:dropwizard-jooq    文件:JooqTransactionalApplicationListenerTest.java   
@Before
public void setUp() throws SQLException, NoSuchMethodException {
    when(dataSource.getConnection()).thenReturn(connection);

    when(appEvent.getType()).thenReturn(ApplicationEvent.Type.INITIALIZATION_APP_FINISHED);
    when(requestFinishEvent.getType()).thenReturn(RequestEvent.Type.FINISHED);
    when(requestMethodExceptionEvent.getType()).thenReturn(RequestEvent.Type.ON_EXCEPTION);
    when(requestFinishEvent.getUriInfo()).thenReturn(uriInfo);
    when(requestMethodExceptionEvent.getUriInfo()).thenReturn(uriInfo);

    when(containerRequest.getProperty(ConfigurationFactory.CONNECTION_PROVIDER_PROPERTY)).thenReturn(connectionProvider);

    when(requestFinishEvent.getContainerRequest()).thenReturn(containerRequest);
    when(requestMethodExceptionEvent.getContainerRequest()).thenReturn(containerRequest);

    requestFinishEvent.getContainerRequest().getProperty(ConfigurationFactory.CONNECTION_PROVIDER_PROPERTY);
}
项目:dropwizard-circuitbreaker    文件:CircuitBreakerApplicationEventListener.java   
@Override
public void onEvent(final ApplicationEvent event) {
    if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
        event.getResourceModel().getResources().parallelStream()
                .filter(Objects::nonNull)
                .forEach(resource -> {
                    this.registerCircuitBreakerAnnotations(resource.getAllMethods());

                    resource.getChildResources().parallelStream()
                            .filter(Objects::nonNull)
                            .forEach(childResource -> {
                                this.registerCircuitBreakerAnnotations(
                                        childResource.getAllMethods());
                            });
                });
    }
}
项目:restskol    文件:RestSkolApplicationEventListener.java   
@Override
public void onEvent(ApplicationEvent applicationEvent) {
    switch (applicationEvent.getType()) {
        case INITIALIZATION_START:
            logger.info("Initialization started");
            break;
        case INITIALIZATION_FINISHED:
            logger.info("Initialization finished");
            break;
        case INITIALIZATION_APP_FINISHED:
            logger.info("Initialization of APP finished");
            break;
        case RELOAD_FINISHED:
            logger.info("Reload completed");
            break;
        case DESTROY_FINISHED:
            logger.info("Destroy completed");
            break;
    }
}
项目:dropwizard-routing    文件:RoutingUnitOfWorkApplicationListenerTest.java   
@Before
public void setUp() throws Exception {
    when(sessionFactory.openSession()).thenReturn(session);
    when(session.getSessionFactory()).thenReturn(sessionFactory);
    when(session.beginTransaction()).thenReturn(transaction);
    when(session.getTransaction()).thenReturn(transaction);

    when(transaction.isActive()).thenReturn(true);

    when(appEvent.getType()).thenReturn(ApplicationEvent.Type.INITIALIZATION_APP_FINISHED);
    when(requestMethodStartEvent.getType()).thenReturn(RequestEvent.Type.RESOURCE_METHOD_START);
    when(responseFiltersStartEvent.getType()).thenReturn(RequestEvent.Type.RESP_FILTERS_START);
    when(requestMethodExceptionEvent.getType()).thenReturn(RequestEvent.Type.ON_EXCEPTION);
    when(requestMethodStartEvent.getUriInfo()).thenReturn(uriInfo);
    when(responseFiltersStartEvent.getUriInfo()).thenReturn(uriInfo);
    when(requestMethodExceptionEvent.getUriInfo()).thenReturn(uriInfo);

    prepareAppEvent("methodWithDefaultAnnotation");
}
项目:biblebot    文件:JerseyEndpointLoggingListener.java   
@Override
public void onEvent(ApplicationEvent event) {
    if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
        final ResourceModel resourceModel = event.getResourceModel();
        final ResourceLogDetails logDetails = new ResourceLogDetails();
        resourceModel.getResources().stream().forEach((resource) -> {
            logDetails.addEndpointLogLines(getLinesFromResource(resource));
        });
        logDetails.log();
    }
}
项目:jersey-2.x-webapp-for-servlet-container    文件:SampleApplicationEventListener.java   
@Override
public synchronized void onEvent(ApplicationEvent applicationEvent) {
  if (applicationEvent.getType().equals(INITIALIZATION_FINISHED)) {

    String applicationName = applicationEvent.getResourceConfig().getApplicationName();

    LOGGER.info("Application '{}' was initialized.", applicationName);
  }
}
项目:CredentialStorageService-dw-hibernate    文件:UnitOfWorkApplicationListenerTest.java   
@Before
public void setUp() throws Exception {
    this.listener.registerBundle(RemoteCredentialHibernateBundle.DEFAULT_NAME, this.bundle);
    this.listener.registerBundle("analytics", this.analyticsBundle);

    final SessionHolders sessionHolders = mock(SessionHolders.class);

    when(this.bundle.getSessionHolders()).thenReturn(sessionHolders);
    when(this.analyticsBundle.getSessionHolders()).thenReturn(sessionHolders);
    when(this.bundle.getSessionFactory()).thenReturn(this.sessionFactory);
    when(this.analyticsBundle.getSessionFactory())
            .thenReturn(this.analyticsSessionFactory);

    when(this.sessionFactory.openSession()).thenReturn(this.session);
    when(this.session.getSessionFactory()).thenReturn(this.sessionFactory);
    when(this.session.beginTransaction()).thenReturn(this.transaction);
    when(this.session.getTransaction()).thenReturn(this.transaction);
    when(this.transaction.isActive()).thenReturn(true);

    when(this.analyticsSessionFactory.openSession()).thenReturn(this.analyticsSession);
    when(this.analyticsSession.getSessionFactory()).thenReturn(this.analyticsSessionFactory);
    when(this.analyticsSession.beginTransaction()).thenReturn(this.analyticsTransaction);
    when(this.analyticsSession.getTransaction()).thenReturn(this.analyticsTransaction);
    when(this.analyticsTransaction.isActive()).thenReturn(true);

    when(this.appEvent.getType()).thenReturn(ApplicationEvent.Type.INITIALIZATION_APP_FINISHED);
    when(this.requestMethodStartEvent.getType())
            .thenReturn(RequestEvent.Type.RESOURCE_METHOD_START);
    when(this.responseFiltersStartEvent.getType())
            .thenReturn(RequestEvent.Type.RESP_FILTERS_START);
    when(this.requestMethodExceptionEvent.getType()).thenReturn(RequestEvent.Type.ON_EXCEPTION);
    when(this.requestMethodStartEvent.getUriInfo()).thenReturn(this.uriInfo);
    when(this.responseFiltersStartEvent.getUriInfo()).thenReturn(this.uriInfo);
    when(this.requestMethodExceptionEvent.getUriInfo()).thenReturn(this.uriInfo);

    this.prepareAppEvent("methodWithDefaultAnnotation");
}
项目:dropwizard-hk2    文件:ComponentActivator.java   
@Override
public void onEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent.getType() == Type.INITIALIZATION_START) {
        // Request all implementations of the contract from HK2 and activate them
        activateComponents();
    }
}
项目:fili    文件:QueryParameterNormalizationFilter.java   
@Override
public void onEvent(ApplicationEvent applicationEvent) {
    if (parameterMap == null && applicationEvent.getType() == ApplicationEvent.Type.INITIALIZATION_START) {
        Set<Class<?>> providers = applicationEvent.getProviders();
        ClassLoader classLoader = applicationEvent.getResourceConfig().getClassLoader();
        parameterMap = buildParameterMap(providers, classLoader);
    }
}
项目:minerva    文件:LoggingApplicationEventListener.java   
@Override
public void onEvent(ApplicationEvent event) {
    switch (event.getType()) {
    case INITIALIZATION_FINISHED:
        LOG.info("Application " + event.getResourceConfig().getApplicationName()
                + " initialization finished.");
        break;
    case DESTROY_FINISHED:
        LOG.info("Application "+ event.getResourceConfig().getApplicationName()+" destroyed.");
        break;
    default:
        break;
    }
}
项目:dropwizard-entitymanager    文件:UnitOfWorkApplicationListener.java   
@Override
public void onEvent(ApplicationEvent event) {
    if (event.getType() == ApplicationEvent.Type.INITIALIZATION_APP_FINISHED) {
        for (Resource resource : event.getResourceModel().getResources()) {
            resource.getAllMethods().forEach(this::registerUnitOfWorkAnnotations);

            for (Resource childResource : resource.getChildResources()) {
                childResource.getAllMethods().forEach(this::registerUnitOfWorkAnnotations);
            }
        }
    }
}
项目:dropwizard-entitymanager    文件:UnitOfWorkApplicationListenerTest.java   
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
    listener.registerEntityManagerFactory(EntityManagerBundle.DEFAULT_NAME, entityManagerFactory);
    listener.registerEntityManagerFactory("analytics", analyticsEntityManagerFactory);

    when(entityManagerFactory.createEntityManager()).thenReturn(entityManager);
    when(entityManager.getEntityManagerFactory()).thenReturn(entityManagerFactory);
    when(entityManager.getSession()).thenReturn(session);
    when(entityManager.getTransaction()).thenReturn(transaction);
    when(transaction.isActive()).thenReturn(true);

    when(analyticsEntityManagerFactory.createEntityManager()).thenReturn(analyticsEntityManager);
    when(analyticsEntityManager.getEntityManagerFactory()).thenReturn(analyticsEntityManagerFactory);
    when(analyticsEntityManager.getSession()).thenReturn(analyticsSession);
    when(analyticsEntityManager.getTransaction()).thenReturn(analyticsTransaction);
    when(analyticsTransaction.isActive()).thenReturn(true);

    when(appEvent.getType()).thenReturn(ApplicationEvent.Type.INITIALIZATION_APP_FINISHED);
    when(requestMethodStartEvent.getType()).thenReturn(RequestEvent.Type.RESOURCE_METHOD_START);
    when(responseFiltersStartEvent.getType()).thenReturn(RequestEvent.Type.RESP_FILTERS_START);
    when(responseFinishedEvent.getType()).thenReturn(RequestEvent.Type.FINISHED);
    when(requestMethodExceptionEvent.getType()).thenReturn(RequestEvent.Type.ON_EXCEPTION);
    when(requestMethodStartEvent.getUriInfo()).thenReturn(uriInfo);
    when(responseFiltersStartEvent.getUriInfo()).thenReturn(uriInfo);
    when(responseFinishedEvent.getUriInfo()).thenReturn(uriInfo);
    when(requestMethodExceptionEvent.getUriInfo()).thenReturn(uriInfo);

    prepareAppEvent("methodWithDefaultAnnotation");
}
项目:lens    文件:LensApplicationListener.java   
@Override
public void onEvent(ApplicationEvent event) {
  switch (event.getType()) {
  case INITIALIZATION_FINISHED:
    log.info("Application {} was initialized.", event.getResourceConfig().getApplicationName());
    break;
  case DESTROY_FINISHED:
    log.info("Application {} was destroyed", event.getResourceConfig().getApplicationName());
    break;
  default:
    break;
  }
}
项目:micrometer    文件:MetricsApplicationEventListener.java   
@Override
public void onEvent(ApplicationEvent event) {
}
项目:dremio-oss    文件:TimingApplicationEventListener.java   
@Override
public void onEvent(ApplicationEvent event) {
  logger.info("ApplicationEventListener.onEvent " + event.getType());
}
项目:registry    文件:TransactionEventListener.java   
@Override
public void onEvent(ApplicationEvent applicationEvent) {
}
项目:dropwizard-hk2bundle    文件:HK2LifecycleListener.java   
@Override
public void onEvent(ApplicationEvent event) {
    if (event.getType() == ApplicationEvent.Type.INITIALIZATION_START) {
        serviceLocator.inject(hk2ValidationBundle);
    }
}
项目:ameba    文件:Application.java   
@Override
public void onEvent(ApplicationEvent event) {
    SystemEventBus.publish(new ameba.core.event.ApplicationEvent(event));
}
项目:jqm    文件:ExceptionLogger.java   
@Override
public void onEvent(final ApplicationEvent applicationEvent)
{}
项目:minnal    文件:JerseyApplicationEventListener.java   
@Override
public void onEvent(ApplicationEvent event) {
}
项目:lyre    文件:APIxListener.java   
@Override
public void onEvent(ApplicationEvent event) {

}
项目:zefiro    文件:ExceptionListener.java   
@Override
public void onEvent(ApplicationEvent event) {

}
项目:dropwizard-jooq    文件:JooqTransactionalApplicationListener.java   
@Override
public void onEvent(ApplicationEvent event) {

}
项目:anycook-api    文件:ExceptionListener.java   
@Override
public void onEvent(ApplicationEvent event) {

}