Package ro.fortsoft.pf4j

Examples of ro.fortsoft.pf4j.Version


    this.runtimeManager = runtimeManager;

    this.pf4j = new DefaultPluginManager(dir);

    try {
      Version systemVersion = Version.createVersion(Constants.getVersion());
      pf4j.setSystemVersion(systemVersion);
    } catch (Exception e) {
      logger.error(null, e);
    }
  }
View Full Code Here


    if (file == null || !file.exists()) {
      logger.error("Failed to download plugin {}", url);
      return false;
    }

    Version oldVersion = pf4j.getPlugin(pluginId).getDescriptor().getVersion();
    if (removePlugin(pluginId, false)) {
      String newPluginId = pf4j.loadPlugin(file);
      if (StringUtils.isEmpty(newPluginId)) {
        logger.error("Failed to load plugin {}", file);
        return false;
View Full Code Here

      }
    }

    for (PluginWrapper pw : pf4j.getPlugins()) {
      String id = pw.getDescriptor().getPluginId();
      Version pv = pw.getDescriptor().getVersion();
      PluginRegistration reg = map.get(id);
      if (reg != null) {
        reg.installedRelease = pv.toString();
      }
    }
    return list;
  }
View Full Code Here

        show(pw);
      }
    }

    protected String buildFieldTable(PluginWrapper pw, PluginRegistration reg) {
      Version system = getContext().getGitblit().getSystemVersion();
      PluginRelease current = reg == null ? null : reg.getCurrentRelease(system);
      if (current == null) {
        current = new PluginRelease();
        current.version = "";
        current.requires = "";
View Full Code Here

        headers = h;
      } else {
        String [] h = { "Id", "Installed", "Current", "Requires", "State" };
        headers = h;
      }
      Version system = getContext().getGitblit().getSystemVersion();
      Object[][] data = new Object[list.size()][];
      for (int i = 0; i < list.size(); i++) {
        PluginRegistration p = list.get(i);
        PluginRelease curr = p.getCurrentRelease(system);
        if (curr == null) {
View Full Code Here

      stdout.println(FlipTable.of(headers, data, Borders.BODY_HCOLS));
    }

    @Override
    protected void asTabbed(List<PluginRegistration> list) {
      Version system = getContext().getGitblit().getSystemVersion();
      for (PluginRegistration p : list) {
        PluginRelease curr = p.getCurrentRelease(system);
        if (curr == null) {
          curr = new PluginRelease();
        }
View Full Code Here

            throw new UnloggedFailure(1,  String.format("Plugin \"%s\" is not in the registry!", urlOrId));
          }

          // enforce minimum system requirement
          if (!StringUtils.isEmpty(pr.requires)) {
            Version requires = Version.createVersion(pr.requires);
            Version system = gitblit.getSystemVersion();
            boolean isValid = system.isZero() || system.atLeast(requires);
            if (!isValid) {
              String msg = String.format("Plugin \"%s:%s\" requires Gitblit %s",
                  urlOrId, pr.version, pr.requires);
              throw new UnloggedFailure(1, msg);
            }
View Full Code Here

        throw new UnloggedFailure(1,  String.format("Plugin \"%s\" is not in the registry!", pluginWrapper.getPluginId()));
      }

      // enforce minimum system requirement
      if (!StringUtils.isEmpty(pr.requires)) {
        Version requires = Version.createVersion(pr.requires);
        Version system = gitblit.getSystemVersion();
        boolean isValid = system.isZero() || system.atLeast(requires);
        if (!isValid) {
          throw new Failure(1, String.format("Plugin \"%s:%s\" requires Gitblit %s",
              pluginWrapper.getPluginId(), pr.version, pr.requires));
        }
      }
View Full Code Here

    public PluginRelease getCurrentRelease(Version system) {
      PluginRelease current = null;
      Date date = new Date(0);
      for (PluginRelease pv : releases) {
        Version requires = Version.ZERO;
        if (!StringUtils.isEmpty(pv.requires)) {
          requires = Version.createVersion(pv.requires);
        }

        if (system.isZero() || system.atLeast(requires)) {
View Full Code Here

    public InstallState getInstallState(Version system) {
      if (StringUtils.isEmpty(installedRelease)) {
        return InstallState.NOT_INSTALLED;
      }
      Version ir = Version.createVersion(installedRelease);
      Version cr = Version.ZERO;
      PluginRelease curr = getCurrentRelease(system);
      if (curr != null) {
        cr = Version.createVersion(curr.version);
      }
      switch (ir.compareTo(cr)) {
View Full Code Here

TOP

Related Classes of ro.fortsoft.pf4j.Version

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.