Class CDORestConfiguration
java.lang.Object
org.eclipse.emf.cdo.server.rest.CDORestConfiguration
Mutable configuration for one CDO REST service. A new instance reads its defaults from
OMPlatform once when
this class is initialized. A service copies the supplied instance when it is constructed, so later changes to this
object do not affect an active service.
Resource limits use UNLIMITED when disabling the limit is meaningful. Depth and offset limits also allow
zero. The default collection limit accepts UNLIMITED to remove its page-size bound, while a finite maximum
collection limit still caps the effective default. The revision reference chunk accepts CDORevision.UNCHUNKED
to use the repository's unchunked legacy loading path.
- Author:
- Eike Stepper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinel for a configurable resource limit that is disabled. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a configuration using the system-property values read when this class was initialized, or their fallback values when no property is set.Copies all configured values from another configuration without re-reading any system properties.CDORestConfiguration(org.eclipse.net4j.util.collection.Tree config) Creates a configuration from repository settings in a configuration tree. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this configuration with another by all 14 configured values.intReturns the effective default number of values emitted for each collection.intReturns the maximum requested collection output size, orUNLIMITED.intReturns the maximum collection offset, orUNLIMITED.intReturns the maximum containment traversal depth, orUNLIMITED.intReturns the maximum graph objects prepared for one response, orUNLIMITED.intReturns the maximum graph values prepared for one response, orUNLIMITED.intReturns the maximum JSON nesting depth accepted in a commit request, orUNLIMITED.intReturns the maximum number of operations accepted in one commit request, orUNLIMITED.intReturns the maximum request path length, orUNLIMITED.intReturns the maximum encoded query-string length, orUNLIMITED.intReturns the maximum number of query parameters, orUNLIMITED.intReturns the maximum non-containment reference traversal depth, orUNLIMITED.intReturns the maximum number of bytes accepted for a commit request body, orUNLIMITED.intReturns the reference chunk used by the legacy revision-loading path.inthashCode()Returns a hash code based on all 14 configured values.voidsetDefaultCollectionLimit(int value) Sets the default number of values emitted for each collection.voidsetMaxCollectionLimit(int value) Sets the maximum requested collection output size.voidsetMaxCollectionOffset(int value) Sets the maximum collection offset.voidsetMaxContainmentDepth(int value) Sets the maximum containment traversal depth.voidsetMaxGraphObjects(int value) Sets the maximum graph objects prepared for one response.voidsetMaxGraphValues(int value) Sets the maximum graph values prepared for one response.voidsetMaxJsonDepth(int value) Sets the maximum JSON nesting depth accepted in a commit request.voidsetMaxOperations(int value) Sets the maximum number of operations accepted in one commit request.voidsetMaxPathLength(int value) Sets the maximum request path length.voidsetMaxQueryLength(int value) Sets the maximum encoded query-string length.voidsetMaxQueryParameters(int value) Sets the maximum number of query parameters.voidsetMaxReferenceDepth(int value) Sets the maximum non-containment reference traversal depth.voidsetMaxRequestBytes(int value) Sets the maximum number of bytes accepted for a commit request body.voidsetRevisionReferenceChunk(int value) Sets the reference chunk used by the legacy revision-loading path.
-
Field Details
-
UNLIMITED
public static final int UNLIMITEDSentinel for a configurable resource limit that is disabled.- See Also:
-
-
Constructor Details
-
CDORestConfiguration
public CDORestConfiguration()Creates a configuration using the system-property values read when this class was initialized, or their fallback values when no property is set.Each property is evaluated once for the class, so later system-property changes do not alter this instance.
- Throws:
IllegalArgumentException- if a configured property has a value outside its supported range
-
CDORestConfiguration
public CDORestConfiguration(org.eclipse.net4j.util.collection.Tree config) Creates a configuration from repository settings in a configuration tree. Missing or blank attributes use the corresponding system-property defaults captured when this class was initialized. Explicit tree values are parsed and validated directly, so an unused system-property default cannot reject an explicit override.- Parameters:
config- the tree containing REST configuration attributes- Throws:
NullPointerException- ifconfigisnullIllegalArgumentException- if a supplied value is not an integer or falls outside the setting's range
-
CDORestConfiguration
Copies all configured values from another configuration without re-reading any system properties.- Parameters:
source- the configuration to copy- Throws:
NullPointerException- ifsourceisnull
-
-
Method Details
-
equals
Compares this configuration with another by all 14 configured values. The configured default collection limit is compared directly rather than through its effective, maximum-capped value. -
hashCode
public int hashCode()Returns a hash code based on all 14 configured values.- Overrides:
hashCodein classObject- Returns:
- a hash code consistent with
equals(Object)
-
getMaxRequestBytes
public int getMaxRequestBytes()Returns the maximum number of bytes accepted for a commit request body, orUNLIMITED.- Returns:
- the request-body byte limit
-
setMaxRequestBytes
public void setMaxRequestBytes(int value) Sets the maximum number of bytes accepted for a commit request body.- Parameters:
value- a positive byte limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxOperations
public int getMaxOperations()Returns the maximum number of operations accepted in one commit request, orUNLIMITED.- Returns:
- the operation-count limit
-
setMaxOperations
public void setMaxOperations(int value) Sets the maximum number of operations accepted in one commit request.- Parameters:
value- a positive operation count orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxJsonDepth
public int getMaxJsonDepth()Returns the maximum JSON nesting depth accepted in a commit request, orUNLIMITED.- Returns:
- the JSON nesting limit
-
setMaxJsonDepth
public void setMaxJsonDepth(int value) Sets the maximum JSON nesting depth accepted in a commit request.- Parameters:
value- a positive depth limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxPathLength
public int getMaxPathLength()Returns the maximum request path length, orUNLIMITED.- Returns:
- the path-length limit
-
setMaxPathLength
public void setMaxPathLength(int value) Sets the maximum request path length.- Parameters:
value- a positive character limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxQueryLength
public int getMaxQueryLength()Returns the maximum encoded query-string length, orUNLIMITED.- Returns:
- the query-string length limit
-
setMaxQueryLength
public void setMaxQueryLength(int value) Sets the maximum encoded query-string length.- Parameters:
value- a positive character limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxQueryParameters
public int getMaxQueryParameters()Returns the maximum number of query parameters, orUNLIMITED.- Returns:
- the query-parameter count limit
-
setMaxQueryParameters
public void setMaxQueryParameters(int value) Sets the maximum number of query parameters.- Parameters:
value- a positive parameter count orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxContainmentDepth
public int getMaxContainmentDepth()Returns the maximum containment traversal depth, orUNLIMITED.- Returns:
- the containment-depth limit
-
setMaxContainmentDepth
public void setMaxContainmentDepth(int value) Sets the maximum containment traversal depth.- Parameters:
value- a non-negative depth limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis negative and is notUNLIMITED
-
getMaxReferenceDepth
public int getMaxReferenceDepth()Returns the maximum non-containment reference traversal depth, orUNLIMITED.- Returns:
- the reference-depth limit
-
setMaxReferenceDepth
public void setMaxReferenceDepth(int value) Sets the maximum non-containment reference traversal depth.- Parameters:
value- a non-negative depth limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis negative and is notUNLIMITED
-
getDefaultCollectionLimit
public int getDefaultCollectionLimit()Returns the effective default number of values emitted for each collection. A finite maximum collection limit caps an unlimited or larger default.- Returns:
- the effective default collection limit, or
UNLIMITED
-
setDefaultCollectionLimit
public void setDefaultCollectionLimit(int value) Sets the default number of values emitted for each collection. The effective value is capped by the configured maximum collection limit when that maximum is enabled.- Parameters:
value- a positive number of values orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxCollectionLimit
public int getMaxCollectionLimit()Returns the maximum requested collection output size, orUNLIMITED.- Returns:
- the collection-size limit
-
setMaxCollectionLimit
public void setMaxCollectionLimit(int value) Sets the maximum requested collection output size. A positive maximum below the configured default collection limit caps the effective default without making setter order significant.- Parameters:
value- a positive collection-size limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxCollectionOffset
public int getMaxCollectionOffset()Returns the maximum collection offset, orUNLIMITED.- Returns:
- the collection-offset limit
-
setMaxCollectionOffset
public void setMaxCollectionOffset(int value) Sets the maximum collection offset.- Parameters:
value- a non-negative offset limit orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis negative and is notUNLIMITED
-
getMaxGraphObjects
public int getMaxGraphObjects()Returns the maximum graph objects prepared for one response, orUNLIMITED.- Returns:
- the graph-object limit
-
setMaxGraphObjects
public void setMaxGraphObjects(int value) Sets the maximum graph objects prepared for one response.- Parameters:
value- a positive object count orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getMaxGraphValues
public int getMaxGraphValues()Returns the maximum graph values prepared for one response, orUNLIMITED.- Returns:
- the graph-value limit
-
setMaxGraphValues
public void setMaxGraphValues(int value) Sets the maximum graph values prepared for one response.- Parameters:
value- a positive value count orUNLIMITED- Throws:
IllegalArgumentException- ifvalueis neither positive norUNLIMITED
-
getRevisionReferenceChunk
public int getRevisionReferenceChunk()Returns the reference chunk used by the legacy revision-loading path.- Returns:
- a positive chunk size or
CDORevision.UNCHUNKED
-
setRevisionReferenceChunk
public void setRevisionReferenceChunk(int value) Sets the reference chunk used by the legacy revision-loading path.- Parameters:
value- a positive chunk size orCDORevision.UNCHUNKED- Throws:
IllegalArgumentException- ifvalueis neither positive norCDORevision.UNCHUNKED
-