public abstract class AbstractAppRegistryCommon extends Object implements AppRegistryCommon
AppRegistryCommon
implementation common for the Classic and the Skipper modes.Modifier and Type | Field and Description |
---|---|
static String |
METADATA_KEY_SUFFIX |
protected static Function<Map.Entry<Object,Object>,AbstractMap.SimpleImmutableEntry<String,URI>> |
toStringAndUriFunc |
Constructor and Description |
---|
AbstractAppRegistryCommon(AppResourceCommon appResourceService) |
Modifier and Type | Method and Description |
---|---|
org.springframework.core.io.Resource |
getAppMetadataResource(AppRegistration appRegistration)
Converts application's metadata URI into Spring resource object.
|
org.springframework.core.io.Resource |
getAppResource(AppRegistration appRegistration)
Converts application's URI into Spring resource object.
|
String |
getResourceVersion(org.springframework.core.io.Resource resource) |
String |
getResourceVersion(String uriString)
Returns the version for the given resource URI string.
|
String |
getResourceWithoutVersion(org.springframework.core.io.Resource resource)
Returns a string representing the resource with version subtracted
|
List<AppRegistration> |
importAll(boolean overwrite,
org.springframework.core.io.Resource... resources)
Import bulk of applications from input load files
|
protected abstract boolean |
isOverwrite(AppRegistration app,
boolean overwrite) |
protected Properties |
loadProperties(org.springframework.core.io.Resource resource) |
protected URI |
metadataUriFromProperties(String key,
Properties properties) |
protected Stream<AppRegistration> |
toValidAppRegistration(Map.Entry<String,URI> kv,
URI metadataURI)
Builds a
Stream from key/value mapping. |
protected URI |
warnOnMalformedURI(String key,
URI uri) |
public static final String METADATA_KEY_SUFFIX
public AbstractAppRegistryCommon(AppResourceCommon appResourceService)
public org.springframework.core.io.Resource getAppResource(AppRegistration appRegistration)
AppRegistryCommon
getAppResource
in interface AppRegistryCommon
appRegistration
- the application registrationResource
instance that corresponds to application's URIpublic org.springframework.core.io.Resource getAppMetadataResource(AppRegistration appRegistration)
AppRegistryCommon
getAppMetadataResource
in interface AppRegistryCommon
appRegistration
- the application registrationResource
instance that corresponds to application's metdata URIpublic String getResourceVersion(org.springframework.core.io.Resource resource)
getResourceVersion
in interface AppRegistryCommon
resource
- to retrieve the version forpublic String getResourceWithoutVersion(org.springframework.core.io.Resource resource)
AppRegistryCommon
getResourceWithoutVersion
in interface AppRegistryCommon
resource
- to be represented as string.public String getResourceVersion(String uriString)
getResourceVersion
in interface AppRegistryCommon
uriString
- String representation of the resource URIprotected Properties loadProperties(org.springframework.core.io.Resource resource)
public List<AppRegistration> importAll(boolean overwrite, org.springframework.core.io.Resource... resources)
AppRegistryCommon
importAll
in interface AppRegistryCommon
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 filesprotected abstract boolean isOverwrite(AppRegistration app, boolean overwrite)
protected Stream<AppRegistration> toValidAppRegistration(Map.Entry<String,URI> kv, URI metadataURI)
Stream
from key/value mapping.kv
- key/value representing app key (key) and app URI (value)metadataURI
- metadataUri computed from a given app keyprotected URI metadataUriFromProperties(String key, Properties properties)
Copyright © 2019 Pivotal Software, Inc.. All rights reserved.