3.2.2.2. Value storages API

Storages provider

Container implementation obtains Values Storages option via the ValueStoragePluginProvider component. Provider acts as a factory of Value channels (ValueIOChannel) and has two methods for this purpose:

ValueIOChannel getApplicableChannel(PropertyData property, int valueOrderNumer) throws IOException;
ValueIOChannel getChannel(String storageId) throws IOException, ValueStorageNotFoundException;

There is also a method for consistency check, but this method is not used anywhere and storage implementations has it empty.

Value storage plugin

Provider implementation should use the ValueStoragePlugin abstract class as a base for all storage implementations. Plugin provides support for provider implementation methods. Plugin's methods should be implemented:

public abstract void init(Properties props, ValueDataResourceHolder resources) throws RepositoryConfigurationException, IOException;
public abstract ValueIOChannel openIOChannel() throws IOException;
public abstract boolean isSame(String valueDataDescriptor);

Value I/O channel

Channel should implement the ValueIOChannel interface. CRUD operation for Value Storage:

ValueData read(String propertyId, int orderNumber, int maxBufferSize) throws IOException;
void write(String propertyId, ValueData data) throws IOException;
void delete(String propertyId) throws IOException;

Transaction support via channel

Modification operations should be applied only when committing. Rollback is required for data created cleanup.

void commit() throws IOException;
void rollback() throws IOException;
void prepare() throws IOException;
void twoPhaseCommit() throws IOException;
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus