Removed ursula dependancy.
[yazpp-moved-to-github.git] / src / yaz-my-server.cpp
index c7c92f4..30c68cd 100644 (file)
@@ -3,7 +3,16 @@
  * See the file LICENSE for details.
  * 
  * $Log: yaz-my-server.cpp,v $
- * Revision 1.1  2001-03-27 14:47:45  adam
+ * Revision 1.4  2001-04-05 13:09:44  adam
+ * Removed ursula dependancy.
+ *
+ * Revision 1.3  2001/04/04 14:02:49  adam
+ * URSULA / Z-ruth service.
+ *
+ * Revision 1.2  2001/03/29 15:14:26  adam
+ * Minor updates.
+ *
+ * Revision 1.1  2001/03/27 14:47:45  adam
  * New server facility scheme.
  *
  * Revision 1.15  2001/03/26 14:43:49  adam
@@ -67,6 +76,9 @@ class MyILL : public Yaz_Facility_ILL {
 public:
     int ill_init (Z_InitRequest *initRequest,
                  Z_InitResponse *initResponse);
+    void ill_service (Z_ExtendedServicesRequest *req,
+                     Z_ItemOrder *io,
+                     Z_ExtendedServicesResponse *res);
 };
 
 class MyRetrieval : public Yaz_Facility_Retrieval, Yaz_USMARC {
@@ -85,8 +97,18 @@ public:
                    Z_Records *records);
 };
 
+#if HAVE_YAZ_URSULA_H
+class MyUrsula : public Yaz_Facility_Ursula {
+public:
+    void ursula_service (Z_ExtendedServicesRequest *req,
+                        Z_UrsPDU *u,
+                        Z_ExtendedServicesResponse *res);
+};
+#endif
+
 class MyServer : public Yaz_Z_Server {
 public:
+    ~MyServer();
     MyServer(IYaz_PDU_Observable *the_PDU_Observable);
     IYaz_PDU_Observer* sessionNotify(IYaz_PDU_Observable *the_PDU_Observable,
                                     int fd);
@@ -95,6 +117,11 @@ public:
     void connectNotify();
 
 private:
+    MyRetrieval m_retrieval;
+    MyILL       m_ill;
+#if HAVE_YAZ_URSULA_H
+    MyUrsula    m_ursula;
+#endif
     int m_no;
 };
 
@@ -105,6 +132,43 @@ int MyILL::ill_init (Z_InitRequest *initRequest,
     return 1;
 }
 
+void MyILL::ill_service (Z_ExtendedServicesRequest *req,
+                        Z_ItemOrder *io,
+                        Z_ExtendedServicesResponse *res)
+{
+    yaz_log (LOG_LOG, "MyServer::ill_service");
+}
+
+
+#if HAVE_YAZ_URSULA_H
+void MyUrsula::ursula_service (Z_ExtendedServicesRequest *req,
+                              Z_UrsPDU *u,
+                              Z_ExtendedServicesResponse *res)
+{
+    yaz_log (LOG_LOG, "MyServer::ursula_service");
+    switch (u->which)
+    {
+    case  Z_UrsPDU_request:
+       yaz_log(LOG_LOG, "request");
+       if (u->u.request->libraryNo)
+           yaz_log (LOG_LOG, "libraryNo: %s", u->u.request->libraryNo);
+       break;
+    case  Z_UrsPDU_update:
+       yaz_log(LOG_LOG, "request");
+       break;
+    case  Z_UrsPDU_reservation:
+       yaz_log(LOG_LOG, "request");
+       break;
+    case  Z_UrsPDU_renewal:
+       yaz_log(LOG_LOG, "request");
+       break;
+    default:
+       yaz_log(LOG_LOG, "unknown");
+       break;
+    }
+}
+#endif
+
 int MyRetrieval::sr_init (Z_InitRequest *initRequest,
                       Z_InitResponse *initResponse)
 {
@@ -148,21 +212,26 @@ void MyRetrieval::sr_record (const char *resultSetName,
 {
     yaz_log (LOG_LOG, "MyServer::recv_Z_record");
     const char *rec = get_record(position);
-    create_databaseRecord (namePlusRecord, 0, VAL_USMARC, rec,
+    create_databaseRecord (odr_encode(), namePlusRecord, 0, VAL_USMARC, rec,
                           strlen(rec));
 }
 
+MyServer::~MyServer()
+{
+}
+
 IYaz_PDU_Observer *MyServer::sessionNotify(
     IYaz_PDU_Observable *the_PDU_Observable, int fd)
 {
     MyServer *new_server;
-    MyRetrieval *new_ret = new MyRetrieval;
-    MyILL *new_ill = new MyILL;
     m_no++;
     new_server = new MyServer(the_PDU_Observable);
     new_server->timeout(900);
-    new_server->facility_add(new_ret, "my sr");
-    new_server->facility_add(new_ill, "my ill");
+    new_server->facility_add(&new_server->m_retrieval, "my sr");
+    new_server->facility_add(&new_server->m_ill, "my ill");
+#if HAVE_YAZ_URSULA_H
+    new_server->facility_add(&new_server->m_ursula, "my ill");
+#endif
 
     new_server->set_APDU_log(get_APDU_log());