mirror of
https://github.com/Eaglercraft-Archive/Eaglercraftx-1.8.8-src.git
synced 2025-06-27 18:38:14 -05:00
Update #0 - First Release
This commit is contained in:
23
sources/main/java/javax/annotation/CheckForNull.java
Normal file
23
sources/main/java/javax/annotation/CheckForNull.java
Normal file
@ -0,0 +1,23 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* The annotated element might be null, and uses of the element should check for
|
||||
* null.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnull(when = When.MAYBE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CheckForNull {
|
||||
|
||||
}
|
22
sources/main/java/javax/annotation/CheckForSigned.java
Normal file
22
sources/main/java/javax/annotation/CheckForSigned.java
Normal file
@ -0,0 +1,22 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* Used to annotate a value that may be either negative or nonnegative, and
|
||||
* indicates that uses of it should check for negative values before using it in
|
||||
* a way that requires the value to be nonnegative, and check for it being
|
||||
* nonnegative before using it in a way that requires it to be negative.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnegative(when = When.MAYBE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CheckForSigned {
|
||||
|
||||
}
|
20
sources/main/java/javax/annotation/CheckReturnValue.java
Normal file
20
sources/main/java/javax/annotation/CheckReturnValue.java
Normal file
@ -0,0 +1,20 @@
|
||||
package javax.annotation;
|
||||
|
||||
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;
|
||||
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation is used to denote a method whose return value should always
|
||||
* be checked after invoking the method.
|
||||
*/
|
||||
@Documented
|
||||
@Target({ ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE, ElementType.PACKAGE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CheckReturnValue {
|
||||
When when() default When.ALWAYS;
|
||||
}
|
16
sources/main/java/javax/annotation/Detainted.java
Normal file
16
sources/main/java/javax/annotation/Detainted.java
Normal file
@ -0,0 +1,16 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Untainted(when = When.ALWAYS)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Detainted {
|
||||
|
||||
}
|
103
sources/main/java/javax/annotation/Generated.java
Normal file
103
sources/main/java/javax/annotation/Generated.java
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
|
||||
import static java.lang.annotation.ElementType.CONSTRUCTOR;
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.PACKAGE;
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>Generated</code> annotation is used to mark source code that has
|
||||
* been generated. It can also be used to differentiate user written code from
|
||||
* generated code in a single file.
|
||||
* <p>
|
||||
* The <code>value</code> element must have the name of the code generator. The
|
||||
* recommended convention is to use the fully qualified name of the code
|
||||
* generator in the value field, for example
|
||||
* <code>com.company.package.classname</code>.
|
||||
* </p>
|
||||
* <p>
|
||||
* The <code>date</code> element is used to indicate the date the source was
|
||||
* generated. The <code>date</code> element must follow the ISO 8601 standard.
|
||||
* For example, the <code>date</code> element could have the value
|
||||
* <code>2001-07-04T12:08:56.235-0700</code>, which represents 2001-07-04
|
||||
* 12:08:56 local time in the U.S. Pacific time zone.
|
||||
* </p>
|
||||
* <p>
|
||||
* The <code>comment</code> element is a place holder for any comments that the
|
||||
* code generator may want to include in the generated code.
|
||||
* </p>
|
||||
*
|
||||
* @since 1.6, Common Annotations 1.0
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(SOURCE)
|
||||
@Target({ PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, PARAMETER })
|
||||
public @interface Generated {
|
||||
/**
|
||||
* The value element must have the name of the code generator. The recommended
|
||||
* convention is to use the fully qualified name of the code generator. For
|
||||
* example: <code>com.acme.generator.CodeGen</code>.
|
||||
*/
|
||||
String[] value();
|
||||
|
||||
/**
|
||||
* Date when the source was generated.
|
||||
*/
|
||||
String date() default "";
|
||||
|
||||
/**
|
||||
* A place holder for any comments that the code generator may want to include
|
||||
* in the generated code.
|
||||
*/
|
||||
String comments() default "";
|
||||
}
|
75
sources/main/java/javax/annotation/ManagedBean.java
Normal file
75
sources/main/java/javax/annotation/ManagedBean.java
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2009-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>ManagedBean</code> annotation marks a POJO (Plain Old Java Object)
|
||||
* as a ManagedBean. A ManagedBean supports a small set of basic services such
|
||||
* as resource injection, lifecycle callbacks and interceptors.
|
||||
*
|
||||
* @since Common Annotations 1.1
|
||||
*/
|
||||
@Target(TYPE)
|
||||
@Retention(RUNTIME)
|
||||
public @interface ManagedBean {
|
||||
/**
|
||||
* The name of the Managed Bean. Managed Bean names must be unique within a Java
|
||||
* EE module. For each named Managed Bean, Java EE containers must make
|
||||
* available the following entries in JNDI, using the same naming scheme used
|
||||
* for EJB components.
|
||||
* <p>
|
||||
* In the application namespace:
|
||||
* <p>
|
||||
* java:app/<module-name>/<bean-name>
|
||||
* <p>
|
||||
* In the module namespace of the module containing the Managed Bean:
|
||||
* <p>
|
||||
* java:module/<bean-name>
|
||||
*
|
||||
*/
|
||||
public String value() default "";
|
||||
}
|
37
sources/main/java/javax/annotation/MatchesPattern.java
Normal file
37
sources/main/java/javax/annotation/MatchesPattern.java
Normal file
@ -0,0 +1,37 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.TypeQualifierValidator;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation is used to denote String values that should always match
|
||||
* given pattern.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifier(applicableTo = String.class)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MatchesPattern {
|
||||
@RegEx
|
||||
String value();
|
||||
|
||||
int flags() default 0;
|
||||
|
||||
static class Checker implements TypeQualifierValidator<MatchesPattern> {
|
||||
public When forConstantValue(MatchesPattern annotation, Object value) {
|
||||
Pattern p = Pattern.compile(annotation.value(), annotation.flags());
|
||||
if (p.matcher(((String) value)).matches())
|
||||
return When.ALWAYS;
|
||||
return When.NEVER;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
47
sources/main/java/javax/annotation/Nonnegative.java
Normal file
47
sources/main/java/javax/annotation/Nonnegative.java
Normal file
@ -0,0 +1,47 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.TypeQualifierValidator;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation is used to annotate a value that should only contain
|
||||
* nonnegative values.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifier(applicableTo = Number.class)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Nonnegative {
|
||||
When when() default When.ALWAYS;
|
||||
|
||||
class Checker implements TypeQualifierValidator<Nonnegative> {
|
||||
|
||||
public When forConstantValue(Nonnegative annotation, Object v) {
|
||||
if (!(v instanceof Number))
|
||||
return When.NEVER;
|
||||
boolean isNegative;
|
||||
Number value = (Number) v;
|
||||
if (value instanceof Long)
|
||||
isNegative = value.longValue() < 0;
|
||||
else if (value instanceof Double)
|
||||
isNegative = value.doubleValue() < 0;
|
||||
else if (value instanceof Float)
|
||||
isNegative = value.floatValue() < 0;
|
||||
else
|
||||
isNegative = value.intValue() < 0;
|
||||
|
||||
if (isNegative)
|
||||
return When.NEVER;
|
||||
else
|
||||
return When.ALWAYS;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
33
sources/main/java/javax/annotation/Nonnull.java
Normal file
33
sources/main/java/javax/annotation/Nonnull.java
Normal file
@ -0,0 +1,33 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.TypeQualifierValidator;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* The annotated element must not be null.
|
||||
* <p>
|
||||
* Annotated fields must not be null after construction has completed.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifier
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Nonnull {
|
||||
When when() default When.ALWAYS;
|
||||
|
||||
class Checker implements TypeQualifierValidator<Nonnull> {
|
||||
|
||||
public When forConstantValue(Nonnull qualifierArgument, Object value) {
|
||||
if (value == null)
|
||||
return When.NEVER;
|
||||
return When.ALWAYS;
|
||||
}
|
||||
}
|
||||
}
|
32
sources/main/java/javax/annotation/Nullable.java
Normal file
32
sources/main/java/javax/annotation/Nullable.java
Normal file
@ -0,0 +1,32 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* The annotated element could be null under some circumstances.
|
||||
* <p>
|
||||
* In general, this means developers will have to read the documentation to
|
||||
* determine when a null value is acceptable and whether it is necessary to
|
||||
* check for a null value.
|
||||
* <p>
|
||||
* This annotation is useful mostly for overriding a {@link Nonnull} annotation.
|
||||
* Static analysis tools should generally treat the annotated items as though
|
||||
* they had no annotation, unless they are configured to minimize false
|
||||
* negatives. Use {@link CheckForNull} to indicate that the element value should
|
||||
* always be checked for a null value.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnull(when = When.UNKNOWN)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Nullable {
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package javax.annotation;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* When this annotation is applied to a method, it indicates that if this method
|
||||
* is overridden in a subclass, the overriding method should invoke this method
|
||||
* (through method invocation on super).
|
||||
* <p>
|
||||
* An example of such method is {@link Object#finalize()}.
|
||||
*/
|
||||
@Documented
|
||||
@Target({ ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OverridingMethodsMustInvokeSuper {
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierDefault;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to a package, class or method to indicate that
|
||||
* the method parameters in that element are nonnull by default unless there is:
|
||||
* <ul>
|
||||
* <li>An explicit nullness annotation
|
||||
* <li>The method overrides a method in a superclass (in which case the
|
||||
* annotation of the corresponding parameter in the superclass applies)
|
||||
* <li>There is a default parameter annotation (like
|
||||
* {@link ParametersAreNullableByDefault}) applied to a more tightly nested
|
||||
* element.
|
||||
* </ul>
|
||||
*
|
||||
* @see Nonnull
|
||||
*/
|
||||
@Documented
|
||||
@Nonnull
|
||||
@TypeQualifierDefault(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ParametersAreNonnullByDefault {
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierDefault;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to a package, class or method to indicate that
|
||||
* the method parameters in that element are nullable by default unless there
|
||||
* is:
|
||||
* <ul>
|
||||
* <li>An explicit nullness annotation
|
||||
* <li>The method overrides a method in a superclass (in which case the
|
||||
* annotation of the corresponding parameter in the superclass applies)
|
||||
* <li>There is a default parameter annotation applied to a more tightly nested
|
||||
* element.
|
||||
* </ul>
|
||||
* <p>
|
||||
* This annotation implies the same "nullness" as no annotation. However, it is
|
||||
* different than having no annotation, as it is inherited and it can override a
|
||||
* {@link ParametersAreNonnullByDefault} annotation at an outer scope.
|
||||
*
|
||||
* @see Nullable
|
||||
*/
|
||||
@Documented
|
||||
@Nullable
|
||||
@TypeQualifierDefault(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ParametersAreNullableByDefault {
|
||||
}
|
97
sources/main/java/javax/annotation/PostConstruct.java
Normal file
97
sources/main/java/javax/annotation/PostConstruct.java
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>PostConstruct</code> annotation is used on a method that needs to
|
||||
* be executed after dependency injection is done to perform any initialization.
|
||||
* This method must be invoked before the class is put into service. This
|
||||
* annotation must be supported on all classes that support dependency
|
||||
* injection. The method annotated with <code>PostConstruct</code> must be
|
||||
* invoked even if the class does not request any resources to be injected. Only
|
||||
* one method in a given class can be annotated with this annotation. The method
|
||||
* on which the <code>PostConstruct</code> annotation is applied must fulfill
|
||||
* all of the following criteria:
|
||||
* <ul>
|
||||
* <li>The method must not have any parameters except in the case of
|
||||
* interceptors in which case it takes an <code>InvocationContext</code> object
|
||||
* as defined by the Interceptors specification.</li>
|
||||
* <li>The method defined on an interceptor class or superclass of an
|
||||
* interceptor class must have one of the following signatures:
|
||||
* <p>
|
||||
* void <METHOD>(InvocationContext)
|
||||
* <p>
|
||||
* Object <METHOD>(InvocationContext) throws Exception
|
||||
* <p>
|
||||
* <i>Note: A PostConstruct interceptor method must not throw application
|
||||
* exceptions, but it may be declared to throw checked exceptions including the
|
||||
* java.lang.Exception if the same interceptor method interposes on business or
|
||||
* timeout methods in addition to lifecycle events. If a PostConstruct
|
||||
* interceptor method returns a value, it is ignored by the container.</i></li>
|
||||
* <li>The method defined on a non-interceptor class must have the following
|
||||
* signature:
|
||||
* <p>
|
||||
* void <METHOD>()</li>
|
||||
* <li>The method on which the <code>PostConstruct</code> annotation is applied
|
||||
* may be public, protected, package private or private.</li>
|
||||
* <li>The method must not be static except for the application client.</li>
|
||||
* <li>The method should not be final.</li>
|
||||
* <li>If the method throws an unchecked exception the class must not be put
|
||||
* into service except in the case where the exception is handled by an
|
||||
* interceptor.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see javax.annotation.PreDestroy
|
||||
* @see javax.annotation.Resource
|
||||
* @since 1.6, Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target(METHOD)
|
||||
public @interface PostConstruct {
|
||||
}
|
96
sources/main/java/javax/annotation/PreDestroy.java
Normal file
96
sources/main/java/javax/annotation/PreDestroy.java
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>PreDestroy</code> annotation is used on a method as a callback
|
||||
* notification to signal that the instance is in the process of being removed
|
||||
* by the container. The method annotated with <code>PreDestroy</code> is
|
||||
* typically used to release resources that it has been holding. This annotation
|
||||
* must be supported by all container-managed objects that support the use of
|
||||
* the <code>PostConstruct</code> annotation except the Java EE application
|
||||
* client. The method on which the <code>PreDestroy</code> annotation is applied
|
||||
* must fulfill all of the following criteria:
|
||||
* <ul>
|
||||
* <li>The method must not have any parameters except in the case of
|
||||
* interceptors in which case it takes an <code>InvocationContext</code> object
|
||||
* as defined by the Interceptors specification.</li>
|
||||
* <li>The method defined on an interceptor class or superclass of an
|
||||
* interceptor class must have one of the following signatures:
|
||||
* <p>
|
||||
* void <METHOD>(InvocationContext)
|
||||
* <p>
|
||||
* Object <METHOD>(InvocationContext) throws Exception
|
||||
* <p>
|
||||
* <i>Note: A PreDestroy interceptor method must not throw application
|
||||
* exceptions, but it may be declared to throw checked exceptions including the
|
||||
* java.lang.Exception if the same interceptor method interposes on business or
|
||||
* timeout methods in addition to lifecycle events. If a PreDestroy interceptor
|
||||
* method returns a value, it is ignored by the container.</i></li>
|
||||
* <li>The method defined on a non-interceptor class must have the following
|
||||
* signature:
|
||||
* <p>
|
||||
* void <METHOD>()</li>
|
||||
* <li>The method on which PreDestroy is applied may be public, protected,
|
||||
* package private or private.</li>
|
||||
* <li>The method must not be static.</li>
|
||||
* <li>The method should not be final.</li>
|
||||
* <li>If the method throws an unchecked exception it is ignored by the
|
||||
* container.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see javax.annotation.PostConstruct
|
||||
* @see javax.annotation.Resource
|
||||
* @since 1.6, Common Annotations 1.0
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target(METHOD)
|
||||
public @interface PreDestroy {
|
||||
}
|
78
sources/main/java/javax/annotation/Priority.java
Normal file
78
sources/main/java/javax/annotation/Priority.java
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>Priority</code> annotation can be applied to classes or parameters
|
||||
* to indicate in what order they should be used. The effect of using the
|
||||
* <code>Priority</code> annotation in any particular instance is defined by
|
||||
* other specifications that define the use of a specific class.
|
||||
* <p>
|
||||
* For example, the Interceptors specification defines the use of priorities on
|
||||
* interceptors to control the order in which interceptors are called.
|
||||
* </p>
|
||||
* <p>
|
||||
* Priority values should generally be non-negative, with negative values
|
||||
* reserved for special meanings such as "undefined" or "not specified". A
|
||||
* specification that defines use of the <code>Priority</code> annotation may
|
||||
* define the range of allowed priorities and any priority values with special
|
||||
* meaning.
|
||||
* </p>
|
||||
*
|
||||
* @since Common Annotations 1.2
|
||||
*/
|
||||
@Target({ TYPE, PARAMETER })
|
||||
@Retention(RUNTIME)
|
||||
@Documented
|
||||
public @interface Priority {
|
||||
/**
|
||||
* The priority value.
|
||||
*/
|
||||
int value();
|
||||
}
|
15
sources/main/java/javax/annotation/PropertyKey.java
Normal file
15
sources/main/java/javax/annotation/PropertyKey.java
Normal file
@ -0,0 +1,15 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
@Documented
|
||||
@TypeQualifier
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PropertyKey {
|
||||
When when() default When.ALWAYS;
|
||||
}
|
44
sources/main/java/javax/annotation/RegEx.java
Normal file
44
sources/main/java/javax/annotation/RegEx.java
Normal file
@ -0,0 +1,44 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.TypeQualifierValidator;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This qualifier is used to denote String values that should be a Regular
|
||||
* expression.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*/
|
||||
@Documented
|
||||
@Syntax("RegEx")
|
||||
@TypeQualifierNickname
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RegEx {
|
||||
When when() default When.ALWAYS;
|
||||
|
||||
static class Checker implements TypeQualifierValidator<RegEx> {
|
||||
|
||||
public When forConstantValue(RegEx annotation, Object value) {
|
||||
if (!(value instanceof String))
|
||||
return When.NEVER;
|
||||
|
||||
try {
|
||||
Pattern.compile((String) value);
|
||||
} catch (PatternSyntaxException e) {
|
||||
return When.NEVER;
|
||||
}
|
||||
return When.ALWAYS;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
144
sources/main/java/javax/annotation/Resource.java
Normal file
144
sources/main/java/javax/annotation/Resource.java
Normal file
@ -0,0 +1,144 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The <code>Resource</code> annotation marks a resource that is needed by the
|
||||
* application. This annotation may be applied to an application component
|
||||
* class, or to fields or methods of the component class. When the annotation is
|
||||
* applied to a field or method, the container will inject an instance of the
|
||||
* requested resource into the application component when the component is
|
||||
* initialized. If the annotation is applied to the component class, the
|
||||
* annotation declares a resource that the application will look up at runtime.
|
||||
* <p>
|
||||
* Even though this annotation is not marked <code>Inherited</code>, deployment
|
||||
* tools are required to examine all superclasses of any component class to
|
||||
* discover all uses of this annotation in all superclasses. All such annotation
|
||||
* instances specify resources that are needed by the application component.
|
||||
* Note that this annotation may appear on private fields and methods of
|
||||
* superclasses; the container is required to perform injection in these cases
|
||||
* as well.
|
||||
* </p>
|
||||
*
|
||||
* @since 1.6, Common Annotations 1.0
|
||||
*/
|
||||
@Target({ TYPE, FIELD, METHOD })
|
||||
@Retention(RUNTIME)
|
||||
@Repeatable(Resources.class)
|
||||
public @interface Resource {
|
||||
/**
|
||||
* The JNDI name of the resource. For field annotations, the default is the
|
||||
* field name. For method annotations, the default is the JavaBeans property
|
||||
* name corresponding to the method. For class annotations, there is no default
|
||||
* and this must be specified.
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* The name of the resource that the reference points to. It can link to any
|
||||
* compatible resource using the global JNDI names.
|
||||
*
|
||||
* @since 1.7, Common Annotations 1.1
|
||||
*/
|
||||
|
||||
String lookup() default "";
|
||||
|
||||
/**
|
||||
* The Java type of the resource. For field annotations, the default is the type
|
||||
* of the field. For method annotations, the default is the type of the
|
||||
* JavaBeans property. For class annotations, there is no default and this must
|
||||
* be specified.
|
||||
*/
|
||||
Class<?> type() default java.lang.Object.class;
|
||||
|
||||
/**
|
||||
* The two possible authentication types for a resource.
|
||||
*/
|
||||
enum AuthenticationType {
|
||||
CONTAINER, APPLICATION
|
||||
}
|
||||
|
||||
/**
|
||||
* The authentication type to use for this resource. This may be specified for
|
||||
* resources representing a connection factory of any supported type, and must
|
||||
* not be specified for resources of other types.
|
||||
*/
|
||||
AuthenticationType authenticationType() default AuthenticationType.CONTAINER;
|
||||
|
||||
/**
|
||||
* Indicates whether this resource can be shared between this component and
|
||||
* other components. This may be specified for resources representing a
|
||||
* connection factory of any supported type, and must not be specified for
|
||||
* resources of other types.
|
||||
*/
|
||||
boolean shareable() default true;
|
||||
|
||||
/**
|
||||
* A product-specific name that this resource should be mapped to. The
|
||||
* <code>mappedName</code> element provides for mapping the resource reference
|
||||
* to the name of a resource known to the applicaiton server. The mapped name
|
||||
* could be of any form.
|
||||
* <p>
|
||||
* Application servers are not required to support any particular form or type
|
||||
* of mapped name, nor the ability to use mapped names. The mapped name is
|
||||
* product-dependent and often installation-dependent. No use of a mapped name
|
||||
* is portable.
|
||||
* </p>
|
||||
*/
|
||||
String mappedName() default "";
|
||||
|
||||
/**
|
||||
* Description of this resource. The description is expected to be in the
|
||||
* default language of the system on which the application is deployed. The
|
||||
* description can be presented to the Deployer to help in choosing the correct
|
||||
* resource.
|
||||
*/
|
||||
String description() default "";
|
||||
}
|
65
sources/main/java/javax/annotation/Resources.java
Normal file
65
sources/main/java/javax/annotation/Resources.java
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This class is used to allow multiple resources declarations.
|
||||
*
|
||||
* @see javax.annotation.Resource
|
||||
* @since 1.6, Common Annotations 1.0
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface Resources {
|
||||
/**
|
||||
* Array used for multiple resource declarations.
|
||||
*/
|
||||
Resource[] value();
|
||||
}
|
19
sources/main/java/javax/annotation/Signed.java
Normal file
19
sources/main/java/javax/annotation/Signed.java
Normal file
@ -0,0 +1,19 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* Used to annotate a value of unknown sign.
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Nonnegative(when = When.UNKNOWN)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Signed {
|
||||
|
||||
}
|
45
sources/main/java/javax/annotation/Syntax.java
Normal file
45
sources/main/java/javax/annotation/Syntax.java
Normal file
@ -0,0 +1,45 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation a value that is of a particular syntax, such as Java syntax
|
||||
* or regular expression syntax. This can be used to provide syntax checking of
|
||||
* constant values at compile time, run time checking at runtime, and can assist
|
||||
* IDEs in deciding how to interpret String constants (e.g., should a
|
||||
* refactoring that renames method {@code x()} to {@code y()} update the String
|
||||
* constant {@code "x()"}).
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifier(applicableTo = CharSequence.class)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Syntax {
|
||||
/**
|
||||
* Value indicating the particular syntax denoted by this annotation. Different
|
||||
* tools will recognize different syntaxes, but some proposed canonical values
|
||||
* are:
|
||||
* <ul>
|
||||
* <li>"Java"
|
||||
* <li>"RegEx"
|
||||
* <li>"JavaScript"
|
||||
* <li>"Ruby"
|
||||
* <li>"Groovy"
|
||||
* <li>"SQL"
|
||||
* <li>"FormatString"
|
||||
* </ul>
|
||||
* <p>
|
||||
* Syntax names can be followed by a colon and a list of key value pairs,
|
||||
* separated by commas. For example, "SQL:dialect=Oracle,version=2.3". Tools
|
||||
* should ignore any keys they don't recognize.
|
||||
*
|
||||
* @return a name indicating the particular syntax.
|
||||
*/
|
||||
String value();
|
||||
|
||||
When when() default When.ALWAYS;
|
||||
}
|
28
sources/main/java/javax/annotation/Tainted.java
Normal file
28
sources/main/java/javax/annotation/Tainted.java
Normal file
@ -0,0 +1,28 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifierNickname;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation is used to denote String values that are tainted, i.e. may
|
||||
* come from untrusted sources without proper validation.
|
||||
* <p>
|
||||
* For example, this annotation should be used on the String value which
|
||||
* represents raw input received from the web form.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*
|
||||
* @see Untainted
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifierNickname
|
||||
@Untainted(when = When.MAYBE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Tainted {
|
||||
|
||||
}
|
27
sources/main/java/javax/annotation/Untainted.java
Normal file
27
sources/main/java/javax/annotation/Untainted.java
Normal file
@ -0,0 +1,27 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import javax.annotation.meta.TypeQualifier;
|
||||
import javax.annotation.meta.When;
|
||||
|
||||
/**
|
||||
* This annotation is used to denote String values that are untainted, i.e.
|
||||
* properly validated.
|
||||
* <p>
|
||||
* For example, this annotation should be used on the String value which
|
||||
* represents SQL query to be passed to database engine.
|
||||
* <p>
|
||||
* When this annotation is applied to a method it applies to the method return
|
||||
* value.
|
||||
*
|
||||
* @see Tainted
|
||||
*/
|
||||
@Documented
|
||||
@TypeQualifier
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Untainted {
|
||||
When when() default When.ALWAYS;
|
||||
}
|
18
sources/main/java/javax/annotation/WillClose.java
Normal file
18
sources/main/java/javax/annotation/WillClose.java
Normal file
@ -0,0 +1,18 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Used to annotate a method parameter to indicate that this method will close
|
||||
* the resource.
|
||||
*
|
||||
* @see WillCloseWhenClosed
|
||||
* @see WillNotClose
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface WillClose {
|
||||
|
||||
}
|
18
sources/main/java/javax/annotation/WillCloseWhenClosed.java
Normal file
18
sources/main/java/javax/annotation/WillCloseWhenClosed.java
Normal file
@ -0,0 +1,18 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Used to annotate a constructor/factory parameter to indicate that returned
|
||||
* object (X) will close the resource when X is closed.
|
||||
*
|
||||
* @see WillClose
|
||||
* @see WillNotClose
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface WillCloseWhenClosed {
|
||||
|
||||
}
|
18
sources/main/java/javax/annotation/WillNotClose.java
Normal file
18
sources/main/java/javax/annotation/WillNotClose.java
Normal file
@ -0,0 +1,18 @@
|
||||
package javax.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Used to annotate a method parameter to indicate that this method will not
|
||||
* close the resource.
|
||||
*
|
||||
* @see WillClose
|
||||
* @see WillCloseWhenClosed
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface WillNotClose {
|
||||
|
||||
}
|
41
sources/main/java/javax/annotation/concurrent/GuardedBy.java
Normal file
41
sources/main/java/javax/annotation/concurrent/GuardedBy.java
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Brian Goetz
|
||||
* Released under the Creative Commons Attribution License
|
||||
* (http://creativecommons.org/licenses/by/2.5)
|
||||
* Official home: http://www.jcip.net
|
||||
*/
|
||||
package javax.annotation.concurrent;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* The field or method to which this annotation is applied can only be accessed
|
||||
* when holding a particular lock, which may be a built-in (synchronization)
|
||||
* lock, or may be an explicit {@link java.util.concurrent.locks.Lock}.
|
||||
* <p>
|
||||
* The argument determines which lock guards the annotated field or method:
|
||||
* <ul>
|
||||
* <li>this : The string literal "this" means that this field is guarded by the
|
||||
* class in which it is defined.
|
||||
* <li>class-name.this : For inner classes, it may be necessary to disambiguate
|
||||
* 'this'; the class-name.this designation allows you to specify which 'this'
|
||||
* reference is intended
|
||||
* <li>itself : For reference fields only; the object to which the field refers.
|
||||
* <li>field-name : The lock object is referenced by the (instance or static)
|
||||
* field specified by field-name.
|
||||
* <li>class-name.field-name : The lock object is reference by the static field
|
||||
* specified by class-name.field-name.
|
||||
* <li>method-name() : The lock object is returned by calling the named nil-ary
|
||||
* method.
|
||||
* <li>class-name.class : The Class object for the specified class should be
|
||||
* used as the lock object.
|
||||
* </ul>
|
||||
*/
|
||||
@Target({ ElementType.FIELD, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface GuardedBy {
|
||||
String value();
|
||||
}
|
33
sources/main/java/javax/annotation/concurrent/Immutable.java
Normal file
33
sources/main/java/javax/annotation/concurrent/Immutable.java
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Brian Goetz
|
||||
* Released under the Creative Commons Attribution License
|
||||
* (http://creativecommons.org/licenses/by/2.5)
|
||||
* Official home: http://www.jcip.net
|
||||
*/
|
||||
package javax.annotation.concurrent;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The class to which this annotation is applied is immutable. This means that
|
||||
* its state cannot be seen to change by callers. Of necessity this means that
|
||||
* all public fields are final, and that all public final reference fields refer
|
||||
* to other immutable objects, and that methods do not publish references to any
|
||||
* internal state which is mutable by implementation even if not by design.
|
||||
* Immutable objects may still have internal mutable state for purposes of
|
||||
* performance optimization; some state variables may be lazily computed, so
|
||||
* long as they are computed from immutable state and that callers cannot tell
|
||||
* the difference.
|
||||
* <p>
|
||||
* Immutable objects are inherently thread-safe; they may be passed between
|
||||
* threads or published without synchronization.
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface Immutable {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Brian Goetz
|
||||
* Released under the Creative Commons Attribution License
|
||||
* (http://creativecommons.org/licenses/by/2.5)
|
||||
* Official home: http://www.jcip.net
|
||||
*/
|
||||
package javax.annotation.concurrent;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The class to which this annotation is applied is not thread-safe. This
|
||||
* annotation primarily exists for clarifying the non-thread-safety of a class
|
||||
* that might otherwise be assumed to be thread-safe, despite the fact that it
|
||||
* is a bad idea to assume a class is thread-safe without good reason.
|
||||
*
|
||||
* @see ThreadSafe
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface NotThreadSafe {
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Brian Goetz
|
||||
* Released under the Creative Commons Attribution License
|
||||
* (http://creativecommons.org/licenses/by/2.5)
|
||||
* Official home: http://www.jcip.net
|
||||
*/
|
||||
package javax.annotation.concurrent;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The class to which this annotation is applied is thread-safe. This means that
|
||||
* no sequences of accesses (reads and writes to public fields, calls to public
|
||||
* methods) may put the object into an invalid state, regardless of the
|
||||
* interleaving of those actions by the runtime, and without requiring any
|
||||
* additional synchronization or coordination on the part of the caller.
|
||||
*
|
||||
* @see NotThreadSafe
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface ThreadSafe {
|
||||
}
|
30
sources/main/java/javax/annotation/meta/Exclusive.java
Normal file
30
sources/main/java/javax/annotation/meta/Exclusive.java
Normal file
@ -0,0 +1,30 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to the value() element of an annotation that
|
||||
* is annotated as a TypeQualifier.
|
||||
*
|
||||
* <p>
|
||||
* For example, the following defines a type qualifier such that if you know a
|
||||
* value is {@literal @Foo(1)}, then the value cannot be {@literal @Foo(2)} or
|
||||
* {{@literal @Foo(3)}.
|
||||
*
|
||||
* <pre>
|
||||
* @TypeQualifier
|
||||
* @interface Foo {
|
||||
* @Exclusive
|
||||
* int value();
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Exclusive {
|
||||
|
||||
}
|
40
sources/main/java/javax/annotation/meta/Exhaustive.java
Normal file
40
sources/main/java/javax/annotation/meta/Exhaustive.java
Normal file
@ -0,0 +1,40 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* This annotation can be applied to the value() element of an annotation that
|
||||
* is annotated as a TypeQualifier. This is only appropriate if the value field
|
||||
* returns a value that is an Enumeration.
|
||||
*
|
||||
* <p>
|
||||
* Applications of the type qualifier with different values are exclusive, and
|
||||
* the enumeration is an exhaustive list of the possible values.
|
||||
*
|
||||
* <p>
|
||||
* For example, the following defines a type qualifier such that if you know a
|
||||
* value is neither {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)},
|
||||
* then the value must be {@literal @Foo(Color.Green)}. And if you know it is
|
||||
* {@literal @Foo(Color.Green)}, you know it cannot be
|
||||
* {@literal @Foo(Color.Red)} or {@literal @Foo(Color.Blue)}
|
||||
*
|
||||
* <pre>
|
||||
* @TypeQualifier
|
||||
* @interface Foo {
|
||||
* enum Color {
|
||||
* RED, BLUE, GREEN
|
||||
* };
|
||||
*
|
||||
* @Exhaustive
|
||||
* Color value();
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Exhaustive {
|
||||
|
||||
}
|
28
sources/main/java/javax/annotation/meta/TypeQualifier.java
Normal file
28
sources/main/java/javax/annotation/meta/TypeQualifier.java
Normal file
@ -0,0 +1,28 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* This qualifier is applied to an annotation to denote that the annotation
|
||||
* should be treated as a type qualifier.
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TypeQualifier {
|
||||
|
||||
/**
|
||||
* Describes the kinds of values the qualifier can be applied to. If a numeric
|
||||
* class is provided (e.g., Number.class or Integer.class) then the annotation
|
||||
* can also be applied to the corresponding primitive numeric types.
|
||||
*
|
||||
* @return a class object which denotes the type of the values the original
|
||||
* annotation can be applied to.
|
||||
*/
|
||||
Class<?> applicableTo() default Object.class;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* This qualifier is applied to an annotation to denote that the annotation
|
||||
* defines a default type qualifier that is visible within the scope of the
|
||||
* element it is applied to.
|
||||
*/
|
||||
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TypeQualifierDefault {
|
||||
ElementType[] value() default {};
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This annotation is applied to a annotation, and marks the annotation as being
|
||||
* a qualifier nickname. Applying a nickname annotation X to a element Y should
|
||||
* be interpreted as having the same meaning as applying all of annotations of X
|
||||
* (other than QualifierNickname) to Y.
|
||||
*
|
||||
* <p>
|
||||
* Thus, you might define a qualifier SocialSecurityNumber as follows:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* @Documented
|
||||
* @TypeQualifierNickname
|
||||
* @Pattern("[0-9]{3}-[0-9]{2}-[0-9]{4}")
|
||||
* @Retention(RetentionPolicy.RUNTIME)
|
||||
* public @interface SocialSecurityNumber {
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
public @interface TypeQualifierNickname {
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface TypeQualifierValidator<A extends Annotation> {
|
||||
/**
|
||||
* Given a type qualifier, check to see if a known specific constant value is an
|
||||
* instance of the set of values denoted by the qualifier.
|
||||
*
|
||||
* @param annotation the type qualifier
|
||||
* @param value the value to check
|
||||
* @return a value indicating whether or not the value is an member of the
|
||||
* values denoted by the type qualifier
|
||||
*/
|
||||
public @Nonnull When forConstantValue(@Nonnull A annotation, Object value);
|
||||
}
|
23
sources/main/java/javax/annotation/meta/When.java
Normal file
23
sources/main/java/javax/annotation/meta/When.java
Normal file
@ -0,0 +1,23 @@
|
||||
package javax.annotation.meta;
|
||||
|
||||
/**
|
||||
* Used to describe the relationship between a qualifier T and the set of values
|
||||
* S possible on an annotated element.
|
||||
*
|
||||
* In particular, an issues should be reported if an ALWAYS or MAYBE value is
|
||||
* used where a NEVER value is required, or if a NEVER or MAYBE value is used
|
||||
* where an ALWAYS value is required.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum When {
|
||||
/** S is a subset of T */
|
||||
ALWAYS,
|
||||
/** nothing definitive is known about the relation between S and T */
|
||||
UNKNOWN,
|
||||
/** S intersection T is non empty and S - T is nonempty */
|
||||
MAYBE,
|
||||
/** S intersection T is empty */
|
||||
NEVER;
|
||||
|
||||
}
|
47
sources/main/java/javax/annotation/package.html
Normal file
47
sources/main/java/javax/annotation/package.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!--
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
|
||||
Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The contents of this file are subject to the terms of either the GNU
|
||||
General Public License Version 2 only ("GPL") or the Common Development
|
||||
and Distribution License("CDDL") (collectively, the "License"). You
|
||||
may not use this file except in compliance with the License. You can
|
||||
obtain a copy of the License at
|
||||
https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
or LICENSE.txt. See the License for the specific
|
||||
language governing permissions and limitations under the License.
|
||||
|
||||
When distributing the software, include this License Header Notice in each
|
||||
file and include the License file at LICENSE.txt.
|
||||
|
||||
GPL Classpath Exception:
|
||||
Oracle designates this particular file as subject to the "Classpath"
|
||||
exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
file that accompanied this code.
|
||||
|
||||
Modifications:
|
||||
If applicable, add the following below the License Header, with the fields
|
||||
enclosed by brackets [] replaced by your own identifying information:
|
||||
"Portions Copyright [year] [name of copyright owner]"
|
||||
|
||||
Contributor(s):
|
||||
If you wish your version of this file to be governed by only the CDDL or
|
||||
only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
elects to include this software in this distribution under the [CDDL or GPL
|
||||
Version 2] license." If you don't indicate a single choice of license, a
|
||||
recipient has the option to distribute your version of this file under
|
||||
either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
its licensees as provided above. However, if you add GPL Version 2 code
|
||||
and therefore, elected the GPL Version 2 license, then the option applies
|
||||
only if the new code is made subject to such option by the copyright
|
||||
holder.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<body>
|
||||
This package defines the common annotations.
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.security;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Used by application to declare security roles. It can be specified on a
|
||||
* class. The value of the <code>DeclareRoles</code> annotation is a list of
|
||||
* security role names.
|
||||
*
|
||||
* @since Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface DeclareRoles {
|
||||
/**
|
||||
* List of security role names.
|
||||
*/
|
||||
String[] value();
|
||||
}
|
63
sources/main/java/javax/annotation/security/DenyAll.java
Normal file
63
sources/main/java/javax/annotation/security/DenyAll.java
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.security;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Specifies that no security roles are allowed to invoke the specified
|
||||
* method(s).
|
||||
*
|
||||
* @see javax.annotation.security.RolesAllowed
|
||||
* @see javax.annotation.security.PermitAll
|
||||
* @since Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target({ TYPE, METHOD })
|
||||
public @interface DenyAll {
|
||||
}
|
70
sources/main/java/javax/annotation/security/PermitAll.java
Normal file
70
sources/main/java/javax/annotation/security/PermitAll.java
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.security;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Specifies that all security roles are allowed to invoke the specified
|
||||
* method(s) — i.e., that the specified method(s) are "unchecked". It can
|
||||
* be specified on a class or on methods. Specifying it on the class means that
|
||||
* it applies to all methods of the class. If specified at the method level, it
|
||||
* only affects that method. If the <code>RolesAllowed</code> annotation is
|
||||
* specified at the class level and this annotation is applied at the method
|
||||
* level, the <code>PermitAll</code> annotation overrides the
|
||||
* <code>RolesAllowed</code> annotation for the specified method.
|
||||
*
|
||||
* @see javax.annotation.security.RolesAllowed
|
||||
* @see javax.annotation.security.DenyAll
|
||||
*
|
||||
* @since Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target({ TYPE, METHOD })
|
||||
public @interface PermitAll {
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.security;
|
||||
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Specifies the list of security roles permitted to access method(s) in an
|
||||
* application. The value of the <code>RolesAllowed</code> annotation is a list
|
||||
* of security role names. This annotation can be specified on a class or on
|
||||
* method(s). Specifying it at a class level means that it applies to all the
|
||||
* methods in the class. Specifying it on a method means that it is applicable
|
||||
* to that method only. If applied at both the class and methods level, the
|
||||
* method value overrides the class value if the two conflict.
|
||||
*
|
||||
* @since Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target({ TYPE, METHOD })
|
||||
public @interface RolesAllowed {
|
||||
/**
|
||||
* List of roles that are permitted access.
|
||||
*/
|
||||
String[] value();
|
||||
}
|
66
sources/main/java/javax/annotation/security/RunAs.java
Normal file
66
sources/main/java/javax/annotation/security/RunAs.java
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.security;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Defines the identity of the application during execution. This allows
|
||||
* developers to execute an application under a particular role. The role must
|
||||
* map to the user / group information in the container's security realm. Its
|
||||
* value is the name of a security role.
|
||||
*
|
||||
* @since Common Annotations 1.0
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface RunAs {
|
||||
/**
|
||||
* Name of a security role.
|
||||
*/
|
||||
String value();
|
||||
}
|
47
sources/main/java/javax/annotation/security/package.html
Normal file
47
sources/main/java/javax/annotation/security/package.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!--
|
||||
|
||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
|
||||
Copyright (c) 2005-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
The contents of this file are subject to the terms of either the GNU
|
||||
General Public License Version 2 only ("GPL") or the Common Development
|
||||
and Distribution License("CDDL") (collectively, the "License"). You
|
||||
may not use this file except in compliance with the License. You can
|
||||
obtain a copy of the License at
|
||||
https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
or LICENSE.txt. See the License for the specific
|
||||
language governing permissions and limitations under the License.
|
||||
|
||||
When distributing the software, include this License Header Notice in each
|
||||
file and include the License file at LICENSE.txt.
|
||||
|
||||
GPL Classpath Exception:
|
||||
Oracle designates this particular file as subject to the "Classpath"
|
||||
exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
file that accompanied this code.
|
||||
|
||||
Modifications:
|
||||
If applicable, add the following below the License Header, with the fields
|
||||
enclosed by brackets [] replaced by your own identifying information:
|
||||
"Portions Copyright [year] [name of copyright owner]"
|
||||
|
||||
Contributor(s):
|
||||
If you wish your version of this file to be governed by only the CDDL or
|
||||
only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
elects to include this software in this distribution under the [CDDL or GPL
|
||||
Version 2] license." If you don't indicate a single choice of license, a
|
||||
recipient has the option to distribute your version of this file under
|
||||
either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
its licensees as provided above. However, if you add GPL Version 2 code
|
||||
and therefore, elected the GPL Version 2 license, then the option applies
|
||||
only if the new code is made subject to such option by the copyright
|
||||
holder.
|
||||
|
||||
-->
|
||||
|
||||
<html>
|
||||
<body>
|
||||
This package contains the security common annotations.
|
||||
</body>
|
||||
</html>
|
355
sources/main/java/javax/annotation/sql/DataSourceDefinition.java
Normal file
355
sources/main/java/javax/annotation/sql/DataSourceDefinition.java
Normal file
@ -0,0 +1,355 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2009-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.sql;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation used to define a container <code>DataSource</code> to be
|
||||
* registered with JNDI. The <code>DataSource</code> may be configured by
|
||||
* setting the annotation elements for commonly used <code>DataSource</code>
|
||||
* properties. Additional standard and vendor-specific properties may be
|
||||
* specified using the <code>properties</code> element.
|
||||
* <p>
|
||||
*
|
||||
* The data source will be registered under the name specified in the
|
||||
* <code>name</code> element. It may be defined to be in any valid Java EE
|
||||
* namespace, which will determine the accessibility of the data source from
|
||||
* other components.
|
||||
* <p>
|
||||
* A JDBC driver implementation class of the appropriate type, either
|
||||
* <code>DataSource</code>, <code>ConnectionPoolDataSource</code>, or
|
||||
* <code>XADataSource</code>, must be indicated by the <code>className</code>
|
||||
* element. The availability of the driver class will be assumed at runtime.
|
||||
* <p>
|
||||
* DataSource properties should not be specified more than once. If the url
|
||||
* annotation element contains a DataSource property that was also specified
|
||||
* using the corresponding annotation element or was specified in the properties
|
||||
* annotation element, the precedence order is undefined and implementation
|
||||
* specific:
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
|
||||
* className="org.apache.derby.jdbc.ClientDataSource",
|
||||
* url="jdbc:derby://localhost:1527/myDB;user=bill",
|
||||
* user="lance",
|
||||
* password="secret",
|
||||
* databaseName="testDB",
|
||||
* serverName="luckydog"
|
||||
* )// DO NOT DO THIS!!!
|
||||
* </pre>
|
||||
* <p>
|
||||
* In the above example, the <code>databaseName</code>, <code>user</code> and
|
||||
* <code>serverName</code> properties were specified as part of the
|
||||
* <code>url</code> property and using the corresponding annotation elements.
|
||||
* This should be avoided.
|
||||
* <p>
|
||||
* If the <code>properties</code> annotation element is used and contains a
|
||||
* DataSource property that was also specified using the corresponding
|
||||
* annotation element, the annotation element value takes precedence. For
|
||||
* example:
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
|
||||
* className="org.apache.derby.jdbc.ClientDataSource",
|
||||
* user="lance",
|
||||
* password="secret",
|
||||
* databaseName="testDB",
|
||||
* serverName="luckydog",
|
||||
* properties= {"databaseName=myDB", "databaseProp=doThis"}
|
||||
* )// DO NOT DO THIS!!!
|
||||
* </pre>
|
||||
* <p>
|
||||
* This would result in the following values being used when configuring the
|
||||
* DataSource:
|
||||
* <ul>
|
||||
* <li>serverName=luckydog</li>
|
||||
* <li>portNumber=1527</li>
|
||||
* <li>databaseName=testDB</li>
|
||||
* <li>user=lance</li>
|
||||
* <li>password=secret</li>
|
||||
* <li>databaseProp=doThis</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Vendors are not required to support properties that do not normally apply to
|
||||
* a specific data source type. For example, specifying the
|
||||
* <code>transactional</code> property to be <code>true</code> but supplying a
|
||||
* value for <code>className</code> that implements a data source class other
|
||||
* than <code>XADataSource</code> may not be supported.
|
||||
* <p>
|
||||
* Vendor-specific properties may be combined with or used to override standard
|
||||
* data source properties defined using this annotation.
|
||||
* <p>
|
||||
* <code>DataSource</code> properties that are specified and are not supported
|
||||
* in a given configuration or cannot be mapped to a vendor specific
|
||||
* configuration property may be ignored.
|
||||
* <p>
|
||||
* Examples: <br>
|
||||
*
|
||||
* <pre>
|
||||
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
|
||||
* className="com.foobar.MyDataSource",
|
||||
* portNumber=6689,
|
||||
* serverName="myserver.com",
|
||||
* user="lance",
|
||||
* password="secret"
|
||||
* )
|
||||
*
|
||||
* </pre>
|
||||
* <p>
|
||||
* Using a <code>URL</code>: <br>
|
||||
*
|
||||
* <pre>
|
||||
* @DataSourceDefinition(name="java:global/MyApp/MyDataSource",
|
||||
* className="org.apache.derby.jdbc.ClientDataSource",
|
||||
* url="jdbc:derby://localhost:1527/myDB",
|
||||
* user="lance",
|
||||
* password="secret"
|
||||
* )
|
||||
* </pre>
|
||||
* <p>
|
||||
* An example lookup of the DataSource from an EJB:
|
||||
*
|
||||
* <pre>
|
||||
* @Stateless
|
||||
* public class MyStatelessEJB {
|
||||
* @Resource(lookup="java:global/MyApp/myDataSource")
|
||||
* DataSource myDB;
|
||||
* ...
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
*
|
||||
* @see javax.sql.DataSource
|
||||
* @see javax.sql.XADataSource
|
||||
* @see javax.sql.ConnectionPoolDataSource
|
||||
* @since Common Annotations 1.1
|
||||
*/
|
||||
@Target({ ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Repeatable(DataSourceDefinitions.class)
|
||||
public @interface DataSourceDefinition {
|
||||
|
||||
/**
|
||||
* JNDI name by which the data source will be registered.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String name();
|
||||
|
||||
/**
|
||||
* Name of a DataSource class that implements <code>javax.sql.DataSource</code>
|
||||
* or <code>javax.sql.XADataSource</code> or
|
||||
* <code>javax.sql.ConnectionPoolDataSource</code>.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String className();
|
||||
|
||||
/**
|
||||
* Description of this data source
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String description() default "";
|
||||
|
||||
/**
|
||||
* A JDBC URL. If the <code>url</code> annotation element contains a DataSource
|
||||
* property that was also specified using the corresponding annotation element,
|
||||
* the precedence order is undefined and implementation specific.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String url() default "";
|
||||
|
||||
/**
|
||||
* User name to use for connection authentication.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String user() default "";
|
||||
|
||||
/**
|
||||
* Password to use for connection authentication.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String password() default "";
|
||||
|
||||
/**
|
||||
* Name of a database on a server.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String databaseName() default "";
|
||||
|
||||
/**
|
||||
* Port number where a server is listening for requests.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int portNumber() default -1;
|
||||
|
||||
/**
|
||||
* Database server name.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String serverName() default "localhost";
|
||||
|
||||
/**
|
||||
* Isolation level for connections. The Isolation level must be one of the
|
||||
* following:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>Connection.TRANSACTION_NONE,
|
||||
* <li>Connection.TRANSACTION_READ_ UNCOMMITTED,
|
||||
* <li>Connection.TRANSACTION_READ_COMMITTED,
|
||||
* <li>Connection.TRANSACTION_REPEATABLE_READ,
|
||||
* <li>Connection.TRANSACTION_SERIALIZABLE
|
||||
* </ul>
|
||||
* <p>
|
||||
* Default is vendor-specific.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int isolationLevel() default -1;
|
||||
|
||||
/**
|
||||
* Set to <code>false</code> if connections should not participate in
|
||||
* transactions.
|
||||
* <p>
|
||||
* Default is to enlist in a transaction when one is active or becomes active.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
boolean transactional() default true;
|
||||
|
||||
/**
|
||||
* Number of connections that should be created when a connection pool is
|
||||
* initialized.
|
||||
* <p>
|
||||
* Default is vendor-specific
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int initialPoolSize() default -1;
|
||||
|
||||
/**
|
||||
* Maximum number of connections that should be concurrently allocated for a
|
||||
* connection pool.
|
||||
* <p>
|
||||
* Default is vendor-specific.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int maxPoolSize() default -1;
|
||||
|
||||
/**
|
||||
* Minimum number of connections that should be allocated for a connection pool.
|
||||
* <p>
|
||||
* Default is vendor-specific.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int minPoolSize() default -1;
|
||||
|
||||
/**
|
||||
* The number of seconds that a physical connection should remain unused in the
|
||||
* pool before the connection is closed for a connection pool.
|
||||
* <p>
|
||||
* Default is vendor-specific
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int maxIdleTime() default -1;
|
||||
|
||||
/**
|
||||
* The total number of statements that a connection pool should keep open. A
|
||||
* value of 0 indicates that the caching of statements is disabled for a
|
||||
* connection pool.
|
||||
* <p>
|
||||
* Default is vendor-specific
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int maxStatements() default -1;
|
||||
|
||||
/**
|
||||
* Used to specify vendor-specific properties and less commonly used
|
||||
* <code>DataSource</code> properties such as:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>dataSourceName
|
||||
* <li>networkProtocol
|
||||
* <li>propertyCycle
|
||||
* <li>roleName
|
||||
* </ul>
|
||||
* <p>
|
||||
* Properties are specified using the format: <i>propertyName=propertyValue</i>
|
||||
* with one property per array element.
|
||||
* <p>
|
||||
* If a DataSource property is specified in the <code>properties</code> element
|
||||
* and the annotation element for the property is also specified, the annotation
|
||||
* element value takes precedence.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
String[] properties() default {};
|
||||
|
||||
/**
|
||||
* Sets the maximum time in seconds that this data source will wait while
|
||||
* attempting to connect to a database. A value of zero specifies that the
|
||||
* timeout is the default system timeout if there is one; otherwise, it
|
||||
* specifies that there is no timeout.
|
||||
* <p>
|
||||
* Default is vendor-specific.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
int loginTimeout() default 0;
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
||||
*
|
||||
* Copyright (c) 2009-2018 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* The contents of this file are subject to the terms of either the GNU
|
||||
* General Public License Version 2 only ("GPL") or the Common Development
|
||||
* and Distribution License("CDDL") (collectively, the "License"). You
|
||||
* may not use this file except in compliance with the License. You can
|
||||
* obtain a copy of the License at
|
||||
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
|
||||
* or LICENSE.txt. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* When distributing the software, include this License Header Notice in each
|
||||
* file and include the License file at LICENSE.txt.
|
||||
*
|
||||
* GPL Classpath Exception:
|
||||
* Oracle designates this particular file as subject to the "Classpath"
|
||||
* exception as provided by Oracle in the GPL Version 2 section of the License
|
||||
* file that accompanied this code.
|
||||
*
|
||||
* Modifications:
|
||||
* If applicable, add the following below the License Header, with the fields
|
||||
* enclosed by brackets [] replaced by your own identifying information:
|
||||
* "Portions Copyright [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
* If you wish your version of this file to be governed by only the CDDL or
|
||||
* only the GPL Version 2, indicate your decision by adding "[Contributor]
|
||||
* elects to include this software in this distribution under the [CDDL or GPL
|
||||
* Version 2] license." If you don't indicate a single choice of license, a
|
||||
* recipient has the option to distribute your version of this file under
|
||||
* either the CDDL, the GPL Version 2 or to extend the choice of license to
|
||||
* its licensees as provided above. However, if you add GPL Version 2 code
|
||||
* and therefore, elected the GPL Version 2 license, then the option applies
|
||||
* only if the new code is made subject to such option by the copyright
|
||||
* holder.
|
||||
*/
|
||||
|
||||
package javax.annotation.sql;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Declares one or more <code>DataSourceDefinition</code> annotations.
|
||||
*
|
||||
* @see javax.annotation.sql.DataSourceDefinition
|
||||
* @since Common Annotations 1.1
|
||||
*/
|
||||
@Target({ ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface DataSourceDefinitions {
|
||||
DataSourceDefinition[] value();
|
||||
|
||||
}
|
Reference in New Issue
Block a user