/*
(non-Javadoc)

@see org.osgi.service.cm.ConfigurationListener#configurationEvent(org.osgi.service.cm.ConfigurationEvent)
964812
@Override
    public void configurationEvent(ConfigurationEvent event) {
        if (event.getType() == ConfigurationEvent.CM_UPDATED && event.getPid().equals(pid)) {
            processProperties();
            initializeInterceptor();
        }

    }
873206
protected void registerBinder(ResourceConfig configuration) {
        configuration.register(new AbstractBinder() {
            @Override
            protected void configure() {
                bind(Container.this).to(Container.class).proxy(false);
            }
        });
        configuration.registerInstances(new ContainerLifecycleListener() {
            @Override
            public void onStartup(org.glassfish.jersey.server.spi.Container container) {
                SystemEventBus.publish(new StartupEvent(Container.this, application));
                logger.trace(Messages.get("info.container.startup"));
            }

            @Override
            public void onReload(org.glassfish.jersey.server.spi.Container container) {
                SystemEventBus.publish(new ReloadedEvent(Container.this, application));
                logger.trace(Messages.get("info.container.reload"));
            }

            @Override
            public void onShutdown(org.glassfish.jersey.server.spi.Container container) {
                logger.info("Container onShutdown");
                SystemEventBus.publish(new ShutdownEvent(Container.this, application));
                logger.trace(Messages.get("info.container.shutdown"));
            }
        });
    }
718682
public void dispatchEvent(Event event, String eventName) {
    int typeInt = Event.getTypeInt(eventName);
    Object[] handlerData = $(element).data(EVENT_DATA);
    for (int i = 0, l = elementEvents.length(); i < l; i++) {
      BindFunction listener = elementEvents.get(i);
      String namespace = JsUtils.prop(event, "namespace");
      boolean matchEV = listener != null && (listener.hasEventType(typeInt) || listener.isTypeOf(eventName));
      boolean matchNS = matchEV && (isNullOrEmpty(namespace) || listener.nameSpace.equals(namespace));
      if (matchEV && matchNS) {
        if (!listener.fire(event, typeInt, eventName, handlerData)) {
          event.stopPropagation();
          event.preventDefault();
        }
      }
    }
  }
1153658
public void webEvent(final WebEvent webEvent) {

		if (LOG.isDebugEnabled()) {
			LOG.debug("Sending web event " + webEvent + " for bundle "
					+ webEvent.getBundleName());
		}

		synchronized (listeners) {
			callListeners(webEvent);
			states.put(webEvent.getBundleId(), webEvent);
		}

		final String topic;
		switch (webEvent.getType()) {
			case WebEvent.DEPLOYING:
				topic = WebTopic.DEPLOYING.toString();
				break;
			case WebEvent.DEPLOYED:
				topic = WebTopic.DEPLOYED.toString();
				break;
			case WebEvent.UNDEPLOYING:
				topic = WebTopic.UNDEPLOYING.toString();
				break;
			case WebEvent.UNDEPLOYED:
				topic = WebTopic.UNDEPLOYED.toString();
				break;
			case WebEvent.FAILED:
				topic = WebTopic.FAILED.toString();
				break;
			case WebEvent.WAITING:
				// topic = WebTopic.WAITING.toString();
				// A Waiting Event is not supported by the specification
				// therefore it is mapped to FAILED, because of collision.
				topic = WebTopic.FAILED.toString();
				break;
			default:
				topic = WebTopic.FAILED.toString();
		}

		try {
			executors.submit(new Runnable() {
				public void run() {
					Dictionary<String, Object> properties = new Hashtable<>();
					properties.put("bundle.symbolicName", webEvent
							.getBundleName());
					properties.put("bundle.id", webEvent.getBundleId());
					String bundleVersionObject = webEvent.getBundleVersion();
					Version bundleVersion;
					if (bundleVersionObject != null) {
						bundleVersion = new Version(
								(String) bundleVersionObject);
					} else {
						bundleVersion = new Version("0.0.0");
					}
					properties.put("bundle.version", bundleVersion);
					properties.put("context.path",
							webEvent.getContextPath());
					properties.put("timestamp", webEvent.getTimestamp());
					properties.put("extender.bundle.id", webEvent
							.getExtenderBundleId());
					properties.put("extender.bundle.symbolicName", webEvent
							.getExtenderBundleName());
					String extenderBundleVersionObject = webEvent
							.getExtenderBundleVersion();
					Version extenderVersion;
					if (extenderBundleVersionObject != null) {
						extenderVersion = new Version(
								(String) extenderBundleVersionObject);
					} else {
						extenderVersion = new Version("0.0.0");
					}
					properties.put("extender.bundle.version",
							extenderVersion);

					if (webEvent.getCause() != null) {
						properties.put("exception", webEvent.getCause());
					}

					if (webEvent.getCollisionIds() != null) {
						properties.put("collision",
								webEvent.getContextPath());
						properties.put("collision.bundles",
								webEvent.getCollisionIds());
					}

					Event event = new Event(topic, properties);
					EventAdmin adminService = getEventAdmin();
					if (adminService != null) {
						adminService.postEvent(event);
					}

				}
			});
		} catch (RejectedExecutionException ree) {
			LOG.warn("Executor shut down", ree);
		}

		try {
			executors.submit(new Runnable() {
				public void run() {
					LogService logService = getLogService();
					if (logService != null) {
						logService.log(LogService.LOG_DEBUG, topic);
					} else {
						if (webEvent.getCause() != null) {
							LOG.error(webEvent.toString());
						} else {
							LOG.debug(topic);
						}
					}
				}
			});
		} catch (RejectedExecutionException ree) {
			LOG.warn("Executor shut down", ree);
		}

	}
360895
protected static void firePropertySetEvent( String key, Object value, boolean accumulated,
         JsonConfig jsonConfig ) {
      if( jsonConfig.isEventTriggeringEnabled() ){
         for( Iterator listeners = jsonConfig.getJsonEventListeners()
               .iterator(); listeners.hasNext(); ){
            JsonEventListener listener = (JsonEventListener) listeners.next();
            try{
               listener.onPropertySet( key, value, accumulated );
            }catch( RuntimeException e ){
               log.warn( e );
            }
         }
      }
   }
1196287
public void emitEvent(
      final NamespaceSynchronizationConfig nsConfig,
      final ChangeEvent<BsonDocument> event) {
    listenersLock.lock();
    try {
      if (nsConfig.getNamespaceListenerConfig() == null) {
        return;
      }
      final NamespaceListenerConfig namespaceListener =
          nsConfig.getNamespaceListenerConfig();
      eventDispatcher.dispatch(() -> {
        try {
          if (namespaceListener.getEventListener() != null) {
            namespaceListener.getEventListener().onEvent(
                BsonUtils.getDocumentId(event.getDocumentKey()),
                ChangeEvents.transformChangeEventForUser(
                    event, namespaceListener.getDocumentCodec()));
          }
        } catch (final Exception ex) {
          logger.error(String.format(
              Locale.US,
              "emitEvent ns=%s documentId=%s emit exception: %s",
              event.getNamespace(),
              BsonUtils.getDocumentId(event.getDocumentKey()),
              ex), ex);
        }
        return null;
      });
    } finally {
      listenersLock.unlock();
    }
  }
497383
@Override
    public void fireEvent(String configName, Optional<String> valueOpt)
    {
        this.emitEvent(configName, valueOpt);
    }
17293
public void addEvent(Event event) {
        if(event == null)
            throw new IllegalStateException("event must be non-null");

        if(logger.isTraceEnabled())
            logger.trace("Adding event " + event);

        eventQueue.add(event);
    }
262192
public void addEvent(final EventType _eventtype,
                         final EventDefinition _eventdef)
        throws CacheReloadException
    {
        List<EventDefinition> evenList = this.events.get(_eventtype);
        if (evenList == null) {
            evenList = new ArrayList<>();
            this.events.put(_eventtype, evenList);
        }
        if (!evenList.contains(_eventdef)) {
            evenList.add(_eventdef);
        }
        // if there are more than one event they must be sorted by their index
        // position
        if (evenList.size() > 1) {
            Collections.sort(evenList, new Comparator<EventDefinition>()
            {
                @Override
                public int compare(final EventDefinition _eventDef0,
                                   final EventDefinition _eventDef1)
                {
                    return Long.compare(_eventDef0.getIndexPos(), _eventDef1.getIndexPos());
                }
            });
        }
        setDirty();
    }
864162
@Override
    public void configureComponent(final Object component,
            final PlexusConfiguration configuration,
            final ExpressionEvaluator expressionEvaluator,
            final ClassRealm containerRealm,
            final ConfigurationListener listener)
            throws ComponentConfigurationException {

        addProjectDependenciesToClassRealm(expressionEvaluator, containerRealm);

        this.converterLookup.registerConverter(new ClassRealmConverter(
                containerRealm));

        final ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();

        converter.processConfiguration(this.converterLookup, component,
                containerRealm, configuration,
                expressionEvaluator, listener);

    }
444062
@SuppressWarnings( "unchecked" )
    private static synchronized void configure(InputStream in) throws ConfigurationException
    {
        if( c_factories == null )
            c_factories = new HashMap<String, StopWatchFactory>();

        try
        {
            c_config.load(in);
        }
        catch (IOException e2)
        {
            throw new ConfigurationException(e2);
        }

        for( Enumeration<String> e = (Enumeration<String>) c_config.propertyNames(); e.hasMoreElements(); )
        {
            String key = e.nextElement();

            String[] components = key.split("\\.");

            if( components.length < 2 || !components[0].equals(PROPERTY_PREFIX) ) continue;

            String logger = components[1];

            StopWatchFactory swf = c_factories.get(logger);

            if( swf == null )
            {
                swf = new StopWatchFactory( instantiateLog(logger) );
            }

            //
            //  Call the respective setXXX() methods of the logger
            //  based on the configuration.
            //
            if( components.length > 2 )
            {
                String setting = components[2];

                String method = "set"+Character.toUpperCase(setting.charAt(0))+setting.substring(1);

                try
                {
                    SetterUtil.set( swf.getLog(), method, (String)c_config.get(key) );
                }
                catch( NoSuchMethodException e1 )
                {
                    log.warn("An unknown setting {} for logger {}, wasn't able to find {}.{}.  Continuing nevertheless.",
                             new Object[] {setting, logger, logger, method} );
                }
                catch (Exception e1)
                {
                    throw new ConfigurationException(e1);
                }
            }

            c_factories.put(logger, swf);
        }
    }
8663
private void parseConfiguration(String config) {

        CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);
        m_comboBox = new CmsSelectComboBox(parser.getOptions(), false);
        if (parser.getDefaultValue() != null) {
            //set the declared value selected.
            m_comboBox.setFormValueAsString(parser.getDefaultValue());
        }
        fireChangeEvent();
    }
17054
protected static void fireArrayEndEvent( JsonConfig jsonConfig ) {
      if( jsonConfig.isEventTriggeringEnabled() ){
         for( Iterator listeners = jsonConfig.getJsonEventListeners()
               .iterator(); listeners.hasNext(); ){
            JsonEventListener listener = (JsonEventListener) listeners.next();
            try{
               listener.onArrayEnd();
            }catch( RuntimeException e ){
               log.warn( e );
            }
         }
      }
   }
228327
public void setEventSourceMappings(java.util.Collection<EventSourceMappingConfiguration> eventSourceMappings) {
        if (eventSourceMappings == null) {
            this.eventSourceMappings = null;
            return;
        }

        this.eventSourceMappings = new com.amazonaws.internal.SdkInternalList<EventSourceMappingConfiguration>(eventSourceMappings);
    }
39611
public void bundleChanged(BundleEvent bundleEvent) {
        final String topic = getTopic(bundleEvent);

        // Bail quickly if the event is one that should be ignored
        if (topic == null) {
            return;
        }

        // Event properties
        Map<String, Object> eventProperties = new HashMap<String, Object>();

        // "event" --> the original event object
        eventProperties.put(EventConstants.EVENT, bundleEvent);

        // Non-null result from getBundle
        // "bundle.id" --> source bundle id as Long
        // "bundle.symbolicName" --> source bundle's symbolic name
        // "bundle" --> the source bundle object
        Bundle bundle = bundleEvent.getBundle();
        if (bundle != null) {
            eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId()));
            String symbolicName = bundle.getSymbolicName();
            if (symbolicName != null) {
                eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName);
            }
            eventProperties.put(EventConstants.BUNDLE, bundle);
        }

        // Construct and fire the event
        Event event = new Event(topic, eventProperties);
        eventAdmin.postEvent(event);
    }
686982
public synchronized void addEvent(WorkManagerEvent event)
   {
      if (trace)
         log.tracef("addEvent(%s)", event);

      List<WorkManagerEvent> e = events.get(event.getAddress().getWorkManagerName());

      if (e == null)
      {
         e = new ArrayList<WorkManagerEvent>();
         events.put(event.getAddress().getWorkManagerName(), e);
      }

      e.add(event);
   }
1168205
@JsonProperty("event")
	public void setEventName(String eventName) {
		try {
			this.event = (Class<? extends RemoteApplicationEvent>) Class
					.forName(eventName);
		}
		catch (ClassNotFoundException e) {
			this.event = UnknownRemoteApplicationEvent.class;
		}
	}