Class CDORestConfiguration

java.lang.Object
org.eclipse.emf.cdo.server.rest.CDORestConfiguration

public final class CDORestConfiguration extends Object
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 Details

    • UNLIMITED

      public static final int UNLIMITED
      Sentinel 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 - if config is null
      IllegalArgumentException - if a supplied value is not an integer or falls outside the setting's range
    • CDORestConfiguration

      public CDORestConfiguration(CDORestConfiguration source)
      Copies all configured values from another configuration without re-reading any system properties.
      Parameters:
      source - the configuration to copy
      Throws:
      NullPointerException - if source is null
  • Method Details

    • equals

      public boolean equals(Object obj)
      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.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare with this configuration
      Returns:
      true if obj is a configuration with the same configured values
    • hashCode

      public int hashCode()
      Returns a hash code based on all 14 configured values.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code consistent with equals(Object)
    • getMaxRequestBytes

      public int getMaxRequestBytes()
      Returns the maximum number of bytes accepted for a commit request body, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxOperations

      public int getMaxOperations()
      Returns the maximum number of operations accepted in one commit request, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxJsonDepth

      public int getMaxJsonDepth()
      Returns the maximum JSON nesting depth accepted in a commit request, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxPathLength

      public int getMaxPathLength()
      Returns the maximum request path length, or UNLIMITED.
      Returns:
      the path-length limit
    • setMaxPathLength

      public void setMaxPathLength(int value)
      Sets the maximum request path length.
      Parameters:
      value - a positive character limit or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxQueryLength

      public int getMaxQueryLength()
      Returns the maximum encoded query-string length, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxQueryParameters

      public int getMaxQueryParameters()
      Returns the maximum number of query parameters, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxContainmentDepth

      public int getMaxContainmentDepth()
      Returns the maximum containment traversal depth, or UNLIMITED.
      Returns:
      the containment-depth limit
    • setMaxContainmentDepth

      public void setMaxContainmentDepth(int value)
      Sets the maximum containment traversal depth.
      Parameters:
      value - a non-negative depth limit or UNLIMITED
      Throws:
      IllegalArgumentException - if value is negative and is not UNLIMITED
    • getMaxReferenceDepth

      public int getMaxReferenceDepth()
      Returns the maximum non-containment reference traversal depth, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is negative and is not UNLIMITED
    • 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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxCollectionLimit

      public int getMaxCollectionLimit()
      Returns the maximum requested collection output size, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxCollectionOffset

      public int getMaxCollectionOffset()
      Returns the maximum collection offset, or UNLIMITED.
      Returns:
      the collection-offset limit
    • setMaxCollectionOffset

      public void setMaxCollectionOffset(int value)
      Sets the maximum collection offset.
      Parameters:
      value - a non-negative offset limit or UNLIMITED
      Throws:
      IllegalArgumentException - if value is negative and is not UNLIMITED
    • getMaxGraphObjects

      public int getMaxGraphObjects()
      Returns the maximum graph objects prepared for one response, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • getMaxGraphValues

      public int getMaxGraphValues()
      Returns the maximum graph values prepared for one response, or UNLIMITED.
      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 or UNLIMITED
      Throws:
      IllegalArgumentException - if value is neither positive nor UNLIMITED
    • 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 or CDORevision.UNCHUNKED
      Throws:
      IllegalArgumentException - if value is neither positive nor CDORevision.UNCHUNKED