A Listener waits for incoming requests and handles them by accepting them and passing them to the ORB for processing.
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Known Derived Classes: Poco::RemotingNG::SOAP::Listener, Poco::RemotingNG::TCP::Listener, EventListener, Poco::UPnP::GENA::Listener, Poco::UPnP::SOAP::Listener
Member Functions: createURI, endPoint, handlesURI, protocol, registerObject, start, stop, unregisterObject
Inherited Functions: duplicate, referenceCount, release
typedef Poco::AutoPtr < Listener > Ptr;
const std::string & endPoint
Creates a Listener.
Takes a local endpoint address as input. For network based listener, this will typically be a port number or socket address in the form <host>:<port>.
virtual std::string createURI(
const Identifiable::TypeId & typeId,
const Identifiable::ObjectId & objectId
) = 0;
Create an URI for accessing the object with the given TypeId and ObjectId through the Listener.
Must return a complete URI for the object. URI scheme and authority can be freely chosen by the Listener; however the URI path must be in format /<protocol>/<typeId>/<objectId>.
const std::string & endPoint() const;
Returns the local endpoint of the Listener, as given in the constructor.
virtual bool handlesURI(
const std::string & uri
) = 0;
Check whether the given URI can be handled by this Listener instance.
This is used by the ORB to check whether a given remote service object identified by the URI is actually located on the same ORB.
In some cases, simply comparing the URI against all locally registered URIs does not work, as URI may be different even if they reference the same object. For example, the URIs http://localhost/a/b/c and http://127.0.0.1/a/b/c are different, but actually reference the same resource.
An implementation of this function should examine the authority part (host and port) of the URI and check if it is equivalent to the endpoint handled by the Listener.
A simple implementation can always return false. In this case, local objects will only be recognized if the URI exactly matches the URI created by the Listener when the object was registered.
virtual const std::string & protocol() const = 0;
virtual void registerObject(
) = 0;
Registers a RemoteObject and its Skeleton with the Listener.
Depending on the protocol, the Listener can opt to let the ORB handle all invocations (i.e. with a protocol that sends the full URI with each request), which allows to implement a request handler that simply calls ORB::invoke(). In this case the Listener does not need to actually register the RemoteObject and Listener internally.
Note that registerObject() is called from inside the ORB, and thus is not allowed to call back into the ORB (danger of dead-lock).
virtual void start() = 0;
Start accepting requests.
virtual void stop() = 0;
virtual void unregisterObject(
) = 0;