Quick Start for 4Suite

This version:
Revision 0.4 (2002-11-21)
Principal authors:
Uche Ogbuji (Fourthought, Inc.)
Shatin Rai (Fourthought, Inc.)
Add'l contributors:
Mike Brown (Fourthought, Inc.)

This document can be freely translated and distributed. It is released under the LDP License.

Abstract

4Suite has many features. This document provides a step-by-step introduction to give the user familiarity with the document repository portion of the software.

Table Of Contents

1 Prerequisites

2 Notes

3 4Suite Command Line Tools

3.1 Running the 4SS Manager

3.1.1 Initializing the 4Suite Repository ("repo")

3.1.2 Starting the 4SS

3.2 Some 4SS Command Line Tools

3.2.1 4ss fetch container

3.2.2 4ss fetch document

3.2.3 4ss create user

3.2.4 4ss create container

3.2.5 4ss set owner

3.2.6 4ss create document

3.2.7 4ss agent

3.2.8 4ss create rawfile

4 Working with the Web features

4.1 Setting up a scratch server

5 4Suite Repository Dashboard

5.1 Let's get started!

5.2 Repository

5.3 Just brief overview of rest of the Dashboard features:

6 Resources

6.1 4Suite @ SourceForge

6.2 External Links

Appendices

A Scratch Server set-up tool

B Using 4ss set acl interactively


1 Prerequisites

It is assumed that the user has already installed 4Suite according to the relevant installation guide (see UNIX/LINUX or WINDOWS Installation Guide).

2 Notes

Anything that would require superuser privileges on the system has been avoided. Examples use the command-line 4Suite utilities, which are available on all supported platforms.

Sometimes there will be a great deal of output from an instruction. If there is nothing of particular interest in the output, it will be omitted and replaced with the text "SNIP".

There are many useful third-party resources mentioned in this document. Those that are necessary for you to access in order to follow instructions are directly linked from the text. Others are marked as endnotes and the links are available in the Resources section.

3 4Suite Command Line Tools

4Suite comes with a rich set of command-line tools for various management tasks. There are two primary commands, each with a number of subcommands, available to users:

  1. Application to Run 4SS Management tools - these are commands only available to the superuser (i.e. 4Suite administrator), for which type:

    $  4ss_manager --help
    
    
  2. Application to access 4SS data - to see help on all of the command line tools available type:

    $ 4ss --help
    
    

Note: There is a GUI interface called Dashboard available to navigate and manipulate the contents of a container in the repository. More on Dashboard later in this document.

3.1 Running the 4SS Manager

The 4Suite developers provide several tools to help get you started with 4Suite. There are stylesheets, documents and document definitions that are included when you initialize the repository (also called the repo).

  1. Initialize the 4Suite repo.

  2. Start the 4SS daemon.

3.1.1 Initializing the 4Suite Repository ("repo")

To initialize the 4Suite repo, type the following command:

$ 4ss_manager init
You are about to initialize 4Suite Server. This will erase ALL DATA in the databases.
Are you sure (yes/no)? y
Add super user name (or just "enter" to pass): su
Password: su
Reenter password: su
Add super user name (or just "enter" to pass):
Installing Repository
Create Container: /ftss
Create Container: /ftss/users
Create Container: /ftss/groups
Create User: /ftss/users/h      docDef=None
Create Group: /ftss/groups/super-users
SNIP

Note: For " Are you sure" question - type y - and add a super user name - in this example su - and enter the desired password - in this example su - and just press "enter" when prompted to add another superuser.

A full initialization may take a while, because over 1000 items will be created in the repository, including over 600 XML documents comprising the API documentation for most 4Suite modules. While arguments can be supplied on the command line to force installation of only certain components, it is best, for purposes of this walkthrough, to have a standard, fully-initialized repo.

3.1.2 Starting the 4SS

Assuming the init was successful, the servers to interface with the repo can now be started! Type the following command:

$ 4ss_manager start
4SS Manager Name: su
Password for su:
controller started (pid 1064)

Note: You'll be again asked for user name and password. Use the super user name and the password that you created in the Initializing the 4Suite Repository ("repo") section, (i.e. from the previous example, the 4SS Manager Name would be su and Password would be su).

In the next section, we'll play around with some of these resources.

3.2 Some 4SS Command Line Tools

3.2.1 4ss fetch container

Seeing the contents of any container of the XML repository is quite simple. For example, to see the resources that were added by the 4ss_manager init type the following:

$ 4ss fetch container /ftss
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:
Listing of /ftss
text/xml   0.3kB Nov 21 01:18   users
text/xml   0.3kB Nov 21 01:18   groups
text/xml   0.7kB Nov 21 01:18   docdefs
text/xml   3.7kB Nov 21 01:18   data
text/xml   1.7kB Nov 21 01:18   demos
text/xml   6.9kB Nov 21 01:19   commands
text/xml   4.0kB Nov 21 01:19   dashboard
text/xml   1.3kB Nov 21 01:24   docs
text/xml   0.5kB Nov 21 01:24   servers
total: 9

Note that you had to log in. By default, one has to log in to use any command, which can get tedious. We shall soon see a way of avoiding this. For Host <localhost> and Port <8803> just press enter on those ones. 8803 is the port used by FtRpc.server, which allows the client to interact with the repository, i.e. the command line tools you're using right now.

The first field is the Internet Media Type (IMT). The second is the size of the file followed by the third, which is the date the resource was last modified. Finally, the last field is the name of the resource. Just a quick note, because everything is defined by an XML file, all the entries above except error.log display as text/xml Internet Media Type. All those entries are in fact containers. For command line help, type 4ss fetch container --help at the prompt.

3.2.2 4ss fetch document

You can display any of the documents by reference to their URI, relative to the root of the repository. The following command displays the XML document that represents the /ftss/users container:

$ 4ss fetch document /ftss/users
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:
Document /ftss/users (text/xml)
----------------------------------------
SNIP

For another example, try 4ss fetch document /ftss/docs/COPYRIGHT.doc

For command line help, type 4ss fetch document --help at the prompt.

3.2.3 4ss create user

Just as in operating system operations, it is a bad idea to use 4Suite as a superuser except as necessary. One of the first things you should do is to create a regular user for typical operations.

$ 4ss create user uo

Note: After entering the new user's password, you might be prompted for a user
name. This is a user name of an existing user in 4SS with permissions to create
a new user.

Enter new password for uo:
Re-enter password:
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:

This creates a new user named "uo". The first two prompts are for the password of the new user. Then you are prompted for the superuser, whose privileges are required. For command line help, type 4ss create user --help at the prompt.

The 4ss fetch command can display various aspects of things in the repository. Compare the output of 4ss fetch user uo, 4ss fetch resource /ftss/users/uo, 4ss fetch rawfile /ftss/users/uo, and 4ss fetch document /ftss/users/uo.

3.2.4 4ss create container

It is useful to create a home container for this new user, a place where that user has permission to create, modify and delete. This must be done as superuser:

$ 4ss create container /home
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:

$ 4ss create container /home/uo
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:

There won't be any output from these commands, unless there was a problem.

For command line help, type 4ss create container --help at the prompt.

3.2.5 4ss set owner

Next we give the new user full ownership and permissions over this container. This must also be done as superuser:

$ 4ss set owner /home/uo uo

There won't be any output from this command, unless there was a problem.

Note: in order to give other users and groups various permissions on this container (or any other resource), you would use the 4ss set acl command, which is discussed in Appendix B. You may not need to bother with this command in typical operation.

3.2.6 4ss create document

Now let us add an XML document to our brand new home container. Using whatever text editor is convenient, type in the following and save it as a file called profle.xml:

