Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roginluo
Jenkins
提交
c9688c34
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,发现更多精彩内容 >>
提交
c9688c34
编写于
8月 06, 2011
作者:
O
Olivier Lamy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change package import due to moove of config provider classes to a separate repo
上级
21a1dafb
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
11 addition
and
462 deletion
+11
-462
core/src/main/java/jenkins/configprovider/AbstractConfigProvider.java
...n/java/jenkins/configprovider/AbstractConfigProvider.java
+0
-124
core/src/main/java/jenkins/configprovider/ConfigProvider.java
.../src/main/java/jenkins/configprovider/ConfigProvider.java
+0
-127
core/src/main/java/jenkins/configprovider/model/Config.java
core/src/main/java/jenkins/configprovider/model/Config.java
+0
-61
core/src/main/java/jenkins/configprovider/model/ConfigDescription.java
.../java/jenkins/configprovider/model/ConfigDescription.java
+0
-53
core/src/main/java/jenkins/configprovider/model/ContentType.java
...c/main/java/jenkins/configprovider/model/ContentType.java
+0
-92
maven-plugin/pom.xml
maven-plugin/pom.xml
+7
-1
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
+2
-2
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
...lugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
+2
-2
未找到文件。
core/src/main/java/jenkins/configprovider/AbstractConfigProvider.java
已删除
100644 → 0
浏览文件 @
21a1dafb
/*
The MIT License
Copyright (c) 2011, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package
jenkins.configprovider
;
import
hudson.BulkChange
;
import
hudson.XmlFile
;
import
hudson.model.Saveable
;
import
hudson.model.listeners.SaveableListener
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
import
jenkins.configprovider.model.Config
;
import
jenkins.configprovider.model.ConfigDescription
;
import
jenkins.model.Jenkins
;
public
abstract
class
AbstractConfigProvider
extends
ConfigProvider
implements
Saveable
{
protected
final
String
ID_PREFIX
=
this
.
getClass
().
getSimpleName
()
+
"."
;
protected
Map
<
String
,
Config
>
configs
=
new
HashMap
<
String
,
Config
>();
public
AbstractConfigProvider
()
{
load
();
}
@Override
public
Collection
<
Config
>
getAllConfigs
()
{
return
Collections
.
unmodifiableCollection
(
configs
.
values
());
}
@Override
public
Config
getConfigById
(
String
configId
)
{
return
configs
.
get
(
configId
);
}
@Override
public
abstract
ConfigDescription
getConfigDescription
();
@Override
public
String
getProviderId
()
{
return
ID_PREFIX
;
}
@Override
public
boolean
isResponsibleFor
(
String
configId
)
{
return
configId
!=
null
&&
configId
.
startsWith
(
ID_PREFIX
);
}
@Override
public
Config
newConfig
()
{
String
id
=
this
.
getProviderId
()
+
System
.
currentTimeMillis
();
return
new
Config
(
id
,
null
,
null
,
null
);
}
@Override
public
void
remove
(
String
configId
)
{
configs
.
remove
(
configId
);
this
.
save
();
}
@Override
public
void
save
(
Config
config
)
{
configs
.
put
(
config
.
id
,
config
);
this
.
save
();
}
/**
* @see hudson.model.Saveable#save()
*/
public
void
save
()
{
if
(
BulkChange
.
contains
(
this
))
return
;
try
{
getConfigXml
().
write
(
this
);
SaveableListener
.
fireOnChange
(
this
,
getConfigXml
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
protected
void
load
()
{
XmlFile
xml
=
getConfigXml
();
if
(
xml
.
exists
())
{
try
{
xml
.
unmarshal
(
this
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
protected
XmlFile
getConfigXml
()
{
return
new
XmlFile
(
Jenkins
.
XSTREAM
,
new
File
(
Jenkins
.
getInstance
().
getRootDir
(),
this
.
getXmlFileName
()));
}
protected
abstract
String
getXmlFileName
();
}
core/src/main/java/jenkins/configprovider/ConfigProvider.java
已删除
100644 → 0
浏览文件 @
21a1dafb
/*
The MIT License
Copyright (c) 2011, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package
jenkins.configprovider
;
import
hudson.ExtensionList
;
import
hudson.ExtensionPoint
;
import
java.util.Collection
;
import
jenkins.configprovider.model.Config
;
import
jenkins.configprovider.model.ConfigDescription
;
import
jenkins.configprovider.model.ContentType
;
import
jenkins.model.Jenkins
;
/**
* A ConfigProvider is able to manage different configuration files (see:
* {@link Config})
*
* @author domi
*
*/
public
abstract
class
ConfigProvider
implements
ExtensionPoint
{
/**
* All registered {@link ConfigProvider}s.
*/
public
static
ExtensionList
<
ConfigProvider
>
all
()
{
return
Jenkins
.
getInstance
().
getExtensionList
(
ConfigProvider
.
class
);
}
/**
* returns all the configs of this provider
*
* @return collection of Configs
*/
public
abstract
Collection
<
Config
>
getAllConfigs
();
/**
* The description of the config this provider is able to provide instances
* of
*
* @return the description
*/
public
abstract
ConfigDescription
getConfigDescription
();
/**
* The content type of the configs this provider manages. e.g. can be used
* to display the content in the UI (editor).
*
* @return the type. <code>null</code> if no specific formating should be
* supported.
*/
public
abstract
ContentType
getContentType
();
/**
* Returns the config item identified by this id.
*
* @param configId
* the id
* @return the config with the given id
*/
public
abstract
Config
getConfigById
(
String
configId
);
/**
* Whether this provider is responsible for a Config with the given Id.
*
* @param configId
* the id to check
* @return <code>true</code> if the provider takes responsibility
*/
public
abstract
boolean
isResponsibleFor
(
String
configId
);
/**
* save the content of the given config.
*
* @param config
* the config to be saved
*/
public
abstract
void
save
(
Config
config
);
/**
* Removes/deletes the config with the given Id
*
* @param configId
* the id
*/
public
abstract
void
remove
(
String
configId
);
/**
* An ID uniquely identifying this provider, the id of each {@link Config}
* must start with this ID separated by a '.'!
*
* @return the unique id for this provider.
*/
public
abstract
String
getProviderId
();
/**
* Returns a new {@link Config} object with a unique id, starting with the
* id of this provider - separated by '.'. e.g. "MyCustomProvider.123456".
* This object is also used initialize the user interface.
*
* @return the new config object, ready for editing.
*/
public
abstract
Config
newConfig
();
}
core/src/main/java/jenkins/configprovider/model/Config.java
已删除
100644 → 0
浏览文件 @
21a1dafb
/*
The MIT License
Copyright (c) 2011, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package
jenkins.configprovider.model
;
import
jenkins.configprovider.ConfigProvider
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
java.io.Serializable
;
/**
* Represents a configuration file. A Config object is always managed by one
* specific {@link ConfigProvider}
*
* @author domi
*
*/
public
class
Config
implements
Serializable
{
/**
* a unique id along all providers!
*/
public
final
String
id
;
public
final
String
name
;
public
final
String
comment
;
public
final
String
content
;
@DataBoundConstructor
public
Config
(
String
id
,
String
name
,
String
comment
,
String
content
)
{
this
.
id
=
id
==
null
?
String
.
valueOf
(
System
.
currentTimeMillis
())
:
id
;
this
.
name
=
name
;
this
.
comment
=
comment
;
this
.
content
=
content
;
}
@Override
public
String
toString
()
{
return
"[Config: id="
+
id
+
", name="
+
name
+
"]"
;
}
}
core/src/main/java/jenkins/configprovider/model/ConfigDescription.java
已删除
100644 → 0
浏览文件 @
21a1dafb
/*
The MIT License
Copyright (c) 2011, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package
jenkins.configprovider.model
;
import
jenkins.configprovider.ConfigProvider
;
/**
* Describes the {@link Config} a {@link ConfigProvider} is able to handle. This
* information can be used for display in the UI.
*
* @author domi
*
*/
public
class
ConfigDescription
{
private
final
String
name
;
private
final
String
description
;
public
ConfigDescription
(
String
name
,
String
description
)
{
this
.
name
=
name
;
this
.
description
=
description
;
}
public
String
getName
()
{
return
name
;
}
public
String
getDescription
()
{
return
description
;
}
}
core/src/main/java/jenkins/configprovider/model/ContentType.java
已删除
100644 → 0
浏览文件 @
21a1dafb
/*
The MIT License
Copyright (c) 2011, Dominik Bartholdi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package
jenkins.configprovider.model
;
/**
* Describes the content of a {@link Config} in a more technical way. In fact it
* provides information to determine how the content should be rendered in a
* editor (e.g. CodeMirror).
*
* @author domi
*
*/
public
interface
ContentType
{
/**
* The CodeMirror mode as defined in Stapler (
* <code>org.kohsuke.stapler.codemirror.mode.*</code>). <br>
* Currently Supported:
* <ul>
* <li>clike</li>
* <li>css</li>
* <li>diff</li>
* <li>haskell</li>
* <li>htmlmixed</li>
* <li>javascript</li>
* <li>lua</li>
* <li>php</li>
* <li>plsql</li>
* <li>python</li>
* <li>rst</li>
* <li>smaltalk</li>
* <li>stex</li>
* <li>xml</li>
* </ul>
* e.g. used in
* <code><textarea name="config.content" codemirror-mode="${contentType.cmMode}" ... /></code>
*
* @return the CodeMirror mode
*/
public
String
getCmMode
();
/**
* Actually the 'mode' attribute for the CodeMirror editor. As in:
* <code><textarea name="config.content" codemirror-config="mode:'${contentType.mime}',lineNumbers: true" ... /></code>
*
* @return the mime.
*/
public
String
getMime
();
public
enum
DefinedType
implements
ContentType
{
XML
(
"xml"
,
"application/xml"
),
HTML
(
"htmlmixed"
,
"text/html"
),
GROOVY
(
"clike"
,
"text/x-groovy"
);
public
final
String
cmMode
;
public
final
String
mime
;
private
DefinedType
(
String
cmMode
,
String
mime
)
{
this
.
cmMode
=
cmMode
;
this
.
mime
=
mime
;
}
public
String
getCmMode
()
{
return
cmMode
;
}
public
String
getMime
()
{
return
mime
;
}
}
}
maven-plugin/pom.xml
浏览文件 @
c9688c34
...
...
@@ -119,7 +119,13 @@ THE SOFTWARE.
<groupId>
org.jenkins-ci.main.maven
</groupId>
<artifactId>
maven3-interceptor
</artifactId>
<version>
${mavenInterceptorsVersion}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.jenkins-ci.lib
</groupId>
<artifactId>
config-provider-model
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.apache.ant
</groupId>
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
浏览文件 @
c9688c34
...
...
@@ -42,8 +42,6 @@ import hudson.model.Descriptor;
import
hudson.model.Descriptor.FormException
;
import
hudson.model.Executor
;
import
hudson.model.TaskListener
;
import
jenkins.configprovider.ConfigProvider
;
import
jenkins.configprovider.model.Config
;
import
jenkins.model.Jenkins
;
import
hudson.model.Item
;
import
hudson.model.ItemGroup
;
...
...
@@ -92,6 +90,8 @@ import net.sf.json.JSONObject;
import
org.apache.commons.lang.math.NumberUtils
;
import
org.apache.maven.model.building.ModelBuildingRequest
;
import
org.jenkinsci.lib.configprovider.ConfigProvider
;
import
org.jenkinsci.lib.configprovider.model.Config
;
import
org.kohsuke.stapler.HttpResponse
;
import
org.kohsuke.stapler.HttpResponses
;
import
org.kohsuke.stapler.QueryParameter
;
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSetBuild.java
浏览文件 @
c9688c34
...
...
@@ -47,8 +47,6 @@ import hudson.model.Computer;
import
hudson.model.Environment
;
import
hudson.model.Executor
;
import
hudson.model.Fingerprint
;
import
jenkins.configprovider.ConfigProvider
;
import
jenkins.configprovider.model.Config
;
import
jenkins.model.Jenkins
;
import
hudson.model.ParameterDefinition
;
import
hudson.model.ParametersAction
;
...
...
@@ -101,6 +99,8 @@ import org.apache.maven.monitor.event.EventDispatcher;
import
org.apache.maven.project.MavenProject
;
import
org.apache.maven.project.ProjectBuildingException
;
import
org.codehaus.plexus.util.PathTool
;
import
org.jenkinsci.lib.configprovider.ConfigProvider
;
import
org.jenkinsci.lib.configprovider.model.Config
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
import
org.kohsuke.stapler.export.Exported
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录