You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/03/02 08:22:43 UTC

svn commit: r1296067 - in /incubator/etch/trunk/binding-cpp/runtime: include/transport/ src/main/ src/main/transport/

Author: veithm
Date: Fri Mar  2 07:22:43 2012
New Revision: 1296067

URL: http://svn.apache.org/viewvc?rev=1296067&view=rev
Log:
ETCH-182 Implementation Session Interfaces

Change-Id: I4f50f851dfb10d07858184c7ff4f88239b44940f

Added:
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessage.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h
    incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchSession.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessage.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessage.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessage.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchMessage.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,31 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef ETCHMESSAGE_H
+#define ETCHMESSAGE_H
+
+class EtchMessage {
+
+public:
+
+
+};
+
+#endif /* ETCHMESSAGE_H */
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSession.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,96 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHSESSION_H__
+#define __ETCHSESSION_H__
+#include "common/EtchObject.h"
+#include "common/EtchString.h"
+#include "common/EtchError.h"
+#include "capu/util/SmartPointer.h"
+
+class EtchSession {
+public:
+
+  virtual ~EtchSession() {
+
+  }
+
+  /**
+   * Gets a configuration or operational value from the handler. The
+   * request is passed up the chain of sessions until some session
+   * recognizes the query, whereupon it returns the requested value.
+   *
+   * @param query an object representing a query, which could be as
+   * simple as a string, integer, or enum, or more complex such as
+   * a class with instance variables for query terms.
+   *
+   * @param result contains the result of given query
+   * @return ETCH_OK if requested operational value is successfully get
+   *         ETCH_ERROR otherwise
+   */
+  virtual status_t sessionQuery(capu::SmartPointer<EtchObject> query, capu::SmartPointer<EtchObject> result) = 0;
+
+  /**
+   * Sets a configuration or operational value in the session. The
+   * request is passed up the chain of sessions until some session
+   * recognizes the control, whereupon it stores the specified value
+   * and returns.
+   *
+   * @param control an object representing a control, which could be as
+   * simple as a string, integer, or enum, or more complex such as
+   * a class with instance variables for control terms.
+   *
+   * @param value the value to set.
+   * @return ETCH_OK if requested operational value is successfully set
+   *         ETCH_ERROR otherwise
+   */
+  virtual status_t sessionControl(capu::SmartPointer<EtchObject> control, capu::SmartPointer<EtchObject> value) = 0;
+
+  /**
+   * Notifies the chain of sessions of the specified event. Unlike query
+   * and control operations above, events are always passed up to the
+   * top to allow all sessions to notice them.
+   *
+   * @param event a class which represents the event, possibly with
+   * parameters. The simplest event could be a string, integer,
+   * or enum, but any class instance will do (as long as some session
+   * in the chain expects it).
+   * @return ETCH_OK if event is notified successfully
+   *         ETCH_ERROR otherwise
+   *
+   */
+  virtual status_t sessionNotify(capu::SmartPointer<EtchObject> event) = 0;
+
+  ///////////////////////
+  // Well-known events //
+  ///////////////////////
+
+  /**
+   * Session event reporting the transport is up.
+   */
+  const static EtchString UP;
+
+  /**
+   * Session event reporting the transport is down.
+   */
+  const static EtchString DOWN;
+
+};
+
+#endif /* ETCHSESSION_H */
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionData.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,54 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHSESSIONDATA_H__
+#define __ETCHSESSIONDATA_H__
+#include "common/EtchError.h"
+#include "capu/util/SmartPointer.h"
+#include "transport/EtchFlexBuffer.h"
+#include "transport/EtchSession.h"
+#include "transport/EtchWho.h"
+
+/**
+ * Interface used to deliver packets to the session from the transport.
+ */
+
+class EtchSessionData : public virtual EtchSession {
+
+public:
+
+  /**
+   * Delivers data to the session from the transport.
+   * @param sender the sender of the data, for transports which allow
+   * multiple senders. This is who to return any response to.
+   * @param buf a FlexBuffer positioned at the data.
+   * @return ETCH_ERROR if there is a parsing error
+   *         ETCH_OK if received data from transport is successfully parsed and passed to the session
+   */
+  virtual status_t sessionData(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchFlexBuffer> buf) = 0;
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchSessionData() {
+
+  }
+};
+
+#endif /* ETCHSESSIONDATA_H */
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionListener.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,46 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHSESSIONLISTENER_H__
+#define __ETCHSESSIONLISTENER_H__
+#include "capu/util/SmartPointer.h"
+#include "transport/EtchSession.h"
+#include "common/EtchError.h"
+
+template <class T>
+class EtchSessionListener : public virtual EtchSession {
+
+public:
+
+  /**
+   * Delivers a socket to the session from the listener.
+   * @param connection
+   */
+  virtual status_t sessionAccepted(capu::SmartPointer<T> connection) = 0;
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchSessionListener() {
+
+  }
+
+};
+
+#endif
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionMessage.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,54 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHSESSIONMESSAGE_H__
+#define __ETCHSESSIONMESSAGE_H__
+
+#include "transport/EtchSession.h"
+#include "common/EtchError.h"
+#include "capu/util/SmartPointer.h"
+#include "transport/EtchWho.h"
+#include "transport/EtchMessage.h"
+
+/**
+ * Interface used to deliver messages to the session from the transport.
+ */
+class EtchSessionMessage : public virtual EtchSession {
+
+public:
+
+  /**
+   * Delivers data to the session from the transport.
+   * @param sender the sender of the message, for transports which allow
+   * multiple senders. This is who to return any response to.
+   * @param msg a Message.
+   * @return true if the message was consumed, false otherwise.
+   */
+  virtual status_t sessionMessage(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchMessage> msg, capu::bool_t &result) = 0;
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchSessionMessage() {
+
+  }
+
+};
+
+#endif /* ETCHSESSIONMESSAGE_H */
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchSessionPacket.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,48 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHSESSIONPACKET_H__
+#define __ETCHSESSIONPACKET_H__
+#include "transport/EtchSession.h"
+#include "transport/EtchFlexBuffer.h"
+#include "capu/util/SmartPointer.h"
+#include "transport/EtchWho.h"
+
+class EtchSessionPacket : public EtchSession {
+
+public:
+
+  /**
+   * Delivers a packet to the session from the transport.
+   * @param sender the sender of the packet, for transports which allow
+   * multiple senders. This is who to return any response to.
+   * @param buf a FlexBuffer positioned at the packet.
+   */
+  virtual status_t sessionPacket(capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchFlexBuffer> buf) = 0;
+
+  /**
+   * Destructor
+   */
+  virtual ~EtchSessionPacket() {
+
+  }
+
+};
+
+#endif /* ETCHSESSIONPACKET_H */
+

