Running the Example


The following configuration and services are required to run the portal example.

Configuration

Although defining and deploying WAR files in Tomcat is outside the scope of this chapter, you can use the following Web.xml file to demonstrate the servlet mapping required in the example:

 <?xml version="1.0" encoding="ISO-8859-1"?>  <web-app>     <servlet>       <servlet-name>homeplace</servlet-name>       <servlet-class>org.jworkplace.homeplace.HomePlace</servlet-class>     </servlet>     <servlet-mapping>         <servlet-name>homeplace</servlet-name>         <url-pattern>/homeplace</url-pattern>     </servlet-mapping> </web-app> 

Unzip the portal.zip file. The included WAR file can simply be copied to the /webapps directory of your Tomcat installation prior to startup. This file will be expanded to create the Web resources necessary to run the portal.

Starting Services

There are a number of services that will initially be required. These services include Tomcat, reggie, mahalo, and JavaSpaces.

Starting Tomcat

Tomcat has instructions on configuring and starting the Tomcat server. To start the server, go to the \bin directory and invoke the startup.bat or startup.sh command file. You must set the JAVA_HOME environment variable to point to your Java installation prior to startup. Be sure to copy the homeplace.war file to the Tomcat \webapps directory prior to starting.

Starting reggie

To start reggie, the Jini-supplied ServiceRegistrar, use the script in Listing 18.9. Simply set the JINI_HOME environment variable to your Jini installation, and your HTTP_ADDRESS to an accessible Tomcat context, such as /Root and the port Tomcat is using:

 Set HTTP_ADDRESS=C:\jakarta-tomcat4.0\webapps\Root:8081  

It is here that you will place all files that must be available for download to clients and services. For instance:

  • reggie-dl.jar

  • mahalo-dl.jar

  • outrigger-dl.jar

Listing 18.9 The startReggie.bat File
 @echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public echo Java P2P Unleashed echo  - echo Jini install directory          %JINI_HOME% echo Tomcat Web server               %HTTP_ADDRESS% echo Default group                   %GROUPS% echo  - java -jar -Djava.security.policy=%JINI_HOME%\policy\policy.all %JINI_HOME%\lib\reggie.jar  graphics/ccc.gifhttp://%HTTP_ADDRESS%/reggie-dl.jar %JINI_HOME%\policy\policy.all .\services\logs\ graphics/ccc.gifreggie_log %GROUPS% 
Starting mahalo

JavaSpaces requires the transaction service mahalo. To start mahalo, run the script in Listing 18.10.

Listing 18.10 The startMahalo.bat File
 @echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public echo Java P2P Unleashed echo  - echo Jini install directory          %JINI_HOME% echo Web server                      %HTTP_ADDRESS% echo Default group                   %GROUPS% echo  - echo Starting the mahalo transaction service... java -jar - Djava.security.policy=%JINI_HOME%\example\txn\policy.all - Dcom.sun.jini. graphics/ccc.gifmahalo.managerName=TransactionManager %JINI_HOME%\lib\mahalo.jar http://%HTTP_ADDRESS%/ graphics/ccc.gifmahalo- dl.jar %JINI_HOME%\example\txn\policy.all.\services\logs\txn_log %GROUPS% 
Starting JavaSpaces

Now start JavaSpaces, using the script in Listing 18.11.

Listing 18.11 The startOutrigger.bat File
 @echo off echo must set JINI_HOME and HTTP_ADDRESS set JINI_HOME= set HTTP_ADDRESS= set GROUPS=public set SPACENAME=JavaSpaces echo Java P2P Unleasehd echo  - echo Jini install directory          %JINI_HOME% echo Web server                      %HTTP_ADDRESS% echo Default group                   %GROUPS% echo Default space name              %SPACENAME% echo  - echo Starting the outrigger JavaSpaces service... java -jar -Djava.security.policy=%JINI_HOME%\policy\policy.all- Dcom.sun.jini.outrigger. graphics/ccc.gifspaceName=%SPACENAME% %JINI_HOME%\lib\outrigger.jar http://%HTTP_ADDRESS%/outrigger-dl. graphics/ccc.gifjar %JINI_HOME%\policy\policy.all .\services\logs\js_log %GROUPS% 

You should now be able to access your portal and begin to add content by starting a Web browser and entering

http://hostname:8081/homeplace/homeplace.html

Figure 18.5 shows the portal in action.

Figure 18.5. The personal portal.

graphics/18fig05.jpg



JavaT P2P Unleashed
JavaT P2P Unleashed
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 209

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net