Class ValueFactoryImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.value.jcr.PartialValueFactory
-
- org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl
-
- All Implemented Interfaces:
javax.jcr.ValueFactory,JackrabbitValueFactory
public class ValueFactoryImpl extends PartialValueFactory implements JackrabbitValueFactory
Implementation ofValueFactoryinterface.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.oak.plugins.value.jcr.PartialValueFactory
DEFAULT_BLOB_ACCESS_PROVIDER
-
-
Constructor Summary
Constructors Constructor Description ValueFactoryImpl(@NotNull Root root, @NotNull NamePathMapper namePathMapper)Creates a new instance ofValueFactory.ValueFactoryImpl(@NotNull Root root, @NotNull NamePathMapper namePathMapper, @NotNull org.apache.jackrabbit.oak.api.blob.BlobAccessProvider blobAccessProvider)Creates a new instance ofValueFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable javax.jcr.BinarycompleteBinaryUpload(@NotNull java.lang.String uploadToken)Complete the transaction of uploading a binary directly to a storage location and return aBinaryto set as value for a binary JCR property.@NotNull javax.jcr.BinarycreateBinary(@NotNull java.io.InputStream stream)@Nullable javax.jcr.BinarycreateBinary(Blob blob)@NotNull javax.jcr.ValuecreateValue(@NotNull java.io.InputStream value)@NotNull javax.jcr.ValuecreateValue(@NotNull javax.jcr.Binary value)@Nullable BlobgetBlob(javax.jcr.Binary binary)@Nullable BinaryUploadinitiateBinaryUpload(long maxSize, int maxParts)Initiate a transaction to upload a binary directly to a storage location and returnBinaryUploadinstructions for a remote client.@Nullable BinaryUploadinitiateBinaryUpload(long maxSize, int maxParts, @NotNull BinaryUploadOptions options)Initiate a transaction to upload a binary directly to a storage location and returnBinaryUploadinstructions for a remote client.-
Methods inherited from class org.apache.jackrabbit.oak.plugins.value.jcr.PartialValueFactory
createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValue, createValues, getNamePathMapper
-
-
-
-
Constructor Detail
-
ValueFactoryImpl
public ValueFactoryImpl(@NotNull @NotNull Root root, @NotNull @NotNull NamePathMapper namePathMapper, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobAccessProvider blobAccessProvider)Creates a new instance ofValueFactory.- Parameters:
root- the root instance for creating binary valuesnamePathMapper- The name/path mapping used for converting JCR names/paths toblobAccessProvider- The blob access provider the internal representation.
-
ValueFactoryImpl
public ValueFactoryImpl(@NotNull @NotNull Root root, @NotNull @NotNull NamePathMapper namePathMapper)Creates a new instance ofValueFactory. TheValues created by this value factory instance will not be backed by a blob access provider and never return a download URI for a binary value.- Parameters:
root- the root instance for creating binary valuesnamePathMapper- The name/path mapping used for converting JCR names/paths to the internal representation.
-
-
Method Detail
-
createValue
@NotNull public @NotNull javax.jcr.Value createValue(@NotNull @NotNull java.io.InputStream value)- Specified by:
createValuein interfacejavax.jcr.ValueFactory
-
createValue
@NotNull public @NotNull javax.jcr.Value createValue(@NotNull @NotNull javax.jcr.Binary value)- Specified by:
createValuein interfacejavax.jcr.ValueFactory
-
createBinary
@NotNull public @NotNull javax.jcr.Binary createBinary(@NotNull @NotNull java.io.InputStream stream) throws javax.jcr.RepositoryException- Specified by:
createBinaryin interfacejavax.jcr.ValueFactory- Throws:
javax.jcr.RepositoryException
-
initiateBinaryUpload
@Nullable public @Nullable BinaryUpload initiateBinaryUpload(long maxSize, int maxParts)
Description copied from interface:JackrabbitValueFactoryInitiate a transaction to upload a binary directly to a storage location and returnBinaryUploadinstructions for a remote client. Returnsnullif the feature is not available.IllegalArgumentExceptionwill be thrown if an upload cannot be supported for the required parameters, or if the parameters are otherwise invalid. Each service provider has specific limitations.- Specified by:
initiateBinaryUploadin interfaceJackrabbitValueFactory- Parameters:
maxSize- The exact size of the binary to be uploaded or the estimated maximum size if the exact size is unknown. If the estimation was too small, the transaction should be restarted by invoking this method again using the correct size.maxParts- The maximum number of upload URIs that the client can accept, for example due to message size limitations. A value of -1 indicates no limit. Upon a successful return, it is ensured that an upload ofmaxSizecan be completed by splitting the binary intomaxURIsparts, otherwiseIllegalArgumentExceptionwill be thrown.- Returns:
- A
BinaryUploadproviding the upload instructions, ornullif the implementation does not support the direct upload feature.
-
initiateBinaryUpload
@Nullable public @Nullable BinaryUpload initiateBinaryUpload(long maxSize, int maxParts, @NotNull @NotNull BinaryUploadOptions options)
Description copied from interface:JackrabbitValueFactoryInitiate a transaction to upload a binary directly to a storage location and returnBinaryUploadinstructions for a remote client. Returnsnullif the feature is not available.IllegalArgumentExceptionwill be thrown if an upload cannot be supported for the required parameters, or if the parameters are otherwise invalid. Each service provider has specific limitations.- Specified by:
initiateBinaryUploadin interfaceJackrabbitValueFactory- Parameters:
maxSize- The exact size of the binary to be uploaded or the estimated maximum size if the exact size is unknown. If the estimation was too small, the transaction should be restarted by invoking this method again using the correct size.maxParts- The maximum number of upload URIs that the client can accept, for example due to message size limitations. A value of -1 indicates no limit. Upon a successful return, it is ensured that an upload ofmaxSizecan be completed by splitting the binary intomaxURIsparts, otherwiseIllegalArgumentExceptionwill be thrown.options- ABinaryUploadOptionsinstance containing any options for this call.- Returns:
- A
BinaryUploadproviding the upload instructions, ornullif the implementation does not support the direct upload feature.
-
completeBinaryUpload
@Nullable public @Nullable javax.jcr.Binary completeBinaryUpload(@NotNull @NotNull java.lang.String uploadToken) throws javax.jcr.RepositoryExceptionDescription copied from interface:JackrabbitValueFactoryComplete the transaction of uploading a binary directly to a storage location and return aBinaryto set as value for a binary JCR property. The binary is not automatically associated with any location in the JCR.The client must provide a valid upload token, obtained from
BinaryUpload.getUploadToken()when this transaction was initialized usingJackrabbitValueFactory.initiateBinaryUpload(long, int). If theuploadTokenis unreadable or invalid, anIllegalArgumentExceptionwill be thrown. This method is idempotent. Calling the method more than one time with the same upload token must not cause an existing binary to be modified; thus if a prior call with this upload token succeeded in creating the binary, subsequent calls with the same upload token have no effect on the binary. This method should always return the binary that was uploaded with this upload token, even in subsequent calls with the same upload token (in other words, calling this method twice with the same upload token results in the same binary being returned both times).- Specified by:
completeBinaryUploadin interfaceJackrabbitValueFactory- Parameters:
uploadToken- A String identifying the upload transaction.- Returns:
- The uploaded
Binary, ornullif the implementation does not support the direct upload feature. - Throws:
javax.jcr.RepositoryException- if another error occurs.
-
createBinary
@Nullable public @Nullable javax.jcr.Binary createBinary(Blob blob) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getBlob
@Nullable public @Nullable Blob getBlob(javax.jcr.Binary binary) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
-