Creating a repository for sharing modules

This topic contains information about hosting a shared repository created with the command-line.

Building a shared repository

Repositories can be used to share modules and artifacts with other developers. The current repositories for IBM@reg; WebSphere@reg; sMash modules and Maven artifacts are typically preconfigured in the command-line interface.

Local and hosted repositories containing WebSphere sMash modules share identical directory layouts. The conventions are inherited because WebSphere sMash uses Apache Ivy and its conventions. This means that you can move any local repository to a hosted environment. The high level steps to hosting a shared repository are provided in the following list:

  1. Prepare a local repository of modules and artifacts to be shared.
  2. Host the local repository for sharing.

The command line interface provides commands that allow modules to be published to a local repository. Additional local repositories, with the purpose of sharing modules, can also be created and handcrafted to include only the modules that you selectively publish to it. The repository commands are used to publish modules to a shared local repository, adhering to the repository directory layout, and create the calculated checksums required for remote repositories.

The process for publishing the module to the private repository intended for sharing is similar to the process of developing the module for publishing it to the local repository. When the module is completed, package the module using the zero package command. To publish the shared repository, however, use the zero repository publish <path> commmand (instead of zero publish). The provided path is the root directory for the private repository on the local file system. The repository publish task creates the necessary files and folders so the modules can be properly resolved when hosted. The private repository can then be hosted using a Web server to provide a new remote repository.

A repository created using the zero repository publish command can be hosted with any Web server if directory browsing or indexing can be enabled. Use the following steps to host the repository but note that these steps might vary, depending on how the repository is transferred to the server.

  1. Archive the local repository using your favorite utility like zip or tar.
  2. Transfer the archive to a file server.
  3. Extract the repository archive to the file server.
  4. Distribute the URL of the repository.
  5. Add the URL for the new repository using the zero modulegroup addurl command.

Typically, the servers used to host the repository are WebSphere sMash or Apache Web server. The steps are similar for both, but the details for each are included for reference in the Hosting the shared repository with WebSphere sMash and Hosting the shared repository with Apache Web server sections that follow. In either case, the server needs to have the repository expanded on the local file system. If the modules are packaged and published on the same file system as the Web server, then file copy or publishing directly to the correct location is sufficient. If the Web server is hosted on another machine, then the repository must be archived and moved to the hosting machine.

The layout of the repository is defined through Apache Ivy, but the top directories configured through WebSphere sMash are under the organization/module directory. Under that directory is the Ivy directory and the corresponding zips or jars directory, depending on the type of artifact. The archive should be created at the same location as the path passed to the repository publish <path> command. The path should include the organization directory, that is typically zero for zero modules.

The repository can then be shared by providing the URL to the hosted repository. The new repository is added using the zero modulegroup addurl <host> command.

Hosting the shared repository with WebSphere sMash

You can host the repository using a WebSphere sMash application and the following steps:

  1. Create an application.
  2. Modify the zero.config file to enable directory browsing.
  3. Copy the repository under the public directory.
  4. Start the application.
  5. Distribute the URL of the repository.

Directory browsing can be enabled by adding the following line to the zero.config file.

/config/fileserver/directoryBrowsing=true

You need to copy the repository under the public directory. It might be preferable to create a root directory under public, like repo. In this case, the hosted URL would then be http://host:8080/repo.

Hosting the shared repository with Apache Web server

You can also host the private repository through Apache Web server. You must configure the alias that includes the host path and the path to the root of the repository and enable indexing.

Alias /private_repo /home/shared/repo
<Directory "/home/shared/repo">
  Options Indexes
</Directory>

If you are hosting from Windows™, then the Alias section might also need Order allow,deny and Allow from all.