Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODE-1706 Support for extra properties #599

Merged
merged 6 commits into from Nov 15, 2012
Merged

Conversation

rhauch
Copy link
Contributor

@rhauch rhauch commented Nov 15, 2012

The Connector framework now has a way for connector implementations to handle "extra" properties that are not normally supported by the external system that the connector is using. These extra properties can be stored in the same Infinispan cache used to persist the regular "internal" repository content, although connector implementations are responsible for explicitly using this new facility.

The file system connector has been changed to take advantage of this mechanism. By default, all properties that cannot be represented by native file system attributes (e.g., lastModified, file content,
etc.) are stored using the extra properties facility. However, the connector can also be configured to store these extra properties on the file system in "sidecar" files, in the same way that the file system connector in ModeShape 2.x worked. These sidecar files can be of several formats, including JSON, BSON, or the ModeShape 2.x format (a text-based but proprietary format).

Several new tests were added to verify the functionality works as expected.

The Connector framework now has a way for connector implementations
to handle "extra" properties that are not normally supported by the
external system that the connector is using. These extra properties
can be stored in the same Infinispan cache used to persist the
regular "internal" repository content, although connector implementations
are responsible for explicitly using this new facility.

The file system connector has been changed to take advantage of this
mechanism. By default, all properties that cannot be represented
by native file system attributes (e.g., lastModified, file content,
etc.) are stored using the extra properties facility. However,
the connector can also be configured to store these extra properties
on the file system in "sidecar" files, in the same way that the
file system connector in ModeShape 2.x worked. These sidecar files
can be of several formats, including JSON, BSON, or the ModeShape 2.x
format (a text-based but proprietary format).

Several new tests were added to verify the functionality works as
expected.

// Add the extra properties (if there are any) ...
writer.addProperties(extraPropertiesStore().getProperties(id));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the way that a connector can obtain the properties from the ExtraPropertiesStore instance and simply add them to the document currently being written. By doing this late in the method, some of the extra properties might overwrite the non-extra properties (which is likely a good thing).

@rhauch
Copy link
Contributor Author

rhauch commented Nov 15, 2012

@hchiorean, what do you think about these changes? If they're okay, then this can be merged onto the 'federation branch.

@hchiorean
Copy link
Member

@rhauch: with the exception of the minor comments above, I think the design looks really good.

@rhauch
Copy link
Contributor Author

rhauch commented Nov 15, 2012

Made the corrections that @hchiorean suggested, and also improved the way the file system connector handles Binary values:

  • The BinaryValue implementation now lazily computes the MIME type (including before the BinaryValue is serialized).
  • The BinaryValue now accesses the content via URL, and the file system connector can be subclassed to override how the URL is determined for a given file. If a file system connector is accessing files that are also served via a web server, a subclass could adapt the file-based URL to an HTTP-based URL.
  • A new connector configuration option specifies whether the mix:mimeType mixin and the jcr:mimeType property should be added to the nt:resource nodes; pre-computing the MIME type can be a relatively expensive operation for large files, and it is not always needed by JCR clients. By default, the 'mix:mimeType' mixin (and the jcr:mimeType property) are not added to the nodes.

…ages

The FileSystemConnector is now in the same 'org.modeshape.connector.filesystem' package as in 2.x, and it
follows the convention used by the sequencers. Note that the file system connector is still located in
the 'modeshape-jcr' module rather than a separate module (as in 2.x) - this is for simplicity.

The MockConnector was moved into the test source, since it is now only used by the test cases
and can be configured like any other connector.
@rhauch rhauch merged commit de055ba into ModeShape:federation Nov 15, 2012
@rhauch
Copy link
Contributor Author

rhauch commented Nov 15, 2012

I merged this into the 'federation' branch. If there are any changes, they can be done in other pull-requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants