public class ResourceUtils extends Object
Constructor and Description |
---|
ResourceUtils() |
Modifier and Type | Method and Description |
---|---|
static org.springframework.core.io.Resource |
getResource(String uriString,
org.springframework.cloud.deployer.resource.maven.MavenProperties mavenProperties)
Retrieve the corresponding
Resource instance based on the URI String. |
static String |
getResourceVersion(org.springframework.core.io.Resource resource)
Extracts the version from the resource.
|
static String |
getResourceVersion(String uriString,
org.springframework.cloud.deployer.resource.maven.MavenProperties mavenProperties)
Returns the version for the given resource URI string.
|
static String |
getResourceWithoutVersion(org.springframework.core.io.Resource resource)
Extracts the string representing the resource with the version number extracted.
|
static String |
getUrlResourceVersion(org.springframework.core.io.UrlResource urlResource)
Parse the version number from a
UrlResource . |
static String |
getUrlResourceWithoutVersion(org.springframework.core.io.UrlResource urlResource) |
public static String getUrlResourceVersion(org.springframework.core.io.UrlResource urlResource)
UrlResource
. It can match a simple
<artifactId>-<version>.jar
formatted name. For example, a resource ending in
file-sink-rabbit-1.2.0.RELEASE.jar
will return 1.2.0.RELEASE
. Snapshot
builds of the form file-sink-rabbit-1.2.0.BUILD-SNAPSHOT.jar
and
file-sink-rabbit-1.2.0-SNAPSHOT.jar
are also supportedurlResource
- public static String getUrlResourceWithoutVersion(org.springframework.core.io.UrlResource urlResource)
public static org.springframework.core.io.Resource getResource(String uriString, org.springframework.cloud.deployer.resource.maven.MavenProperties mavenProperties)
Resource
instance based on the URI String.
Maven properties are used if the URI corresponds to maven resource.uriString
- String representation of the resource URImavenProperties
- the maven properties to use in case of maven resourcepublic static String getResourceVersion(org.springframework.core.io.Resource resource)
MavenResource
, DockerResource
, and UrlResource
. @param resource to be
used. @return the version the resource. @throwspublic static String getResourceVersion(String uriString, org.springframework.cloud.deployer.resource.maven.MavenProperties mavenProperties)
uriString
- String representation of the resource URImavenProperties
- the maven properties to use in case of maven resourcepublic static String getResourceWithoutVersion(org.springframework.core.io.Resource resource)
resource
- to be used.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.