com.atlassian.plugin.Plugin.isUninstallable()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中com.atlassian.plugin.Plugin.isUninstallable()方法的一些代码示例,展示了Plugin.isUninstallable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.isUninstallable()方法的具体详情如下:
包路径:com.atlassian.plugin.Plugin
类名称:Plugin
方法名:isUninstallable

Plugin.isUninstallable介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

private void removePluginFromLoader(final Plugin plugin) throws PluginException {
  if (plugin.isUninstallable()) {
    final PluginLoader pluginLoader = installedPluginsToPluginLoader.get(plugin);
    pluginLoader.removePlugin(plugin);
  }
  installedPluginsToPluginLoader.remove(plugin);
}

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

/**
 * Called during plugin framework shutdown
 *
 * @param event The shutdown event
 */
@PluginEventListener
public void onShutdown(final PluginFrameworkShutdownEvent event) {
  for (final Iterator<Plugin> it = plugins.values().iterator(); it.hasNext(); ) {
    final Plugin plugin = it.next();
    if (plugin.isUninstallable()) {
      plugin.uninstall();
    }
    it.remove();
  }
  scanner.reset();
}

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

private PluginLoader ensurePluginAndLoaderSupportsUninstall(final Plugin plugin) {
  if (!plugin.isUninstallable()) {
    throw new PluginException("Plugin is not uninstallable: " + plugin);
  }
  final PluginLoader loader = installedPluginsToPluginLoader.get(plugin);
  if ((loader != null) && !loader.supportsRemoval()) {
    throw new PluginException("Not uninstalling plugin - loader doesn't allow removal. Plugin: " + plugin);
  }
  return loader;
}

代码示例来源:origin: com.atlassian.plugins/atlassian-connect-core

private void removeOldPlugin(String pluginKey) throws ConnectAddonInstallException {
  final Plugin plugin = pluginAccessor.getPlugin(pluginKey);
  /*!
  With the app key validated for the user, the previous app with that key,
  if any, is uninstalled.
  */
  if (plugin != null) {
    if (plugin.isUninstallable() && !vertigoState.isVertigoInstance()) {
      pluginController.uninstall(plugin);
    } else {
      throw new ConnectAddonInstallException(String.format("Addon-key cannot match key of system plugin: %s", pluginKey));
    }
  } else if (connectAddonManager.hasDescriptor(pluginKey)) {
    connectAddonManager.uninstallConnectAddonQuietly(pluginKey, emptyList(), true);
  }
}

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

/**
 * @param plugin - the plugin to remove
 * @throws com.atlassian.plugin.PluginException representing the reason for failure.
 */
public void removePlugin(final Plugin plugin) throws PluginException {
  if (plugin.getPluginState() == PluginState.ENABLED) {
    throw new PluginException("Cannot remove enabled plugin '" + plugin.getKey() + '"');
  }
  if (!plugin.isUninstallable()) {
    throw new PluginException("Cannot remove uninstallable plugin '" + plugin.getKey() + '"');
  }
  final DeploymentUnit deploymentUnit = findMatchingDeploymentUnit(plugin);
  plugin.uninstall();
  if (plugin.isDeleteable()) {
    // If this throws (which it does if the file exists, it's directory is writable, and yet deletion fails),
    // we will leak resources. However, this is not unique to this code, and i'm loathe to change the exception
    // behaviour here in case there are ramifications in UPM. If this is getting restructured in 4.0 we can
    // hopefully revisit when we've got a backward compatibility break point.
    deleteDeploymentUnit(deploymentUnit);
  }
  plugins.remove(deploymentUnit);
  log.info("Removed plugin '" + plugin.getKey() + "'");
}

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

newPlugin.setKey(oldPlugin.getKey());
newPlugin.setI18nNameKey(oldPlugin.getI18nNameKey());
newPlugin.setUninstallable(oldPlugin.isUninstallable());
newPlugin.setDeletable(oldPlugin.isDeleteable());
newPlugin.setPluginsVersion(oldPlugin.getPluginsVersion());

相关文章