Package org.ungoverned.osgi.service.bundlerepository

Examples of org.ungoverned.osgi.service.bundlerepository.BundleRecord


        }

        boolean printed = false;
        for (int i = 0; i < m_brs.getBundleRecordCount(); i++)
        {
            BundleRecord record = m_brs.getBundleRecord(i);
            String name = (String) record.getAttribute(BundleRecord.BUNDLE_NAME);
            if (name != null)
            {
                if ((substr == null) ||
                    (name.toLowerCase().indexOf(substr) >= 0))
                {
                    if (!printed)
                    {
                        printed = true;
                        out.println("");
                    }
                    String version =
                        (String) record.getAttribute(BundleRecord.BUNDLE_VERSION);
                    if (version != null)
                    {
                        out.println(name + " (" + version + ")");
                    }
                    else
View Full Code Here


    {
      ParsedCommand pc = parseInfo(commandLine);
      for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++) {
        out.println("");

        BundleRecord record = null;

        // If there is no version, then try to retrieve by
        // name, but error if there are multiple versions.
        if (pc.getTargetVersion(i) == null) {
          BundleRecord[] records =
            m_brs.getBundleRecords(pc.getTargetName(i));

          if (records.length == 1) {
            record = records[0];
          }
        } else {
          record = m_brs.getBundleRecord(
                                         pc.getTargetName(i),
                                         new Version(pc.getTargetVersion(i)));
        }

        if (record != null) {
          record.printAttributes(out);
        } else {
          err.println("Unknown bundle or amiguous version: "
                      + pc.getTargetName(i));
        }
      }
View Full Code Here

            }

            // If update location wasn't found locally, look in repository.
            if (updateLocation == null)
            {
                BundleRecord record =
                    findBundleRecord(pc.getTargetName(i), pc.getTargetVersion(i));
                if (record != null)
                {
                    updateLocation = (String)
                        record.getAttribute(BundleRecord.BUNDLE_UPDATELOCATION);
                }
            }

            if (updateLocation != null)
            {
View Full Code Here

            // Make sure the bundle is not already installed.
            Bundle bundle = findLocalBundle(targetName, targetVersionString);
            if (bundle == null)
            {
                // Find the targets bundle record.
                BundleRecord record = findBundleRecord(targetName, targetVersionString);

                // If we found a record, try to install it.
                if (record != null)
                {
                    m_brs.deployBundle(
                        out, // Output stream.
                        err, // Error stream.
                        (String) record.getAttribute(BundleRecord.BUNDLE_UPDATELOCATION), // Update location.
                        pc.isResolve(), // Resolve dependencies.
                        command.equals(START_CMD)); // Start.
                }
                else
                {
View Full Code Here

        // Parse the command line to get all local targets to update.
        ParsedCommand pc = parseSource(commandLine);

        for (int i = 0; i < pc.getTargetCount(); i++)
        {
            BundleRecord record = findBundleRecord(
                pc.getTargetName(i), pc.getTargetVersion(i));
            if (record != null)
            {
                String srcURL = (String)
                    record.getAttribute(BundleRecord.BUNDLE_SOURCEURL);
                if (srcURL != null)
                {
                    FileUtil.downloadSource(
                        out, err, srcURL, pc.getDirectory(), pc.isExtract());
                }
View Full Code Here

        }
    }

    private BundleRecord findBundleRecord(String name, String versionString)
    {
      BundleRecord record = null;

      // If there is no version, then try to retrieve by
      // name, but error if there are multiple versions.
      if (versionString == null) {
        BundleRecord[] records =
View Full Code Here

  out.println("No   Name                Update-location");
      } else {
  out.println("No   Name");
      }
      for (int i = 0; i < brs.getBundleRecordCount(); i++) {
  BundleRecord record = brs.getBundleRecord(i);
  String name = (String) record.getAttribute(BundleRecord.BUNDLE_NAME);
  if (name != null) {
    if ((substr == null) ||
        (name.toLowerCase().indexOf(substr) >= 0))  {
      nCount++;
      String version =
        (String) record.getAttribute(BundleRecord.BUNDLE_VERSION);
      boolean bCit = true; // name.indexOf(" ") != -1;


      StringBuffer sb = new StringBuffer();
      sb.append(" ");
      sb.append(Integer.toString(i + 1));
      pad(sb, 5);
      if(bCit) {
        sb.append("\"");
      }
      if (version != null) {
        sb.append(name + ";" + version);
      } else {
        sb.append(name);
      }
      if(bCit) {
        sb.append("\"");
      }
      if(bLong) {
        sb.append(" ");
        pad(sb, 25);
        sb.append(record.getAttribute(BundleRecord.BUNDLE_UPDATELOCATION));
      }
      out.println(sb.toString());
    }
  }
      }
View Full Code Here

  public int cmdInfo(Dictionary opts, Reader in, PrintWriter outPW, Session session) {
    String[] infos = (String[])opts.get("name;version");

    ParsedCommand pc = parseInfo(infos);
    for (int i = 0; (pc != null) && (i < pc.getTargetCount()); i++) {
      BundleRecord record = null;

      // If there is no version, then try to retrieve by
      // name, but error if there are multiple versions.
      if (pc.getTargetVersion(i) == null) {
        BundleRecord[] records =
          brs.getBundleRecords(pc.getTargetName(i));

        if (records.length == 1) {
          record = records[0];
        } else {

        }
      } else {
        record =
          brs.getBundleRecord(pc.getTargetName(i),
                              new Version(pc.getTargetVersion(i)));
      }

      if (record != null) {
        PrintStream outStream = new PrintWriterStream(outPW);

        record.printAttributes(outStream);
      } else {
        outPW.println("Unknown bundle or ambiguous version: "
                      + pc.getTargetName(i));

        for (int j = 0; j < brs.getBundleRecordCount(); j++) {
          BundleRecord r2 = brs.getBundleRecord(j);
          String name    = (String) r2.getAttribute(BundleRecord.BUNDLE_NAME);
          String version = (String) r2.getAttribute(BundleRecord.BUNDLE_VERSION);
          if(name.equals(pc.getTargetName(i))) {
            outPW.println(" \"" + name + ";" + version + "\"");
          }
        }
      }
View Full Code Here

    bundle.getHeaders().get(Constants.BUNDLE_UPDATELOCATION);
      }

      // If update location wasn't found locally, look in repository.
      if (updateLocation == null) {
  BundleRecord record =
    findBundleRecord(pc.getTargetName(i), pc.getTargetVersion(i));
  if (record != null) {
    updateLocation = (String)
      record.getAttribute(BundleRecord.BUNDLE_UPDATELOCATION);
  }
      }

      if (updateLocation != null) {
  PrintStream outStream = new PrintWriterStream(outPW);
View Full Code Here

  // Make sure the bundle is not already installed.
  Bundle bundle = findLocalBundle(targetName, targetVersionString);
  if (bundle == null) {
    // Find the targets bundle record.
    BundleRecord record = findBundleRecord(targetName, targetVersionString);

    // If we found a record, try to install it.
    if (record != null) {
      PrintStream outStream = new PrintWriterStream(outPW);

      brs.deployBundle(
             outStream, // Output stream.
             outStream, // Error stream.
             (String) record.getAttribute(BundleRecord.BUNDLE_UPDATELOCATION), // Update location.
             bResolve, // Resolve dependencies.
             bStart);
    } else {
      outPW.println("Not in repository: " + targetName);
      return 1;
View Full Code Here

TOP

Related Classes of org.ungoverned.osgi.service.bundlerepository.BundleRecord

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.