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
Resources.
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
FieldsModifier and TypeFieldDescriptionprotected final org.springframework.cloud.dataflow.audit.service.AuditRecordServiceprotected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtilsprotected static final org.slf4j.Logger -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAppRegistryService(AppRegistrationRepository appRegistrationRepository, AppResourceCommon appResourceCommon, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService) -
Method Summary
Modifier and TypeMethodDescriptionbooleanappExist(String name, ApplicationType type) Checks if an application with such name and type exists and is set as default.booleanappExist(String name, ApplicationType type, String version) Checks if anAppRegistrationwith this name, type and version exists.voiddelete(String name, ApplicationType type, String version) Deletes anAppRegistration.voiddeleteAll(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 booleanisOverwrite(AppRegistration app, boolean overwrite) protected PropertiesloadProperties(Resource resource) Saves a newAppRegistrationidentified by its name, type, version and URIs.save(AppRegistration app) Save anAppRegistrationinstance.voidsetDefaultApp(String name, ApplicationType type, String version) Set an application with name, type and version as the default for all name:type applications.voidvalidate(AppRegistration registration, String uri, String version) Validate given registration with given uri and version.protected URIwarnOnMalformedURI(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:
findin interfaceAppRegistryService- Parameters:
name- application nametype- application typ- Returns:
- the application with those name and type and default version
-
find
- Specified by:
findin interfaceAppRegistryService- Parameters:
name- application nametype- application typeversion- application version- Returns:
- the application with those name and type and default version
-
getDefaultApp
- Specified by:
getDefaultAppin 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:AppRegistryServiceValidate 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:
validatein interfaceAppRegistryService- Parameters:
registration- app registrationuri- uri of the registrationversion- version of the registration
-
setDefaultApp
Description copied from interface:AppRegistryServiceSet 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:
setDefaultAppin interfaceAppRegistryService- Parameters:
name- application nametype- application typeversion- application version.
-
findAll
- Specified by:
findAllin 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:
findAllByTypeAndNameIsLikein interfaceAppRegistryService- Parameters:
type- appliation typename- application namepageable- Pagination information- Returns:
- returns all
AppRegistrationversions 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:
findAllByTypeAndNameIsLikeAndDefaultVersionIsTruein interfaceAppRegistryService- Parameters:
type- appliation typename- application namepageable- Pagination information- Returns:
- returns the
AppRegistrations 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:
findAllin 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:AppRegistryServiceSaves a newAppRegistrationidentified by its name, type, version and URIs.- Specified by:
savein 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:AppRegistryServiceSave anAppRegistrationinstance.- Specified by:
savein interfaceAppRegistryService- Parameters:
app- appRegistration to save- Returns:
- the saved appRegistration
-
delete
Deletes anAppRegistration. If theAppRegistrationdoes not exist, aNoSuchAppRegistrationExceptionwill be thrown.- Specified by:
deletein 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:AppRegistryServiceDeletes all providedAppRegistration's.- Specified by:
deleteAllin interfaceAppRegistryService- Parameters:
appRegistrations- theAppRegistrations that will be deleted
-
isOverwrite
-
appExist
Description copied from interface:AppRegistryServiceChecks if an application with such name and type exists and is set as default.- Specified by:
appExistin interfaceAppRegistryService- Parameters:
name- applicaiton nametype- applicaiton type- Returns:
- true if a default application with this name and type exists.
-
appExist
Description copied from interface:AppRegistryServiceChecks if anAppRegistrationwith this name, type and version exists.- Specified by:
appExistin interfaceAppRegistryService- Parameters:
name- application nametype- application typeversion- application version.- Returns:
- true if the AppRegistration exists, false otherwise.
-
getAppResource
Description copied from interface:AppRegistryServiceConverts application's URI into Spring resource object. Supports File:, Http:, Maven: and Docker: schemas- Specified by:
getAppResourcein interfaceAppRegistryService- Parameters:
appRegistration- the application registration- Returns:
- Returns
Resourceinstance that corresponds to application's URI
-
getAppMetadataResource
Description copied from interface:AppRegistryServiceConverts application's metadata URI into Spring resource object. Supports File:, Http:, Maven: and Docker: schemas- Specified by:
getAppMetadataResourcein interfaceAppRegistryService- Parameters:
appRegistration- the application registration- Returns:
- Returns
Resourceinstance that corresponds to application's metdata URI
-
getResourceVersion
- Specified by:
getResourceVersionin interfaceAppRegistryService- Parameters:
resource- to retrieve the version for- Returns:
- Returns the version for the provided resource
-
getResourceWithoutVersion
Description copied from interface:AppRegistryServiceReturns a string representing the resource with version subtracted- Specified by:
getResourceWithoutVersionin 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:
getResourceVersionin 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:AppRegistryServiceReturns all app registrations based on various optional parameters.- Specified by:
findAllByTypeAndNameIsLikeAndVersionAndDefaultVersionin interfaceAppRegistryService- Parameters:
type- application typename- application nameversion- application versiondefaultVersion- application default versionpageable- Pagination information- Returns:
- returns all
AppRegistrationversions for given name and type. Uses the pagination.
-
loadProperties
-
warnOnMalformedURI
-
importAll
Description copied from interface:AppRegistryServiceImport bulk of applications from input load files- Specified by:
importAllin 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
-