Package org.osgi.framework

Examples of org.osgi.framework.ServiceListener


    assertEquals(1, mock.getServiceListeners().size());
    assertSame(listener, mock.getServiceListeners().iterator().next());
  }

  public void testRemoveServiceListener() throws Exception {
    ServiceListener listener = new ServiceListener() {
      public void serviceChanged(ServiceEvent event) {
      }
    };

    Set listeners = mock.getServiceListeners();
View Full Code Here


  @Override
  public void destroy(final URI id) throws Exception {
    IsolationEnvironment env = getEnvironment(id);
    final Semaphore s = new Semaphore(0);
    ServiceListener l = new ServiceListener() {
      @Override
      public void serviceChanged(ServiceEvent event) {
        if (event.getType() != ServiceEvent.UNREGISTERING) {
          return;
        }
View Full Code Here

            pendingTransformationArtifacts.add(file.getAbsolutePath());
        }
        if (deployerListener == null) {
            try {
                String filter = "(" + Constants.OBJECTCLASS + "=" + DeploymentListener.class.getName() + ")";
                deployerListener = new ServiceListener() {
                    public void serviceChanged(ServiceEvent event) {
                        executor.execute(new Runnable() {
                            public void run() {
                                Set<String> files;
                                synchronized (pendingTransformationArtifacts) {
View Full Code Here

        counter.increment();

        final List<T> services = new ArrayList<T>();

        ServiceListener listener = new ServiceListener() {
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
                    services.add((T) bundleContext.getService(event.getServiceReference()));
                    counter.decrement();
                }
View Full Code Here

    }

    private class CommandTracker {
        public CommandTracker() throws Exception {
            BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
            ServiceListener listener = new ServiceListener() {
                public void serviceChanged(ServiceEvent event) {
                    commands.clear();
                }
            };
            context.addServiceListener(listener,
View Full Code Here

        pendingArtifacts.add(file.getAbsolutePath());
        if (listener == null) {
            try {
                executor = Executors.newSingleThreadExecutor();
                String filter = "(" + Constants.OBJECTCLASS + "=" + DeploymentListener.class.getName() + ")";
                listener = new ServiceListener() {
                    public void serviceChanged(ServiceEvent event) {
                        executor.execute(new Runnable() {
                            public void run() {
                                onFilesChanged(pendingArtifacts);
                            }
View Full Code Here

    }

    private class CommandTracker {
        public CommandTracker() throws Exception {
            BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext();
            ServiceListener listener = new ServiceListener() {
                public void serviceChanged(ServiceEvent event) {
                    commands.clear();
                }
            };
            context.addServiceListener(listener,
View Full Code Here

                }
            });
        doAnswer(new Answer<Void>() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
                ServiceListener listener = (ServiceListener) invocation.getArguments()[0];
                String filter = (String) invocation.getArguments()[1];
                synchronized (listeners) {
                    if (filter == null) {
                        listeners.put(listener, null);
                    } else {
View Full Code Here

    private final Set<File> failedInstalls = Sets.newHashSet();

    private BundleContext bundleContext;

    public void init() throws InvalidSyntaxException {
        bundleContext.addServiceListener(new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                try {
                    tryInstallFailed();
                } catch (Exception e) {
View Full Code Here

        counter.increment();

        final List<T> services = new ArrayList<T>();

        ServiceListener listener = new ServiceListener() {
            @SuppressWarnings("unchecked")
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
                    services.add((T) bundleContext.getService(event.getServiceReference()));
                    counter.decrement();
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceListener

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.