@Transactional public class DefaultAppRegistryService extends Object implements AppRegistryService
AppRegistryService that operates on higher level
DefaultAppRegistryService objects and supports on-demand loading of
Resources.
Stores AppRegistration with up to two keys:
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.cloud.dataflow.audit.service.AuditRecordService |
auditRecordService |
protected org.springframework.cloud.dataflow.audit.service.AuditServiceUtils |
auditServiceUtils |
protected static org.slf4j.Logger |
logger |
static String |
METADATA_KEY_SUFFIX |
| Constructor and Description |
|---|
DefaultAppRegistryService(AppRegistrationRepository appRegistrationRepository,
AppResourceCommon appResourceCommon,
org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
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 an
AppRegistration with this name, type and version exists. |
void |
delete(String name,
ApplicationType type,
String version)
Deletes an
AppRegistration. |
void |
deleteAll(Iterable<AppRegistration> appRegistrations)
Deletes all provided
AppRegistration's. |
AppRegistration |
find(String name,
ApplicationType type) |
AppRegistration |
find(String name,
ApplicationType type,
String version) |
List<AppRegistration> |
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.
|
Resource |
getAppMetadataResource(AppRegistration appRegistration)
Converts application's metadata URI into Spring resource object.
|
Resource |
getAppResource(AppRegistration appRegistration)
Converts application's URI into Spring resource object.
|
AppRegistration |
getDefaultApp(String name,
ApplicationType type) |
String |
getResourceVersion(Resource resource) |
String |
getResourceVersion(String uriString)
Returns the version for the given resource URI string.
|
String |
getResourceWithoutVersion(Resource resource)
Returns a string representing the resource with version subtracted
|
List<AppRegistration> |
importAll(boolean overwrite,
Resource... resources)
Import bulk of applications from input load files
|
protected boolean |
isOverwrite(AppRegistration app,
boolean overwrite) |
protected Properties |
loadProperties(Resource resource) |
AppRegistration |
save(AppRegistration app)
Save an
AppRegistration instance. |
AppRegistration |
save(String name,
ApplicationType type,
String version,
URI uri,
URI metadataUri,
org.springframework.cloud.dataflow.schema.AppBootSchemaVersion bootVersion)
Saves a new
AppRegistration identified by its name, type, version and URIs. |
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) |
public static final String METADATA_KEY_SUFFIX
protected static final org.slf4j.Logger logger
protected final org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService
protected final org.springframework.cloud.dataflow.audit.service.AuditServiceUtils auditServiceUtils
public DefaultAppRegistryService(AppRegistrationRepository appRegistrationRepository, AppResourceCommon appResourceCommon, org.springframework.cloud.dataflow.audit.service.AuditRecordService auditRecordService)
public AppRegistration find(String name, ApplicationType type)
find in interface AppRegistryServicename - application nametype - application typpublic AppRegistration find(String name, ApplicationType type, String version)
find in interface AppRegistryServicename - application nametype - application typeversion - application versionpublic AppRegistration getDefaultApp(String name, ApplicationType type)
getDefaultApp in interface AppRegistryServicename - application nametype - application versionpublic void validate(AppRegistration registration, String uri, String version)
AppRegistryServicevalidate in interface AppRegistryServiceregistration - app registrationuri - uri of the registrationversion - version of the registrationpublic void setDefaultApp(String name, ApplicationType type, String version)
AppRegistryServicesetDefaultApp in interface AppRegistryServicename - application nametype - application typeversion - application version.public List<AppRegistration> findAll()
findAll in interface AppRegistryServiceAppRegistration's including multiple version for the same
application.public org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLike(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable)
findAllByTypeAndNameIsLike in interface AppRegistryServicetype - appliation typename - application namepageable - Pagination informationAppRegistration versions for given name and type. Uses the
pagination.public org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue(ApplicationType type, String name, org.springframework.data.domain.Pageable pageable)
findAllByTypeAndNameIsLikeAndDefaultVersionIsTrue in interface AppRegistryServicetype - appliation typename - application namepageable - Pagination informationAppRegistrations that have the default version set to `true` and matches the given name and type. Uses the
pagination.public org.springframework.data.domain.Page<AppRegistration> findAll(org.springframework.data.domain.Pageable pageable)
findAll in interface AppRegistryServicepageable - Pagination informationAppRegistration's including multiple version for the same
application. Uses the pagination.public AppRegistration save(String name, ApplicationType type, String version, URI uri, URI metadataUri, org.springframework.cloud.dataflow.schema.AppBootSchemaVersion bootVersion)
AppRegistryServiceAppRegistration identified by its name, type, version and URIs.save in interface AppRegistryServicename - 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 savebootVersion - Spring Boot schema version indicating Task 2, Batch 4 or Task 3, Batch 5public AppRegistration save(AppRegistration app)
AppRegistryServiceAppRegistration instance.save in interface AppRegistryServiceapp - appRegistration to savepublic void delete(String name, ApplicationType type, String version)
AppRegistration. If the AppRegistration does not exist, a
NoSuchAppRegistrationException will be thrown.delete in interface AppRegistryServicename - Name of the AppRegistration to deletetype - Type of the AppRegistration to deleteversion - Version of the AppRegistration to deletepublic void deleteAll(Iterable<AppRegistration> appRegistrations)
AppRegistryServiceAppRegistration's.deleteAll in interface AppRegistryServiceappRegistrations - the AppRegistrations that will be deletedprotected boolean isOverwrite(AppRegistration app, boolean overwrite)
public boolean appExist(String name, ApplicationType type)
AppRegistryServiceappExist in interface AppRegistryServicename - applicaiton nametype - applicaiton typepublic boolean appExist(String name, ApplicationType type, String version)
AppRegistryServiceAppRegistration with this name, type and version exists.appExist in interface AppRegistryServicename - application nametype - application typeversion - application version.public Resource getAppResource(AppRegistration appRegistration)
AppRegistryServicegetAppResource in interface AppRegistryServiceappRegistration - the application registrationResource instance that corresponds to application's URIpublic Resource getAppMetadataResource(AppRegistration appRegistration)
AppRegistryServicegetAppMetadataResource in interface AppRegistryServiceappRegistration - the application registrationResource instance that corresponds to application's metdata URIpublic String getResourceVersion(Resource resource)
getResourceVersion in interface AppRegistryServiceresource - to retrieve the version forpublic String getResourceWithoutVersion(Resource resource)
AppRegistryServicegetResourceWithoutVersion in interface AppRegistryServiceresource - to be represented as string.public String getResourceVersion(String uriString)
getResourceVersion in interface AppRegistryServiceuriString - String representation of the resource URIpublic org.springframework.data.domain.Page<AppRegistration> findAllByTypeAndNameIsLikeAndVersionAndDefaultVersion(ApplicationType type, String name, String version, boolean defaultVersion, org.springframework.data.domain.Pageable pageable)
AppRegistryServicefindAllByTypeAndNameIsLikeAndVersionAndDefaultVersion in interface AppRegistryServicetype - application typename - application nameversion - application versiondefaultVersion - application default versionpageable - Pagination informationAppRegistration versions for given name and type. Uses the
pagination.protected Properties loadProperties(Resource resource)
public List<AppRegistration> importAll(boolean overwrite, Resource... resources)
AppRegistryServiceimportAll in interface AppRegistryServiceoverwrite - 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 filesCopyright © 2024 Pivotal Software, Inc.. All rights reserved.