# Sirius – Provide representation location rule (experimental)

## Goals

An experimental mode to serialize representations in different files is available with the system property `createRepresentationInSeparateResource=true`. That means all new representations will be saved, by default, in a separate file with *.srm extension.
Developer may need to override this rule by choosing to add one or several representations in a specific resource.

## Override the representation location rule.

### The `DRepresentationLocationRule` interface

- `boolean provides(DRepresentation representation, Resource dViewResource)`: Indicates if this `DRepresentationLocationRule` provides a custom URI for this kind of representation and the resource that holds the `DView`. If not and if there is no other `DRepresentationLocationRule` that provides, Sirius fall back to the default implementation.

- `URI getResourceURI(DRepresentation representation, Resource dViewResource)`: Provides the new URI for the given representation.

- `Boolean isARepresentationResource(String fileExtension)`: Indicates if the given file extension is considered as a representation file. This extension point allows to define its own extension to hold representations. The developer still needs to register the Resource Factory to `org.eclipse.emf.ecore.extension_parser` extension point.

### Provide your `DRepresentationLocationRule` using the `org.eclipse.sirius.dRepresentationLocationRule` extension point

Please refer to this extension point documentation for more details.