From 88903369c6bf7f41d5a89f3e5e0d9f906d61ebc8 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 21 Jan 2025 11:37:30 -0800 Subject: [PATCH] Inline `jenkins-stapler-support` --- bom/pom.xml | 5 --- core/pom.xml | 4 -- .../stapler/StaplerAccessibleType.java | 39 +++++++++++++++++ .../security/stapler/StaplerDispatchable.java | 39 +++++++++++++++++ .../security/stapler/StaplerFragments.java | 43 +++++++++++++++++++ .../stapler/StaplerNotDispatchable.java | 39 +++++++++++++++++ .../security/stapler/StaplerViews.java | 43 +++++++++++++++++++ 7 files changed, 203 insertions(+), 9 deletions(-) create mode 100644 core/src/main/java/jenkins/security/stapler/StaplerAccessibleType.java create mode 100644 core/src/main/java/jenkins/security/stapler/StaplerDispatchable.java create mode 100644 core/src/main/java/jenkins/security/stapler/StaplerFragments.java create mode 100644 core/src/main/java/jenkins/security/stapler/StaplerNotDispatchable.java create mode 100644 core/src/main/java/jenkins/security/stapler/StaplerViews.java diff --git a/bom/pom.xml b/bom/pom.xml index 6c6e5bed54..dd5e31464b 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -131,11 +131,6 @@ THE SOFTWARE. commons-lang 2.6 - - io.jenkins.stapler - jenkins-stapler-support - 1.1 - jakarta.servlet jakarta.servlet-api diff --git a/core/pom.xml b/core/pom.xml index 5314c25f50..2f45d021da 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -166,10 +166,6 @@ THE SOFTWARE. commons-lang commons-lang - - io.jenkins.stapler - jenkins-stapler-support - jakarta.servlet.jsp.jstl diff --git a/core/src/main/java/jenkins/security/stapler/StaplerAccessibleType.java b/core/src/main/java/jenkins/security/stapler/StaplerAccessibleType.java new file mode 100644 index 0000000000..5f20743979 --- /dev/null +++ b/core/src/main/java/jenkins/security/stapler/StaplerAccessibleType.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * + * Copyright (c) 2018, CloudBees, Inc. + * + * 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.security.stapler; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Explicitly tell Jenkins the annotated type is to be accessible by Stapler, i.e. getters and fields with this (return) type can be invoked. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface StaplerAccessibleType {} diff --git a/core/src/main/java/jenkins/security/stapler/StaplerDispatchable.java b/core/src/main/java/jenkins/security/stapler/StaplerDispatchable.java new file mode 100644 index 0000000000..aa0953a80b --- /dev/null +++ b/core/src/main/java/jenkins/security/stapler/StaplerDispatchable.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * + * Copyright (c) 2018, CloudBees, Inc. + * + * 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.security.stapler; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Explicitly tell Jenkins the annotated element is to be dispatched by Stapler, if possible. + */ +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface StaplerDispatchable {} diff --git a/core/src/main/java/jenkins/security/stapler/StaplerFragments.java b/core/src/main/java/jenkins/security/stapler/StaplerFragments.java new file mode 100644 index 0000000000..2fafe442a7 --- /dev/null +++ b/core/src/main/java/jenkins/security/stapler/StaplerFragments.java @@ -0,0 +1,43 @@ +/* + * The MIT License + * + * Copyright (c) 2019 CloudBees, Inc. + * + * 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.security.stapler; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Lists the view names that should be considered fragments and should not be directly dispatched. + * + * @since 1.1 + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface StaplerFragments { + String[] value() default {}; +} diff --git a/core/src/main/java/jenkins/security/stapler/StaplerNotDispatchable.java b/core/src/main/java/jenkins/security/stapler/StaplerNotDispatchable.java new file mode 100644 index 0000000000..dac4af5008 --- /dev/null +++ b/core/src/main/java/jenkins/security/stapler/StaplerNotDispatchable.java @@ -0,0 +1,39 @@ +/* + * The MIT License + * + * Copyright (c) 2018, CloudBees, Inc. + * + * 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.security.stapler; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Explicitly tell Jenkins the annotated element is not to be dispatched by Stapler. + */ +@Target({ElementType.FIELD, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface StaplerNotDispatchable {} diff --git a/core/src/main/java/jenkins/security/stapler/StaplerViews.java b/core/src/main/java/jenkins/security/stapler/StaplerViews.java new file mode 100644 index 0000000000..b16905b734 --- /dev/null +++ b/core/src/main/java/jenkins/security/stapler/StaplerViews.java @@ -0,0 +1,43 @@ +/* + * The MIT License + * + * Copyright (c) 2019 CloudBees, Inc. + * + * 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.security.stapler; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Lists the dispatchable views of a class. + * + * @since 1.1 + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface StaplerViews { + String[] value() default {}; +}