Skip to content

Commit 066bd8d

Browse files
committed
initial commit
0 parents  commit 066bd8d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4705
-0
lines changed

.cloudbees.md

Whitespace-only changes.

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Maven build files
2+
target/
3+
4+
# Jenkins plugin development
5+
work/
6+
7+
# IntelliJ project files
8+
*.iml
9+
*.ipr
10+
*.iws
11+
.idea/
12+
13+
# Eclipse project files
14+
.settings/
15+
.classpath
16+
.project
17+
.metadata
18+
.loadpath
19+
20+
# NetBeans project files
21+
nbproject/private/
22+
build/
23+
nbbuild/
24+
dist/
25+
nbdist/
26+
nbactions.xml
27+
nb-configuration.xml

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Support Core Plugin
2+
3+
This plugin provides a common set of classes to assist in generating support bundles.
4+
5+
See also this [plugin's wiki page][wiki]
6+
7+
# Environment
8+
9+
The following build environment is required to build this plugin
10+
11+
* `java-1.6` and `maven-3.0.5`
12+
13+
# Build
14+
15+
To build the plugin locally:
16+
17+
mvn clean verify
18+
19+
# Release
20+
21+
To release the plugin:
22+
23+
mvn release:prepare release:perform -B
24+
25+
# Test local instance
26+
27+
To test in a local Jenkins instance
28+
29+
mvn hpi:run
30+
31+
[wiki]: http://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin

pom.xml

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ The MIT License
4+
~
5+
~ Copyright (c) 2013, CloudBees, Inc.
6+
~
7+
~ Permission is hereby granted, free of charge, to any person obtaining a copy
8+
~ of this software and associated documentation files (the "Software"), to deal
9+
~ in the Software without restriction, including without limitation the rights
10+
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
~ copies of the Software, and to permit persons to whom the Software is
12+
~ furnished to do so, subject to the following conditions:
13+
~
14+
~ The above copyright notice and this permission notice shall be included in
15+
~ all copies or substantial portions of the Software.
16+
~
17+
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
~ THE SOFTWARE.
24+
-->
25+
26+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
27+
<modelVersion>4.0.0</modelVersion>
28+
29+
<parent>
30+
<groupId>org.jenkins-ci.plugins</groupId>
31+
<artifactId>plugin</artifactId>
32+
<version>1.480</version>
33+
</parent>
34+
35+
<artifactId>support-core</artifactId>
36+
<version>1.0-SNAPSHOT</version>
37+
<packaging>hpi</packaging>
38+
39+
<name>Support Core Plugin</name>
40+
<description>
41+
This plugin provides a common set of classes to assist in generating support bundles.
42+
</description>
43+
<url>http://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin</url>
44+
<licenses>
45+
<license>
46+
<name>The MIT license</name>
47+
<url>http://www.opensource.org/licenses/mit-license.php</url>
48+
<distribution>repo</distribution>
49+
</license>
50+
</licenses>
51+
52+
<developers>
53+
<developer>
54+
<id>stephenconnolly</id>
55+
<name>Stephen Connolly</name>
56+
</developer>
57+
</developers>
58+
59+
<prerequisites>
60+
<maven>2.2.1</maven>
61+
</prerequisites>
62+
63+
<scm>
64+
<connection>scm:git:git://github.com/jenkinsci/support-core-plugin.git</connection>
65+
<developerConnection>scm:git:git@github.com:jenkinsci/support-core-plugin.git</developerConnection>
66+
<url>http://github.com/jenkinsci/support-core-plugin</url>
67+
<tag>HEAD</tag>
68+
</scm>
69+
70+
<properties>
71+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
72+
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
73+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
74+
<maven.findbugs.failure.strict>true</maven.findbugs.failure.strict>
75+
</properties>
76+
77+
<repositories>
78+
<repository>
79+
<id>repo.jenkins-ci.org</id>
80+
<url>http://repo.jenkins-ci.org/public/</url>
81+
</repository>
82+
</repositories>
83+
<pluginRepositories>
84+
<pluginRepository>
85+
<id>repo.jenkins-ci.org</id>
86+
<url>http://repo.jenkins-ci.org/public/</url>
87+
</pluginRepository>
88+
</pluginRepositories>
89+
90+
<dependencies>
91+
<!-- regular dependencies -->
92+
<dependency>
93+
<groupId>net.jcip</groupId>
94+
<artifactId>jcip-annotations</artifactId>
95+
<version>1.0</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>com.github.stephenc.findbugs</groupId>
99+
<artifactId>findbugs-annotations</artifactId>
100+
<version>1.3.9-1</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>com.google.code.findbugs</groupId>
104+
<artifactId>jsr305</artifactId>
105+
<version>1.3.9</version>
106+
</dependency>
107+
<!-- regular dependencies -->
108+
<dependency>
109+
<groupId>com.yammer.metrics</groupId>
110+
<artifactId>metrics-core</artifactId>
111+
<version>2.2.0</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>com.yammer.metrics</groupId>
115+
<artifactId>metrics-servlet</artifactId>
116+
<version>2.2.0</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>net.sf.uadetector</groupId>
120+
<artifactId>uadetector-resources</artifactId>
121+
<version>2013.02</version>
122+
</dependency>
123+
<dependency>
124+
<groupId>org.codehaus.mojo</groupId>
125+
<artifactId>animal-sniffer-annotations</artifactId>
126+
<version>1.9</version>
127+
</dependency>
128+
<!-- plugin dependencies -->
129+
<!-- jenkins dependencies -->
130+
<!-- test dependencies -->
131+
<dependency>
132+
<groupId>junit</groupId>
133+
<artifactId>junit</artifactId>
134+
<version>4.11</version>
135+
<scope>test</scope>
136+
</dependency>
137+
</dependencies>
138+
139+
<build>
140+
<pluginManagement>
141+
<plugins>
142+
<plugin>
143+
<artifactId>maven-enforcer-plugin</artifactId>
144+
<version>1.3.1</version>
145+
<executions>
146+
<execution>
147+
<id>enforce-maven</id>
148+
<goals>
149+
<goal>enforce</goal>
150+
</goals>
151+
<configuration>
152+
<rules>
153+
<requireMavenVersion>
154+
<version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
155+
<message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.
156+
</message>
157+
</requireMavenVersion>
158+
<requireMavenVersion>
159+
<version>(,3.0),[3.0.4,)</version>
160+
<message>Maven 3.0 through 3.0.3 inclusive do not pass correct settings.xml to Maven Release
161+
Plugin.
162+
</message>
163+
</requireMavenVersion>
164+
</rules>
165+
</configuration>
166+
</execution>
167+
</executions>
168+
</plugin>
169+
</plugins>
170+
</pluginManagement>
171+
<plugins>
172+
<plugin>
173+
<artifactId>maven-release-plugin</artifactId>
174+
<version>2.4.1</version>
175+
</plugin>
176+
<plugin>
177+
<groupId>org.codehaus.mojo</groupId>
178+
<artifactId>findbugs-maven-plugin</artifactId>
179+
<version>2.5.2</version>
180+
<configuration>
181+
<excludeFilterFile>src/findbugs/excludesFilter.xml</excludeFilterFile>
182+
<failOnError>${maven.findbugs.failure.strict}</failOnError>
183+
</configuration>
184+
<executions>
185+
<execution>
186+
<phase>verify</phase>
187+
<goals>
188+
<goal>check</goal>
189+
</goals>
190+
</execution>
191+
</executions>
192+
</plugin>
193+
</plugins>
194+
</build>
195+
196+
</project>

src/findbugs/excludesFilter.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<FindBugsFilter>
2+
<Match>
3+
<Class name="~.*\.Messages"/>
4+
</Match>
5+
</FindBugsFilter>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Copyright (c) 2013, CloudBees, Inc.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
package com.cloudbees.jenkins.support;
26+
27+
import com.yammer.metrics.core.MetricsRegistry;
28+
29+
import java.util.HashMap;
30+
import java.util.Map;
31+
32+
/**
33+
* A default metrics filter.
34+
*
35+
* @author Stephen Connolly
36+
*/
37+
public class DefaultSupportMetricsFilter extends SupportMetricsFilter {
38+
private static final String NAME_PREFIX = "responseCodes.";
39+
private static final int OK = 200;
40+
private static final int CREATED = 201;
41+
private static final int NO_CONTENT = 204;
42+
private static final int BAD_REQUEST = 400;
43+
private static final int NOT_FOUND = 404;
44+
private static final int SERVER_ERROR = 500;
45+
46+
/**
47+
* Creates a new instance of the filter.
48+
*
49+
* @param registry
50+
*/
51+
public DefaultSupportMetricsFilter(MetricsRegistry registry) {
52+
super(registry, createMeterNamesByStatusCode(), NAME_PREFIX + "other");
53+
}
54+
55+
private static Map<Integer, String> createMeterNamesByStatusCode() {
56+
final Map<Integer, String> meterNamesByStatusCode = new HashMap<Integer, String>(6);
57+
meterNamesByStatusCode.put(OK, NAME_PREFIX + "ok");
58+
meterNamesByStatusCode.put(CREATED, NAME_PREFIX + "created");
59+
meterNamesByStatusCode.put(NO_CONTENT, NAME_PREFIX + "noContent");
60+
meterNamesByStatusCode.put(BAD_REQUEST, NAME_PREFIX + "badRequest");
61+
meterNamesByStatusCode.put(NOT_FOUND, NAME_PREFIX + "notFound");
62+
meterNamesByStatusCode.put(SERVER_ERROR, NAME_PREFIX + "serverError");
63+
return meterNamesByStatusCode;
64+
}
65+
}

0 commit comments

Comments
 (0)