Package org.alfresco.solr.content
Class SolrContentUrlBuilder
- java.lang.Object
-
- org.alfresco.solr.content.SolrContentUrlBuilder
-
public class SolrContentUrlBuilder extends Object
Utility class that wraps up the creation of SOLR content URLs given arbitrary, string-based metadata. The URL is constructed from a 19 digit number (zero-padded long), which is built from the ACL ID, the DB ID or a CRC32 of the provided metadata, and a numerical version starting with "000".
For example, the DB ID "4775808" will generate "someprefix:///db/4775/808.gz"
The- Since:
- 5.0
- Author:
- Derek Hulley
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlogger
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SolrContentUrlBuilderadd(String key, String value)Add some metadata to the URL generator.Stringget()Get the final content URL using thesupplied metadata.static SolrContentUrlBuilderstart()Factory method to start building the SOLR content URL.
-
-
-
Method Detail
-
start
public static SolrContentUrlBuilder start()
Factory method to start building the SOLR content URL.- Returns:
- an instance of the builder
-
add
public SolrContentUrlBuilder add(String key, String value)
Add some metadata to the URL generator. The order in which metadata is added is irrelevant. Note that there are specific keys that are commonly used and, if provided, may not be null or empty.KEY_TENANT: The name of the tenant or 'default' if missing.KEY_DB_ID: The database ID.KEY_ACL_ID: The ACL ID.
- Parameters:
key- an arbitrary metadata key (never null>value- some metadata value (null is supported)- Returns:
- this builder for more building
- Throws:
IllegalArgumentException- if the key is nullIllegalStateException- if the key has been used already
-
get
public String get()
Get the final content URL using thesupplied metadata.- Returns:
- the SOLR content URL
- Throws:
IllegalStateException- if no metadata has been added
-
-