Class DefaultCloudFontConnector
- java.lang.Object
-
- ca.cgjennings.graphics.cloudfonts.DefaultCloudFontConnector
-
- All Implemented Interfaces:
CloudFontConnector
public class DefaultCloudFontConnector extends java.lang.Object implements CloudFontConnector
The connector used to implementCloudFonts.getDefaultCollection()
.
-
-
Constructor Summary
Constructors Constructor Description DefaultCloudFontConnector()
DefaultCloudFontConnector(java.lang.String identifier, java.lang.String cacheName, java.lang.String fontBaseUrl, java.lang.String metadataUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CloudFontCollection
createFontCollection()
Creates a collection that will use this connector's connection details.java.lang.String
getIdentifier()
Returns a unique identifier for the connector.java.io.File
getLocalCacheRoot()
Returns the root directory of the local cache.java.net.URL
getUrlForFontPath(java.lang.String fontPath)
Given a path to a font resource relative to the cloud file system root, returns a URL that can be used to download the resource.java.net.URL
getUrlForMetadata()
Returns a URL for metadata that describes the available fonts.java.net.URL
getUrlForMetadataVersion()
Returns a URL that returns a version code for the font metadata.
-
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from interface:CloudFontConnector
Returns a unique identifier for the connector. This can be used to distinguish data from different connectors, for example, when storing settings.- Specified by:
getIdentifier
in interfaceCloudFontConnector
- Returns:
- a unique identifier for the connector
-
getUrlForFontPath
public java.net.URL getUrlForFontPath(java.lang.String fontPath)
Description copied from interface:CloudFontConnector
Given a path to a font resource relative to the cloud file system root, returns a URL that can be used to download the resource.- Specified by:
getUrlForFontPath
in interfaceCloudFontConnector
- Parameters:
fontPath
- a path to a font resource, such as"ofl/lobster/Lobster-Regular.ttf"
- Returns:
- a URL that can be used to download the resource
-
getUrlForMetadata
public java.net.URL getUrlForMetadata()
Description copied from interface:CloudFontConnector
Returns a URL for metadata that describes the available fonts.- Specified by:
getUrlForMetadata
in interfaceCloudFontConnector
- Returns:
- a URL for the font metadata
-
getUrlForMetadataVersion
public java.net.URL getUrlForMetadataVersion()
Description copied from interface:CloudFontConnector
Returns a URL that returns a version code for the font metadata. When this version code changes, any cached metadata should be considered stale.- Specified by:
getUrlForMetadataVersion
in interfaceCloudFontConnector
- Returns:
- a URL for the font metadata version
-
getLocalCacheRoot
public java.io.File getLocalCacheRoot()
Description copied from interface:CloudFontConnector
Returns the root directory of the local cache. This directory is used to store downloaded font files and metadata. Two collection instances should not share the same cache root.- Specified by:
getLocalCacheRoot
in interfaceCloudFontConnector
- Returns:
- the local cache root
-
createFontCollection
public final CloudFontCollection createFontCollection()
Description copied from interface:CloudFontConnector
Creates a collection that will use this connector's connection details.- Specified by:
createFontCollection
in interfaceCloudFontConnector
-
-