Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roginluo
Jenkins
提交
99875244
J
Jenkins
项目概览
roginluo
/
Jenkins
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
99875244
编写于
2月 27, 2011
作者:
S
Stuart McCulloch
提交者:
Kohsuke Kawaguchi
3月 01, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
JENKINS-8897
上级
d4db356c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
52 deletion
+49
-52
core/src/main/java/hudson/ClassicPluginStrategy.java
core/src/main/java/hudson/ClassicPluginStrategy.java
+34
-0
core/src/main/java/hudson/DescriptorExtensionList.java
core/src/main/java/hudson/DescriptorExtensionList.java
+0
-5
core/src/main/java/hudson/ExtensionList.java
core/src/main/java/hudson/ExtensionList.java
+2
-46
core/src/main/java/hudson/PluginStrategy.java
core/src/main/java/hudson/PluginStrategy.java
+13
-1
未找到文件。
core/src/main/java/hudson/ClassicPluginStrategy.java
浏览文件 @
99875244
...
...
@@ -24,6 +24,7 @@
package
hudson
;
import
hudson.PluginWrapper.Dependency
;
import
hudson.model.Hudson
;
import
hudson.util.IOException2
;
import
hudson.util.MaskingClassLoader
;
import
hudson.util.VersionNumber
;
...
...
@@ -47,6 +48,7 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.jar.Manifest
;
import
java.util.jar.Attributes
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.apache.tools.ant.BuildException
;
...
...
@@ -256,6 +258,38 @@ public class ClassicPluginStrategy implements PluginStrategy {
public
void
initializeComponents
(
PluginWrapper
plugin
)
{
}
public
<
T
>
List
<
ExtensionComponent
<
T
>>
findComponents
(
Class
<
T
>
type
,
Hudson
hudson
)
{
List
<
ExtensionFinder
>
finders
;
if
(
type
==
ExtensionFinder
.
class
)
{
// Avoid infinite recursion of using ExtensionFinders to find ExtensionFinders
finders
=
Collections
.<
ExtensionFinder
>
singletonList
(
new
ExtensionFinder
.
Sezpoz
());
}
else
{
finders
=
hudson
.
getExtensionList
(
ExtensionFinder
.
class
);
}
/**
* See {@link ExtensionFinder#scout(Class, Hudson)} for the dead lock issue and what this does.
*/
if
(
LOGGER
.
isLoggable
(
Level
.
FINER
))
LOGGER
.
log
(
Level
.
FINER
,
"Scout-loading ExtensionList: "
+
type
,
new
Throwable
());
for
(
ExtensionFinder
finder
:
finders
)
{
finder
.
scout
(
type
,
hudson
);
}
List
<
ExtensionComponent
<
T
>>
r
=
new
ArrayList
<
ExtensionComponent
<
T
>>();
for
(
ExtensionFinder
finder
:
finders
)
{
try
{
r
.
addAll
(
finder
.
_find
(
type
,
hudson
));
}
catch
(
AbstractMethodError
e
)
{
// backward compatibility
for
(
T
t
:
finder
.
findExtensions
(
type
,
hudson
))
r
.
add
(
new
ExtensionComponent
<
T
>(
t
));
}
}
return
r
;
}
public
void
load
(
PluginWrapper
wrapper
)
throws
IOException
{
// override the context classloader so that XStream activity in plugin.start()
// will be able to resolve classes in this plugin
...
...
core/src/main/java/hudson/DescriptorExtensionList.java
浏览文件 @
99875244
...
...
@@ -141,11 +141,6 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
return
this
;
}
@Override
protected
void
scoutLoad
()
{
// no-op, since our load() doesn't by itself do any classloading
}
/**
* Loading the descriptors in this case means filtering the descriptor from the master {@link ExtensionList}.
*/
...
...
core/src/main/java/hudson/ExtensionList.java
浏览文件 @
99875244
...
...
@@ -23,7 +23,6 @@
*/
package
hudson
;
import
hudson.ExtensionFinder.Sezpoz
;
import
hudson.init.InitMilestone
;
import
hudson.model.Hudson
;
import
hudson.util.AdaptedIterator
;
...
...
@@ -31,6 +30,7 @@ import hudson.util.DescriptorList;
import
hudson.util.Memoizer
;
import
hudson.util.Iterators
;
import
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
;
import
hudson.PluginStrategy
;
import
java.util.AbstractList
;
import
java.util.ArrayList
;
...
...
@@ -197,22 +197,12 @@ public class ExtensionList<T> extends AbstractList<T> {
return
null
;
}
/**
* Returns {@link ExtensionFinder}s used to search for the extension instances.
*/
protected
Iterable
<?
extends
ExtensionFinder
>
finders
()
{
return
hudson
.
getExtensionList
(
ExtensionFinder
.
class
);
}
private
List
<
ExtensionComponent
<
T
>>
ensureLoaded
()
{
if
(
extensions
!=
null
)
return
extensions
;
// already loaded
if
(
Hudson
.
getInstance
().
getInitLevel
().
compareTo
(
InitMilestone
.
PLUGINS_PREPARED
)<
0
)
return
legacyInstances
;
// can't perform the auto discovery until all plugins are loaded, so just make the legacy instances visible
scoutLoad
();
synchronized
(
getLoadLock
())
{
if
(
extensions
==
null
)
{
List
<
ExtensionComponent
<
T
>>
r
=
load
();
...
...
@@ -237,17 +227,6 @@ public class ExtensionList<T> extends AbstractList<T> {
*/
private
static
final
class
Lock
{}
/**
* See {@link ExtensionFinder#scout(Class, Hudson)} for the dead lock issue and what this does.
*/
protected
void
scoutLoad
()
{
if
(
LOGGER
.
isLoggable
(
Level
.
FINER
))
LOGGER
.
log
(
Level
.
FINER
,
"Scout-loading ExtensionList: "
+
extensionType
,
new
Throwable
());
for
(
ExtensionFinder
finder
:
finders
())
{
finder
.
scout
(
extensionType
,
hudson
);
}
}
/**
* Loads all the extensions.
*/
...
...
@@ -255,17 +234,7 @@ public class ExtensionList<T> extends AbstractList<T> {
if
(
LOGGER
.
isLoggable
(
Level
.
FINE
))
LOGGER
.
log
(
Level
.
FINE
,
"Loading ExtensionList: "
+
extensionType
,
new
Throwable
());
List
<
ExtensionComponent
<
T
>>
r
=
new
ArrayList
<
ExtensionComponent
<
T
>>();
for
(
ExtensionFinder
finder
:
finders
())
{
try
{
r
.
addAll
(
finder
.
_find
(
extensionType
,
hudson
));
}
catch
(
AbstractMethodError
e
)
{
// backward compatibility
for
(
T
t
:
finder
.
findExtensions
(
extensionType
,
hudson
))
r
.
add
(
new
ExtensionComponent
<
T
>(
t
));
}
}
return
r
;
return
hudson
.
getPluginManager
().
getPluginStrategy
().
findComponents
(
extensionType
,
hudson
);
}
/**
...
...
@@ -282,19 +251,6 @@ public class ExtensionList<T> extends AbstractList<T> {
}
public
static
<
T
>
ExtensionList
<
T
>
create
(
Hudson
hudson
,
Class
<
T
>
type
)
{
if
(
type
==
ExtensionFinder
.
class
)
return
new
ExtensionList
<
T
>(
hudson
,
type
)
{
Set
<
Sezpoz
>
finders
=
Collections
.
singleton
(
new
Sezpoz
());
/**
* If this ExtensionList is searching for ExtensionFinders, calling hudson.getExtensionList
* results in infinite recursion.
*/
@Override
protected
Iterable
<?
extends
ExtensionFinder
>
finders
()
{
return
finders
;
}
};
if
(
type
.
getAnnotation
(
LegacyInstancesAreScopedToHudson
.
class
)!=
null
)
return
new
ExtensionList
<
T
>(
hudson
,
type
);
else
{
...
...
core/src/main/java/hudson/PluginStrategy.java
浏览文件 @
99875244
...
...
@@ -23,8 +23,11 @@
*/
package
hudson
;
import
hudson.model.Hudson
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
/**
* Pluggability point for how to create {@link PluginWrapper}.
...
...
@@ -63,4 +66,13 @@ public interface PluginStrategy extends ExtensionPoint {
*/
public
abstract
void
initializeComponents
(
PluginWrapper
plugin
);
}
\ No newline at end of file
/**
* Find components of the given type using the assigned strategy.
*
* @param type The component type
* @param hudson The Hudson scope
* @return Sequence of components
* @since 1.400
*/
public
abstract
<
T
>
List
<
ExtensionComponent
<
T
>>
findComponents
(
Class
<
T
>
type
,
Hudson
hudson
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录