<?xml version='1.0' encoding='UTF-8'?>
<profile xmlns:V='http://www.w3.org/2001/vcard-rdf/3.0#'>
    <V:FN>Uchenna Ogbuji</V:FN>
    <V:N>
      <V:Family>Ogbuji</V:Family>
      <V:Given>Uchenna</V:Given>
    </V:N>
    <V:EMAIL>uche.ogbuji@fourthought.com</V:EMAIL>
</profile>

Now type the following command:

$ 4ss create document --type=xml file:profile.xml /home/uo/profile.xml
4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:

There won't be any output from this command, unless there was a problem.

Different types of documents are stored in different ways in the repository. The first option, --type, indicates the document type to use as a guide for this purpose, and is one of: xml, xslt, rdf, container, user, group, alias, xpathdocdef, xsltdocdef, or schematron. It's not strictly necessary; the type is inferred from the '.xml' suffix, but it's better to be specific.

The first argument after the --type option is a file name or URI of the file containing the data to add.

The second argument is the full path in the repository where you want the document to go. Any additional command-line arguments are optinoal and are interpreted as aliases to be assigned to the new resource. For more information, type in 4ss create document --help at the command line.

3.2.7 4ss agent

If you've been following along with these examples, you're probably quite tired of logging in over and over. You can avoid this by using two 4SS tools: 4ss login and 4ss agent. We'll focus on the latter. 4ss agent allows you to log in once, and creates a new command shell in which you don't even have to log in as that user.

$ 4ss agent
Username: uo
Password:
Host <localhost>:
Port <8803>:
Starting new shell: /bin/bash

Now you can execute commands, and the credentials for user "uo" will automatically be applied. For example, let us now examine the contents of the home container:

$ 4ss fetch container /home/uo
Listing of /home/uo
text/xml   0.3kB Nov 21 03:47   profile.xml
total: 1

You can see the document we added earlier, and the fact that it inherited its access control from the container, i.e. 4ss set acl to view the access controls. For more information, type in 4ss agent --help at the command line.

3.2.8 4ss create rawfile

The repository can also store plain files. For example, these might be images or downloadable files to be retrieved by browsers.

          $ 4ss create rawfile --imt=image/jpeg 4SS.jpg /home/uo/4SS.jpg
$ 4ss fetch container /home/uo
Listing of /home/uo
text/xml   0.3kB Nov 21 03:47   profile.xml
image/jpeg 4.0kB Nov 21 04:01   4SS.jpg
total: 2

The "--imt" argument is the Internet Media Type of the new file, then the source file name is specified, then the destination in the repository. One or more aliases can be specified after this. For command line help, type 4ss create rawfile --help at the prompt.

4 Working with the Web features

4Suite comes with a built-in Web server system, which allows one to use XML and RDF features to deploy Web applications.

You can define multiple servers, each of which represents a distinct site to be served by 4Suite. Each server is usually on a separate port. 4Suite comes with 2 HTTP servers built in: one for the dashboard, which we shall discuss later in this document. The other is for the demo applications that come with 4Suite.

4.1 Setting up a scratch server

In order to develop and test 4Suite apps, or to deploy little Web pages that don't merit a dedicated server, we highly recommedn that you set up a scratch server. This is basically just a 4Suite server which you can partition as you like, and host pages and apps on as you like. The Web app examples in this document will all use the sratch server.

As a convenience, Appendix A features a Python program that asks a few questions and then sets up a scratch server for you. If you have access to the Web, you can just download it from http://uche.ogbuji.net/tech/4Suite/scratch-server.py. If not, just copy and paste from the listing. By the way, if you are a Python developer, you might find the contents of scratch-server.py a useful example of the Python API.

Run the script. When it prompts you to log in, you must do so as superuser.

$ python tech/4Suite/scratch-server.py
4SS superuser name: su
Password for su:
In the following prompts, just hit enter if the given defaults are OK.
Name for the container to create [web]:
Port on which to host the HTTP server [8080]:
Brief name to identify the server [4ss]:
Contact e-mail address to display in case of error [root@localhost]:
$

