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

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

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

Plugin.getModuleDescriptor介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.confluence.ext/newcode-macro-plugin

/**
   * Returns a module descriptor identified by key.
   *
   * @param key The key of the module descriptor
   * @return The module descriptor
   */
  protected ModuleDescriptor<?> getDescriptor(final String key) {
    return pluginAccessor.getPlugin(Constants.PLUGIN_KEY)
        .getModuleDescriptor(key);
  }
}

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

/**
 * Registers descriptors.  
 *
 * @param descriptors the module descriptors of the plugin
 * @return a representation of the descriptor registration
 */
public Registration registerDescriptors(Iterable<ModuleDescriptor<?>> descriptors) {
  final List<ServiceRegistration> registrations = newArrayList();
  for (ModuleDescriptor<?> descriptor : descriptors) {
    ModuleDescriptor<?> existingDescriptor = descriptor.getPlugin().getModuleDescriptor(descriptor.getKey());
    if (existingDescriptor != null) {
      log.error("Duplicate key '" + descriptor.getKey() + "' detected, disabling previous instance");
      ((StateAware) existingDescriptor).disabled();
    }
    log.debug("Registering descriptor {}", descriptor.getClass().getName());
    registrations.add(bundleContext.registerService(ModuleDescriptor.class.getName(), descriptor, null));
  }
  return new Registration(registrations);
}

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

