

I - Description :
----------------
This example is written in order to demonstrate a significant part of the 
capabilities provided by the "C" SDK and JESMF agent.

This example is composed of:
	- The test_httpd Component Product that simulates a very simple web 
	server


The test_httpd  which exposes 3 services and resource which are displayed in the 
index menu. 
	-LOGIN     service
	-WILDCARD  service
	-DISPLAY   service
	-CIRC_FILE resource


For each service, it is possible to enable enable or disable the 
instrumentation selectively and also to trigger the test execution
of the service.

The test execution of a service is instrumented with the instrumentation
API  and the result of the instrumentation (all the instrumentation values) 
are made visible within the returned web page of the test service.

 
The resource represents a circular buffer where is stored the buffer result 
of each service instrumentation result. The resource is incremented each time 
a service is triggered.

Those services and resource are exposed at the CIB level using 
HTTPSERV_SRVModule 





II - Layout 
-----------
BASE_DIR is the base installation directory, and is made up of the following
subdirectories:

a) ${BASE_DIR}/opt/SUNWmfwk/examples/c/httpservCP/src:
When you run the command "make" , the library generated is libhttp.so.
	
b) ${BASE_DIR}/opt/SUNWmfwk/examples/c/httpservCP/test
When you run the command "make", the executable generated is test_httpd
which is the web server daemon

c) ${BASE_DIR}/opt/SUNWmfwk/examples/httpservCP
The following class is used to build the CACAO HTTPSERV module :
HTTPSERV_SRVModule.java  the CACAO module implementation

d) deployment descriptor:
/etc/opt/SUNWcacao/modules/com.sun.mfwk.httpservCP_module.xml
which contains the path to access to the cacao module:

/opt/SUNWmfwk/examples/httpservCP/httpservCP_module.jar




III - Deployment :
-----------------


You need to be root to if you have not copied the examples
directory to to another place.


C http server
+++++++++++++
1/ To to compile the C test_httpd component product

	cd ${BASE_DIR}/opt/SUNWmfwk/examples/c/httpservCP/src
	make

	cd ${BASE_DIR}/opt/SUNWmfwk/examples/c/httpservCP/test
	make
	
	The executable test_httpd is generated within this directory



Java part
+++++++++

1/ requirements

you need to have installed previously:
	-JDMK5.1 software
	-CACAO software

2/ To compile the cacao module for httpservCP:
Specify the following jar files in your classpath:
  jdmk and jmx jars files:  jdmkrt.jar jmxremote.jar jmxremote_optional.jar jmxri.jar 
  cacao jar file : cacao_cacao.jar
  MFWK SDK jar file : mfwk-0_1_sdk.jar
  MFWK J2EE management jar file : javax77.jar
  
If all packages have been installed in default root directory, your classpath should be :
CLASSPATH=\
${BASE_DIR}/opt/SUNWjdmk/5.1/lib/jmx.jar:\
${BASE_DIR}/opt/SUNWjdmk/5.1/lib/jmxremote.jar:\
${BASE_DIR}/opt/SUNWjdmk/5.1/lib/jmxremote_optional.jar:\
${BASE_DIR}/opt/SUNWjdmk/5.1/lib/jdmkrt.jar:\
${BASE_DIR}/opt/SUNWcacao/lib/cacao_cacao.jar:\
${BASE_DIR}/opt/SUNWmfwk/lib/mfwk_sdk.jar:\
${BASE_DIR}/opt/SUNWmfwk/lib/javax77.jar


Then invoke javac command :
cd ${BASE_DIR}/opt/SUNWmfwk/examples
javac -d . -classpath $CLASSPATH httpservCP/*.java 

Then build your modules jars files :
jar -cvf httpservCP/httpservCP_module.jar com/sun/mfwk/examples/httpservCP/HTTPSERV_SRVModule.class

3/ To deploy your CACAO modules :
copy modules deployment descriptors into CACAO modules directory :
cp httpservCP/com.sun.mfwk.httpservCP_module.xml /etc/opt/SUNWcacao/modules/




IV - Run :
--------- 

1/ Start CACAO :
cd ${BASE_DIR}/opt/SUNWcacao/bin
./cacaoadm start
(you may have to do a cacaoadm stop before if necessary).



3/ Start the "C" web server test_httpd  :
	cd ${BASE_DIR}/opt/SUNWmfwk/examples/c/httpservCP/test
	sh test_httpd.sh


4/ To use httpd web server make the metrics interesting:
	-launch a web browser at the URL 9090 of the machine
	 on which the test_httpd server is running.

	-You obtain the test_httpd index web page displaying
	each of the 3 services and the resource that you can 
	test enable/disable selectively
		




V - Test :
---------

1/ Connect to the Agent :
use html adaptor on port 8082

2/ It is possible browse some within this web page the httpservCP module
info and to observe at the CIB level the changes that have occurred within
th httpd server


