diff options
author | Marc G. Fournier | 1998-11-19 02:39:51 +0000 |
---|---|---|
committer | Marc G. Fournier | 1998-11-19 02:39:51 +0000 |
commit | 056ba1288115f8cfa156a742ca4af3b2547dc663 (patch) | |
tree | e5ef43271f62ff98d82c59c64a5480370de4c8ca | |
parent | fd0366e1b57df0bb0ad30140acf2c4225cae017b (diff) |
Updating and addign files...
-rw-r--r-- | src/corba/pgsql.idl | 175 | ||||
-rw-r--r-- | src/corba/pgsql_int.idl | 7 | ||||
-rw-r--r-- | src/corba/server.cc | 59 |
3 files changed, 162 insertions, 79 deletions
diff --git a/src/corba/pgsql.idl b/src/corba/pgsql.idl index 63a593b2f37..760108404a2 100644 --- a/src/corba/pgsql.idl +++ b/src/corba/pgsql.idl @@ -1,79 +1,96 @@ -#ifndef pgsql_idl
-#define pgsql_idl
-
-#ifndef CosQuery_idl
-#include "CosQuery.idl"
-#endif
-
-#ifndef CosQueryCollection_idl
-#include "CosQueryCollection.idl"
-#endif
-
-module PostgreSQL {
-
- // Built-in types
-
- module Types {
- // Arrays in network order
- typedef short int2;
- typedef long int4;
- typedef long int8[2];
- };
-
-
- // NULL support
-
- typedef boolean Null;
-
- union Value switch (Null) {
- case false: any value;
- };
-
-
- // Row definition
-
- typedef sequence<Value> Row;
-
- // <info>
- // More about the application of COSS:
- //
- // A Table will be a QueryableCollection of Rows
- // A Database will be a QueryableCollection of Tables
- // (Currently Tables are not exported... maybe later.)
- // Both will be queryable via the Query Service
- //
- // Other relations will be representable using the Relationship Service
- // This includes primary/foreign keys and anything else :)
- //
- // GRANT/REVOKE can be supplied via the Security Service
- //
- // See a pattern here? The whole of SQL can be implemented by these services!
- // The statements go through a parser. Queries and subqueries are passed to the
- // database for processing. Returned items are handled appropriately:
- //
- // SELECT: return the items to the caller
- // UPDATE: modify the items (direct)
- // DELETE: call delete() on each Row (direct)
- // GRANT/REVOKE: modify ACLs (via Security Service)
- // ALTER: modify the items (direct) and/or the relations (via Relationship Service)
- // etc.
- //
- // I'm not sure yet about LOCK and UNLOCK.
- // </info>
-
-
- // Connected database object
-
- interface Database : CosQuery::QueryableCollection {
- void disconnect();
- };
-
-
- // Server object (stateless)
-
- interface Server {
- Database connect(in string db, in string user, in string password);
- };
-};
-
-#endif // pgsql_idl
+#ifndef pgsql_idl +#define pgsql_idl + +#ifndef CosQuery_idl +#include "CosQuery.idl" +#endif + +#ifndef CosQueryCollection_idl +#include "CosQueryCollection.idl" +#endif + +#pragma prefix "" + +module PostgreSQL { + + // Built-in types + + module Types { + // Arrays in network order + typedef short int2; + typedef long int4; + typedef long int8[2]; + }; + + + // NULL support + + typedef boolean Null; + + union Value switch (Null) { + case FALSE: any value; + }; + + + // Row definition + + typedef sequence<Value> Row; + + // <info> + // More about the application of COSS: + // + // A Table will be a QueryableCollection of Rows + // A Database will be a QueryableCollection of Tables + // (Currently Tables are not exported... maybe later.) + // Both will be queryable via the Query Service + // + // Other relations will be representable using the Relationship Service + // This includes primary/foreign keys and anything else :) + // + // GRANT/REVOKE can be supplied via the Security Service + // + // See a pattern here? The whole of SQL can be implemented by these services! + // The statements go through a parser. Queries and subqueries are passed to the + // database for processing. Returned items are handled appropriately: + // + // SELECT: return the items to the caller + // UPDATE: modify the items (direct) + // DELETE: call delete() on each Row (direct) + // GRANT/REVOKE: modify ACLs (via Security Service) + // ALTER: modify the items (direct) and/or the relations (via Relationship Service) + // etc. + // + // I'm not sure yet about LOCK and UNLOCK. + // </info> + + // Expirable object + + interface Expirable { + /* oneway? */ void keepalive(); + void remove(); + }; + + + // Upcall object + + interface Upcall { + void notice(in string message); + void abort(); + }; + + + // Connected database object + + interface Database : CosQuery::QueryableCollection, Expirable { + void setupcall(in Upcall obj); + }; + + + // Server object (stateless) + + interface Server { + Database connect(in string db, in string user, in string password); + }; +}; + +#endif // pgsql_idl diff --git a/src/corba/pgsql_int.idl b/src/corba/pgsql_int.idl new file mode 100644 index 00000000000..8cfebc0ab4b --- /dev/null +++ b/src/corba/pgsql_int.idl @@ -0,0 +1,7 @@ +// Internal interfaces + +#include "pgsql.idl" + +module PostgreSQL { + interface QueryResult : CosQueryCollection::Collection, Expirable {}; +}; diff --git a/src/corba/server.cc b/src/corba/server.cc new file mode 100644 index 00000000000..dff13287a8d --- /dev/null +++ b/src/corba/server.cc @@ -0,0 +1,59 @@ +#include <iostream>
+#include "pgsql_int.h"
+
+bool terminate = false;
+
+int main(int argc, char *argv)
+{
+ CORBA::ORB_var orb = CORBA::ORB_init(argc,argv,"");
+ PortableManager::POA_var poa = PortableServer::POA::_narrow(orb->resolve_initial_references("RootPOA"));
+ PortableManager::POAManager_var mgr = poa->the_POAManager();
+
+ Server_impl *server = new Server_impl;
+ poa->activate_object(server);
+
+ CosNaming::NamingContext_var ctx = CosNaming::NamingContext::_narrow(orb->resolve_initial_references("NamingService"));
+ CosNaming::Name_var n = new CosNaming::Name(1);
+ n[0].id("PostgreSQL");
+ n[0].name("service");
+ bool bindok = false;
+
+ if (!CORBA::Object::is_nil(ctx)) {
+ try {
+ CosNaming::NamingContext_var myctx = ctx->bind_new_context(n);
+ CosNaming::Name_var n2 = new CosNaming::Name(1);
+ n2[0].id("Server");
+ n2[0].name("Server");
+ myctx->bind(n2,server->_this());
+ bindok = true;
+ } catch (CORBA::Exception &e) {
+ cerr << "Warning: Naming Service bind failed" << endl;
+ bindok = false;
+ }
+ } else {
+ cerr << "Warning: Naming Service not found" << endl;
+ }
+
+ mgr->activate();
+ while (!terminate) {
+ if (orb->work_pending())
+ orb->perform_work();
+ if (expiry_needed())
+ expire_now();
+ }
+
+ if (!CORBA::Object::is_nil(ctx) && bindok) {
+ try {
+ CosNaming::NamingContext myctx = ctx->resolve(n);
+ ctx->unbind(n);
+ myctx->destroy();
+ } catch (CORBA::Exception &e) {
+ cerr << "Warning: Naming Service unbind failed" << endl;
+ }
+ }
+
+ orb->shutdown(true);
+
+ delete server;
+ return 0;
+}
|