Package org.osgi.service.event

Examples of org.osgi.service.event.EventAdmin


    return new Event( path, (Dictionary) dict );
  }

  public void run()
  {
    EventAdmin ea = (EventAdmin) eventAdminTracker.getService();
    if (null!=ea) {
      ea.postEvent( getEvent() );
    }

    for (Enumeration en = listeners.elements(); en.hasMoreElements();) {
      ServiceReference sr = (ServiceReference) en.nextElement();
      UserAdminListener ual = (UserAdminListener) bc.getService(sr);
View Full Code Here


    private void postLoginEvent(final AuthenticationInfo authInfo) {
        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
        properties.put(SlingConstants.PROPERTY_USERID, authInfo.getUser());
        properties.put(AuthenticationInfo.AUTH_TYPE, authInfo.getAuthType());

        EventAdmin localEA = this.eventAdmin;
        if (localEA != null) {
            localEA.postEvent(new Event(AuthConstants.TOPIC_LOGIN, properties));
        }
    }
View Full Code Here

        // clear the factory cache to force rebuild on next access
        this.factoryCache.clear();

        // send event
        final EventAdmin localEA = this.eventAdmin;
        if ( localEA != null ) {
            final Dictionary<String, Object> props = new Hashtable<String, Object>();
            props.put(SlingConstants.PROPERTY_ADAPTABLE_CLASSES, adaptables);
            props.put(SlingConstants.PROPERTY_ADAPTER_CLASSES, adapters);
            localEA.postEvent(new Event(SlingConstants.TOPIC_ADAPTER_FACTORY_ADDED,
                    props));
        }
    }
View Full Code Here

        if (factoriesModified) {
            this.factoryCache.clear();
        }

        // send event
        final EventAdmin localEA = this.eventAdmin;
        if ( localEA != null ) {
            final Dictionary<String, Object> props = new Hashtable<String, Object>();
            props.put(SlingConstants.PROPERTY_ADAPTABLE_CLASSES, adaptables);
            props.put(SlingConstants.PROPERTY_ADAPTER_CLASSES, adapters);
            localEA.postEvent(new Event(SlingConstants.TOPIC_ADAPTER_FACTORY_REMOVED,
                    props));
        }
    }
View Full Code Here

                    final Resource eventResource = resolver.getResource(path);
                    if ( DistributedEventAdminImpl.RESOURCE_TYPE_EVENT.equals(eventResource.getResourceType())) {
                        final Event e = this.readEvent(eventResource);
                        if ( e != null ) {
                            // we check event admin as processing is async
                            final EventAdmin localEA = this.eventAdmin;
                            if ( localEA != null ) {
                                localEA.postEvent(e);
                            } else {
                                this.logger.error("Unable to post event as no event admin is available.");
                            }
                        }
                    }
View Full Code Here

                Mockito.any(Dictionary.class))).thenReturn(null);

        final SlingSettingsService otherSettings = Mockito.mock(SlingSettingsService.class);
        Mockito.when(otherSettings.getSlingId()).thenReturn(OTHER_APP_ID);

        final EventAdmin ea = new EventAdmin() {

            @Override
            public void sendEvent(final Event event) {
                this.postEvent(event);
            }
View Full Code Here

        when(resolver.getResource(anyString())).thenReturn(new JcrTestNodeResource(resolver, session.getNode("/"), null));

        ResourceResolverFactory factory = mock(ResourceResolverFactory.class);
        when(factory.getAdministrativeResourceResolver(anyMap())).thenReturn(resolver);

        EventAdmin mockEA = new EventAdmin() {
            public void postEvent(Event event) {
                addEvent(event);
            }

            public void sendEvent(Event event) {
View Full Code Here

        when(session.getWorkspace()).thenReturn(workspace);

        SlingRepository repository = mock(SlingRepository.class);
        when(repository.loginAdministrative(null)).thenReturn(session);

        EventAdmin eventAdmin = mock(EventAdmin.class);
        ServiceReference serviceRef = mock(ServiceReference.class);
        ServiceReference[] serviceRefs = new ServiceReference[]{serviceRef};
        BundleContext bundleContext = mock(BundleContext.class);
        when(bundleContext.getServiceReferences(anyString(), anyString())).thenReturn(serviceRefs);
        when(bundleContext.getService(serviceRef)).thenReturn(eventAdmin);
View Full Code Here

        Mockito.when(resolver.getResource(Mockito.anyString())).thenReturn(new JcrTestNodeResource(resolver, this.adminSession.getNode("/"), null));

        final ResourceResolverFactory factory = Mockito.mock(ResourceResolverFactory.class);
        Mockito.when(factory.getAdministrativeResourceResolver(Mockito.anyMap())).thenReturn(resolver);

        final EventAdmin mockEA = new EventAdmin() {

            public void postEvent(final Event event) {
                addEvent(event);
            }
View Full Code Here

    /**
     * @see javax.jcr.observation.EventListener#onEvent(javax.jcr.observation.EventIterator)
     */
    public void onEvent(final EventIterator events) {
        // if the event admin is currently not available, we just skip this
        final EventAdmin localEA = this.support.getEventAdmin();
        if ( localEA == null ) {
            return;
        }
        final Map<String, Map<String, Object>> addedEvents = new HashMap<String, Map<String, Object>>();
        final Map<String, ChangedAttributes> changedEvents = new HashMap<String, ChangedAttributes>();
View Full Code Here

TOP

Related Classes of org.osgi.service.event.EventAdmin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.