Check-in Number:
|
3917 | |
Date: |
2003-Jan-16 09:37:40 (local)
2003-Jan-16 08:37:40 (UTC) |
User: | ms |
Branch: | |
Comment: |
Add logic to connect and syncronize with a CORBA server. Hard code usage of
MICO libraries into build configuration. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/as/as-gui/Makefile.in 1.29 -> 1.30
--- Makefile.in 2002/12/19 21:02:22 1.29
+++ Makefile.in 2003/01/16 08:37:40 1.30
@@ -49,6 +49,10 @@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
+# CORBA-specific variables
+CORBABASE = @CORBABASE@
+IDL = $(CORBABASE)/bin/idl
+
# Qt-specific variables
QTBASE = @QTBASE@
UIC = @UIC@
@@ -72,6 +76,11 @@
GRAFX = gfx/ossplogo.xpm
+# IDL compiler generated
+IDL_SRC = asdb.idl
+IDL_OUT = asdb.cpp asdb.h
+IDL_OBJ = asdb.o
+
# Qt meta object compiler (MOC) generated
MOC_OUT = moc_as_gui.cpp moc_as_table.cpp
MOC_OBJ = moc_as_gui.o moc_as_table.o
@@ -92,12 +101,18 @@
all: Makefile $(TARGET_PROGS) $(TARGET_MANS)
-$(PROG_NAME): $(OBJS) $(MOC_OBJ)
+$(PROG_NAME): $(OBJS) $(IDL_OBJ) $(MOC_OBJ)
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
moc_%.cpp: %.h
$(MOC) $< -o $@
+# Run the IDL compiler over IDL source
+# but avoid a make deps spaghetti nest
+$(SRCS):$(IDL_OUT)
+$(IDL_OUT): $(IDL_SRC)
+ $(IDL) --c++-suffix=cpp $<
+
as-gui.1: as_gui.pod
VS=`$(SHTOOL) version -lc -dshort as_version.cpp`; \
VL=`$(SHTOOL) version -lc -dlong as_version.cpp`; \
@@ -136,13 +151,14 @@
$(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE)
clean:
- $(RM) $(TARGET_PROGS) $(OBJS) $(MOC_OBJ)
+ $(RM) $(TARGET_PROGS) $(OBJS) $(IDL_OBJ) $(MOC_OBJ)
$(RM) as-gui.conf.5 as-gui.1
$(RM) as_gui_pcre.tab *.core
distclean: clean
$(RM) config.log config.status config.cache # Generated by ./configure
$(RM) Makefile ac_config.h # Generated by ./configure
+ $(RM) $(IDL_OUT) # Generated by $(IDL)
$(RM) $(MOC_OUT) # Generated by $(MOC)
realclean: distclean
|
|
ossp-pkg/as/as-gui/aclocal.m4 1.7 -> 1.8
--- aclocal.m4 2003/01/16 08:32:31 1.7
+++ aclocal.m4 2003/01/16 08:37:40 1.8
@@ -158,6 +158,42 @@
dnl ##
+dnl ## Test for the presence of the MICO ORB
+dnl ##
+dnl ## configure.in:
+dnl ## AC_TEST_MICO
+dnl ##
+
+AC_DEFUN(AC_TEST_MICO,[dnl
+AC_ARG_WITH(micodir,dnl
+[ --with-micodir=[DIR] prefix where MICO is installed], micodir=$withval,)
+AC_MSG_CHECKING(the MICO installation path)
+
+dnl ## Ensure that we have a basic path to start searching
+if test -x "$micodir";
+then
+ CORBABASE=$micodir
+ AC_MSG_RESULT(${CORBABASE})
+elif test -x "${MICODIR}";
+then
+ CORBABASE="${MICODIR}"
+ AC_MSG_RESULT(${CORBABASE})
+else
+ AC_MSG_RESULT(not found)
+ AC_MSG_ERROR([Neither \$MICODIR nor --with-micodir=[DIR] paths exist])
+fi
+
+dnl ## Append paths of libs and headers
+LIBS="$LIBS -lmico -lmicocoss -lssl -lcrypto"
+LDFLAGS="$LDFLAGS -L${CORBABASE}/lib -R${CORBABASE}/lib"
+CPPFLAGS="$CPPFLAGS -I${CORBABASE}/include"
+CXXCPP="$CXXCPP -I${CORBABASE}/include"
+CXXFLAGS="$CXXFLAGS"
+AC_DEFINE(HAVE_MICO, 1, [Define to 1 if building with the MICO ORB.])
+])
+
+
+dnl ##
dnl ## Test for the presence of EasySOAP
dnl ##
dnl ## configure.in:
|
|
ossp-pkg/as/as-gui/as_gui.cpp 1.33 -> 1.34
--- as_gui.cpp 2002/12/19 20:46:26 1.33
+++ as_gui.cpp 2003/01/16 08:37:40 1.34
@@ -38,7 +38,7 @@
// Construct a Titraqform which is a child of 'pParent', with the
// name 'kszName' and widget flags set to 'Flags'
//
-Titraqform::Titraqform(QWidget *pParent, const char *kszName, WFlags Flags) :
+Titraqform::Titraqform(QWidget *pParent, const char *kszName, WFlags Flags) :
QMainWindow(pParent, kszName, Flags)
{
// Early initializations
|
|
ossp-pkg/as/as-gui/as_slot.cpp 1.77 -> 1.78
--- as_slot.cpp 2003/01/16 08:32:31 1.77
+++ as_slot.cpp 2003/01/16 08:37:40 1.78
@@ -38,6 +38,8 @@
// RPC headers
#include <easysoap/SOAP.h>
+#include <coss/CosNaming.h>
+#include "asdb.h" // CORBA stubs and skeletons
// User interface
#include "as_gui.h" // Main classes
@@ -1154,8 +1156,86 @@
//
void Titraqform::syncIiop(void)
{
- Prototype Unimp;
- Unimp.doMbox();
+ int nNada = 0; // Some false parameters
+ char **ppcNada = NULL; // to fake out the ORB
+ CORBA::ORB_var Orb; // The ORB
+
+ CORBA::Object_var Nameobj; // Name service reference
+ CosNaming::NamingContext_var Namectx; // COSS ns context
+ CosNaming::Name Cosname; // Our requested obj name
+
+ CORBA::Object_var Objcaster; // Generic CORBA object
+ Asdatabase_var Asdbase; // Casted object to ASDB
+ Astuple Singlerow; // A single row of AS data
+
+ try {
+ // Initialization of the ORB and COSS naming service
+ Orb = CORBA::ORB_init(nNada, ppcNada, "mico-local-orb");
+ Nameobj = Orb->resolve_initial_references("NameService");
+ Namectx = CosNaming::NamingContext::_narrow(Nameobj);
+ if (CORBA::is_nil(Namectx)) { // Verify sanity
+ m_pStatbar->message(trUtf8("Could not find the COSS naming service"));
+ qWarning("Could not find the COSS naming service\n");
+ }
+
+ // Prepare the COSS name request
+ Cosname.length(1);
+ Cosname[0].id = CORBA::string_dup("Asdatabase");
+ Cosname[0].kind = CORBA::string_dup("");
+
+ try { // Resolve to a CORBA object
+ Objcaster = Namectx->resolve(Cosname);
+ }
+ catch (CosNaming::NamingContext::NotFound &Cossex) {
+ m_pStatbar->message(trUtf8("NotFound exception thrown"));
+ qWarning("NotFound exception thrown\n");
+ return;
+ }
+ catch (CosNaming::NamingContext::CannotProceed &Cossex) {
+ m_pStatbar->message(trUtf8("CannotProceed exception thrown"));
+ qWarning("CannotProceed exception thrown\n");
+ return;
+ }
+ catch (CosNaming::NamingContext::InvalidName &Cossex) {
+ m_pStatbar->message(trUtf8("InvalidName exception thrown"));
+ qWarning("InvalidName exception thrown\n");
+ return;
+ }
+
+ // Cast the generic CORBA object to a AS database type
+ Asdbase = Asdatabase::_narrow(Objcaster);
+ if (CORBA::is_nil(Asdbase)) { // Verify sanity
+ m_pStatbar->message(trUtf8("Could not find the AS database"));
+ qWarning("Could not find the AS database\n");
+ return;
+ }
+
+ // Open an account object on the remote server
+ Account_var Account = Asdbase->Open("/tmp/corbadb.txt"); // Security problem!
+ if (CORBA::is_nil(Account)) { // Verify sanity
+ m_pStatbar->message(trUtf8("Could not create an account object on the server"));
+ qWarning("Could not create an account object on the server\n");
+ return;
+ }
+
+ // Fill an account object to marshall and transmit
+ int nLastrow = m_pMaintable->numRows() - 1;
+ Singlerow.nDate = m_pMaintable->text(nLastrow, TITRAQ_IDXDATE).toInt();
+ Singlerow.nTime = m_pMaintable->text(nLastrow, TITRAQ_IDXSTART).toInt();
+ Singlerow.szName = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXUSER));
+ Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXTASK));
+ Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXREMARK));
+
+ Account->Log(Singlerow); // Finally transmit to server
+ m_pStatbar->message(trUtf8("Successful transmission of accounting data"));
+ }
+ catch (const CORBA::Exception &Corbex) {
+ m_pStatbar->message(trUtf8("Caught CORBA exception: %1").arg(Corbex._repoid()));
+ qWarning("Caught CORBA exception: %s\n", Corbex._repoid());
+ }
+ catch (...) {
+ qWarning("Caught unknown exception\n");
+ }
}
//
@@ -1190,6 +1270,9 @@
m_pStatbar->message(trUtf8("Caught SOAP exception: %1").arg(Soapex.What().Str()));
qDebug("Caught SOAP exception: %s\n", Soapex.What().Str());
}
+ catch (...) {
+ qDebug("Caught unknown exception\n");
+ }
}
//
|
|
ossp-pkg/as/as-gui/configure.in 1.13 -> 1.14
--- configure.in 2003/01/16 08:32:31 1.13
+++ configure.in 2003/01/16 08:37:40 1.14
@@ -73,6 +73,10 @@
dmalloc, dmalloc_debug, dmalloc.h,
[AC_DEFINE(WITH_DMALLOC, 1, [Define to 1 if building with Dmalloc])])
+dnl Test for the local CORBA implementation
+AC_TEST_MICO
+AC_SUBST(CORBABASE)
+
dnl Test for the local SOAP implementation
AC_TEST_ESOAP
AC_SUBST(SOAPBASE)
|
|