当前位置: 首页>>代码示例>>Java>>正文


Java ServiceEvent.MODIFIED属性代码示例

本文整理汇总了Java中org.osgi.framework.ServiceEvent.MODIFIED属性的典型用法代码示例。如果您正苦于以下问题:Java ServiceEvent.MODIFIED属性的具体用法?Java ServiceEvent.MODIFIED怎么用?Java ServiceEvent.MODIFIED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.osgi.framework.ServiceEvent的用法示例。


在下文中一共展示了ServiceEvent.MODIFIED属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serviceChanged

@Override
public synchronized void serviceChanged ( final ServiceEvent event )
{
    switch ( event.getType () )
    {
        case ServiceEvent.REGISTERED:
            addReference ( event.getServiceReference () );
            break;
        case ServiceEvent.MODIFIED:
            update ();
            break;
        case ServiceEvent.UNREGISTERING:
            removeReference ( event.getServiceReference () );
            break;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:ServiceDiscoverer.java

示例2: serviceChanged

@Override
public void serviceChanged(ServiceEvent event) {
    if (closed) {
        return;
    }

    ServiceReference<?> sr = event.getServiceReference();

    switch (event.getType()) {
    case ServiceEvent.REGISTERED:
        onServiceRegistration(sr);
        break;

    case ServiceEvent.MODIFIED:
        onServiceUpdate(sr);
        break;

    case ServiceEvent.MODIFIED_ENDMATCH:
    case ServiceEvent.UNREGISTERING:
        onServiceDeparture(sr);
        break;
    }
}
 
开发者ID:primeval-io,项目名称:aspecio,代码行数:23,代码来源:ServiceWeavingManager.java

示例3: serviceChanged

/**
 * Implements ServiceListener.serviceChanged().
 * Prints the details of any service event from the framework.
 * @param event the fired service event.
**/
public void serviceChanged(ServiceEvent event)
{
    String[] objectClass = (String[])
        event.getServiceReference().getProperty("objectClass");

    if (event.getType() == ServiceEvent.REGISTERED)
    {
        System.out.println(
            "Ex1: Service of type " + objectClass[0] + " registered.");
    }
    else if (event.getType() == ServiceEvent.UNREGISTERING)
    {
        System.out.println(
            "Ex1: Service of type " + objectClass[0] + " unregistered.");
    }
    else if (event.getType() == ServiceEvent.MODIFIED)
    {
        System.out.println(
            "Ex1: Service of type " + objectClass[0] + " modified.");
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:26,代码来源:Activator.java

示例4: serviceChanged

/**
 * Handle notifications of new/removed GenericDeviceEventListeners
 *
 * @param event
 */
@Override
public void serviceChanged(ServiceEvent event) {
    ServiceReference reference = event.getServiceReference();
    GDEventListener listener = (GDEventListener) context.getService(reference);
    switch (event.getType()) {
        case ServiceEvent.REGISTERED:
            Object filter = reference.getProperty(GENERICDEVICE_FILTER);
            listeners.put(listener, getFilter(filter));
            break;
        case ServiceEvent.MODIFIED:
            break;
        case ServiceEvent.UNREGISTERING:
            listeners.remove(listener);
            break;
    }
}
 
开发者ID:Ericsson-LMF,项目名称:IoT-Gateway,代码行数:21,代码来源:EventManager.java

示例5: serviceChanged

@Override
public void serviceChanged(final ServiceEvent serviceEvent) {
    switch(serviceEvent.getType()) {
        case ServiceEvent.REGISTERED:
            registerWithOnmsRegistry(serviceEvent.getServiceReference());
            break;
        case ServiceEvent.MODIFIED:
            registerWithOnmsRegistry(serviceEvent.getServiceReference());
            break;
        case ServiceEvent.MODIFIED_ENDMATCH:
            unregisterWithOnmsRegistry(serviceEvent.getServiceReference());
            break;
        case ServiceEvent.UNREGISTERING:
            unregisterWithOnmsRegistry(serviceEvent.getServiceReference());
            break;
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:OnmsOSGiBridgeActivator.java

示例6: getServiceEventTypeText

private String getServiceEventTypeText(int type) {
    switch (type) {
    case ServiceEvent.REGISTERED:
        return "Registered";
    case ServiceEvent.MODIFIED:
        return "Modified";
    case ServiceEvent.MODIFIED_ENDMATCH:
        return "Modified End Match";
    case ServiceEvent.UNREGISTERING:
        return "Unregistering";
    default:
        return type + " ???";
    }
}
 
开发者ID:vorburger,项目名称:ch.vorburger.minecraft.osgi,代码行数:14,代码来源:LoggingServiceListener.java

示例7: serviceChanged

@Override
public void serviceChanged(ServiceEvent event) {
    final ServiceReference reference = event.getServiceReference();

    final ServiceItem ri = new ServiceItem(reference);

    EnumSet<RuntimeDataProviderListener.EventType> events = EnumSet.noneOf(RuntimeDataProviderListener.EventType.class);

    switch (event.getType()) {
    case ServiceEvent.REGISTERED:
        synchronized (serviceSet) {
            if (serviceSet.contains(ri)) {
                serviceSet.add(ri);
                events = EnumSet.of(RuntimeDataProviderListener.EventType.ADD);
            }
        }
        break;
    case ServiceEvent.UNREGISTERING:
        synchronized (serviceSet) {
            if (serviceSet.contains(ri)) {
                serviceSet.remove(ri);
                events = EnumSet.of(RuntimeDataProviderListener.EventType.REMOVE);
            }
        }
        break;
    case ServiceEvent.MODIFIED:
    default:
        events = EnumSet.of(RuntimeDataProviderListener.EventType.CHANGE);
        break;
    }

    fireProviderChangeEvent(events);
}
 
开发者ID:apache,项目名称:karaf-eik,代码行数:33,代码来源:EclipseRuntimeDataProvider.java

示例8: serviceChanged

@Override
public void serviceChanged(final ServiceEvent aEvent) {

	final ServiceReference<?> svcRef = aEvent.getServiceReference();

	switch (aEvent.getType()) {
	case ServiceEvent.REGISTERED:
		// New service to export
		exportService(svcRef);
		break;

	case ServiceEvent.MODIFIED:
		if (pServiceUids.containsKey(svcRef)) {
			// Already known service
			updateService(svcRef);

		} else {
			// New match
			exportService(svcRef);
		}
		break;

	case ServiceEvent.MODIFIED_ENDMATCH:
	case ServiceEvent.UNREGISTERING:
		// Service must not be exported
		unexportService(svcRef);
		break;

	default:
		break;
	}
}
 
开发者ID:cohorte,项目名称:cohorte-remote-services,代码行数:32,代码来源:ExportDispatcher.java

示例9: serviceChanged

public void serviceChanged(ServiceEvent event) {
	ClassLoader tccl = Thread.currentThread().getContextClassLoader();

	try {
		Thread.currentThread().setContextClassLoader(classLoader);
		ServiceReference ref = event.getServiceReference();
		Long serviceId = (Long) ref.getProperty(Constants.SERVICE_ID);
		EventResult state = null;

		switch (event.getType()) {

		case (ServiceEvent.REGISTERED):
		case (ServiceEvent.MODIFIED):
			// same as ServiceEvent.REGISTERED
			state = addService(serviceId, ref);
			// inform listeners
			if (state.collectionModified) {
				OsgiServiceBindingUtils.callListenersBind(state.proxy, ref, listeners);

				if (serviceRequiredAtStartup && state.shouldInformStateListeners)
					notifySatisfiedStateListeners();
			}

			break;

		case (ServiceEvent.UNREGISTERING):

			state = canRemoveService(serviceId, ref);

			if (state.collectionModified) {
				OsgiServiceBindingUtils.callListenersUnbind(state.proxy, ref, listeners);
				state = removeService(serviceId, ref);

				if (serviceRequiredAtStartup && state.shouldInformStateListeners)
					notifyUnsatisfiedStateListeners();
			}

			break;

		default:
			throw new IllegalArgumentException("unsupported event type:" + event);
		}
	}
	// OSGi swallows these exceptions so make sure we get a chance to
	// see them.
	catch (Throwable re) {
		if (log.isWarnEnabled()) {
			log.warn("serviceChanged() processing failed", re);
		}
	} finally {
		Thread.currentThread().setContextClassLoader(tccl);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:53,代码来源:OsgiServiceCollection.java

示例10: validate

@Validate
public void validate() {		
	// set service listener to check if endpoint port is changed
	String wFilter =  "(objectclass=" + HttpService.class.getName() + ")";
	ServiceListener wListener = new ServiceListener() {			
		@Override
		public void serviceChanged(ServiceEvent aServiceEvent) {
			if (aServiceEvent.getType() == ServiceEvent.MODIFIED) {
				pLogger.log(LogService.LOG_INFO, "Properties modified! should update Http service port..");
				//checkEndpoints(aServiceEvent.getServiceReference().getProperty(HTTP_SERVICE_ENDPOINTS));
				// to garanty the synchronization of tests, we call instead the synchronized method:
				checkRegisteredHttpService();
			}
		}				
	};
	try {								
		pBundleContext.addServiceListener(wListener, wFilter);						
	} catch (InvalidSyntaxException e) {			
		pLogger.log(LogService.LOG_ERROR, "Invalid syntax while registering a service listener: " 
						+ e.getMessage());
		pController = false;
		pHttpPort = -1;
	}
	// set a timer to check periodically if endpoint port is set the first time!
	// when the port is set, the timer is canceled and we do use only service listener
	// to check if port change again.
	pTimer = new Timer();
	pTimer.scheduleAtFixedRate(new TimerTask() {
		
		@Override
		public void run() {
			checkRegisteredHttpService();
			if (pHttpPort > 0) {							
				this.cancel();
			} else {
				// MOD_BD_20170724
				if (pHops.incrementAndGet() > MAX_CHECK_HOPS) {
					setDefaultHttpServicePort();
				}
			}
		}
		
	}, 1000, 1000);						
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:44,代码来源:CHttpServiceAvailabilityChecker.java

示例11: updateDependencies

private void updateDependencies(ServiceEvent serviceEvent) {
	boolean trace = log.isTraceEnabled();
	boolean debug = log.isDebugEnabled();

	for (Iterator i = dependencies.keySet().iterator(); i.hasNext();) {
		MandatoryServiceDependency dependency = (MandatoryServiceDependency) i.next();

		// check if there is a match on the service
		if (dependency.matches(serviceEvent)) {
			switch (serviceEvent.getType()) {

				case ServiceEvent.REGISTERED:
				case ServiceEvent.MODIFIED:
					unsatisfiedDependencies.remove(dependency);
					if (debug) {
						log.debug("Found service for " + context.getDisplayName() + "; eliminating "
								+ dependency + ", remaining [" + unsatisfiedDependencies + "]");
					}

					sendDependencySatisfiedEvent(dependency);
					break;

				case ServiceEvent.UNREGISTERING:
					unsatisfiedDependencies.put(dependency, dependency.getBeanName());
					if (debug) {
						log.debug("Service unregistered; adding " + dependency);
					}
					sendDependencyUnsatisfiedEvent(dependency);
					break;
				default: // do nothing
					if (debug) {
						log.debug("Unknown service event type for: " + dependency);
					}
					break;
			}
		}
		else {
			if (trace) {
				log.trace(dependency + " does not match: "
						+ OsgiStringUtils.nullSafeToString(serviceEvent.getServiceReference()));
			}
		}
	}
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:44,代码来源:DependencyServiceManager.java


注:本文中的org.osgi.framework.ServiceEvent.MODIFIED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。