Webs



UMLUML Activity Diagram for Adding a New Database to WebFindit Create realdatabaseCreate thecodatabaseAdd a newdatabaseto WebFinditModify relatedscriptsCreate databaserelateddocuments(see Note 1)Create databaseschema(see Note 2)Populate newdatabase(see Note 4)Populate newdatabase(See Note 3)RelationaldatabaseOOdatabaseRegister withOrbix(See Note 10)Register withOrbixWeb(see Note 5)Register withEJB server(see Note 7)Register withRMI server(see Note 8)Register withVisibroker(see Note 6)Register withDCOM server(see Note 9)OrbixWebEJB RMIVisibrokerMO DCtextCreate newontology(see Note 11)Create newcodatabase(see Note 15)Ontology not exist Ontology exist Create newontologyin related codb dir(see Note 13)Modify otherrelatedcodatabase(see Note 16)Create newcodatabase(see Note 12)Modify otherrelatedcodatabase(see Note 14)Create scripts toregister withOrbix(see Note 17)Create scripts tostart codb server(See Note 19)RelationaldatabaseOOdatabaseCreate relatedfiles to start dbserver(See Note 18)Modify the scriptto check systemavailability(See Note 20)Modify relatedfiles(See Note 21)Modify relatedfiles(See Note 22)OOdatabasesupportxml queryNotes 1. Go to ~/public_html/webfindit/Documentation Create a new directory, put the database related html files and images there. For example, if the new database is QUT, create a new directory QUT in ~/public_html/webfindit/Documentation. In QUT, create directory html and images. 2. Go to ~/public_html/webfindit/Documentation/schemas Create a new directory. Then create default.htm containing the schema of the new database there. For example, if the new database is QUT, create a new directory QUT in ~/public_html/webfindit/Documentation/schemas. Part of the content of default.htm is like: Table people ( people_id int not null primary key, first_name char(20), surname char(20) (Table staff ( people_id int not null primary key, office_number char(5), office_phone char(15), last_qualification char(30), major_res_interest char(40), num_publications int (3. Go to ~/WebFindit_3/Actual_Databases Create a new directory. Then create SQL scripts to populate the database. For example, If the new database QUT is a DB2 database, create a new directory DB2_QUT and take the scripts in DB2_Medicare as examples. If the new database QUT is a INFORMIX database, create a new directory INFORMIX_NT_QUT and take the scripts in INFORMIX_NT_ DONATION as examples. If the new database QUT is a MSQL database, create a new directory MSQL_QUT and take the scripts in MSQL_MBF as examples. If the new database QUT is a ORACLE database, create a new directory ORACLE_QUT and take the scripts in ORACLE_QUH as examples. If the new database QUT is a ObjectStore database, create a new directory OBJ_STORE_QUT and take the scripts in OBJ_STORE_AMP as examples. The most important one you should work on is Create_*_. 4. Go to ~/WebFindit_3/IDL Create an idl file using AMP.idl as an example. Compile the idl file into Java and C++ files. Go to ~/WebFindit_3/Actual_Databases/ and create a new dir Orbix_*. Create files using files in Orbix_AMP as examples. For example, the new database is QUT, the idl file is like the following. Field1, Field2, Field3 represent the fields in the QUT database table. #include "Types.idl" #include "Query.idl" typedef sequence<string> StringSeq; interface QUT } StringSeq RetrieveAllField1(); StringSeq RetrieveAllField2(); StringSeq RetrieveAllField3(); ... ... string execute(in string query, inout Query::QueryStatus qs); // gets the Documentation for a particular doc type from the database Types::MimeObjectSeq getDocumentation( in long docTypeId, inout Query::QueryStatus qs); // gets the database schema string getSchema(); ;{ 5. If the database registers with OrbixWeb ORB, go to ~/WebFindit_3/Actual_Databases/OrbixWeb_Actual_Databases/ and modify OwebServer.java. In OwebServer.java, add the code to create an instance of DatabaseImpl. For example, the new database QUT is an DB2 database, add the following code: qut = new DatabaseImpl ("QUT Research", "COM.ibm.db2..DB2Driver", "jdbc:db2://earth.nvc.cs.vt.edu:QUTR", " QUT/default.htm"); 6. If the database registes with Visibroker ORB, go to ~/WebFindit_3/Actual_Databases/VisiBroker_Actual_Databases/ and modify OwebServer.java to create a new instance of DatabaseImpl and register it with ORB. For example, if the new database is SGF, add the following code in OwebServer.java: DatabaseImpl sgf = new DatabaseImpl("State Government Funding", "oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@pluto.nvc.cs.vt.edu:1521:project", " SGF/default.htm"); orb.connect(sgf); FileWriter output = new FileWriter("/people/project/WebFindit_3/IORs /Actual_Database_IORs/sgf_db.ior"); output.write(orb.object_to_string(sgf)); System.out.println("Wrote Patient's IOR to file: sgf_db.ior"); output.close(); 7. If the database registers with EJB server, go to ~/WebFindit_3/Actual_Databases/VB_CorbaEJB/ and modify VbrokerServer.java. If the new database MIC is a Oracle database, add the following code in VbrokerServer.java: DatabaseImpl myejb = new DatabaseImpl ("company", "oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@jupiter.nvc.cs.vt.edu:1521:project", " MIC/default.htm"); orb.connect(myejb); FileWriter output = new FileWriter("/people/project/WebFindit_3/IORs /Actual_Database_IORs/MIC_db.ior"); output.write(orb.object_to_string(myejb)); System.out.println("Wrote Patient's IOR to file: MIC_db.ior"); 8. If the database registers with RMI server, go to ~/WebFindit_3/Actual_Databases/VB_CorbaRMI/ and modify VbrokerServer.java. If the new database QUH is a Oracle database, add the following code in VbrokerServer.java: DatabaseImpl QUH = new DatabaseImpl ("QUH", "oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@pluto.nvc.cs.vt.edu:1521:project", " QUH/default.htm"); orb.connect(QUH); FileWriter output = new FileWriter("/people/project/WebFindit_3/IORs/Actual_Database_IORs/QUH_db.ior"); output.write(orb.object_to_string(QUH)); System.out.println("Wrote Patient's IOR to file: QUH_db.ior"); output.close(); 9. If the database registers with DCOM server, go to ~/WebFindit_3/Actual_Databases/VB_CorbaDCOM/ and modify VbrokerServer.java. For example, if the new database is an Informix database on Windows NT, add the following code to VbrokerSerser.java. DatabaseImpl sgf = new DatabaseImpl ("Donation", "driver", "informix", " DONATION/default.htm"); orb.connect(sgf); FileWriter output = new FileWriter("/people/project/WebFindit_3/IORs /Actual_Database_IORs/DONATION_db.ior"); output.write(orb.object_to_string(sgf)); System.out.println("Wrote Patient's IOR to file: DONATION_db.ior"); output.close(); 10. Go to ~/WebFindit_3/Actual_Databases/ Orbix_*. Create files using files in Orbix_AMP as examples. For example, if the new database is AMP, the follow code are needed in Srv_: // create a AMP object - using the implementation class AMP_i AMP_i amp_db; // This section is to store the AMP IOR into a file char *tmpFileName = ""; char tmpFilePath[1024]; strcat(tmpFileName, "/people/project/WebFindit_3/IORs/Actual_Database_IORs/amp_db.ior"); CORBA::Orbix.setServerName("AMP"); char *stringObj; try { stringObj = amp_db._object_to_string(CORBA::IT_INTEROPERABLE_OR_KIND); { catch (CORBA::SystemException &sysEx) { cerr << "Unexpected system exception " << endl; cerr << &sysEx; { // get Orbix to start processing incoming requests try { CORBA::Orbix.impl_is_ready("AMP",CORBA::Orbix.INFINITE_TIMEOUT); { catch (CORBA::SystemException &sysEx) { cerr << "Unexpected system exception" << &sysEx << endl; exit (1); { 11. Go to ~/WebFindit_3/Codatabases/ and create a new directory *_Codatabase_Source. Add new files, for example, if the new database belongs to a new ontology Welfare, create new files such as Coalition_Welfare.hh and Coalition_. Also add new OS_MARK_SCHEMA_TYPE in as follows: OS_MARK_SCHEMA_TYPE (Welfare); Coalition_ is like #include <string.h> #include <stdio.h> #include "Coalition_Welfare.hh" Coalition_Welfare::Coalition_Welfare(char *keywords, char *database_name, char *dbms, char * operating_system, char *query_language) } strcpy(Keywords, keywords); strcpy(DatabaseName, database_name); strcpy(Dbms, dbms); strcpy(OperatingSystem, operating_system); strcpy(QueryLanguage, query_language); ;{ 12. Copy all files in ~/WebFindit_3/Codatabases/RBH_Codatabase_Source/ to the current directory and modify those files and rename files. The most important file need to be modified is Create_*_. For example, the new database RBH is an instance of Medical Ontology. The following code is added: cout << PROGRAM_NAME << ": creating RBH instance in Medical Ontology" << endl; MC[0] = new(db1, Coalition_Medical_type) Coalition_Medical( "Medicines, Patients, Doctors", "Fairfax_Hospital", "Oracle", "Unix Solaris 2.6", "SQL"); DocumentationTypes *RBH_Medical_DocTypes[3]; RBH_Medical_DocTypes[0] = new(db1, DocumentationTypes_type) Documentation Types(1, "Slow Connection", " /slow.gif"); RBH_Medical_DocTypes[1] = new(db1, DocumentationTypes_type) Documentation Types(4, "Medium Connection", " /medium.gif"); RBH_Medical_DocTypes[2] = new(db1, DocumentationTypes_type) DocumentationTypes(3, "Fast Connection", ""); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[0]); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[1]); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[2]); 13. Go to other *_Codatabase_Source directory, if the current database belongs to a new ontology Welfare, create new files such as Coalition_Welfare.hh and Coalition_. Also add new OS_MARK_SCHEMA_TYPE in as follows: OS_MARK_SCHEMA_TYPE (Welfare); For example, the current database is RBH, in Create_RBH_, the following part should be added: cout << PROGRAM_NAME << ": creating Welfare Ontology" << endl; Coalition_Welfare *MC[3]; // Instances in the Welfare Ontology // Instances for RBH,... os_typespec *Coalition_Welfare_type = new os_typespec("Coalition_Welfare"); cout << PROGRAM_NAME << ": creating RBH instance in Welfare Ontology" << endl; MC[0] = new(db1, Coalition_Welfare_type) Coalition_Welfare( "Medicines, Patients, Doctors", "Fairfax_Hospital", "Oracle", "Unix Solaris 2.6", "SQL"); DocumentationTypes *RBH_Welfare_DocTypes[3]; RBH_Medical_DocTypes[0] = new(db1, DocumentationTypes_type) DocumentationTypes(1, "Slow Connection", ""); RBH_Medical_DocTypes[1] = new(db1, DocumentationTypes_type) DocumentationTypes(4, "Medium Connection", ""); RBH_Medical_DocTypes[2] = new(db1, DocumentationTypes_type) DocumentationTypes(3, "Fast Connection", ""); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[0]); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[1]); MC[0]->documentation_types.insert(RBH_Medical_DocTypes[2]); cout << PROGRAM_NAME << ": creating Queensland Cancer fund instance in Welfare Ontology" << endl; ... ... 14. Go to other *_Codatabase_Source directories, if the new database and the current database belong to the same ontology, modify Create_*_. For example, the new database QUT and the current database RBH are both instances of Medical Ontology. The following code is needed in the part of creating Medical Ontology in Create_RBH_. cout << PROGRAM_NAME << ": creating QUT instance in Medical Ontology" << endl; MC[2] = new(db1, Coalition_Medical_type) Coalition_Medical( "medical, hospitals, health", "Virginia_Tech_Research", "DB2", "Unix Solaris 2.6", "SQL"); DocumentationTypes *QUT_MEDICAL_DocTypes[3]; QUT_MEDICAL_DocTypes[0] = new(db1, DocumentationTypes_type) DocumentationTypes(5, "Slow Connection", ""); QUT_MEDICAL_DocTypes[1] = new(db1, DocumentationTypes_type) DocumentationTypes(0, "Medium Connection", ""); QUT_MEDICAL_DocTypes[2] = new(db1, DocumentationTypes_type)DocumentationTypes(4, "Fast Connection", ""); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[0]); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[1]); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[2]); If the new database and the current database both are instances of the new ontology, copy the new ontology files to current directory. For example, both of them are instances of new ontology Welfare. Copy Coalition_ and Coalition_Welfare.hh and add OS_MARK_SCHEMA_TYPE (Welfare) in . Then add both databases to new ontology in Create_*_. 15. Go to ~/WebFindit_3/Codatabases/ and create a new directory *_Codatabase_Source. Copy all files in ~/WebFindit_3/Codatabases/RBH_Codatabase_Source/ to the current directory and modify files and rename files. For example, the new database is QUT, change Create_RBH_ to Create_QUT_. In Create_QUT_, modify any places related to current database. For example, change strcpy(theCoDb->localDatabaseIOR, "/people/project/WebFindit_3/IORs/Actual_Database_IORs/rbh_db.ior"); to strcpy(theCoDb->localDatabaseIOR, "/people/project/WebFindit_3/IORs/Actual_Database_IORs/qut_db.ior"); Another example, change strcpy(theCoDb->databaseName, "Fairfax_Hospital"); to strcpy(theCoDb->databaseName, "Virginia_Tech_Research"); 16. Go to other *_Codatabase_Source directories, if the new database and the current database belong to the same ontology, modify Create_*_. For example, the new database QUT and the current database RBH are both instances of Medical Ontology. The following code is needed in the part of creating Medical Ontology in Create_RBH_. cout << PROGRAM_NAME << ": creating QUT instance in Medical Ontology" << endl; MC[2] = new(db1, Coalition_Medical_type) Coalition_Medical( "medical, hospitals, health", "Virginia_Tech_Research", "DB2", "Unix Solaris 2.6", "SQL"); DocumentationTypes *QUT_MEDICAL_DocTypes[3]; QUT_MEDICAL_DocTypes[0] = new(db1, DocumentationTypes_type) DocumentationTypes(5, "Slow Connection", ""); QUT_MEDICAL_DocTypes[1] = new(db1, DocumentationTypes_type) DocumentationTypes(0, "Medium Connection", ""); QUT_MEDICAL_DocTypes[2] = new(db1, DocumentationTypes_type)DocumentationTypes(4, "Fast Connection", ""); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[0]); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[1]); MC[2]->documentation_types.insert( QUT_MEDICAL_DocTypes[2]); 17. Go to ~/WebFindit_3/Actual_Databases/, modify runorbixdbs to run new Orbix database server. For example, the new database QUT is an ObjectStore database, add the following line to runorbixdbs: Orbix_QUT/server & 18. Go to ~/WebFindit_3/admin/db/, create a new file start_*_db using start_amp_db as an example. Go to ~/WebFindit_3/admin/db/scripts/, create a new file *_db_server.pl using amp_db_server.pl as an example. For example, the new datbase is QUT, create a new file qut_db_server.pl: #!/usr/local/bin/perl print "starting database server (QUT) registered with Orbix ORB\n"; print "on host elara.nvc.cs.vt.edu\n"; print "\n\n"; system ('rsh elara.nvc.cs.vt.edu \'setenv WEBFINDIT_HOME "/people/project/WebFindit_3"; source $WEBFINDIT_HOME/etc/orbix.env; source $WEBFINDIT_HOME/etc/objectstore.env; $WEBFINDIT_HOME/Actual_Databases/Orbix_QUT/server >&$WEBFINDIT_HOME/log/db/qut_db_server.log\' &'); 19. Go to ~/WebFindit_3/admin/codb, create some new scripts according to the ontologies the database belong to. For example, if the new database is QUT, which is an instance of Research Ontology, create start_qut_research_codb as follows: #!/bin/csh setenv WEBFINDIT_HOME /people/project/WebFindit_3 source $WEBFINDIT_HOME/etc/webfindit.env source $WEBFINDIT_HOME/etc/objectstore.env source $WEBFINDIT_HOME/etc/orbix.env $WEBFINDIT_HOME/admin/codb/scripts/research/QUT.pl Go to ~/WebFindit_3/admin/codb/scripts/, if the database doesn’t belong to any ontologies, make new scripts in the current dir. If the ontologies that the database belong to exist, go to the corresponding ontology directories and make new scripts there. If the ontologies don't exist, make new directories and scripts. For example, the new database QUT is an instance of Research Ontology, create a file QUT.pl in research directory: #!/usr/local/bin/perl print "starting codb server for database QUT Research\n"; print "in coalition research on host elara.nvc.cs.vt.edu\n"; print "\n\n"; system ('$WEBFINDIT_HOME/bin/CoDatabaseServer QUT_CoDatabase_coalition_research Virginia_Tech_Research saturn:$OSTORE_DB_HOME/saturn/QUT_Research_Codatabase/qut _Codatabase.db $WEBFINDIT_HOME/IORs/Codatabase_IORs/qut_codb_coalition_research. ior &'); 20. Go to ~/System_Start/, modify check_all and check_and_restart. For example, if the new database QUT is an instance of Research Ontology, which is running on elara, add the following code to check_all: set wc_line=`rsh -l project elara ps -ef | grep QUT_CoD | grep proj | grep -v gr ep |wc` if ("$wc_line[1]" == "0" ) then echo QUT CoDatabaseServer is not running rsh -l project elara /people/project/WebFindit_3/admin/codb/start_qut_re search_codb& endif In check_and_restart, the process number on elara increases from 7 to 8, change set wc_line=`rsh -l project elara ps -ef | grep CoD | grep proj | grep -v grep | wc` if ("$wc_line[1]" != "7" ) then echo There is only "$wc_line[1]" codatabase servers on elara rsh -l project elara /people/project/System_Start/stop_codatabases rsh -l project elara /people/project/System_Start/start_codatabases& endif to set wc_line=`rsh -l project elara ps -ef | grep CoD | grep proj | grep -v grep | wc` if ("$wc_line[1]" != "8" ) then echo There is only "$wc_line[1]" codatabase servers on elara rsh -l project elara /people/project/System_Start/stop_codatabases rsh -l project elara /people/project/System_Start/start_codatabases& endif 21. If the new database supports XML query, modify ~/WebFindit_3/ui+qp/src/au/edu/qut/cis/webfindit/ui/WebFinditPanel.java. For example, the new database is QUT, change if (dbName.equals("Internal_Revenue_Service") || dbName.equals("Social_Secu rity_Administration") || dbName.equals("Medicare") || dbName.equals("American_Association_of_Pediatrics")) } // If it supports XML, enable the XML Query Tab tabbedPane.setEnabledAt(3, true); { else } // Else if it doesn't support XML, disable the XML Query Tab tabbedPane.setEnabledAt(3, false); { to if (dbName.equals("Internal_Revenue_Service") || dbName.equals("Social_Secu rity_Administration") || dbName.equals("Medicare") || dbName.equals("American_Association_of_Pediatrics") || dbName.equals ("QUT")) } // If it supports XML, enable the XML Query Tab tabbedPane.setEnabledAt(3, true); { else } // Else if it doesn't support XML, disable the XML Query Tab tabbedPane.setEnabledAt(3, false); { In ~/WebFindit_3/ui+qp/src/au/edu/qut/cis/webfindit/ui/XMLQueryPanel.java, also change // XML supported databases are hard coded here if (dbName.equals("Internal_Revenue_Service") || dbName.equals("Social_Sec urity_Administration") || dbName.equals("Medicare") || dbName.equals("American_Association_of_Pediatrics")) to if (dbName.equals("Internal_Revenue_Service") || dbName.equals("Social_Secu rity_Administration") || dbName.equals("Medicare") || dbName.equals("American_Association_of_Pediatrics") || dbName.equals ("QUT")) 22. If the new database is ObjectStore database, modify ~/WebFindit_3/ui+qp/src/au/edu/qut/cis/webfindit/WebFinditWebInterface.java. For example, the new database is QUT, change if ((dbName.equals("Trigon")) || (dbName.equals("Arlington_Hospital")) || (d bName.equals("Ambulance"))){ to if ((dbName.equals("Trigon")) || (dbName.equals("Arlington_Hospital")) || (d bName.equals("Ambulance")) || (dbName.equals("QUT"))){ In ~/WebFindit_3/ui+qp/src/au/edu/qut/cis/webfindit/qp/QueryProcessorImpl.java add else if (pareTo("QUT")==0) { t.stop(); IE.Iona.OrbixWeb.CORBA.ObjectRef _objRef = IE.Iona.OrbixWeb._OrbixWeb.Object(orb.string_to_object(ior)); QUT db = QUTHelper.bind( ":" + _objRef._implementation(), _objRef._host()); System.out.println("... got qut_db " + db); returnResult = db.execute(queryString, new QueryStatusHolder(qs)); { after each if (pareTo("Trigon")==0) { t.stop(); //AMP db = AMPHelper.narrow(orb.string_to_object(ior)); System.out.println("before string_to_object"); IE.Iona.OrbixWeb.CORBA.ObjectRef _objRef = IE.Iona.OrbixWeb._OrbixWeb.Object(orb.string_to_object(ior)); System.out.println("before bind"); AMP db = AMPHelper.bind(":" +_objRef._implementation(), _objRef._host()); System.out.println("... got amp_db " + db); returnResult = db.execute(queryString, new QueryStatusHolder(qs)); { ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download