JBoss Community Archive (Read Only)

ModeShape 5

Composite

Description

A binary store which aggregates several other binary stores. This is a special type of binary store which requires the usage of ModeShape-specific API when creating BinaryValue instances:

org.modeshape.jcr.api.ValueFactory
   /**
     * Creates a JCR {@link org.modeshape.jcr.api.Binary} value from the given input stream with a hint to the factory (which is
     * passed to the storage layer)
     * 
     * @param value a non-null input stream
     * @param hint a hint that the storage layer may use to make persistence decisions
     * @return a Binary implementation instance
     */
    public Binary createBinary( InputStream value, String hint );

based on the value of the hint parameter, a binary value will be stored in one or another store, depending on the configuration (see below):

Configuration

JSON

 "storage" : {
        "binaryStorage" : {
            "type"  : "composite",
            "namedStores" : {
                "default" : {
                    "type" : "file",
                    "directory":"target/composite/repository/binaries"
                },
                "alternative-jdbc" : {
                    "type"  : "database",
                    "driverClass" : "org.h2.Driver",
                    "url" : "jdbc:h2:mem:target/test/binary-store-db;DB_CLOSE_DELAY=-1",
                    "username" : "sa"
                }
            }
        }
    }

in this example the File and Database binary stores are qualified with the default and alternative-jdbc names. These would serve as the hint in the above mentioned API in order to dictate where a particular binary gets stored.

JBoss AS

 <repository>
    <composite-binary-storage >
       <file-binary-storage store-name="fs1" path="modeshape/compositeBinaryStoreRepository/binaries/fs1" relative-to="jboss.server.data.dir"/>
       <file-binary-storage store-name="fs2" path="modeshape/compositeBinaryStoreRepository/binaries/fs2" relative-to="jboss.server.data.dir"/>
       <cache-binary-storage store-name="default" data-cache-name="binary-fs" metadata-cache-name="binary-fs-meta"/>
    </composite-binary-storage>
 </repository>

here the additional store-name attribute on each of the individual stores is used to qualify each of them.

The supported types of nested stored in the JSON and JBoss AS configuration are: File, Database, Infinispan and Custom

Attributes

Name

Required

Configuration

Description

namedStores

yes

JSON

the JSON object defining the inner binary stores

store-name

yes

JBoss AS

an additional attribute for each of the internal binary stores used to qualify it

plus the common attributes described here

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:12:57 UTC, last content change 2016-04-07 07:22:48 UTC.