Package org.eclipse.equinox.region

Examples of org.eclipse.equinox.region.RegionDigraph


        this.coordinator = coordinator;
      }
    }
    else if (service instanceof RegionDigraph) {
      if (service.equals(regionDigraph)) {
        RegionDigraph regionDigraph = (RegionDigraph)findAlternateServiceFor(this.regionDigraph);
        if (regionDigraph == null)
          deactivate();
        this.regionDigraph = regionDigraph;
      }
    }
View Full Code Here


  }
 
  private void handleExplicitlyInstalledBundleRegionDigraph(Bundle origin, BundleRevision bundleRevision) {
      // The bundle needs to be associated with the scoped subsystem of
      // the region used to install the bundle.
      RegionDigraph digraph = activator.getRegionDigraph();
      Region region = digraph.getRegion(origin);
      for (BasicSubsystem s : getSubsystems().getSubsystems()) {
        if ((s.isApplication() || s.isComposite())
            && region.equals(s.getRegion())) {
          Utils.installResource(bundleRevision, s);
          return;
View Full Code Here

 
  private Region createRegion(long id) throws BundleException {
    if (!isScoped())
      return getParents().iterator().next().getRegion();
    Activator activator = Activator.getInstance();
    RegionDigraph digraph = activator.getRegionDigraph();
    if (getParents().isEmpty())
      // This is the root subsystem. Associate it with the region in which
      // the subsystems implementation bundle was installed.
      return digraph.getRegion(activator.getBundleContext().getBundle());
    String name = getSubsystemManifest()
        .getSubsystemSymbolicNameHeader().getSymbolicName()
        + ';'
        + getSubsystemManifest().getSubsystemVersionHeader()
            .getVersion()
        + ';'
        + getSubsystemManifest().getSubsystemTypeHeader()
            .getType() + ';' + Long.toString(id);
    Region region = digraph.getRegion(name);
    // TODO New regions need to be cleaned up if this subsystem fails to
    // install, but there's no access to the coordination here.
    if (region == null)
      return digraph.createRegion(name);
    return region;
  }
View Full Code Here

    digraph = tail.getRegionDigraph();
  }
 
  public void addRequirements(Collection<? extends Requirement> requirements) throws BundleException, InvalidSyntaxException {
    for (int i = 0; i < MAX_ATTEMPTS_DEFAULT; i++) {
      RegionDigraph copy = copyDigraph();
      Region tail = copyTail(copy);
      Region head = copyHead(copy);
      Set<Long> bundleIds = copyBundleIds(tail);
      Map<String, RegionFilterBuilder> heads = copyHeadRegions(tail, copy);
      Map<String, RegionFilterBuilder> tails = copyTailRegions(tail, copy);
      copy.removeRegion(tail);
      tail = copy.createRegion(tail.getName());
      addBundleIds(bundleIds, tail);
      addRequirements(requirements, heads.get(head.getName()));
      addHeadRegions(heads, tail, copy);
      addTailRegions(tails, tail, copy);
      // Replace the current digraph.
View Full Code Here

    @Override
    public void start(final BundleContext bundleContext) throws Exception {
        tracker = new SingleServiceTracker<RegionDigraph>(bundleContext, RegionDigraph.class, new SingleServiceTracker.SingleServiceListener() {
            public void serviceFound() {
                log.debug("Found RegionDigraph service, initializing");
                RegionDigraph regionDigraph = tracker.getService();
                Bundle framework = bundleContext.getBundle(0);
                RegionsPersistenceImpl persistence = null;
                try {
                    persistence = new RegionsPersistenceImpl(regionDigraph, framework);
                    reg = bundleContext.registerService(RegionsPersistence.class, persistence, null);
View Full Code Here

        if (ref == null) {
            System.out.println("RegionDigraph service is unavailable.");
            return null;
        }
        try {
            RegionDigraph admin = (RegionDigraph) getBundleContext().getService(ref);
            if (admin == null) {
                System.out.println("RegionDigraph service is unavailable.");
                return null;
            }
View Full Code Here

        }
        // Region -> bundles mapping
        // Region -> policy mapping
        dstate.bundlesPerRegion = new HashMap<>();
        dstate.filtersPerRegion = new HashMap<>();
        RegionDigraph clone = digraph.copy();
        for (Region region : clone.getRegions()) {
            // Get bundles
            dstate.bundlesPerRegion.put(region.getName(), new HashSet<>(region.getBundleIds()));
            // Get policies
            Map<String, Map<String, Set<String>>> edges = new HashMap<>();
            for (RegionDigraph.FilteredRegion fr : clone.getEdges(region)) {
                Map<String, Set<String>> policy = new HashMap<>();
                Map<String, Collection<String>> current = fr.getFilter().getSharingPolicy();
                for (String ns : current.keySet()) {
                    for (String f : current.get(ns)) {
                        addToMapSet(policy, ns, f);
View Full Code Here

        systemBundleContext.getBundle().adapt(FrameworkWiring.class).resolveBundles(bundles);
    }

    @Override
    public void replaceDigraph(Map<String, Map<String, Map<String, Set<String>>>> policies, Map<String, Set<Long>> bundles) throws BundleException, InvalidSyntaxException {
        RegionDigraph temp = digraph.copy();
        // Remove everything
        for (Region region : temp.getRegions()) {
            temp.removeRegion(region);
        }
        // Re-create regions
        for (String name : policies.keySet()) {
            temp.createRegion(name);
        }
        // Dispatch bundles
        for (Map.Entry<String, Set<Long>> entry : bundles.entrySet()) {
            Region region = temp.getRegion(entry.getKey());
            for (long bundleId : entry.getValue()) {
                region.addBundle(bundleId);
            }
        }
        // Add policies
        for (Map.Entry<String, Map<String, Map<String, Set<String>>>> entry1 : policies.entrySet()) {
            Region region1 = temp.getRegion(entry1.getKey());
            for (Map.Entry<String, Map<String, Set<String>>> entry2 : entry1.getValue().entrySet()) {
                Region region2 = temp.getRegion(entry2.getKey());
                RegionFilterBuilder rfb = temp.createRegionFilterBuilder();
                for (Map.Entry<String, Set<String>> entry3 : entry2.getValue().entrySet()) {
                    for (String flt : entry3.getValue()) {
                        rfb.allow(entry3.getKey(), flt);
                    }
                }
View Full Code Here

            // Add bundles
            Map<String, Set<Long>> bundles = new HashMap<>();
            add(bundles, apply(unmanagedBundles, bundleId()));
            add(bundles, managedBundles);
            // Compute policies
            RegionDigraph computedDigraph = resolver.getFlatDigraph();
            Map<String, Map<String, Map<String, Set<String>>>> policies = copy(dstate.filtersPerRegion);
            // Only keep regions which still have bundles
            policies.keySet().retainAll(bundles.keySet());
            // Fix broken filters
            for (String name : policies.keySet()) {
                policies.get(name).keySet().retainAll(policies.keySet());
            }
            // Update managed regions
            for (Region computedRegion : computedDigraph.getRegions()) {
                String name = computedRegion.getName();
                Map<String, Map<String, Set<String>>> policy = policies.get(name);
                if (policy == null) {
                    policy = new HashMap<>();
                    policies.put(name, policy);
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.region.RegionDigraph

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.