Search in sources :

Example 1 with IDirectoryFinder

use of org.apache.aries.util.filesystem.IDirectoryFinder in project aries by apache.

the class Activator method removedService.

@Override
public synchronized void removedService(ServiceReference<Object> reference, Object service) {
    if (service instanceof Coordinator) {
        if (service.equals(coordinator)) {
            Coordinator coordinator = findAlternateServiceFor(Coordinator.class);
            if (coordinator == null)
                deactivate();
            this.coordinator = coordinator;
        }
    } else if (service instanceof RegionDigraph) {
        if (service.equals(regionDigraph)) {
            RegionDigraph regionDigraph = findAlternateServiceFor(RegionDigraph.class);
            if (regionDigraph == null)
                deactivate();
            this.regionDigraph = regionDigraph;
        }
    } else if (service instanceof Resolver) {
        if (service.equals(resolver)) {
            Resolver resolver = findAlternateServiceFor(Resolver.class);
            if (resolver == null)
                deactivate();
            this.resolver = resolver;
        }
    } else if (service instanceof IDirectoryFinder)
        finders.remove(service);
    else {
        if (service.equals(modelledResourceManager)) {
            try {
                Class clazz = getClass().getClassLoader().loadClass(MODELLED_RESOURCE_MANAGER);
                Object manager = findAlternateServiceFor(clazz);
                if (manager == null) {
                    modelledResourceManager = null;
                    serviceModeller = null;
                } else {
                    modelledResourceManager = service;
                    serviceModeller = new ApplicationServiceModeller(service);
                }
            } catch (ClassNotFoundException e) {
            // ignore
            } catch (NoClassDefFoundError e) {
            // ignore
            }
        }
    }
}
Also used : RegionDigraph(org.eclipse.equinox.region.RegionDigraph) Resolver(org.osgi.service.resolver.Resolver) IDirectoryFinder(org.apache.aries.util.filesystem.IDirectoryFinder) Coordinator(org.osgi.service.coordinator.Coordinator)

Aggregations

IDirectoryFinder (org.apache.aries.util.filesystem.IDirectoryFinder)1 RegionDigraph (org.eclipse.equinox.region.RegionDigraph)1 Coordinator (org.osgi.service.coordinator.Coordinator)1 Resolver (org.osgi.service.resolver.Resolver)1