Adding or changing server specifications may be recognized by the running repository after a certain delay, or not at all, depending on your configuration options. Just to be sure, you may want to run 4ss_manager restart.

5 4Suite Repository Dashboard

Now that you've played with some of the command-line tools, this section will show those similar set of commands in a visual environment called the 4Suite Repository Dashboard. Dashboard comprises of a GUI interface to manage servers, users, groups, repository and the configuration.

5.1 Let's get started!

Open up your web browser and type in the following URL: http://localhost:8800/

Note: This is provided you've followed the installation guide and have the 4ss_manager running. Use a web browser and check out localhost ports 8800 and 8801. For example, http://localhost:8800/ for Dashboard and http://localhost:8801 for Demos.

5.2 Repository

The default redirect is set to the 4Suite Repository container manager. You should see the following (provided that you followed the command-line examples in the quick-start guide, else you would only see the ftss container).

Notice the ftss and the home directories. Since we've been playing with the "home" container, let's continue with it. Click on "home" directory, where you should find "uo" directory. Click on "uo", and you should see two files, "4SS.jpg" and "profile.xml", that were added to the container from the previous command-line section. Now if you click on the "4SS.jpg" file, you'll be able to view the file, on the web browser, by clicking on the "View Raw File Data".

You should also be able to replace the file. For "profile.xml", you can edit the document in the "Editing Content" area or view the document in the browser by pressing "View XML Document Data" button.

In the change directory field, type in /home/uo/ and press the "Change Directory" button.You should be able to add new resources by selecting the type (pull down menu) and clicking on the "Add Resource" button. You'll be taken to a page where you have the option of editing a file or browsing for the file. But you'll have to provide the name of the file for the repository, i.e. a local name, otherwise you'll get a randomly generated reference name for the file.

5.3 Just brief overview of rest of the Dashboard features:

  • Server Manager:

    Server manager allows a convenient way to edit server xml file.

  • User Manager:

    Users name and passwords can be edited via the User Manager. Notice the usernames "su" and "uo" that you created in the previous section.

  • Group Manager:

    You can edit, add, and remove members from a group.

  • Configure:

    The configuration screen allows you to configure certain aspects of Dashboard. The temporary workspace entry allows you to define a directory on your local machine where GraphViz (refer to the installation guide for more information) will put its output files. The 'dot' executable directory is the directory where the GraphViz executable is located. The 'Default Manager' option allows you to determine whether or not to view XML based resources using their special managers or to use the generic raw-file manager (in this case to modify the XML content directly). The 'Display icons' option determines whether or not to show icons of container children in the container-manager. Finally, the last option allows the user to determine whether or not to rotate RDF visualizations by 90 degrees, which is helpful for very large graphs, which tend to be wider than they are tall.

6 Resources

6.1 4Suite @ SourceForge

4Suite Project Page - Bug Reports, Feature Requests, Patches

6.2 External Links

4suite.org - Documentation, Downloads, News, CVS, Developer Resources

4Suite Users Mailing List - Peer & Developer Support

4Suite Announcement Mailing List - Infrequent Announcements about 4Suite

Fourthought, Inc. - Commercial Development, Consulting & Support

A Scratch Server set-up tool

import sys, sha, getpass
from Ft.Server.Client import FtServerClientException
from Ft.Lib import Uri
from Ft.Server.Common import ResourceTypes, AclConstants
from Ft.Server.Client import Core


