Package org.glassfish.spec
Class Spec
- java.lang.Object
-
- org.glassfish.spec.Spec
-
public class Spec extends java.lang.Object
The API specification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Spec.JarType
The different kind of Spec Jar files.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
API_SUFFIX
ArtifactId suffix for Spec withapi
JarType.private java.lang.String
apiPackage
The Spec API Package.private Artifact
artifact
The Spec Artifact.private java.util.List<java.lang.String>
errors
The errors during spec verification.private java.lang.String
implBuild
The Spec Implementation Builder Number.private java.lang.String
implNamespace
The Spec Implementation Namespace.private java.lang.String
implVersion
The Spec Implementation Version.static java.lang.String
JAKARTA_GROUP_ID
GroupId used for JakartaEE specs.private java.util.jar.JarFile
jar
The Spec JAR file.private Spec.JarType
jarType
The Spec Jar Type seeSpec.JarType
.static java.lang.String
JAVAX_GROUP_ID
GroupId used for JavaEE specs.private static java.lang.String
JCP_VERSION_RULE
Constant for JCP Version Rule.private Metadata
metadata
The Spec Artifact Metadata.private java.lang.String
newImplVersion
The Spec Implementation Version.private java.lang.String
newSpecVersion
The new Spec Version (for non final API).private boolean
nonFinal
The Spec Final flag.private static java.lang.String
NONFINAL_BUILD_SEPARATOR
Constant for Non Final API Build Separator.private static java.lang.String
NONFINAL_BUILD_SEPARATOR_SPEC
Constant for Non Final API Build Spec Separator.private java.lang.String
specBuild
The Spec Build Number.private java.lang.String
specImplVersion
The Spec Implementation Version.private SpecMode
specMode
The Spec mode ("javaee"
or"jakarta"
).private java.lang.String
specVersion
The Spec Version.
-
Constructor Summary
Constructors Constructor Description Spec()
Create a new instance ofSpec
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
buildBundleSymbolicName()
Build bundle symbolic name from API package and API_SUFFIX.private void
checkClasses(java.util.jar.JarFile jarfile, java.lang.String... pkgs)
Verify that the classes inside the given jarFile match the right package.Artifact
getArtifact()
Get the Spec Artifact.java.util.List<java.lang.String>
getErrors()
Get the errors collected during verification.Metadata
getMetadata()
Get the Spec Metadata.void
read(java.util.jar.JarFile jarfile)
Populate the spec artifact and metadata from the given JAR file.void
setApiPackage(java.lang.String pkg)
Set the API package for this spec.void
setArtifact(Artifact a)
Set the artifact for this spec.void
setImplBuild(java.lang.String build)
Set the implementation build for this spec.void
setImplNamespace(java.lang.String namespace)
Set the implementation namespace for this spec.void
setImplVersion(java.lang.String version)
Set the implementation version for this spec.void
setJarType(java.lang.String type)
Set the spec JAR type.void
setMetadata(Metadata mdata)
Set metadata for this spec.void
setNewImplVersion(java.lang.String version)
Set the new spec implementation version for this spec.void
setNewSpecVersion(java.lang.String version)
Set the new spec version for this spec.void
setNonFinal(boolean nfinal)
Set the spec non final flag.void
setSpecBuild(java.lang.String build)
Set the spec build for this spec.void
setSpecImplVersion(java.lang.String version)
Set the spec implementation version for this spec.void
setSpecMode(java.lang.String name)
Set spec mode value for this spec.void
setSpecVersion(java.lang.String version)
Set the spec version for this spec.java.lang.String
toString()
Create a readable inline description of the spec.void
verify()
Perform the Spec verification.private void
verifyApiPackagePrefix()
Verify that apiPackage starts with proper prefix.
-
-
-
Field Detail
-
JAVAX_GROUP_ID
public static final java.lang.String JAVAX_GROUP_ID
GroupId used for JavaEE specs.- See Also:
- Constant Field Values
-
JAKARTA_GROUP_ID
public static final java.lang.String JAKARTA_GROUP_ID
GroupId used for JakartaEE specs.- See Also:
- Constant Field Values
-
artifact
private Artifact artifact
The Spec Artifact.
-
metadata
private Metadata metadata
The Spec Artifact Metadata.
-
jar
private java.util.jar.JarFile jar
The Spec JAR file.
-
specMode
private SpecMode specMode
The Spec mode ("javaee"
or"jakarta"
). Default value isSpecMode.JAKARTA
.
-
specVersion
private java.lang.String specVersion
The Spec Version.
-
newSpecVersion
private java.lang.String newSpecVersion
The new Spec Version (for non final API).
-
specImplVersion
private java.lang.String specImplVersion
The Spec Implementation Version.
-
implVersion
private java.lang.String implVersion
The Spec Implementation Version.
-
newImplVersion
private java.lang.String newImplVersion
The Spec Implementation Version.
-
specBuild
private java.lang.String specBuild
The Spec Build Number.
-
implBuild
private java.lang.String implBuild
The Spec Implementation Builder Number.
-
apiPackage
private java.lang.String apiPackage
The Spec API Package.
-
implNamespace
private java.lang.String implNamespace
The Spec Implementation Namespace.
-
nonFinal
private boolean nonFinal
The Spec Final flag.
-
jarType
private Spec.JarType jarType
The Spec Jar Type seeSpec.JarType
.
-
errors
private final java.util.List<java.lang.String> errors
The errors during spec verification.
-
NONFINAL_BUILD_SEPARATOR_SPEC
private static final java.lang.String NONFINAL_BUILD_SEPARATOR_SPEC
Constant for Non Final API Build Spec Separator.- See Also:
- Constant Field Values
-
NONFINAL_BUILD_SEPARATOR
private static final java.lang.String NONFINAL_BUILD_SEPARATOR
Constant for Non Final API Build Separator.- See Also:
- Constant Field Values
-
JCP_VERSION_RULE
private static final java.lang.String JCP_VERSION_RULE
Constant for JCP Version Rule.- See Also:
- Constant Field Values
-
API_SUFFIX
public static final java.lang.String API_SUFFIX
ArtifactId suffix for Spec withapi
JarType.- See Also:
- Constant Field Values
-
-
Method Detail
-
read
public void read(java.util.jar.JarFile jarfile) throws java.io.IOException
Populate the spec artifact and metadata from the given JAR file.- Parameters:
jarfile
- the JAR file to process- Throws:
java.io.IOException
- if an error occurs while reading the JAR file
-
checkClasses
private void checkClasses(java.util.jar.JarFile jarfile, java.lang.String... pkgs)
Verify that the classes inside the given jarFile match the right package.- Parameters:
jarfile
- the JAR file to processpkgs
- the packages to match
-
verifyApiPackagePrefix
private void verifyApiPackagePrefix()
Verify that apiPackage starts with proper prefix. Verification depends on current spec mode:- javaee: strict check for required prefix
- jakarta: both currently supported prefixes are allowed
-
verify
public void verify()
Perform the Spec verification.
-
getArtifact
public Artifact getArtifact()
Get the Spec Artifact.- Returns:
- the artifact
-
getMetadata
public Metadata getMetadata()
Get the Spec Metadata.- Returns:
- the metadata
-
getErrors
public java.util.List<java.lang.String> getErrors()
Get the errors collected during verification.- Returns:
- the list of errors
-
setSpecMode
public void setSpecMode(java.lang.String name)
Set spec mode value for this spec.- Parameters:
name
- spec mode value matching lower case value ofSpecMode
name attribute
-
setApiPackage
public void setApiPackage(java.lang.String pkg)
Set the API package for this spec.- Parameters:
pkg
- the apiPackage to use
-
buildBundleSymbolicName
public java.lang.String buildBundleSymbolicName()
Build bundle symbolic name from API package and API_SUFFIX.- Returns:
- bundle symbolic name value to be supplied
as
spec.bundle.symbolic-name
property.
-
setImplNamespace
public void setImplNamespace(java.lang.String namespace)
Set the implementation namespace for this spec.- Parameters:
namespace
- the implementation namespace
-
setImplVersion
public void setImplVersion(java.lang.String version)
Set the implementation version for this spec.- Parameters:
version
- the implementation version
-
setSpecVersion
public void setSpecVersion(java.lang.String version)
Set the spec version for this spec.- Parameters:
version
- the spec version
-
setNewImplVersion
public void setNewImplVersion(java.lang.String version)
Set the new spec implementation version for this spec.- Parameters:
version
- the spec version
-
setSpecBuild
public void setSpecBuild(java.lang.String build)
Set the spec build for this spec.- Parameters:
build
- the spec build
-
setSpecImplVersion
public void setSpecImplVersion(java.lang.String version)
Set the spec implementation version for this spec.- Parameters:
version
- the spec implementation version
-
setNewSpecVersion
public void setNewSpecVersion(java.lang.String version)
Set the new spec version for this spec.- Parameters:
version
- the new spec version
-
setImplBuild
public void setImplBuild(java.lang.String build)
Set the implementation build for this spec.- Parameters:
build
- the implementation build
-
setArtifact
public void setArtifact(Artifact a)
Set the artifact for this spec.- Parameters:
a
- the artifact to use
-
setNonFinal
public void setNonFinal(boolean nfinal)
Set the spec non final flag.- Parameters:
nfinal
- the non final value to use
-
setJarType
public void setJarType(java.lang.String type)
Set the spec JAR type.- Parameters:
type
- the JAR type to use
-
setMetadata
public void setMetadata(Metadata mdata)
Set metadata for this spec.- Parameters:
mdata
- the metadata use
-
toString
public java.lang.String toString()
Create a readable inline description of the spec.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the description as a string
-
-