Package io.fabric8.agent.resolver

Examples of io.fabric8.agent.resolver.ResourceImpl


        root.getConnection().run(new IJMXRunnable() {
         
          @Override
          public void run(MBeanServerConnection connection) throws JMXException {
            // TODO REPLACE WITH BETTER JmxTemplateImpl...
            BrokerFacade facade = new RemoteBrokerFacade(connection);
            BrokerNode broker = new BrokerNode(root, facade, "Broker");
            root.addChild(broker);
          }
        });
      } catch (CoreException e) {
View Full Code Here


    if( parentElement instanceof IConnectionWrapper ) {
      IConnectionWrapper w = (IConnectionWrapper)parentElement;
      Root r = w.getRoot();
      if( r != null ) {
        if (r.containsDomain("org.apache.activemq")) {
          BrokerFacade facade = new JmxTemplateBrokerFacade(new JmxPluginJmxTemplate(r.getConnection()));
          String brokerName = null;
          try {
            brokerName = facade.getBrokerName();
          } catch (Exception e) {
            ActiveMQJMXPlugin.getLogger().warning("Could not find Broker name: " + e, e);
          }
          if (brokerName == null) {
            brokerName = "Broker";
View Full Code Here

    if( parentElement instanceof IConnectionWrapper ) {
      IConnectionWrapper w = (IConnectionWrapper)parentElement;
      Root r = w.getRoot();
      if( r != null ) {
        if (r.containsDomain("org.apache.activemq")) {
          BrokerFacade facade = new JmxTemplateBrokerFacade(new JmxPluginJmxTemplate(r.getConnection()));
          String brokerName = null;
          try {
            brokerName = facade.getBrokerName();
          } catch (Exception e) {
            ActiveMQJMXPlugin.getLogger().warning("Could not find Broker name: " + e, e);
          }
          if (brokerName == null) {
            brokerName = "Broker";
View Full Code Here

        root.getConnection().run(new IJMXRunnable() {
         
          @Override
          public void run(MBeanServerConnection connection) throws JMXException {
            // TODO REPLACE WITH BETTER JmxTemplateImpl...
            BrokerFacade facade = new RemoteBrokerFacade(connection);
            BrokerNode broker = new BrokerNode(root, facade, "Broker");
            root.addChild(broker);
          }
        });
      } catch (CoreException e) {
View Full Code Here

                         Map<String, Map<VersionRange, Map<String, String>>> metadata,
                         DeploymentDownloadListener listener) throws IOException, MultiException, InterruptedException, ResolutionException {
        this.downloader = new AgentUtils.FileDownloader(manager);
        this.resources = new ConcurrentHashMap<String, Resource>();
        this.providers = new ConcurrentHashMap<String, StreamProvider>();
        this.requirements = new ResourceImpl("dummy", "dummy", Version.emptyVersion);
        this.metadata = metadata;
        // First, gather all bundle resources
        for (String feature : features) {
            registerMatchingFeatures(feature);
        }
        for (String bundle : bundles) {
            downloadAndBuildResource(bundle, listener);
        }
        for (String fab : fabs) {
            downloadAndBuildResource(FAB_PROTOCOL + fab, listener);
        }
        for (String req : reqs) {
            downloadAndBuildResource(REQ_PROTOCOL + req, listener);
        }
        for (String override : overrides) {
            // TODO: ignore download failures for overrides
            downloadAndBuildResource(extractUrl(override), listener);
        }
        for (String optional : optionals) {
            downloadAndBuildResource(optional, listener);
        }
        // Wait for all resources to be created
        downloader.await();
        // Do override replacement
        for (String override : overrides) {
            Resource over = resources.remove(extractUrl(override));
            if (over == null) {
                // Ignore invalid overrides
                continue;
            }
            for (String uri : new ArrayList<String>(resources.keySet())) {
                Resource res = resources.get(uri);
                if (getSymbolicName(res).equals(getSymbolicName(over))) {
                    VersionRange range;
                    String vr = extractVersionRange(override);
                    if (vr == null) {
                        // default to micro version compatibility
                        Version v1 = getVersion(res);
                        Version v2 = new Version(v1.getMajor(), v1.getMinor() + 1, 0);
                        range = new VersionRange(false, v1, v2, true);
                    } else {
                        range = VersionRange.parseVersionRange(vr);
                    }
                    // The resource matches, so replace it with the overridden resource
                    // if the override is actually a newer version than what we currently have
                    if (range.contains(getVersion(res)) && getVersion(res).compareTo(getVersion(over)) < 0) {
                        resources.put(uri, over);
                    }
                }
            }
        }
        // Build features resources
        for (Feature feature : featuresToRegister) {
            ResourceImpl resource = FeatureResource.build(feature, featureRange, resources);
            resources.put("feature:" + feature.getName() + "/" + feature.getVersion(), resource);
            for (Conditional cond : feature.getConditional()) {
                Feature featCond = cond.asFeature(feature.getName(), feature.getVersion());
                FeatureResource resCond = FeatureResource.build(feature, cond, featureRange, resources);
                requireFeature(featCond.getName() + "/" + featCond.getVersion(), resource, true);
View Full Code Here

                        listener.onDownload(file, pendings);
                    }
                    FabResolver resolver = fabResolverFactory.getResolver(file.toURI().toURL());
                    FabBundleInfo fabInfo = resolver.getInfo();

                    ResourceImpl resource = (ResourceImpl) manageResource(location, fabInfo.getManifest(), new StreamProvider.Fab(fabInfo));
                    for (String name : fabInfo.getFeatures()) {
                        registerMatchingFeatures(name);
                        requireFeature(name, resource);
                    }
                    for (DependencyTree dep : fabInfo.getBundles()) {
                        File depFile = dep.getJarFile();
                        Attributes attrs = getAttributes(dep.getJarURL().toString(), depFile);
                        if (attrs.getValue(Constants.BUNDLE_SYMBOLICNAME) != null) {
                            manageResource(getMvnUrl(dep), attrs, new StreamProvider.File(depFile));
                        }
                    }
                }
            });
        } else if (location.startsWith(REQ_PROTOCOL)) {
            try {
                ResourceImpl resource = new ResourceImpl(location, "dummy", Version.emptyVersion);
                for (Requirement req : ResourceBuilder.parseRequirement(resource, location.substring(REQ_PROTOCOL.length()))) {
                    resource.addRequirement(req);
                }
                resources.put(location, resource);
            } catch (BundleException e) {
                throw new IOException("Error parsing requirement", e);
            }
View Full Code Here

  @Override
  public void update(ViewerCell cell) {
    Object element = cell.getElement();
    ContainerViewBean bean = ContainerViewBean.toContainerViewBean(element);
    if (bean != null) {
      Container container = bean.container();
      boolean managed = container.isManaged();
      String image = "yellow-dot.png";
      String status = bean.getStatus();
      Fabric8JMXPlugin.getLogger().debug(
          "Container: " + container.getId() + " alive: "
              + container.isAlive() + " managed: "
              + container.isManaged() + " pending: "
              + container.isProvisioningPending() + " complete: "
              + container.isProvisioningComplete() + " status: "
              + container.getProvisionStatus());
      if (!bean.isAlive()) {
        image = "gray-dot.png";
      }
      if (container.isProvisioningPending()) {
        // image = "pending.gif";
        image = "yellow-dot.png";
        managed = true;
      } else if (status != null) {
        String lowerStatus = status.toLowerCase();
View Full Code Here

            .getImageDescriptor("terminal_view.gif")) {
      @Override
      public void run() {
        List<Container> selectedContainers = getSelectedContainers();
        if (selectedContainers.size() > 0) {
          Container container = selectedContainers.get(0);
          if (container != null) {
            System.err.println("TODO: open terminal");
//            ContainerNode.openTerminal(getFabric(), container, null);
          }
        }
View Full Code Here

      public void run() {
        ContainersNode containersNode = fabric.getContainersNode();
        if (containersNode != null) {
          List<Container> selectedContainers = getSelectedContainers();
          if (!selectedContainers.isEmpty()) {
            Container container = selectedContainers.get(0);
            ContainerNode containerNode = containersNode.getContainerNode(container.getId());
            if (containerNode != null) {
              Selections.setSingleSelection(
                  fabric.getRefreshableUI(), containerNode);
            }
          }
View Full Code Here

    IStructuredSelection selection = getSelection();
    if (selection != null) {
      boolean changed = false;
      Iterator iterator = selection.iterator();
      while (iterator.hasNext()) {
        Container container = ContainerNode.toContainer(iterator.next());
        if (container != null) {
          containers.add(container);
        }
      }
    }
View Full Code Here

TOP

Related Classes of io.fabric8.agent.resolver.ResourceImpl

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.