Package org.appng.core.domain
Class RepositoryImpl
- java.lang.Object
-
- org.appng.core.domain.RepositoryImpl
-
- All Implemented Interfaces:
Serializable
,Identifiable<Integer>
,Nameable
,Named<Integer>
,Versionable<Date>
,Auditable<Integer>
,Repository
@Entity public class RepositoryImpl extends Object implements Repository, Auditable<Integer>
Repository
implementation.- Author:
- Matthias Herlitzius
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RepositoryImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deletePackageVersion(String applicationName, String applicationVersion, String applicationTimestamp)
byte[]
getAcceptedCerts()
static ApplicationImpl
getApplication(ApplicationImpl application, ApplicationInfo applicationInfo)
static ApplicationImpl
getApplication(ApplicationInfo applicationInfo)
Certification
getCertification()
Returns theCertification
@Size(max=8192,message="{validation.string.max}") String
getDescription()
Returns the description.String
getDigest()
The digest for this repository, used for local published repositories to grant remote accesssInteger
getId()
Returns the id.List<InstallablePackage>
getInstallablePackages(List<Identifier> provisionedPackages)
Returns a list ofInstallablePackage
s for the given list of packageIdentifier
s@NotNull(message="{validation.notNull}") @Size(max=64,message="{validation.string.max}") String
getName()
Returns the name.PackageArchive
getPackageArchive(String applicationName, String applicationVersion, String applicationTimestamp)
Returns thePackageArchive
with the given name, version and timestampPackages
getPackages()
Packages
getPackages(String packageName)
PackageVersions
getPackageVersions(String name)
Returns thePackageVersions
for the package with the given name, containing a list ofPackageInfo
rmationsList<PackageVersion>
getPackageVersions(List<Identifier> provisionedPackagesList, String name)
Collection<X509Certificate>
getRemoteCerts()
Returns the certificate chain, if this is a signed remote repository.@Size(max=64,message="{validation.string.max}") String
getRemoteRepositoryName()
In case the type for this repository isRepositoryType.REMOTE
, returns the name of the referred remote repository.RepositoryMode
getRepositoryMode()
The mode for this repository,RepositoryType
getRepositoryType()
The type for this repository.Collection<X509Certificate>
getTrustedCertChain()
Returns the certificate chain, if this is a remote repository and a certificate chain to be trusted has been definedURI
getUri()
The URI for thisRepository
, may refer to to local filesystem or a remote addressDate
getVersion()
Returns the version.boolean
isActive()
Whether or notPackageArchive
s can be retrieved from this repositoryboolean
isPublished()
Whether or not this repository is being published via the SOAP interface, so other repositories can refer to it as an remote repositoryboolean
isStrict()
Whether or not this repository uses strict filename validation when scanning forPackageArchive
s, i.e.void
reload()
Reloads the application repository.void
setAcceptedCerts(byte[] acceptedCerts)
void
setActive(boolean isActive)
void
setDescription(String description)
void
setDigest(String digest)
void
setId(Integer id)
void
setName(String name)
void
setPublished(boolean isPublished)
void
setRemoteRepositoryName(String remoteRepositoryName)
void
setRepositoryMode(RepositoryMode repositoryMode)
void
setRepositoryType(RepositoryType repositoryType)
void
setStrict(boolean isStrict)
void
setTrustedCertChain(Collection<X509Certificate> trustedCerts)
Sets the certificate chain to trust for this repositoryvoid
setUri(URI uri)
void
setVersion(Date version)
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.appng.core.domain.Auditable
getAuditName
-
-
-
-
Method Detail
-
getId
public Integer getId()
Description copied from interface:Identifiable
Returns the id.- Specified by:
getId
in interfaceIdentifiable<Integer>
- Returns:
- the id
-
setId
public void setId(Integer id)
-
getName
@NotNull(message="{validation.notNull}") @Size(max=64, message="{validation.string.max}") public @NotNull(message="{validation.notNull}") @Size(max=64,message="{validation.string.max}") String getName()
Description copied from interface:Nameable
Returns the name.
-
setName
public void setName(String name)
-
getDescription
@Size(max=8192, message="{validation.string.max}") public @Size(max=8192,message="{validation.string.max}") String getDescription()
Description copied from interface:Nameable
Returns the description.- Specified by:
getDescription
in interfaceNameable
- Returns:
- the description
-
setDescription
public void setDescription(String description)
-
getVersion
public Date getVersion()
Description copied from interface:Versionable
Returns the version.- Specified by:
getVersion
in interfaceVersionable<Date>
- Returns:
- the version
-
setVersion
public void setVersion(Date version)
-
getRepositoryType
public RepositoryType getRepositoryType()
Description copied from interface:Repository
The type for this repository.- Specified by:
getRepositoryType
in interfaceRepository
- Returns:
- the
RepositoryType
-
setRepositoryType
public void setRepositoryType(RepositoryType repositoryType)
-
getUri
public URI getUri()
Description copied from interface:Repository
The URI for thisRepository
, may refer to to local filesystem or a remote address- Specified by:
getUri
in interfaceRepository
- Returns:
- the URI
-
setUri
public void setUri(URI uri)
-
isActive
public boolean isActive()
Description copied from interface:Repository
Whether or notPackageArchive
s can be retrieved from this repository- Specified by:
isActive
in interfaceRepository
- Returns:
true
if this repository is active,false
otherwise
-
setActive
public void setActive(boolean isActive)
-
isPublished
public boolean isPublished()
Description copied from interface:Repository
Whether or not this repository is being published via the SOAP interface, so other repositories can refer to it as an remote repository- Specified by:
isPublished
in interfaceRepository
- Returns:
true
if this repository is published,false
otherwise- See Also:
Repository.getRepositoryType()
-
setPublished
public void setPublished(boolean isPublished)
-
isStrict
public boolean isStrict()
Description copied from interface:Repository
Whether or not this repository uses strict filename validation when scanning forPackageArchive
s, i.e. the naming pattern must be<name>-<version>-<timestamp>.zip
. If this method returnsfalse
, the more lax naming pattern<name>-<version>.zip
is used, omitting the<timestamp>
part.- Specified by:
isStrict
in interfaceRepository
- Returns:
- if this repository uses strict filename validation
-
setStrict
public void setStrict(boolean isStrict)
-
getRepositoryMode
public RepositoryMode getRepositoryMode()
Description copied from interface:Repository
The mode for this repository,- Specified by:
getRepositoryMode
in interfaceRepository
- Returns:
- the
RepositoryMode
-
setRepositoryMode
public void setRepositoryMode(RepositoryMode repositoryMode)
-
getRemoteRepositoryName
@Size(max=64, message="{validation.string.max}") public @Size(max=64,message="{validation.string.max}") String getRemoteRepositoryName()
Description copied from interface:Repository
In case the type for this repository isRepositoryType.REMOTE
, returns the name of the referred remote repository.- Specified by:
getRemoteRepositoryName
in interfaceRepository
- Returns:
- the name of the referred remote repository
-
setRemoteRepositoryName
public void setRemoteRepositoryName(String remoteRepositoryName)
-
getDigest
public String getDigest()
Description copied from interface:Repository
The digest for this repository, used for local published repositories to grant remote accesss- Specified by:
getDigest
in interfaceRepository
- Returns:
- the digest
- See Also:
Repository.isPublished()
-
setDigest
public void setDigest(String digest)
-
getInstallablePackages
public List<InstallablePackage> getInstallablePackages(List<Identifier> provisionedPackages) throws BusinessException
Description copied from interface:Repository
Returns a list ofInstallablePackage
s for the given list of packageIdentifier
s- Specified by:
getInstallablePackages
in interfaceRepository
- Parameters:
provisionedPackages
- the list of package identifiers- Returns:
- a list of
InstallablePackage
s for the given package identifiers - Throws:
BusinessException
- if an error occurs while retrieving the packages
-
getPackageVersions
public List<PackageVersion> getPackageVersions(List<Identifier> provisionedPackagesList, String name) throws BusinessException
- Throws:
BusinessException
-
getPackages
public Packages getPackages() throws BusinessException
Description copied from interface:Repository
- Specified by:
getPackages
in interfaceRepository
- Returns:
- the
Packages
offered by this repository - Throws:
BusinessException
- if an error occurs while reading the package informations
-
getPackages
public Packages getPackages(String packageName) throws BusinessException
Description copied from interface:Repository
- Specified by:
getPackages
in interfaceRepository
- Parameters:
packageName
- an optional search-string for the package's name, supporting*
as a placeholder- Returns:
- the
Packages
offered by this repository - Throws:
BusinessException
- if an error occurs while reading the package informations
-
getCertification
public Certification getCertification() throws BusinessException
Description copied from interface:Repository
Returns theCertification
- Specified by:
getCertification
in interfaceRepository
- Returns:
- Throws:
BusinessException
-
getPackageVersions
public PackageVersions getPackageVersions(String name) throws BusinessException
Description copied from interface:Repository
Returns thePackageVersions
for the package with the given name, containing a list ofPackageInfo
rmations- Specified by:
getPackageVersions
in interfaceRepository
- Parameters:
name
- the name of the package to get the versions for- Returns:
- the
PackageVersions
- Throws:
BusinessException
- if an error occurs while retrieving thePackageVersions
-
getPackageArchive
public PackageArchive getPackageArchive(String applicationName, String applicationVersion, String applicationTimestamp) throws BusinessException
Description copied from interface:Repository
Returns thePackageArchive
with the given name, version and timestamp- Specified by:
getPackageArchive
in interfaceRepository
- Parameters:
applicationName
- the name of the archiveapplicationVersion
- the version of the archiveapplicationTimestamp
- the timestamp of the archive, only used ifRepository.isStrict()
returnstrue
.- Returns:
- the
PackageArchive
- Throws:
BusinessException
- if no suchPackageArchive
exists or if this repository is not active- See Also:
Repository.isStrict()
,Repository.isActive()
-
deletePackageVersion
public void deletePackageVersion(String applicationName, String applicationVersion, String applicationTimestamp) throws Exception
- Throws:
Exception
-
getApplication
public static ApplicationImpl getApplication(ApplicationInfo applicationInfo)
-
getApplication
public static ApplicationImpl getApplication(ApplicationImpl application, ApplicationInfo applicationInfo)
-
reload
public void reload() throws BusinessException
Reloads the application repository.- Throws:
BusinessException
-
getAcceptedCerts
public byte[] getAcceptedCerts()
-
setAcceptedCerts
public void setAcceptedCerts(byte[] acceptedCerts)
-
getRemoteCerts
public Collection<X509Certificate> getRemoteCerts() throws SigningException, BusinessException
Returns the certificate chain, if this is a signed remote repository.- Returns:
- the immutable certificate chain
- Throws:
SigningException
- if an error occurs while retrieving the certificate chainBusinessException
- if an the remote repository could not be reached
-
setTrustedCertChain
public void setTrustedCertChain(Collection<X509Certificate> trustedCerts) throws SigningException
Sets the certificate chain to trust for this repository- Parameters:
trustedCerts
- the certificate chain- Throws:
SigningException
- if an error occurs while encoding the certificates to their binary form- See Also:
getTrustedCertChain()
-
getTrustedCertChain
public Collection<X509Certificate> getTrustedCertChain() throws SigningException
Description copied from interface:Repository
Returns the certificate chain, if this is a remote repository and a certificate chain to be trusted has been defined- Specified by:
getTrustedCertChain
in interfaceRepository
- Returns:
- the immutable certificate chain, or
null
- Throws:
SigningException
- if an error occurs while reading the certificate chain
-
-