def Run():
    user_name = raw_input("4SS superuser name: ")
    passwdHash = sha.new(getpass.getpass("Password for %s: " % user_name)).hexdigest()
    print "In the following prompts, just hit enter if the given defaults are OK."
    container_name = raw_input("Name for the container to create [web]: ")
    if not container_name: container_name = 'web'
    server_port = raw_input("Port on which to host the HTTP server [8080]: ")
    if not server_port: server_port = '8080'
    server_name = raw_input("Brief name to identify the server [4ss]: ")
    if not server_name: server_name = '4ss'
    contact = raw_input("Contact e-mail address to diaplay in case of error [root@localhost]: ")
    if not contact: contact = 'root@localhost'
    server_doc = SERVER_FILE%locals()

    try:
        try:
            commit = 0
            #Get the repository by logging in
            repo = Core.GetRepository(user_name, passwdHash, 'localhost', 8803)
            cont = repo.createContainer('/' + container_name)
            cont.setAcl(AclConstants.WRITE_ACCESS, AclConstants.USERS_GROUP_NAME, AclConstants.ALLOWED)
            cont.setAcl(AclConstants.READ_ACCESS, AclConstants.USERS_GROUP_NAME, AclConstants.ALLOWED)
            cont.setAcl(AclConstants.READ_ACCESS, AclConstants.WORLD_GROUP_NAME, AclConstants.ALLOWED)
            doc = repo.createDocument('/' + container_name + '/server.xml',
                                      server_doc,
                                      imt='text/xml',
                                      docDef=None,
                                      forcedType=ResourceTypes.ResourceType.SERVER)
            commit = 1
        finally:
            try:
                if commit:
                    repo.txCommit()
                else:
                    repo.txRollback()
            except:
                pass

    except FtServerClientException, e:
        print e


SERVER_FILE = """<Server xmlns="http://xmlns.4suite.org/reserved" xmlns:dc="http://purl.org/dc/elements/1.1/"
>
  <dc:Description>Scratch server</dc:Description>
  <Status running='1'/>
  <Module>Http</Module>
  <Handler>http_basic</Handler>
  <Port>%(server_port)s</Port>

  <!-- contact information -->
  <ServerAdmin>%(contact)s</ServerAdmin>
  <ServerName>%(server_name)s</ServerName>

  <!-- logging -->
  <LogLevel>notice</LogLevel>

  <DocumentRoot>/%(container_name)s</DocumentRoot>
</Server>
"""


if __name__ == "__main__":
    Run()

B Using 4ss set acl interactively

Then give the new user full permissions over this container.

Note: ACL stands for access-control list. An access control list limits the operations possible on the resource. For each resource, there is a set of users and groups that can perform each of the operations. There are six operations currently: Read, Write, Execute, Delete, Change Permissions, and Change Owner.

$ 4ss set acl /home/uo

4SS User Name: su
Password for su:
Host <localhost>:
Port <8803>:
Current ACL Settings for: /home/uo
Read ACL
  owner --> allowed
  world --> allowed
  super-users --> allowed
Write ACL
  owner --> allowed
  super-users --> allowed
Execute ACL
  owner --> allowed
  world --> allowed
  super-users --> allowed
Delete ACL
  owner --> allowed
  super-users --> allowed
Change Permissions ACL
  owner --> allowed
  super-users --> allowed
Change Owner ACL
  owner --> allowed
  super-users --> allowed

Here, you'll be asked to enter a command. These commands allows you to change the above list of ACL permissions, i.e. Read ACL has super-users, world, and owner with the access permission of allowed to the /home/uo container. You'll see how to modify these permissions in the examples below.


Please enter a command:
(s)et
(a)dd
(r)emove
(q)uit and save
(e)xit without save
>> s

Type of access: read | write | execute | delete | change owner | change
permissions

Please enter the type of access: write
Please enter the ident (i.e. username) to set: uo
Should uo be allowed write on /home/uo (yes/no): y
Current ACL Settings for: /home/uo
Read ACL
  super-users --> allowed
  world --> allowed
  owner --> allowed
Write ACL
  uo --> allowed
Execute ACL

SNIP

Please enter a command:
(s)et
(a)dd
(r)emove
(q)uit and save
(e)xit without save
>> q

This allows any user to read the contents of the container, but only user "uo" can modify, or add contents to the container. To add more permissions (such as delete), you would simply continue with the above example (instead of (q)uit, press (s)et and enter type of access as delete. For command line help, type 4ss set acl --help at the prompt.