Changing Resource Folder Location
You can change the default directory where your resources are persisted. You can do this by overriding certain properties of the entity type the resource comes from.
If you want to change the resource folder location in a cloud setup, it is better to use a SQL database to store resources as it can be accessed by every instance in your setup. For more information, see Persisting Resources in SQl Database.
Changing Resource Folder Location Programmatically
In this procedure we assume the access is a SmoodAccess and the metamodel your access uses has a dependency to basic-resource-model which contains the FileSystemSource entity type. For more information about accesses, see Access.
-
Find the proper
ResourceSourceyour model uses. In this example, our model uses theFileSystemSource. Depending on your model, yourResourceSourcemay be different. -
Create an instance of
FileSystemBinaryProcessorand, in thebasePathproperty, assign the path where you want your resources to be persisted.
It is best to use the common Tribefire storage path runtime property (
${TRIBEFIRE_STORAGE_DIR}/your/custom/path) as the base for your custom path but you can also use an absolute path or a completely new runtime property. For more information on available properties, see Runtime Properties.
@Managed
private FileSystemBinaryProcessor fsStreamerProcessor() {
FileSystemBinaryProcessor bean = FileSystemBinaryProcessor.T.create();
bean.setExternalId("binaryProcessor.FileSystem");
bean.setBasePath(TribefireRuntime.getProperty("RESOURCE_BASE_PATH"));
return bean;
}
- Create an instance of the
binaryProcessWithmetadata and set the values of theretrievalandpersistence, for example:
@Managed
BinaryProcessWith fsBinaryWithRequest() {
BinaryProcessWith processWith = BinaryProcessWith.T.create();
processWith.setRetrieval(fsStreamerProcessor());
processWith.setPersistence(fsStreamerProcessor());
processWith.setGlobalId(someId);
processWith.setConflictPriority(1d);
return processWith;
}
- Add your configured instance of
binaryProcessWithmetadata to theFileSystemSourceentity type of your model:
ModelMetaDataEditor mdEditor = new BasicModelMetaDataEditor(yourModel);
mdEditor.onEntityType(ResourceSource.T).addMetaData(fsBinaryWithRequest());
mdEditor.onEntityType(FileSystemSource.T).addMetaData(fsBinaryWithRequest());
Changing Resource Folder Location in Control Center
-
Log in to Control Center. For more information about Control Center, see Using Control Center.
-
Create an instance of
FileSystemBinaryProcessor(com.braintribe.model.deployment.resource.filesystem.FileSystemBinaryProcessor) and assign proper values for the following:externalIdnamebasePath

- Create a
BinaryProcessWithMetadata (com.braintribe.model.extensiondeployment.meta.BinaryProcessWith) and assign proper values for the following:- in the
persistenceproperty, assign your instance ofFileSystemBinaryProcessorfrom step 2 - in the
retrievalproperty, also assign your instance ofFileSystemBinaryProcessorfrom step 2
- in the

-
Create a
GmEntityTypeOverridetype override (com.braintribe.model.meta.override.GmEntityTypeOverride) and assign proper values for the following:- in the
declaringModelproperty, assign the metamodel of your access - in the
entityTypeproperty, assignFileSystemSource - assign your instance of
BinaryProcessWithmetadata here
- in the
-
In the metamodel of your access, add your instance of
GmEntityTypeOverrideyou created in step 4.
