Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXES JENKINS-24690] Administrative monitor to show hook registering…
… problems
- Loading branch information
Showing
28 changed files
with
1,120 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ target | |
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# autogenerated resources | ||
src/main/webapp/css/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/org/jenkinsci/plugins/github/admin/GHRepoName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.jenkinsci.plugins.github.admin; | ||
|
||
import com.cloudbees.jenkins.GitHubRepositoryName; | ||
import org.kohsuke.stapler.AnnotationHandler; | ||
import org.kohsuke.stapler.InjectedParameter; | ||
import org.kohsuke.stapler.StaplerRequest; | ||
import org.slf4j.Logger; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
|
||
import static java.lang.annotation.ElementType.PARAMETER; | ||
import static java.lang.annotation.RetentionPolicy.RUNTIME; | ||
import static org.apache.commons.lang3.Validate.notNull; | ||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
/** | ||
* InjectedParameter annotation to use on WebMethod parameters. | ||
* Converts form submission to {@link GitHubRepositoryName} | ||
* | ||
* @author lanwen (Merkushev Kirill) | ||
* @see <a href=https://wiki.jenkins-ci.org/display/JENKINS/Web+Method>Web Method</a> | ||
* @since TODO | ||
*/ | ||
@Retention(RUNTIME) | ||
@Target(PARAMETER) | ||
@Documented | ||
@InjectedParameter(GHRepoName.PayloadHandler.class) | ||
public @interface GHRepoName { | ||
class PayloadHandler extends AnnotationHandler<GHRepoName> { | ||
private static final Logger LOGGER = getLogger(PayloadHandler.class); | ||
|
||
/** | ||
* @param param name of param in form and name of the argument in web-method | ||
* | ||
* @return {@link GitHubRepositoryName} extracted from request or null on any problem | ||
*/ | ||
@Override | ||
public GitHubRepositoryName parse(StaplerRequest req, GHRepoName a, Class type, String param) { | ||
String repo = notNull(req, "Why StaplerRequest is null?").getParameter(param); | ||
LOGGER.trace("Repo url in method {}", repo); | ||
return GitHubRepositoryName.create(repo); | ||
} | ||
} | ||
} |
Oops, something went wrong.