JBoss Community Archive (Read Only)

ModeShape 5

Repository Web Explorer

What is Repository Web Explorer?

Repository Web Explorer is a browser interface for JCR compliant in general and ModeShape in particular  repositories.  Repository Web Explorer provides the bulk of functionality for browsing and managing repositories.

Here are some of the additional features of Repository Web Explorer:

  • Browse repository nodes

  • Add/Remove/Edit nodes

  • Manage node types

  • Edit node properties

  • View/Download/Upload binary content

  • Backup/Restore repositories

  • Execute queries

Requirements

The only requirements is a compliant servlet container. The specific of that depend on what is a container and repository.

Configuration

Web explorer is a regular Java web application and it allows configuration via context parameters specified in web.xml. The cooperation between browser and repositories is archived through Connector interface. Connector interface exposes repositories and some additional administrative functions. The detailed view of this interface is as follows:

public interface Connector extends Serializable {
    /**    
      * Starts this connector using given context.    
      *     
      * @param config     
      */   
    public void start(ServletContext context) throws RemoteException;       
    /**    
     * Logs in with given credentials.    
     *     
     * @param username the user name
     * @param password user's password.
     */   
     public void login( String username, String password );
    /**
     * Logs out.
     */
    public void logout();
    /**
     * Gets name of user currently logged in.
     *
     * @return user name or null if not logged yet.
     */
    public String userName();
    /**
     * Gets list of all available repositories.
     *
     * @return the collection of repository names
     */
    public Collection<RepositoryName> getRepositories();
    /**
     * Searches repository with given name.
     *
     * @param name the name of the repository to search.
     * @return repository instance or null if not found.
     * @throws RemoteException if there is an error getting the repository
     */
    public LRepository find( String name ) throws RemoteException;
    public Collection<RepositoryName> search( String name ) throws RemoteException;
}

Reference to the concrete implementation can be specified in the web.xml using context-parameter element

<context-param>
  <param-name>connector-class</param-name>
  <param-value>org.modeshape.web.server.impl.ConnectorImpl</param-value>
</context-param>

Repository explorer ships with two Connectors developed for ModeShape repositories: the first connector allows the Explorer to access repositories bound in JNDI (this connector is used when ModeShape is deployed as subsystem inside the WildFly application server) and second starts & accesses a ModeShape repository from regular JSON configuration file.

JNDI Connector

To be able access repositories deployed in a container & bound in JNDI, use the following configuration:

<context-param>
  <param-name>connector-class</param-name>
  <param-value>org.modeshape.web.server.impl.ConnectorImpl</param-value>
</context-param>

<context-param>
  <param-name>jndi-prefix</param-name>
  <param-value>jndi-name-of-modeshape-repository</param-value>
</context-param>

Standalone Connector

To be able to deploy web explorer with a standalone repository specified by a JSON configuration file use the following configuration:

<context-param>
   <param-name>connector-class</param-name>
   <param-value>org.modeshape.web.server.impl.JsonConfigConnectorImpl</param-value>
</context-param>

<context-param>       
 <param-name>config-url</param-name>
 <param-value>path-to-json-config</param-value>
</context-param>

The value of path-to-json-config must be path resolvable by the ClassLoader of the web application in which the org.modeshape.web.server.impl.JsonConfigConnectorImpl class resides.

Using the Web Explorer

There are 2 ways in which the Web Explorer web application can be used:

  • inside the JBoss Application Server together with the ModeShape subsystem

  • standalone by customizing it and adding your own configuration

In the JBoss Applicaton Server

By default the ModeShape JBoss Application Server kit comes prepackaged with the Repository Explorer web application. This is in turn is configured to use the JNDI Connector (see above) and accesses all the ModeShape repositories defined via the ModeShape subsystem. The only configuration element required to enable the Explorer is:

<subsystem xmlns="urn:jboss:domain:modeshape:2.1">
  <webapp name="modeshape-explorer.war"/>
</subsystem>

Once this element is present, you can access the application by default at: http://localhost:8080/modeshape-explorer.

In your own application

If you're not using the JBoss Application Server kit & configuration, you have the option of embedding the Repository Explorer in your own application. However, this requires some additional configuration steps normally added to your build system (for exemplification, we'll assume this build system is Maven):

  1. make sure you have a module which produces a WAR artifact

  2. add a dependency on the org.modeshape:modeshape-web-explorer:jar artifact

  3. add a src/main/webapp/WEB-INF/web.xml file which contains your own configuration parameters & connectors (see above). For example, if you have an embedded repository configuration, add this configuration to src/main/resources/repo-config.json file and then add the following fragment to the web.xml configuration file:

        <context-param>
            <param-name>connector-class</param-name>
            <param-value>org.modeshape.web.server.impl.JsonConfigConnectorImpl</param-value>
        </context-param>
        <context-param>
            <param-name>config-url</param-name>
            <param-value>repo-config.json</param-value>
        </context-param>

As an alternative to step 2 from above, you can use the org.modeshape:modeshape-web-explorer-war:war artifact which comes prepackaged with a Demo (empty) embedded repository. You can then use Maven's WAR overlaying feature to add your own custom configuration.

By default the Repository Web Explorer is configured to use the JNDI connector and expects a ModeShape Engine instance bound in JNDI under java:/jcr. When embedding it in your own application you should always overwrite this behavior and add your own custom web.xml configuration.

Navigation

Web Explorer contains five main tabs, each of which provides management page for a aspect of the repository:

  • Explore The "Explore" page on controls content of the repository. Using this page user is able to browse content, add, remove or edit node. Change properties of the node, etc;

  • Node Types The "Node Types" page on provides web-based management interface for node types management functions;

  • Descriptor The "Descriptor" page on shows repository parameters;

  • Query "Query" page on allows user execute query;

  • Admin "Admin" page on provides access to the administrative functions and metrics.

images/author/download/attachments/103547172/edit-node.png

Explore tab

Explore tab displays repository contents. Using this tab user can browse nodes, add new nodes, rename or delete node. Explore tab includes additional tabs:

  • Children tab which displays child nodes of the selected node;

  • Properties tab displays node properties

  • Access list tabs displays access rights of the selected node.

Node types.

Node types page displays all registered node types.

Descriptor page

Descriptor page display repository parameters

Query page

Query page provides interface to the query engine. This page contains query editor and query language select and table which displays result.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 12:12:53 UTC, last content change 2016-04-07 07:15:45 UTC.