final List<ServiceRegistration> registrations = newArrayList();
for (ModuleDescriptor<?> descriptor : descriptors) {
  ModuleDescriptor<?> existingDescriptor = descriptor.getPlugin().getModuleDescriptor(descriptor.getKey());
  if (existingDescriptor != null) {
    log.error("Duplicate key '" + descriptor.getKey() + "' detected, disabling previous instance");

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

private ModuleDescriptor<?> getPluginModule(final ModuleCompleteKey key) {
  final Plugin plugin = getPlugin(key.getPluginKey());
  if (plugin == null) {
    return null;
  }
  return plugin.getModuleDescriptor(key.getModuleKey());
}

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

private ModuleDescriptor<?> getPluginModule(final ModuleCompleteKey key) {
  final Plugin plugin = getPlugin(key.getPluginKey());
  if (plugin == null) {
    return null;
  }
  return plugin.getModuleDescriptor(key.getModuleKey());
}

代码示例来源:origin: com.atlassian.labs/speakeasy-plugin

public String getScreenshotUrl(String pluginKey, String user) throws UnauthorizedAccessException
{
  validateAccess(user);
  Plugin plugin = getPlugin(pluginKey);
  ModuleDescriptor<?> screenshotDescriptor = plugin.getModuleDescriptor("screenshot");
  if (screenshotDescriptor == null)
  {
    screenshotDescriptor = unknownScreenshotDescriptor;
  }
  return webResourceManager.getStaticPluginResource(screenshotDescriptor, "screenshot.png", UrlMode.ABSOLUTE);
}

代码示例来源:origin: com.atlassian.labs/speakeasy-plugin

public static void resolveDependency(Plugin plugin, Element dep, long state)
  {
    String fullKey = dep.getTextTrim();
    int pos = fullKey.indexOf(':');
    String pluginKey;
    String moduleKey;
    if (pos == -1)
    {
      moduleKey = fullKey;
      pluginKey = plugin.getKey();
    }
    else
    {
      pluginKey = fullKey.substring(0, pos);
      moduleKey = fullKey.substring(pos + 1);
    }

    ModuleDescriptor<?> descriptor = plugin.getModuleDescriptor(moduleKey);
    String depText = pluginKey + ":" + moduleKey;
    if (pluginKey.equals(plugin.getKey()) && descriptor != null && descriptor instanceof SpeakeasyWebResourceModuleDescriptor)
    {
      depText += "-" + state;
    }

    dep.setText(depText);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-gadgets-plugin

ModuleDescriptor<?> moduleDescriptor = bonfire.getModuleDescriptor("bonfire-license-service");
if (moduleDescriptor == null)

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

@Override
public ModuleDescriptor<?> getEnabledPluginModule(@Nullable final String completeKey) {
  final ModuleCompleteKey key = new ModuleCompleteKey(completeKey);
  // If it's disabled, return null
  if (!isPluginModuleEnabled(key)) {
    return null;
  }
  return getEnabledPlugin(key.getPluginKey()).getModuleDescriptor(key.getModuleKey());
}

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

public ModuleDescriptor<?> getEnabledPluginModule(final String completeKey) {
  final ModuleCompleteKey key = new ModuleCompleteKey(completeKey);
  // If it's disabled, return null
  if (!isPluginModuleEnabled(key)) {
    return null;
  }
  return getEnabledPlugin(key.getPluginKey()).getModuleDescriptor(key.getModuleKey());
}

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

private ErrorCollection invokeBonfireSetLicence() throws Exception
{
  //
  // Bonfire doesnt implement the PluginLicenseManager because this is @since 4.4 and Bonfire needs to run on 4.3.3
  // So we call directly onto its licence service with a custom written method just for JIRA (since 1.6.0 onwards)
  //
  SimpleErrorCollection errorCollection = new SimpleErrorCollection();
  Plugin plugin = pluginAccessor.getPlugin(COM_ATLASSIAN_BONFIRE_PLUGIN);
  if (plugin == null)
  {
    errorCollection.addErrorMessage("setup.bonfire.no.plugin");
  }
  else
  {
    // this doesnt throw exceptions if its not present
    pluginController.enablePlugins(COM_ATLASSIAN_BONFIRE_PLUGIN);
    ModuleDescriptor<?> moduleDescriptor = plugin.getModuleDescriptor("bonfire-license-service");
    if (moduleDescriptor == null)
    {
      errorCollection.addErrorMessage(getText("setup.bonfire.no.licence.module"));
    }
    else
    {
      Object bonfireLicenceService = moduleDescriptor.getModule();
      Method validateAndSetLicence = bonfireLicenceService.getClass().getMethod("validateAndSetLicence", ErrorCollection.class, String.class);
      validateAndSetLicence.invoke(bonfireLicenceService, errorCollection, getLicense());
    }
  }
  return errorCollection;
}

代码示例来源:origin: com.atlassian.confluence.ext/newcode-macro-plugin

ModuleDescriptor<?> moduleDescriptor = otherPlugin.getModuleDescriptor(module.getResourceKey());
if (!(moduleDescriptor instanceof WebResourceModuleDescriptor)) {
  log.error("Failed to register new code macro language " +

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

public Plugin configurePlugin(final ModuleDescriptorFactory moduleDescriptorFactory, final Plugin plugin) throws PluginParseException {
  plugin.setName(descriptorReader.getPluginName());
  plugin.setKey(getKey());
  plugin.setPluginsVersion(getPluginsVersion());
  plugin.setSystemPlugin(isSystemPlugin());
  plugin.setI18nNameKey(descriptorReader.getI18nPluginNameKey().orElseGet(plugin::getI18nNameKey));
  if (plugin.getKey().indexOf(":") > 0) {
    throw new PluginParseException("Plugin keys cannot contain ':'. Key is '" + plugin.getKey() + "'");
  }
  plugin.setEnabledByDefault(descriptorReader.isEnabledByDefault());
  plugin.setResources(descriptorReader.getResources());
  plugin.setPluginInformation(createPluginInformation());
  for (Element module : descriptorReader.getModules(plugin.getInstallationMode())) {
    final ModuleDescriptor<?> moduleDescriptor = createModuleDescriptor(plugin, module, moduleDescriptorFactory);
    // If we're not loading the module descriptor, null is returned, so we skip it
    if (moduleDescriptor == null) {
      continue;
    }
    if (plugin.getModuleDescriptor(moduleDescriptor.getKey()) != null) {
      throw new PluginParseException("Found duplicate key '" + moduleDescriptor.getKey() + "' within plugin '" + plugin.getKey() + "'");
    }
    plugin.addModuleDescriptor(moduleDescriptor);
    // If we have any unloadable modules, also create an unloadable plugin, which will make it clear that there was a problem
    if (moduleDescriptor instanceof UnloadableModuleDescriptor) {
      log.error("There were errors loading the plugin '" + plugin.getName() + "'. The plugin has been disabled.");
      return UnloadablePluginFactory.createUnloadablePlugin(plugin);
    }
  }
  return plugin;
}

代码示例来源:origin: com.atlassian.labs/speakeasy-plugin

plugin.getModuleDescriptor("modules") != null &&
plugin.getModuleDescriptor("images") != null &&
plugin.getModuleDescriptor("css") != null)

相关文章