Sun Java System Portal Server 7.2 Developer's Guide

Running the Example

To run the example described in Example 28–1, follow these steps.

ProcedureTo Run the Example

  1. Edit the definitions for MY_SCOPE, MY_CSID, and MY_ATTR_VIEW as appropriate for your situation. For more information, see Running the Example.

  2. Save the file in PortalServer-base/sdk/rdm/examples directory. For example, save the file as example4.c in PortalServer-base/sdk/rdm/examples directory.

  3. Create a makefile. You can find sample makefiles at PortalServer-base/sdk/rdm/examples directory. Edit the makefile to include example4.c. Following is a makefile with the changes needed for example4.c in bold:

    Makefile for Search/RDM examples


    #  Makefile for Search/RDM SDK examples
    #  Use make and cc.
    CC              = cc
    SDKDIR          = ..
    SDKLIB          = $(SDKDIR)/lib/librdm.a
    SDKINC          = $(SDKDIR)/include/
    CFLAGS          = -I$(SDKINC) -DXP_UNIX
    CFLAGS          += -DSOLARIS
    #CFLAGS         += -DIRIX
    #CFLAGS         += -DHPUX
    #CFLAGS         += -DAIX
    EXAMPLES        = example1 example2 example3
                       example4
    all:    $(EXAMPLES)
    example1:example1.o
    $(CC) -o $@ $@.o $(SDKLIB)
    example2:example2.o
    $(CC) -o $@ $@.o $(SDKLIB)
    example3:example3.o
    $(CC) -o $@ $@.o $(SDKLIB)
    example4:example4.o
    $(CC) -o $@ $@.o $(SDKLIB)
    
  4. From the PortalServer-base/sdk/rdm/examples directory, build the example as follows:


    Solaris:gmake
  5. From the PortalServer-base/sdk/rdm/examples directory, run the example4.c program to generate the RDM file.


    example4.c > rdm.search

    Following is an example of rdm.search file.


    @RDMHEADER { -
     catalog-service-id{40}:x-catalog://budgie.siroe.com:6714/budgie
     rdm-version{3}: 1.0
     rdm-type{10}: rd-request
     rdm-query-language{6}: search
    }
    
    @RDMQUERY { -
     view-attributes{18}: title,content-type
     scope{5}: varrius
    }

    The file rdm.search created in must be placed into the server instance directory.

  6. Send the Search contained in rdm.search to the program sendrdm. For example, type:


    ./run-cs-cli sendrdm -u /portal/search rdm.search

    The current directory should be the server instance directory. If rdm.search is not in the server instance directory, reference the file from where is was created. For example:

    1. Change directories to server_instace_dir.

    2. Type ./run-cs-cli sendrdm -u /portal/search sdk_dir/rdm.search.

    3. The results of the sendrdm program will be a Search stream containing the results of the query, such as the following example:


      @RDMHEADER { - catalog-service-id{41}:x-catalog://budgie.siroe.com:6714/
      budgie rdm-version{3}: 1.0 rdm-type{11}: rd-response rdm-response-interpret{51}:
      20 results out of 36281 hits across 88985 documents } @DOCUMENT 
      { http://fury.sesta.com:999/it/newsref/pr/newsrelease417.html content-type{9}: 
      text/html score{3}: 100 title{17}: Comunicato stampa } @DOCUMENT 
      { http://fury.sesta.com:999/it/newsref/pr/newsrelease374.html content-type{9}:
      text/html score{3}: 100 title{17}: Comunicato stampa }

      You can pipe the output of sendrdm (which is a SearchStream) to another program to print the results of the query.