Package org.osgi.framework

Examples of org.osgi.framework.AllServiceListener


     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (serviceListener == null) {
                serviceListener = new AllServiceListener() {
                    public void serviceChanged(ServiceEvent serviceevent) {
                        try {
                            // Create a notification for the event
                            final Notification notification = new Notification(EVENT, OBJECTNAME,
                                    notificationSequenceNumber.getAndIncrement());
View Full Code Here


        // capture the ServiceListener registered with BundleContext to issue ServiceEvents
        ArgumentCaptor<AllServiceListener> argument = ArgumentCaptor.forClass(AllServiceListener.class);
        verify(context).addServiceListener(argument.capture());

        //send events
        AllServiceListener serviceListener = argument.getValue();
        serviceListener.serviceChanged(registeredEvent);
        serviceListener.serviceChanged(modifiedEvent);

        //shutdown dispatcher via unregister callback
        serviceState.postDeregister();
        //check the ServiceListener is cleaned up
        verify(context).removeServiceListener(serviceListener);
View Full Code Here

        // capture the ServiceListener registered with BundleContext to issue ServiceEvents
        ArgumentCaptor<AllServiceListener> argument = ArgumentCaptor.forClass(AllServiceListener.class);
        verify(context).addServiceListener(argument.capture());

        AllServiceListener serviceListener = argument.getValue();
        assertNotNull(serviceListener);

        ExecutorService dispatcher = serviceState.getEventDispatcher();

        //do registration with another server
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (serviceListener == null) {
                serviceListener = new AllServiceListener() {
                    public void serviceChanged(ServiceEvent serviceevent) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new ServiceEventData(serviceevent).toCompositeData());
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (serviceListener == null) {
                serviceListener = new AllServiceListener() {
                    public void serviceChanged(ServiceEvent serviceevent) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new ServiceEventData(serviceevent).toCompositeData());
View Full Code Here

   *
   * @see org.osgi.jmx.core.ServiceStateMBean#getUsingBundles(long)
   */

  protected ServiceListener getServiceListener() {
    return new AllServiceListener() {
      public void serviceChanged(ServiceEvent serviceEvent) {
        Notification notification = new Notification(
            SERVICE_EVENT_TYPE, objectName, sequenceNumber++);
        notification.setUserData(new OSGiServiceEvent(serviceEvent)
            .asCompositeData());
View Full Code Here

        // capture the ServiceListener registered with BundleContext to issue ServiceEvents
        ArgumentCaptor<AllServiceListener> argument = ArgumentCaptor.forClass(AllServiceListener.class);       
        verify(context).addServiceListener(argument.capture());
       
        //send events
        AllServiceListener serviceListener = argument.getValue();
        serviceListener.serviceChanged(registeredEvent);
        serviceListener.serviceChanged(modifiedEvent);
       
        //shutdown dispatcher via unregister callback
        serviceState.postDeregister();
        //check the ServiceListener is cleaned up
        verify(context).removeServiceListener(serviceListener);
View Full Code Here

       
        // capture the ServiceListener registered with BundleContext to issue ServiceEvents
        ArgumentCaptor<AllServiceListener> argument = ArgumentCaptor.forClass(AllServiceListener.class);       
        verify(context).addServiceListener(argument.capture());
       
        AllServiceListener serviceListener = argument.getValue();
        assertNotNull(serviceListener);
       
        ExecutorService dispatcher = serviceState.getEventDispatcher();
       
        //do registration with another server
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (serviceListener == null) {
                serviceListener = new AllServiceListener() {
                    public void serviceChanged(ServiceEvent serviceevent) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new ServiceEventData(serviceevent).toCompositeData());
View Full Code Here

     */
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        lock.lock();
        try {
            if (serviceListener == null) {
                serviceListener = new AllServiceListener() {
                    public void serviceChanged(ServiceEvent serviceevent) {
                        final Notification notification = new Notification(EVENT, OBJECTNAME,
                                notificationSequenceNumber.getAndIncrement());
                        try {
                            notification.setUserData(new ServiceEventData(serviceevent).toCompositeData());
View Full Code Here

TOP

Related Classes of org.osgi.framework.AllServiceListener

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.