本文整理了Java中com.atlassian.plugin.Plugin.getPluginState()
方法的一些代码示例,展示了Plugin.getPluginState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getPluginState()
方法的具体详情如下:
包路径:com.atlassian.plugin.Plugin
类名称:Plugin
方法名:getPluginState
暂无
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
@Override
public boolean test(@Nonnull final Plugin plugin) {
return PluginState.ENABLED.equals(plugin.getPluginState()) && !pluginsBeingEnabled.contains(plugin);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean apply(Plugin input)
{
return !PluginState.ENABLED.equals(input.getPluginState());
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
@Override
public boolean isPluginEnabled(final String key) throws IllegalArgumentException {
final Plugin plugin = pluginRegistry.get(notNull("Plugin key", key));
return plugin != null && plugin.getPluginState() == PluginState.ENABLED;
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
/**
* This method checks to see if the plugin is enabled based on the state
* manager and the plugin.
*
* @param key The plugin key
* @return True if the plugin is enabled
*/
public boolean isPluginEnabled(final String key) {
final Plugin plugin = pluginRegistry.get(notNull("The plugin key must be specified", key));
return plugin != null &&
plugin.getPluginState() == PluginState.ENABLED;
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
final PluginState pluginState = plugin.getPluginState();
if (pluginState != PluginState.ENABLING) {
log.info("Plugin '{}' is now {}", plugin.getKey(), pluginState);
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
@Override
public Collection<Plugin> getEnabledPlugins() {
return getPlugins((Predicate<Plugin>) p -> PluginState.ENABLED.equals(p.getPluginState()));
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public void doUpgrade(boolean setupMode) throws Exception
{
// UPM can be enabled by setting the property string with key
// "jira.plugin.state-.com.atlassian.upm.atlassian-universal-plugin-manager-plugin" to "true".
// However, by the time the Upgrade Tasks are run, the plugin system has been started and a restart is required
// for the change to the property string to take effect.
// Therefore, we will use the PluginController to enable the UPM plugin.
Plugin plugin = pluginAccessor.getPlugin(UPM_KEY);
if (plugin != null && plugin.getPluginState() != PluginState.ENABLED)
{
pluginController.enablePlugins(UPM_KEY);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public void doUpgrade(final boolean setupMode) throws Exception
{
if (setupMode)
{
// There is no need to do this on a clean install
return;
}
Plugin plugin = pluginAccessor.getPlugin(PLUGIN_KEY);
if (plugin == null)
{
LOG.warn("The plugin '" + PLUGIN_KEY + "' does not exist.");
}
else
{
PluginState pluginState = plugin.getPluginState();
if (pluginState != PluginState.ENABLING && pluginState != PluginState.ENABLED)
{
pluginController.enablePlugins(PLUGIN_KEY);
}
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
/**
* Disable a plugin without broadcasting PluginDisabl(ing|ed) events
* <p>
* It is expected that {@link #broadcastPluginDisabling(Plugin)} will be called for the plugin before
* and {@link #broadcastPluginDisabled(Plugin)} will be called after the method call
* <p>
* Note: all plugin's modules will be disabled in this method and corresponding PluginModule* events
* will still be broadcasted
*
* @param plugin the plugin to disable
*/
private void disablePluginWithModuleEvents(final Plugin plugin) {
if (plugin.getPluginState() == PluginState.DISABLED) {
return;
}
disablePluginModules(plugin);
// This needs to happen after modules are disabled to prevent errors
plugin.disable();
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
/**
* Determines, recursively, which disabled plugins this plugin depends upon, and enables all of them at once.
* Returns the plugins that were successfully enabled, including dependencies that weren't explicitly specified.
*
* @param plugins The set of plugins to enable
* @return a collection of plugins that were actually enabled
*/
Collection<Plugin> enableAllRecursively(final Collection<Plugin> plugins) {
final Collection<Plugin> pluginsToEnable = new ArrayList<>();
final Set<String> requiredKeys = new HashSet<>();
for (final Plugin plugin : plugins) {
scanDependencies(plugin, requiredKeys);
}
for (final String key : requiredKeys) {
pluginsToEnable.add(pluginAccessor.getPlugin(key));
}
enable(pluginsToEnable);
final ImmutableList.Builder<Plugin> enabledPlugins = new ImmutableList.Builder<>();
for (final Plugin plugin : pluginsToEnable) {
if (plugin.getPluginState().equals(PluginState.ENABLED)) {
enabledPlugins.add(plugin);
}
}
return enabledPlugins.build();
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
if (PluginState.ENABLED == plugin.getPluginState()) {
log.warn("Plugin {} was early but failed to enable, but was fallback enabled in lateStartup."
+ " It likely has dependencies on plugins which are late, in which case you should fix those plugins and"
if (plugin.getPluginState() == PluginState.ENABLED) {
if (enableConfiguredPluginModules(plugin)) {
broadcastIgnoreError(new PluginEnabledEvent(plugin));
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
protected void disablePluginInternal(final String key, final boolean persistDisabledState) {
if (key == null) {
throw new IllegalArgumentException("You must specify a plugin key to disable.");
}
final Plugin plugin = pluginRegistry.get(key);
if (plugin == null) {
final Plugin delayedPlugin = findDelayedPlugin(key);
if (delayedPlugin == null) {
log.info("No plugin was found for key '{}'. Not disabling.", key);
} else {
if (persistDisabledState) {
persistentStateModifier.disable(delayedPlugin);
}
}
return;
}
// Do not disable if the plugin is already disabled
if (plugin.getPluginState() != PluginState.DISABLED) {
final DependentPlugins disabledPlugins = disablePlugins(ImmutableList.of(plugin.getKey()),
ImmutableSet.of(MANDATORY, OPTIONAL)
);
notifyPluginDisabled(plugin);
if (persistDisabledState) {
disabledPlugins.getByTypes(ImmutableSet.of(MANDATORY)).forEach(persistentStateModifier::disable);
persistentStateModifier.disable(plugin);
}
reenableDependent(ImmutableList.of(plugin), disabledPlugins, PluginState.DISABLED);
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
try {
plugin.enable();
final PluginState pluginState = plugin.getPluginState();
if (pluginState == PluginState.ENABLING) {
pluginsInEnablingState.add(plugin);
代码示例来源:origin: com.atlassian.jira/jira-core
final PluginState state = plugin.getPluginState();
final boolean isSystemPlugin = !pluginMetadataManager.isUserInstalled(plugin);
final boolean unloadablePlugin = plugin instanceof UnloadablePlugin;
代码示例来源: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
if (plugin.getPluginState() != PluginState.ENABLED) {
pluginsToEnable.add(plugin);
代码示例来源:origin: com.atlassian.support/stp
void addPluginInformation(SupportInfoBuilder pluginBuilder, Plugin plugin)
{
PluginInformation pluginInformation = plugin.getPluginInformation();
pluginBuilder.addValue(PLUGIN_KEY, plugin.getKey());
pluginBuilder.addValue(PLUGIN_VERSION, pluginInformation.getVersion());
pluginBuilder.addValue(PLUGIN_VENDOR, pluginInformation.getVendorName());
pluginBuilder.addValue(PLUGIN_STATUS, plugin.getPluginState().toString());
pluginBuilder.addValue(PLUGIN_VENDOR_URL, pluginInformation.getVendorUrl());
pluginBuilder.addValue(PLUGIN_FRAMEWORK_VERSION, String.valueOf(plugin.getPluginsVersion()));
pluginBuilder.addContext(plugin);
}
代码示例来源:origin: com.atlassian.support/stp
private void loadPluginPropertiesIntoStore(final PropertyStore pluginPropertiesStore, final Collection<Plugin> pluginsCollection)
{
for (final Plugin plugin : pluginsCollection)
{
final PluginInformation pluginInformation = plugin.getPluginInformation();
final PropertyStore pluginStore = pluginPropertiesStore.addCategory(PLUGINS_PLUGIN);
pluginStore.setValue(PLUGIN_KEY, plugin.getKey());
pluginStore.setValue(PLUGIN_NAME, plugin.getName()); // this is important for the SysInfo page
pluginStore.setValue(PLUGIN_VERSION, pluginInformation.getVersion());
pluginStore.setValue(PLUGIN_VENDOR, pluginInformation.getVendorName());
pluginStore.setValue(PLUGIN_STATUS, plugin.getPluginState().toString());
pluginStore.setValue(PLUGIN_VENDOR_URL, pluginInformation.getVendorUrl());
pluginStore.setValue(PLUGIN_FRAMEWORK_VERSION, String.valueOf(plugin.getPluginsVersion()));
pluginStore.setValue(PLUGIN_BUNDLED, plugin.isBundledPlugin() ? getText(PLUGIN_BUNDLED) : getText(PLUGIN_USER_INSTALLED));
}
}
代码示例来源:origin: com.atlassian.support/stp
private void addPluginInfo(final PropertyStore store) {
callAndLogExceptions((Callable<Void>) () -> {
Collection<Plugin> plugins = utils.getPlugins();
PluginMetadataManager pluginMetadataManager = ComponentManager.getComponent(PluginMetadataManager.class);
PropertyStore pluginProperties = store.addCategory(AbstractSupportApplicationInfo.ENABLED_PLUGINS);
for (Plugin plugin : plugins) {
PluginInformation pluginInformation = plugin.getPluginInformation();
PropertyStore pluginStore = pluginProperties.addCategory(PLUGINS_PLUGIN);
pluginStore.setValue(PLUGIN_KEY, plugin.getKey());
pluginStore.setValue(PLUGIN_NAME, plugin.getName());
pluginStore.setValue(PLUGIN_VERSION, pluginInformation.getVersion());
pluginStore.setValue(PLUGIN_VENDOR, pluginInformation.getVendorName());
pluginStore.setValue(PLUGIN_STATUS, plugin.getPluginState().toString());
pluginStore.setValue(PLUGIN_VENDOR_URL, pluginInformation.getVendorUrl());
pluginStore.setValue(PLUGIN_FRAMEWORK_VERSION, String.valueOf(plugin.getPluginsVersion()));
pluginStore.setValue(PLUGIN_USER_INSTALLED, pluginMetadataManager.isUserInstalled(plugin) ? "true" : "false");
pluginStore.setValue(PLUGIN_BUNDLED, plugin.isBundledPlugin() ? getText(PLUGIN_BUNDLED) : getText(PLUGIN_USER_INSTALLED));
}
return null;
});
}
代码示例来源:origin: com.atlassian.support/stp
pluginStore.setValue(PLUGIN_VERSION, info.getVersion());
pluginStore.setValue(PLUGIN_VENDOR, info.getVendorName());
pluginStore.setValue(PLUGIN_STATUS, plugin.getPluginState().toString());
pluginStore.setValue(PLUGIN_BUNDLED, plugin.isBundledPlugin() ? getText(PLUGIN_BUNDLED) : getText(PLUGIN_USER_INSTALLED));
内容来源于网络,如有侵权,请联系作者删除!