You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/08/23 18:46:37 UTC
svn commit: r1376587 - in /incubator/etch/trunk:
binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/
binding-cpp/runtime/include/common/ binding-cpp/runtime/include/support/
binding-cpp/runtime/src/main/common/ binding-cpp/ru...
Author: fitzner
Date: Thu Aug 23 16:46:37 2012
New Revision: 1376587
URL: http://svn.apache.org/viewvc?rev=1376587&view=rev
Log:
ETCH-198 Changed remote compiler template
Implemented initial client answers
Change-Id: I2bc036e131e9b5e90ffd1a204b14f9b49c0cafc2
Added:
incubator/etch/trunk/examples/helloworld/java/.classpath
incubator/etch/trunk/examples/helloworld/java/.project
Modified:
incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm
incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm
incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm
incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h
incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResult.h
incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResultNone.h
incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchException.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchAsyncResultNone.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchPlainMailbox.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
incubator/etch/trunk/examples/helloworld/cpp/src/main/include/MainHelloWorldClient.h
incubator/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp
Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm Thu Aug 23 16:46:37 2012
@@ -35,8 +35,9 @@ using namespace $namespace;
#foreach($n in $intf.iterator())
#if($n.isMsgDir($mc))
#if(!$n.isHidden())
-$clname::$n.name()AsyncResultRemote::$n.name()AsyncResultRemote(EtchRuntime* runtime, EtchMailbox* mailbox)
- : #if($n.hasReturn())EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)>(runtime, mailbox)#{else}EtchAsyncResultNone(runtime, mailbox)#end {
+$clname::$n.name()AsyncResultRemote::$n.name()AsyncResultRemote($clname* base, EtchMailbox* mailbox)
+ : #if($n.hasReturn())EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)>(base->mRuntime, mailbox)#{else}EtchAsyncResultNone(base->mRuntime, mailbox)#end {
+ mBase = base;
}
$clname::$n.name()AsyncResultRemote::~$n.name()AsyncResultRemote() {
@@ -44,7 +45,28 @@ $clname::$n.name()AsyncResultRemote::~$n
status_t $clname::$n.name()AsyncResultRemote::mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed) {
- //TODO implemented callback
+#if(!$n.isOneway())
+ status_t status;
+
+ if(!closed) {
+ capu::SmartPointer<EtchObject> result;
+ status = mBase->endcall(mb, $vfname::$n.getResultMessage().vname($helper), result);
+ if(status != ETCH_OK) {
+ // TODO set result to a runtime exception
+ return ETCH_OK;
+ }
+ if(result->isInstanceOf(EtchException::TYPE())) {
+ setException(result);
+ }
+#if($n.hasReturn())
+ else {
+ setResult(result);
+ }
+#end
+
+ }
+
+#end
return ETCH_OK;
}
@@ -70,7 +92,7 @@ $intfname::$n.name()AsyncResultPtr $clna
// TODO log error
}
- $n.name()AsyncResultRemote* result = new $n.name()AsyncResultRemote(base->mRuntime, mb);
+ $n.name()AsyncResultRemote* result = new $n.name()AsyncResultRemote(base, mb);
return result;
}
@@ -103,13 +125,10 @@ $clname::~$clname() {
#if(!$methodList.contains($n.name().name()))
#set ( $addMethodListStatus = $methodList.add($n.name().name()))
-#if(!$n.isMsgDirBoth())
-#if($n.isOneway())
+#if($hasBaseClass && $n.isMsgDirBoth())
$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
- $n.name()AsyncResultPtr result = $clname::$n.name()AsyncResultRemote::Begin(this, #set($sep = "")#foreach($p in $n.iterator())$p.name() #set( $sep = ", ")#end);
- return result;
+ return Remote$i::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$p.name() #set( $sep = ", " )#end);
}
-
#else
$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
$n.name()AsyncResultPtr result = $clname::$n.name()AsyncResultRemote::Begin(this, #set($sep = "")#foreach($p in $n.iterator())$p.name() #set( $sep = ", ")#end);
@@ -117,12 +136,6 @@ $intfname::$n.name()AsyncResultPtr $clna
}
#end
-#else
-$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
- return Remote$i::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$p.name() #set( $sep = ", " )#end);
-}
-#end
-
#end
#end
#end
Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm Thu Aug 23 16:46:37 2012
@@ -64,7 +64,7 @@ namespace $namespace {
/**
* Create a new instance from $clname class
*/
- $n.name()AsyncResultRemote(EtchRuntime* runtime, EtchMailbox* mailbox);
+ $n.name()AsyncResultRemote($clname* base, EtchMailbox* mailbox);
/**
* Destructor
@@ -80,6 +80,9 @@ namespace $namespace {
* Create a new instance from $clname class
*/
static $n.name()AsyncResultPtr Begin($clname* base, #set($sep = "")#foreach($p in $n.iterator())$sep$helper.getEtchTypeName($p.type(), true) $p.name()#set($sep = ", ")#end);
+
+ private:
+ $clname* mBase;
};
#end
Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm Thu Aug 23 16:46:37 2012
@@ -80,9 +80,7 @@ public:
// create result message
#if($mthd.hasReturn())
if(ar->hasResult()) {
- capu::SmartPointer<$helper.getEtchTypeName($mthd.type(), false)> result;
- ar->getResult(result);
- _rmsg->put(ValueFactory$i::_mf_result(), result);
+ _rmsg->put(ValueFactory$i::_mf_result(), ar->getResult());
} else
#end
if(ar->hasException()) {
Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h Thu Aug 23 16:46:37 2012
@@ -20,7 +20,7 @@
#define __ETCHOBJECT_H__
#include "capu/util/SmartPointer.h"
-#include "capu/container/List.h"
+#include "capu/container/List.h"
#include "EtchError.h"
class EtchObjectType;
@@ -49,17 +49,16 @@ public:
virtual ~EtchObject();
/**
- * Returns object type id of this type.
- */
+ */
virtual const EtchObjectType* getObjectType() const;
- /**
- * Returns true if the type hierarchy of this instance
- * is from the given type.
- * @param type to check
- * @return true if the instance is compatible to the given type
- */
- virtual capu::bool_t isInstanceOf(const EtchObjectType* type) const;
+ /**
+ * Returns true if the type hierarchy of this instance
+ * is from the given type.
+ * @param type to check
+ * @return true if the instance is compatible to the given type
+ */
+ virtual capu::bool_t isInstanceOf(const EtchObjectType* type) const;
/**
* Returns hash code
@@ -72,19 +71,19 @@ public:
*/
virtual capu::bool_t equals(const EtchObject * other) const;
- protected:
- /**
- * Adds the object type to the type hierachy of this instance.
- * @param type that should be added to type hierachy of this instance.
- */
- virtual status_t addObjectType(const EtchObjectType* type);
-
- // TODO remove me if object hierachy was refactored
- virtual status_t setObjectType(const EtchObjectType* type);
-
- private:
- const EtchObjectType* mType;
- capu::List<const EtchObjectType*> mTypes;
+protected:
+ /**
+ * Adds the object type to the type hierachy of this instance.
+ * @param type that should be added to type hierachy of this instance.
+ */
+ virtual status_t addObjectType(const EtchObjectType* type);
+
+ // TODO remove me if object hierachy was refactored
+ virtual status_t setObjectType(const EtchObjectType* type);
+
+private:
+ const EtchObjectType* mType;
+ capu::List<const EtchObjectType*> mTypes;
};
typedef capu::SmartPointer<EtchObject> EtchObjectPtr;
Modified: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResult.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResult.h?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResult.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResult.h Thu Aug 23 16:46:37 2012
@@ -75,15 +75,14 @@ public:
/**
* Returns the result
*/
- status_t getResult(capu::SmartPointer<T> &result) {
+ capu::SmartPointer<T> getResult() {
if(hasException()) {
- return ETCH_ERROR;
- }
+ return NULL;
+ } else
if(hasResult()) {
- result = mResult;
- return ETCH_OK;
+ return mResult;
}
- return ETCH_OK;
+ return NULL;
}
private:
Modified: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResultNone.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResultNone.h?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResultNone.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchAsyncResultNone.h Thu Aug 23 16:46:37 2012
@@ -62,7 +62,7 @@ public:
/**
* @see EtchNotify
*/
- virtual status_t mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed);
+ virtual status_t mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed) {return ETCH_OK;};
protected:
EtchRuntime* mRuntime;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchException.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchException.cpp?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchException.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchException.cpp Thu Aug 23 16:46:37 2012
@@ -23,13 +23,17 @@ const EtchObjectType* EtchException::TYP
}
EtchException::EtchException()
-: EtchObject(EtchException::TYPE()), mErrorMessage(""), mErrorcode(0), mExcptype(0) {
-
+: EtchObject(), mErrorMessage(""), mErrorcode(0), mExcptype(0) {
+ EtchObject::addObjectType(EtchException::TYPE());
+ // TODO change object hierachy
+ EtchObject::setObjectType(EtchException::TYPE());
}
EtchException::EtchException(EtchString msg, status_t errcode, EtchExceptionType type)
-: EtchObject(EtchException::TYPE()), mErrorMessage(msg), mErrorcode(errcode), mExcptype(type) {
-
+: EtchObject(), mErrorMessage(msg), mErrorcode(errcode), mExcptype(type) {
+ EtchObject::addObjectType(EtchException::TYPE());
+ // TODO change object hierachy
+ EtchObject::setObjectType(EtchException::TYPE());
}
EtchException::EtchException(EtchString msg, status_t errcode, EtchExceptionType type, const EtchObjectType* type_id)
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchAsyncResultNone.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchAsyncResultNone.cpp?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchAsyncResultNone.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchAsyncResultNone.cpp Thu Aug 23 16:46:37 2012
@@ -38,8 +38,6 @@ EtchAsyncResultNone::~EtchAsyncResultNon
capu::bool_t EtchAsyncResultNone::hasException() {
mMutex.lock();
while(!mHasMailboxStatus) {
- // TODO wait
- break;
mCond.wait(&mMutex);
}
mMutex.unlock();
@@ -61,17 +59,3 @@ void EtchAsyncResultNone::setException(c
mCond.signal();
mMutex.unlock();
}
-
-status_t EtchAsyncResultNone::mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed) {
-
- // TODO get data or exception from mailbox
- // TODO call onResult( EtchObject* state);
- // TODO call onEception( EtchObject* state);
- // TODO setException(NULL);
- // TODO call delegate
- mMutex.lock();
- mHasMailboxStatus = true;
- mCond.signal();
- mMutex.unlock();
- return ETCH_OK;
-}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchPlainMailbox.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchPlainMailbox.cpp?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchPlainMailbox.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchPlainMailbox.cpp Thu Aug 23 16:46:37 2012
@@ -66,12 +66,12 @@ void EtchPlainMailbox::fireNotify() {
n = mNotify;
s = mState;
c = mQueue.isClosed();
+
+ mMutex.unlock();
if (n != NULL) {
n->mailboxStatus(this, s, c);
}
- // TODO: check if the unlock must be so late
- mMutex.unlock();
}
status_t EtchPlainMailbox::read(EtchMailbox::EtchElement*& result) {
@@ -120,11 +120,60 @@ status_t EtchPlainMailbox::closeRead() {
}
status_t EtchPlainMailbox::registerNotify(EtchMailbox::EtchNotify* notify, EtchObject* state, capu::int32_t maxDelay) {
- return ETCH_EUNIMPL;
+ if(notify == NULL) {
+ return ETCH_EINVAL;
+ }
+
+ if(maxDelay < 0) {
+ return ETCH_EINVAL;
+ }
+
+ capu::bool_t isNotEmptyOrIsClosed;
+
+ mMutex.lock();
+
+ if(mNotify != NULL) {
+ mMutex.unlock();
+ return ETCH_EINVAL;
+ }
+
+ mNotify = notify;
+ mState = state;
+
+ isNotEmptyOrIsClosed = !mQueue.isEmpty() || mQueue.isClosed();
+
+ mMutex.unlock();
+
+ if(isNotEmptyOrIsClosed) {
+ fireNotify();
+ }
+
+ return ETCH_OK;
}
status_t EtchPlainMailbox::unregisterNotify(EtchMailbox::EtchNotify* notify) {
- return ETCH_EUNIMPL;
+
+ if(mNotify == NULL) {
+ return ETCH_EINVAL;
+ }
+
+ if(notify == NULL) {
+ return ETCH_OK;
+ }
+
+ mMutex.lock();
+
+ if(mNotify != notify) {
+ mMutex.unlock();
+ return ETCH_EINVAL;
+ }
+
+ mNotify = NULL;
+ mState = NULL;
+
+ mMutex.unlock();
+
+ return ETCH_OK;
}
capu::bool_t EtchPlainMailbox::isEmpty() {
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp Thu Aug 23 16:46:37 2012
@@ -19,9 +19,61 @@
#include <gtest/gtest.h>
#include "common/EtchString.h"
+class EtchObjectMy1Object : public EtchObject {
+public:
+
+ /**
+ * EtchObjectType for EtchObjectMyObject.
+ */
+ static const EtchObjectType* TYPE() {
+ const static EtchObjectType TYPE(11, NULL);
+ return &TYPE;
+ }
+
+ /**
+ * Constructor
+ */
+ EtchObjectMy1Object()
+ : EtchObject() {
+ EtchObject::addObjectType(TYPE());
+ }
+
+};
+
+class EtchObjectMy2Object : public EtchObject {
+public:
+
+ /**
+ * EtchObjectType for EtchObjectMyObject.
+ */
+ static const EtchObjectType* TYPE() {
+ const static EtchObjectType TYPE(12, NULL);
+ return &TYPE;
+ }
+
+ /**
+ * Constructor
+ */
+ EtchObjectMy2Object()
+ : EtchObject() {
+ EtchObject::addObjectType(TYPE());
+ }
+
+};
+
+
TEST(EtchObjectTest, getTypeTrait) {
EXPECT_EQ(EtchObjectType::VALUE, EtchObjectType::getTypeTrait<EtchString>());
EXPECT_EQ(EtchObjectType::POINTER, EtchObjectType::getTypeTrait<EtchString*>());
EXPECT_EQ(EtchObjectType::SMART_POINTER, EtchObjectType::getTypeTrait<capu::SmartPointer<EtchString> >());
}
+
+TEST(EtchObjectTest, isInstanceOf) {
+ EtchObjectMy1Object* o1 = new EtchObjectMy1Object();
+ EXPECT_EQ(true, o1->isInstanceOf(EtchObjectMy1Object::TYPE()));
+ EXPECT_EQ(true, o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_EQ(false, o1->isInstanceOf(EtchObjectMy2Object::TYPE()));
+
+ delete o1;
+}
\ No newline at end of file
Modified: incubator/etch/trunk/examples/helloworld/cpp/src/main/include/MainHelloWorldClient.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/cpp/src/main/include/MainHelloWorldClient.h?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/cpp/src/main/include/MainHelloWorldClient.h (original)
+++ incubator/etch/trunk/examples/helloworld/cpp/src/main/include/MainHelloWorldClient.h Thu Aug 23 16:46:37 2012
@@ -19,11 +19,11 @@ namespace org_apache_etch_examples_hello
* Main program for HelloWorldClient. This program makes a connection to the
* listener created by MainHelloWorldListener.
*/
- class MainHelloWorldClient
+ class MainHelloWorldClientFactory
: public HelloWorldHelper::HelloWorldClientFactory
{
public:
- virtual ~MainHelloWorldClient() {}
+ virtual ~MainHelloWorldClientFactory() {}
HelloWorldClient* newHelloWorldClient(RemoteHelloWorldServer* server);
};
}
Modified: incubator/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp?rev=1376587&r1=1376586&r2=1376587&view=diff
==============================================================================
--- incubator/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp (original)
+++ incubator/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp Thu Aug 23 16:46:37 2012
@@ -16,7 +16,7 @@
using namespace org_apache_etch_examples_helloworld_HelloWorld;
-HelloWorldClient* MainHelloWorldClient::newHelloWorldClient(RemoteHelloWorldServer* server)
+HelloWorldClient* MainHelloWorldClientFactory::newHelloWorldClient(RemoteHelloWorldServer* server)
{
return new ImplHelloWorldClient(server);
}
@@ -35,16 +35,15 @@ capu::int32_t main(int argc, const char*
// TODO Change to correct URI
EtchString uri("tcp://127.0.0.1:4001");
- MainHelloWorldClient mc;
- status_t result;
+ MainHelloWorldClientFactory mc;
+ status_t result;
RemoteHelloWorldServer *remote = NULL;
result = HelloWorldHelper::newServer(runtime, uri, NULL, mc, remote);
if (result != ETCH_OK) {
//TODO Handle error
}
-
// Connect to the service
result = remote->transportControl(new EtchString(EtchTransportData::START_AND_WAIT_UP()), new EtchInt32(4000));
if (result != ETCH_OK) {
@@ -52,8 +51,16 @@ capu::int32_t main(int argc, const char*
}
HelloWorld::userPtr myUser = new HelloWorld::user(new EtchInt32(1),new EtchString("World"));
- remote->say_hello(myUser);
-
+ HelloWorldServer::say_helloAsyncResultPtr say_helloResult = remote->say_hello(myUser);
+ if(say_helloResult->hasException()) {
+ capu::SmartPointer<EtchException> exception = say_helloResult->getException();
+ printf("say_hello FAILED: exception=%s \n", exception->getErrorMessage().c_str());
+ }
+ if(say_helloResult->hasResult()) {
+ capu::SmartPointer<EtchString> result = say_helloResult->getResult();
+ printf("say_hello OK: result=%s\n", result->c_str());
+ }
+
// Disconnect from the service
remote->transportControl(new EtchString(EtchTransportData::STOP_AND_WAIT_DOWN()), new EtchInt32(4000));
Added: incubator/etch/trunk/examples/helloworld/java/.classpath
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/.classpath?rev=1376587&view=auto
==============================================================================
--- incubator/etch/trunk/examples/helloworld/java/.classpath (added)
+++ incubator/etch/trunk/examples/helloworld/java/.classpath Thu Aug 23 16:46:37 2012
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main"/>
+ <classpathentry kind="src" path="target/generated-sources/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="ETCH_HOME/binding-java/lib/apache-etch-java-runtime-1.3.0-incubating.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: incubator/etch/trunk/examples/helloworld/java/.project
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/examples/helloworld/java/.project?rev=1376587&view=auto
==============================================================================
--- incubator/etch/trunk/examples/helloworld/java/.project (added)
+++ incubator/etch/trunk/examples/helloworld/java/.project Thu Aug 23 16:46:37 2012
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.etch.binding-java.examples.helloworld</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>