Cosmo and Derby
The OSAF bundle comes with the
Apache Derby database.
Derby tools to analyse the database used by Cosmo
You will need the derbytools.jar to issue SQL commands and view the content stored by Cosmo
The OSAF bundle does not come with the derbytools.jar and this file can be found in the complete Derby install -
Derby Download
After downloading, export the classpath to include the derby and the derby tools jar file.
#bash# export CLASSPATH=$CLASSPATH:~/Desktop/db-derby-10.1.2.1-bin/lib/derbytools.jar
:$OSAF_BUNDLE_HOME/tomcat/common/lib/derby-10.1.2.1.jar
Hibernate and Derby
#bash# cd $OSAF_BUNDLE_HOME
#bash# java org.apache.derby.tools.dblook -d jdbc:derby:db
-- Timestamp: 2006-09-19 15:46:36.157
-- Source database is: db
-- Connection URL is: jdbc:derby:db
-- appendLogs: false
-- ----------------------------------------------
-- DDL Statements for schemas
-- ----------------------------------------------
CREATE SCHEMA "SA";
-- ----------------------------------------------
-- DDL Statements for tables
-- ----------------------------------------------
CREATE TABLE "SA"."SERVER_PROPERTIES" ("ID" BIGINT NOT NULL, "PROPERTYNAME" VARCHAR(255), "PROPERTYVALUE" VARCHAR(255));
CREATE TABLE "SA"."DICTIONARY_VALUES" ("ATTRIBUTEID" BIGINT NOT NULL, "STRINGVALUE" VARCHAR(255), "KEYNAME" VARCHAR(255) NOT NULL);
CREATE TABLE "SA"."CAL_TIMERANGE_INDEX" ("ID" BIGINT NOT NULL, "STARTDATE" VARCHAR(255), "ENDDATE" VARCHAR(255),
"COMPONENTTYPE" VARCHAR(255), "ISRECURRING" SMALLINT, "ISFLOATING" SMALLINT, "ITEMID" BIGINT);
CREATE TABLE "SA"."ITEM" ("ID" BIGINT NOT NULL, "ITEMTYPE" VARCHAR(16) NOT NULL, "VERSION" INTEGER NOT NULL,
"OWNERID" BIGINT, "PARENTID" BIGINT, "UID" VARCHAR(255), "ITEMNAME" VARCHAR(255), "DATECREATED" TIMESTAMP,
"DATEMODIFIED" TIMESTAMP);
.
.
.
The output is truncated here for clarity. The complete output can be found
here
All the tables are a direct mapping of the objects in the model directory and the
mapping defined in the hibernate xml mapping.
(COSMO_SRC_HOME/src/main/resources/org/osaf/cosmo/model)
Example listing the SA.ITEM table:
vinu@vinu-laptop:~/vinu/cosmoacl/snarf/dist/osaf-server-bundle-0.5-SNAPSHOT$ java org.apache.derby.tools.ij
ij version 10.1
ij> connect 'jdbc:derby:db';
ij> select * from SA.ITEM;
ID |ITEMTYPE |VERSION |OWNERID |PARENTID |UID |ITEMNAME |DATECREATED |DATEMODIFIED
----------------------------------------------------------------------------------------------------------------------------------------------------
65536 |homecollection |0 |32768 |NULL |3u446ahth0 |root |2006-09-19 14:28:10.944 |2006-09-19 14:28:10.944
65537 |homecollection |0 |32769 |NULL |bxfv21hw20 |test |2006-09-19 14:31:17.019 |2006-09-19 14:31:17.019
2 rows selected