ModeShape Tools is a set of Eclipse plugins for working with ModeShape and JCR repositories. The plugins have been available for a little while, but we wanted to make sure you knew about them.
Editor for CND files
The first plugin we’ll talk about is an Eclipse editor for the Compact Node Definition (CND) format defined in the JCR 2.0 (JSR-283) specification. Although a client application can connect to a JCR repository and programmatically register node types, it is usually easier to place the node type definitions inside a CND file and to use that file to register all the node types contained within it. ModeShape Tool’s CND editor makes it easy to edit such files.
(The JCR 2.0 API does not define how an implementation should support registering node types via CND files, but many of the implementations have a proprietary way to do it. ModeShape extends the javax.jcr.nodetype.NodeTypeManager
interface with several “registerNodeTypes
” methods that each take a java.io.File
, a java.net.URL
, or an java.io.InputStream
containing CND content. We’re hoping the JSR-333 effort for JCR 2.1 adopts our approach.)
The CND editor is a 2-page Eclipse editor used for editing *.cnd files. The first page is form-based and consists of sections for managing namespace mappings, node type definitions, property definitions, and child node definitions. The second page is a readonly view of the file content.
Take a look at the CND editor with the properties and child node sections collapsed:

When you select a node type, the editor shows the information about that node type on the right side. This includes the node type’s name, attributes, supertypes, and property and child node definitions. Add, change, or remove a property definition or child node definition by double-clicking the particular row in the section’s table or by using the section’s toolbar. Here’s a view of the editor with the properties and child node sections expanded:

The CND editor’s second page is a readonly source view of the *.cnd file. You can control the verbosity of the CND notation by a preference. The source page looks like this:

Here’s a few other features of the CND editor:
- automatic validation of the CND file, with errors displayed in the header section
- copy and paste CND elements within the same editor or between CND editors
- automatic URI completion when adding standard (built-in) namespaces
- the node type section has a search filter to quickly find and select a node type, even when there are hundreds of node types in the file
- the ability to show/hide property definitions and child node definitions inherited from supertypes
- attach comments to any CND element
- Ctrl-space completion and “look ahead” typing for available supertypes and required types.
- built-in help
You can read more detail about the CND Editor in our online documentation.
The CND Editor can edit any CND files for ModeShape or any other JCR 2.0 repository implementation. It is also possible to just install just this plugin. So even if you’re not using ModeShape, we think you’ll still find the CND Editor very useful.
Publishing files to ModeShape
The second ModeShape Tools plugin provides a way to upload files from your Eclipse workspace to a ModeShape repository. It can publish entire projects, folders, or just selected files. You select the ModeShape server, repository, workspace, and area within the workspace where the file(s) are to be placed.
To use, simply select the files and/or directories you want to publish, and then choose “ModeShape->Publish” from the context menu. You’ll then see a dialog that confirms the details of the publishing request:

Simply select “Finish” to publish the files to ModeShape.
The publishing tool can also:
- un-publish (or delete) resources from a publish area of a ModeShape server
- indicate which files should also be versioned (with “mix:versionable”) when they are published
- show the output of the publishing operations in the message console view
- show in a Servers view the repositories, workspaces, and publish areas for multiple ModeShape servers
- always ignore certain file types from being included in the publishing operations, configured via preferences
- built-in help
Installation
Each of these features can be installed separately or together by following these steps:
- Start up Eclipse 3.7 (Juno), then choose “Help > Install New Software…”
- Enter http://download.jboss.org/jbosstools/updates/stable/juno/soa-tooling/modeshape/ and hit “Enter”.
- When the site loads, select which feature(s) you want to install, or click the “Select All” button.
- Click “Next”, agree to the license terms, and install.
You can read more about ModeShape Tools in our documentation
Want to contribute?
These plugins are open source and are on GitHub, licensed under EPL and LGPL. We’re always looking for contributors to help out. If you would like to contribute, find a bug, want to suggest a new feature, or have any questions, please let us know in our discussion forum and we’ll get you started. The JIRA for these plugins is here.
Filed under: features, news, open source, releases, tools, uncategorized