Class DefaultAppRegistryService
java.lang.Object
org.springframework.cloud.dataflow.registry.service.DefaultAppRegistryService
- All Implemented Interfaces:
AppRegistryService
Convenience wrapper for the
AppRegistryService
that operates on higher level
DefaultAppRegistryService
objects and supports on-demand loading of
Resource
s.
Stores AppRegistration with up to two keys:
- <type>.<name>: URI for the actual app
- <type>.<name>.metadata: Optional URI for the app metadata
- Author:
- Mark Fisher, Gunnar Hillert, Thomas Risberg, Eric Bottard, Ilayaperumal Gopinathan, Oleg Zhurakousky, Christian Tzolov, Chris Schaefer, Corneil du Plessis
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.springframework.cloud.dataflow.audit.service.AuditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils
protected static final org.slf4j.Logger
-
Constructor Summary
ConstructorDescriptionDefaultAppRegistryService
(AppRegistrationRepository appRegistrationRepository, AppResourceCommon appResourceCommon, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
appExist
(String name, ApplicationType type) Checks if an application with such name and type exists and is set as default.boolean
appExist
(String name, ApplicationType type, String version) Checks if anAppRegistration
with this name, type and version exists.void
delete
(String name, ApplicationType type, String version) Deletes anAppRegistration
.void
deleteAll
(Iterable<AppRegistration> appRegistrations) Deletes all providedAppRegistration
's.find
(String name, ApplicationType type) find
(String name, ApplicationType type, String version) findAll()
org.springframework.data.domain.Page<AppRegistration>
findAll
(org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<AppRegistration>
findAllByTypeAndNameIsLike
(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<AppRegistration>
findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue
(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable) org.springframework.data.domain.Page<AppRegistration>
findAllByTypeAndNameIsLikeAndVersionAndDefaultVersion
(ApplicationType type, String name, String version, boolean defaultVersion, org.springframework.data.domain.Pageable pageable) Returns all app registrations based on various optional parameters.getAppMetadataResource
(AppRegistration appRegistration) Converts application's metadata URI into Spring resource object.getAppResource
(AppRegistration appRegistration) Converts application's URI into Spring resource object.getDefaultApp
(String name, ApplicationType type) getResourceVersion
(String uriString) Returns the version for the given resource URI string.getResourceVersion
(Resource resource) getResourceWithoutVersion
(Resource resource) Returns a string representing the resource with version subtractedImport bulk of applications from input load filesprotected boolean
isOverwrite
(AppRegistration app, boolean overwrite) protected Properties
loadProperties
(Resource resource) Saves a newAppRegistration
identified by its name, type, version and URIs.save
(AppRegistration app) Save anAppRegistration
instance.void
setDefaultApp
(String name, ApplicationType type, String version) Set an application with name, type and version as the default for all name:type applications.void
validate
(AppRegistration registration, String uri, String version) Validate given registration with given uri and version.protected URI
warnOnMalformedURI
(String key, URI uri)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger -
auditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService -
auditServiceUtils
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils auditServiceUtils
-
-
Constructor Details
-
DefaultAppRegistryService
public DefaultAppRegistryService(AppRegistrationRepository appRegistrationRepository, AppResourceCommon appResourceCommon, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService)
-
-
Method Details
-
find
- Specified by:
find
in interfaceAppRegistryService
- Parameters:
name
- application nametype
- application typ- Returns:
- the application with those name and type and default version
-
find
- Specified by:
find
in interfaceAppRegistryService
- Parameters:
name
- application nametype
- application typeversion
- application version- Returns:
- the application with those name and type and default version
-
getDefaultApp
- Specified by:
getDefaultApp
in interfaceAppRegistryService
- Parameters:
name
- application nametype
- application version- Returns:
- the default application for this name:type pair. Returns null if no name:type application exists or if none of the name:type applications is set as default.
-
validate
Description copied from interface:AppRegistryService
Validate given registration with given uri and version. Validation will fail if given uri logically impossible to use with further expected logic with using versions.- Specified by:
validate
in interfaceAppRegistryService
- Parameters:
registration
- app registrationuri
- uri of the registrationversion
- version of the registration
-
setDefaultApp
Description copied from interface:AppRegistryService
Set an application with name, type and version as the default for all name:type applications. The previous default name:type application is set to non-default.- Specified by:
setDefaultApp
in interfaceAppRegistryService
- Parameters:
name
- application nametype
- application typeversion
- application version.
-
findAll
- Specified by:
findAll
in interfaceAppRegistryService
- Returns:
- returns all
AppRegistration
's including multiple version for the same application.
-
findAllByTypeAndNameIsLike
public org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLike(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable) - Specified by:
findAllByTypeAndNameIsLike
in interfaceAppRegistryService
- Parameters:
type
- appliation typename
- application namepageable
- Pagination information- Returns:
- returns all
AppRegistration
versions for given name and type. Uses the pagination.
-
findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue
public org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable) - Specified by:
findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue
in interfaceAppRegistryService
- Parameters:
type
- appliation typename
- application namepageable
- Pagination information- Returns:
- returns the
AppRegistration
s that have the default version set to `true` and matches the given name and type. Uses the pagination.
-
findAll
public org.springframework.data.domain.Page<AppRegistration> findAll(org.springframework.data.domain.Pageable pageable) - Specified by:
findAll
in interfaceAppRegistryService
- Parameters:
pageable
- Pagination information- Returns:
- returns all
AppRegistration
's including multiple version for the same application. Uses the pagination.
-
save
public AppRegistration save(String name, ApplicationType type, String version, URI uri, URI metadataUri) Description copied from interface:AppRegistryService
Saves a newAppRegistration
identified by its name, type, version and URIs.- Specified by:
save
in interfaceAppRegistryService
- Parameters:
name
- Name of the AppRegistration to savetype
- Type of the AppRegistration to saveversion
- Version of the AppRegistration to saveuri
- Resource uri of the AppRegistration to savemetadataUri
- metadata of the AppRegistration to save- Returns:
- the saved AppRegistration
-
save
Description copied from interface:AppRegistryService
Save anAppRegistration
instance.- Specified by:
save
in interfaceAppRegistryService
- Parameters:
app
- appRegistration to save- Returns:
- the saved appRegistration
-
delete
Deletes anAppRegistration
. If theAppRegistration
does not exist, aNoSuchAppRegistrationException
will be thrown.- Specified by:
delete
in interfaceAppRegistryService
- Parameters:
name
- Name of the AppRegistration to deletetype
- Type of the AppRegistration to deleteversion
- Version of the AppRegistration to delete
-
deleteAll
Description copied from interface:AppRegistryService
Deletes all providedAppRegistration
's.- Specified by:
deleteAll
in interfaceAppRegistryService
- Parameters:
appRegistrations
- theAppRegistration
s that will be deleted
-
isOverwrite
-
appExist
Description copied from interface:AppRegistryService
Checks if an application with such name and type exists and is set as default.- Specified by:
appExist
in interfaceAppRegistryService
- Parameters:
name
- applicaiton nametype
- applicaiton type- Returns:
- true if a default application with this name and type exists.
-
appExist
Description copied from interface:AppRegistryService
Checks if anAppRegistration
with this name, type and version exists.- Specified by:
appExist
in interfaceAppRegistryService
- Parameters:
name
- application nametype
- application typeversion
- application version.- Returns:
- true if the AppRegistration exists, false otherwise.
-
getAppResource
Description copied from interface:AppRegistryService
Converts application's URI into Spring resource object. Supports File:, Http:, Maven: and Docker: schemas- Specified by:
getAppResource
in interfaceAppRegistryService
- Parameters:
appRegistration
- the application registration- Returns:
- Returns
Resource
instance that corresponds to application's URI
-
getAppMetadataResource
Description copied from interface:AppRegistryService
Converts application's metadata URI into Spring resource object. Supports File:, Http:, Maven: and Docker: schemas- Specified by:
getAppMetadataResource
in interfaceAppRegistryService
- Parameters:
appRegistration
- the application registration- Returns:
- Returns
Resource
instance that corresponds to application's metdata URI
-
getResourceVersion
- Specified by:
getResourceVersion
in interfaceAppRegistryService
- Parameters:
resource
- to retrieve the version for- Returns:
- Returns the version for the provided resource
-
getResourceWithoutVersion
Description copied from interface:AppRegistryService
Returns a string representing the resource with version subtracted- Specified by:
getResourceWithoutVersion
in interfaceAppRegistryService
- Parameters:
resource
- to be represented as string.- Returns:
- String representation of the resource.
-
getResourceVersion
Returns the version for the given resource URI string.- Specified by:
getResourceVersion
in interfaceAppRegistryService
- Parameters:
uriString
- String representation of the resource URI- Returns:
- the resource version
-
findAllByTypeAndNameIsLikeAndVersionAndDefaultVersion
public org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLikeAndVersionAndDefaultVersion(ApplicationType type, String name, String version, boolean defaultVersion, org.springframework.data.domain.Pageable pageable) Description copied from interface:AppRegistryService
Returns all app registrations based on various optional parameters.- Specified by:
findAllByTypeAndNameIsLikeAndVersionAndDefaultVersion
in interfaceAppRegistryService
- Parameters:
type
- application typename
- application nameversion
- application versiondefaultVersion
- application default versionpageable
- Pagination information- Returns:
- returns all
AppRegistration
versions for given name and type. Uses the pagination.
-
loadProperties
-
warnOnMalformedURI
-
importAll
Description copied from interface:AppRegistryService
Import bulk of applications from input load files- Specified by:
importAll
in interfaceAppRegistryService
- Parameters:
overwrite
- if set to true this command will override and existing application with same name:type:version If set to false operation will throw an exception in the application already exists.resources
- list of input load files- Returns:
- list of application being imported
-