Added: incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/transport/EtchWho.h Fri Mar  2 07:22:43 2012
@@ -0,0 +1,33 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __ETCHWHO_H__
+#define __ETCHWHO_H__
+
+class EtchWho {
+
+public:
+
+  virtual ~EtchWho() {
+
+  }
+};
+
+#endif
+
+

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1296067&r1=1296066&r2=1296067&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Fri Mar  2 07:22:43 2012
@@ -46,6 +46,12 @@ SET(MAIN_INCLUDES
     ${PROJECT_SOURCE_DIR}/include/util/EtchURL.h
     ${PROJECT_SOURCE_DIR}/include/util/EtchResources.h
     ${PROJECT_SOURCE_DIR}/include/transport/EtchFlexBuffer.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchSession.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchSessionData.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchSessionListener.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchSessionMessage.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchSessionPacket.h
+    ${PROJECT_SOURCE_DIR}/include/transport/EtchWho.h
     ${PROJECT_SOURCE_DIR}/include/util/EtchUtil.h
     )
 
@@ -66,6 +72,7 @@ SET(MAIN_SOURCES
     util/EtchURL.cpp
     util/EtchResources.cpp
     transport/EtchFlexBuffer.cpp
+    transport/EtchSession.cpp
     util/EtchUtil.cpp
     )
 

Added: incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchSession.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchSession.cpp?rev=1296067&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchSession.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/transport/EtchSession.cpp Fri Mar  2 07:22:43 2012
@@ -0,0 +1,23 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "transport/EtchSession.h"
+
+const EtchString EtchSession::UP("UP");
+
+const EtchString EtchSession::DOWN("DOWN");