ModeShape

An open-source, federated content repository

One CND file or many?

One question people have when starting out with ModeShape and JCR is this:

Should I create one CND file with all of my node types, or should I create multiple CND files?

Naturally, the answer is “It depends”, since there really is no one way that works for everyone. So to help you figure out your own answer, here are several guidelines that we consider. (If you know of others, please let us know in the comments.)

(BTW, do you know about our CND Editor for Eclipse? If not, check it out because it really makes it easy to edit CND files. It doesn’t even require you to have or use ModeShape.)

Simplicity

A single CND file is easy, and can have node type names that use different namespaces. Just look at a CND file with the standard built-in typesWhere possible, keep things simple and use just a single CND file.

Organization

Perhaps you have enough node types that it’s becomes harder to keep them all in one CND file. In that case, consider putting semantically-related node type definitions in separate files.

Reusability

Some node types might be more reusable than others. In this case, consider putting common or more reusable node types in separate files. For example, you might reuse a subset of your node type definitions in multiple repositories. Or multiple applications might need a common set of node type definitions, while also having their own application-specific types.

When you have reusable node types, then you might also want to consider how those common node types are governed. Are they defined by a central group of people? Are they put into their own Maven artifacts that can be easily shared, and if so are they released separately from the applications? These may all affect how you break up those common node types into one or more files.

Deployment

You may also want to create separate CND files when they’re used/registered at different times. Deployment mechanisms will often dictate the ability or desire to do this.

A ModeShape repository configuration can specify a set of CND files that are to be registered immediately upon startup of the repository. But applications using that repository can also use the JCR API to register new (or updated) node types, too. So you might want some node types to be installed upon initialization, while others might be registered only when the application needs them. You’ll likely want different CND files for each purpose.

Here’s an example. Consider that you have ModeShape installed into an AS7 instance, so the ModeShape repositories are configured as part of the AS7 configuration and started when they’re needed/used. Then web application (or web service) can simply get a hold of the (running) repository via the JNDI, @Resource injection, or RepositoryFactory techniques. In fact, multiple applications can use the same repository. Perhaps some basic node types should installed as part of the repository configuration, while each application (if deployed) can register their own application-specific (or even common) node types.

About these ads

Filed under: uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

ModeShape is

a lightweight, fast, pluggable, open-source JCR repository that federates and unifies content from multiple systems, including files systems, databases, data grids, other repositories, etc.

Use the JCR API to access the information you already have, or use it like a conventional JCR system (just with more ways to persist your content).

ModeShape used to be 'JBoss DNA'. It's the same project, same community, same license, and same software.

ModeShape

Topics

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: