Tuesday, August 17, 2010

Deploying Resources - OGSA-DAI/CXF/Linux/Ant/Tomcat/mysql

A random post on deploying the resources. :)

Set an OGSADAI_HOME environment variable
export OGSADAI_HOME=/home/pradeeban/ogsa-dai/ogsa-dai/trunk/release-scripts/ogsa-dai/cxf/build/ogsadai-4.1-cxf-2.2.6-src/build/ogsadai-4.1-cxf-2.2.6-bin

Set the CLASSPATH
cd $OGSADAI_HOME
source setenv.sh

Checking for too long path issue
After setting the environment using setenv.sh, make sure that your classpath hasn't exceeded the maximum allowed length. If it had exceeded, as a quick fix, you can consider moving your OGSADAI_HOME to somewhere upwards towards the root directory.


Creating a sample MySQL database 'ogsadai' using ogsa-dai's createTestMySQLDB class with the table 'littleblackbook' and 10000 entries.

java uk.org.ogsadai.dbcreate.CreateTestMySQLDB -host coal.epcc.ed.ac.uk -port 3306 -database ogsadai -username mysqlUser -password 123456 -rootusername ogsadairootuser -rootpassword ogsadairootpassword

java -cp $CLASSPATH:/home/pradeeban/ogsa-dai/third-party/dependencies/mysql/mysql-connector/5.0.4/mysql-connector-java-5.0.4-bin.jar:/home/pradeeban/gsoc2010/data/build/lib/ogsadai-4.1-sampledata-1.0.jar uk.org.ogsadai.dbcreate.CreateTestMySQLDB -host localhost -port 3306 -database ogsadai -username root -password root -rootusername root -rootpassword root
MySQL Settings:
    MySQLDriverClass:        org.gjt.mm.mysql.Driver
    MySQLHostName:           localhost
    MySQLPortNumber:         3306
    MySQLDatabaseName:       ogsadai
    MySQLUserName:           root
    MySQLPassword:           root
    NameOfTableToCreate:     littleblackbook
    NumberOfRowsToCreate:    10000
    MySQLRootUserName:       root
    MySQLRootPassword:       root
Opening connection to MySQL system database
Creating 'ogsadai' database in MySQL if it does not already exist
Creating user 'root' with password 'root' in MySQL if it does not already exist
User 'root' already exists within MySQL
Dropping table if it already exists
Creating littleblackbook table in database
Preparing insert statement
Adding 10000 entries to 'littleblackbook' .............
Test database created successfully!


Deploying the database to ogsa-dai
DeployResource deployMySQL MySQLResource jdbc:mysql://localhost:3306/ogsadai Login permit MySQLResource ANY
DeployResource deployMySQL MySQLResource jdbc:mysql://localhost:3306/ogsadai Login permit MySQLResource ANY ogsadai root



getVersion method
java -cp $CLASSPATH:/home/pradeeban/gsoc2010/core/client/build/lib/ogsadai-4.1-client-1.0.jar:/home/pradeeban/gsoc2010/core/common/build/lib/ogsadai-4.1-common-1.0.jar:/home/pradeeban/gsoc2010/core/clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c getVersion


java -cp $CLASSPATH:/home/pradeeban/gsoc2010/core/client/build/lib/ogsadai-4.1-client-1.0.jar:/home/pradeeban/gsoc2010/core/common/build/lib/ogsadai-4.1-common-1.0.jar:/home/pradeeban/gsoc2010/core/clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c getVersion

java uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c getVersion


How to show the server version
java uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c listResources

java -cp $CLASSPATH:/home/pradeeban/gsoc2010/core/client/build/lib/ogsadai-4.1-client-1.0.jar:/home/pradeeban/gsoc2010/core/common/build/lib/ogsadai-4.1-common-1.0.jar:/home/pradeeban/gsoc2010/core/clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c listResources

java -cp client/build/lib/ogsadai-4.1-client-1.0.jar:common/build/lib/ogsadai-4.1-common-1.0.jar:clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -c listResources


java -cp client/build/lib/ogsadai-4.1-client-1.0.jar:common/build/lib/ogsadai-4.1-common-1.0.jar:clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.ServerClient -u http://localhost:8080/dai/services/ -r MySQLDataResource -t uk.org.ogsadai.DATA_RESOURCE -c getLifetime


DB Query
pradeeban@pradeeban-laptop:~/ogsa-dai/ogsa-dai/trunk/extensions/basic/client$ ant jar
pradeeban@pradeeban-laptop:~/ogsa-dai/ogsa-dai/trunk/extensions/relational/client$ ant jar

mySQLResourceConfig.txt
DeployResource deployMySQL MySQLResource jdbc:mysql://localhost:3306/ogsadai Login permit MySQLResource ANY
DeployResource deployMySQL MySQLResource jdbc:mysql://localhost:3306/ogsadai Login permit MySQLResource ANY ogsadai root


Deploy the above DeployResource script with:
ant -Dtomcat.dir=$CATALINA_HOME -Dconfig.file=mySQLResourceConfig.txt configure

java -cp /home/pradeeban/ogsa-dai/ogsa-dai/trunk/extensions/relational/client/build/lib/ogsadai-4.1-relational-client-1.0.jar:/home/pradeeban/gsoc2010/core/client/build/lib/ogsadai-4.1-client-1.0.jar:/home/pradeeban/gsoc2010/core/common/build/lib/ogsadai-4.1-common-1.0.jar:/home/pradeeban/gsoc2010/core/clientserver/build/lib/ogsadai-4.1-clientserver-1.0.jar uk.org.ogsadai.client.toolkit.example.SQLClient -u http://localhost:8080/dai/services -d MySQLResource -q "SELECT * FROM littleblackbook WHERE id <  10"
*DRER ID: DataRequestExecutionResource
Data Resource ID: MySQLResource
Base Services URL: http://localhost:8080/dai/services
SQL-Query: SELECT * FROM littleblackbook WHERE id <  10

No comments:

Post a Comment