本文整理了Java中com.atlassian.plugin.Plugin.getClassLoader()
方法的一些代码示例,展示了Plugin.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.getClassLoader()
方法的具体详情如下:
包路径:com.atlassian.plugin.Plugin
类名称:Plugin
方法名:getClassLoader
暂无
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ResourceBundle getBundle(final Locale targetLocale, final Plugin plugin, final ResourceDescriptor descriptor)
{
return ResourceBundle.getBundle(
descriptor.getLocation(), targetLocale, plugin.getClassLoader(), NO_FALLBACK_CONTROL);
}
代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module
private ChainingClassLoader getChainingClassLoader(final Plugin plugin) {
return new ChainingClassLoader(getClass().getClassLoader(), plugin.getClassLoader());
}
}
代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module
private ChainingClassLoader getChainingClassLoader(final Plugin plugin) {
return new ChainingClassLoader(getClass().getClassLoader(), plugin.getClassLoader());
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
protected ClassLoader getClassLoader()
{
return getPlugin().getClassLoader();
}
代码示例来源:origin: com.atlassian.sal/sal-refimpl-message-plugin
private ResourceBundle getBundle(String bundleName, Locale locale, Plugin plugin)
{
return resolver.getBundle(bundleName, locale, plugin.getClassLoader());
}
代码示例来源:origin: com.atlassian.fisheye/sal-fisheye-plugin
private ResourceBundle getBundle(String bundleName, Locale locale, Plugin plugin)
{
return resolver.getBundle(bundleName, locale, plugin.getClassLoader());
}
代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-sal-plugin
private ResourceBundle getBundle(String bundleName, Locale locale, Plugin plugin) {
return resolver.getBundle(bundleName, locale, plugin.getClassLoader());
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
@Override
protected URL findResource(final String name) {
final Plugin indexedPlugin;
synchronized (this) {
indexedPlugin = pluginResourceIndex.get(name);
}
final URL result;
if (isPluginEnabled(indexedPlugin)) {
result = indexedPlugin.getClassLoader().getResource(name);
} else {
result = getResourceFromPlugins(name);
}
if (log.isDebugEnabled()) {
log.debug("Find resource [ " + name + " ], found [ " + result + " ]");
}
return result;
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
private URL getResourceFromPlugins(final String name) {
final boolean isMissedResource;
synchronized (this) {
isMissedResource = missedPluginResource.contains(name);
}
if (isMissedResource) {
return null;
}
final Collection<Plugin> plugins = pluginAccessor.getEnabledPlugins();
for (final Plugin plugin : plugins) {
final URL resource = plugin.getClassLoader().getResource(name);
if (resource != null) {
synchronized (this) {
pluginResourceIndex.put(name, plugin);
}
return resource;
}
}
synchronized (this) {
missedPluginResource.add(name);
}
return null;
}
代码示例来源:origin: com.atlassian.templaterenderer/atlassian-template-renderer-velocity16-plugin
@Override
protected TemplateRenderer createRenderer(Plugin plugin) {
return new VelocityTemplateRendererImpl(plugin.getClassLoader(), plugin.getKey(),
Collections.<String, String>emptyMap(), templateContextFactory);
}
}
代码示例来源:origin: com.atlassian.templaterenderer/atlassian-template-renderer-velocity17-plugin
@Override
protected TemplateRenderer createRenderer(Plugin plugin) {
return new VelocityTemplateRendererImpl(plugin.getClassLoader(), plugin.getKey(),
Collections.<String, String>emptyMap(), templateContextFactory);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
private <T> Class<T> loadClassEvenIfNotEnabled(final String className) throws ClassNotFoundException
{
// Here we don't limit to only enabled plugins like in PluginsClassLoader
for (final Plugin plugin : pluginAccessor.getPlugins())
{
try
{
//noinspection unchecked
return (Class<T>) plugin.getClassLoader().loadClass(className);
}
catch (final ClassNotFoundException ex)
{
// continue searching the other plugins
}
catch (final RuntimeException re)
{
// Probably a ClassCastException from the wrong plugin or an IllegalStateException
// from a plugin that's in the middle of disabling
// continue searching the other plugins
}
catch (final LinkageError le)
{
// Binary incompatibility or runtime exception in a static initializer
// continue searching the other plugins
}
}
throw new ClassNotFoundException("Class '" + className + "' not found.");
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
@Override
protected Class<?> findClass(final String className) throws ClassNotFoundException {
final Plugin indexedPlugin;
synchronized (this) {
indexedPlugin = pluginClassIndex.get(className);
}
final Class<?> result;
if (isPluginEnabled(indexedPlugin)) {
result = indexedPlugin.getClassLoader().loadClass(className);
} else {
result = loadClassFromPlugins(className);
}
if (log.isDebugEnabled()) {
log.debug("Find class [ " + className + " ], found [ " + result + " ]");
}
if (result != null) {
return result;
} else {
throw new ClassNotFoundException(className);
}
}
代码示例来源:origin: com.atlassian.sal/sal-fisheye-plugin
private void addPluginResourceBundles(Plugin plugin)
{
List<ResourceBundle> bundles = new LinkedList<ResourceBundle>();
Iterable<ResourceDescriptor> descriptors = plugin.getResourceDescriptors("i18n");
for (ResourceDescriptor descriptor : descriptors)
{
try
{
bundles.add(ResourceBundle.getBundle(descriptor.getLocation(), Locale.getDefault(), plugin.getClassLoader()));
}
catch (MissingResourceException e)
{
// ignore, move on to next one
}
}
pluginResourceBundles.put(plugin.getKey(), bundles);
}
代码示例来源:origin: com.atlassian.jira/jira-core
private Object bruteForceWireInstance(String className)
{
for (final Plugin plugin : pluginAccessor.getEnabledPlugins())
{
try
{
@SuppressWarnings("unchecked")
final Class clazz = plugin.getClassLoader().loadClass(className);
if (log.isDebugEnabled())
{
log.debug("Class '" + className + "' loaded from plugin " + plugin.getKey() + " - attempting to instantiate with dependencies...");
}
Object o = newInstanceFromPlugin(clazz, plugin);
if (log.isDebugEnabled())
{
log.debug("Wired Class '" + className + "' successfully from plugin " + plugin.getKey() + " .");
}
return o;
}
catch (Exception autowireException)
{
// continue searching the other plugins
}
}
throw new RuntimeException("Class '" + className + "' is loadable from OSGi but no enabled plugins could autowire an instance.");
}
代码示例来源:origin: com.atlassian.plugin.rest/atlassian-rest-plugin-manager-plugin
public static PluginResourceResolver getResourceResolver(Plugin plugin)
{
Preconditions.checkNotNull(plugin);
if (plugin instanceof OsgiPlugin)
{
return new OsgiPluginResourceResolver((OsgiPlugin) plugin);
}
else if (plugin.getClassLoader() instanceof PluginClassLoader)
{
return new PluginClassLoaderResourceResolver(plugin);
}
else
{
return new NoOpPluginResouceResolver(plugin);
}
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
public ResourceBundle getBundle(final LanguageModuleDescriptor descriptor)
{
return ResourceBundle.getBundle(descriptor.getResourceBundleName(), descriptor.getModule().getLocale(),
descriptor.getPlugin().getClassLoader(), NO_FALLBACK_CONTROL);
}
}
代码示例来源:origin: com.atlassian.plugin.rest/atlassian-rest-plugin-manager-plugin
private URL getResourceUrl(String resourceName)
{
final URL resource = ((PluginClassLoader) plugin.getClassLoader()).getLocalResource(resourceName);
if (resource == null)
{
throw new PluginResourceNotFoundException(plugin.getKey(), resourceName);
}
return resource;
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Clear internal {@link java.util.ResourceBundle#cacheList} from plugin bundles. All plugin related bundles are
* cached in I18nHelper so keeping a copy in {@link java.util.ResourceBundle#cacheList} will only be duplication.
*/
public void cleanPluginBundlesFromResourceBundleCache()
{
if(!jiraProperties.isResourceBundleCacheCleaningDisabled())
{
final List<Plugin> enabledPlugins = Lists.newArrayList(pluginAccessor.get().getEnabledPlugins());
for (final Plugin plugin : enabledPlugins)
{
final ClassLoader pluginClassLoader = plugin.getClassLoader();
if (isPluginClassLoader(pluginClassLoader))
{
ResourceBundle.clearCache(pluginClassLoader);
}
}
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
if (!isEmpty(this.getLicensesLocation()))
ClassLoader classLoader = plugin.getClassLoader();
内容来源于网络,如有侵权,请联系作者删除!