Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-15-2005
xdm's Avatar
xdm xdm is online now
ZeroC Staff
 
Name: José Gutíerrez de la Concha Martínez
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Sep 2003
Location: La Coruña, Spain
Posts: 291
IceStorm and model view controller pattern

Hello

I trying to implement the model view controller pattern using IceStorm to deliver messages or events fron model objects to client views. in oder to do it I add a new interface to my base object derived from Ice::Object, create and Event class to emcapsulate events that are send and create a listener inteface that must be implemented or agreate by View objects the definitios as are follow

Code:
           module Oz
           {
              module Base
              {
                 class Event
                  {
                          // the id of the object that send the event
                          Ice::Identity objectId;
                          // a name used for diference events
                          string name; 
                  };
                  inteface EventPublisher
                  {
                         void eMit(Oz::Base::Event e);
                  };
                  
                  interface EventListener
                  {
                       // this operation create a Ices::Storm subcriber 
                       // for topic named objectId.name
                       idempotent void suscribe(Ice::Identity objectId);

                       // this operation unsuscribe object 
                       // for topic objectId.name
                       idempotent void unsuscribe(Ice::Identity objectId);
                       
                       // this opeartion is the contract betwen publisher 
                       // and subscriber object
                       idempotent void notify(Event e);
                   };
               };
            };

my problem is that i need a diferent topic for each object and this topics must be created on demand with object creation like topics are not persistent and objects are persistents. I think to diferents ways to manage this situation are

1) try to retrive a topic in objectInitializer and if topic not exist creating it the code can be as folow


Code:
void 
Oz::Base::ObjectInitializer::initializer(
       const Ice::ObjectAdapterPtr&,
       const Ice::Identity& objId,
       const std::string& ,
       const Ice::ObjectPtr& obj)
{

         /** heare I initilize topic manager code not show for simplicy **/
        try
        {
          obj->topic=topicManagerPx->retrieve(obj->getId().name);
        }
        catch(const IceStorm::NoSuchTopic& ex)
        {
                  obj->topic=topicManagerPx->create(obj->getId().name);
        }
}
2) can be a better aproach to do it this in the eMit operation if ObjectNoExistException is throw whe try to a call an operation on topic object

Code:
               void Oz::Base::eMit(Oz::Base::Event e)
                {
                           try
                           {
                                topic->notify(e);
                           }
                           catch(ObjectNoExistException& e)
                           {
                                  /*retrive topic manager code not show*/
                                 topic=topicManagerPx->create(id.name);
                                 topic->notify(e);
                           }
                }

In the client side i create a subscriber Proxy for each view and sucribe it to the correspoding model proxy.

My subscriber implementation can hold a pointer to the view object a when notifiy
operation is invoked in the subscriber in dispach the envet to the view.



can you say me if this a correct usage for IceStorm service?

what aproach can be better to ensure that s exist a topic for each object, or
any sugestion for do it in a diferent way?


In other to subscribe objects be accessible by IceStorm service is neceary configuring Glacier or Glacier2 are both valid?

it is posible to adquire topic manager via IcePack::Query i think yes but i'm not sure.

Thanks in advantage
Reply With Quote
  #2 (permalink)  
Old 02-15-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
Quote:
Originally Posted by xdm
Hello

my problem is that i need a diferent topic for each object and this topics must be created on demand with object creation like topics are not persistent and objects are persistents. I think to diferents ways to manage this situation are
Actually, topics are persistent, see section 41.3.6 of the Ice manual. Once created, the IceStorm topics will persist until you destroy them.

Quote:
Originally Posted by xdm
In the client side i create a subscriber Proxy for each view and sucribe it to the correspoding model proxy.

My subscriber implementation can hold a pointer to the view object a when notifiy
operation is invoked in the subscriber in dispach the envet to the view.

can you say me if this a correct usage for IceStorm service?
This sounds fine.

Quote:
Originally Posted by xdm
In other to subscribe objects be accessible by IceStorm service is neceary configuring Glacier or Glacier2 are both valid?
I'm not sure I understand the question, can you detail what you're trying to do here with Glacier?

Quote:
Originally Posted by xdm
it is posible to adquire topic manager via IcePack::Query i think yes but i'm not sure.
Yes, you can register the topic manager with the IcePack registry in order to access it with the IcePack::Query interface. You can either register it manually with the IcePack::Admin interface or the icepackadmin utility, or you can use the IcePack deployment mechanism to deploy your IceStorm service.

Hope this helps!

Benoit.
Reply With Quote
  #3 (permalink)  
Old 02-15-2005
xdm's Avatar
xdm xdm is online now
ZeroC Staff
 
Name: José Gutíerrez de la Concha Martínez
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Sep 2003
Location: La Coruña, Spain
Posts: 291
Hi beniot thanks for your replys

in realation to Glacier i want to say that if is posible thats IceStorm invoke topic notificatios in a client throw a glacier or glacier2 router.


for example how can i do to have a server runing IceStorm in a private network dispaching topic notificatios to a client in other private network


I think that i need configure a router in server runing IceStorm in order to clients can reach IceStorm. But I don't now what i must do in order to IceStorm can reach subscribers and scenarios is more complicated if each subscriber is in a diferent private network. How can i handle this?

thanks for all
Reply With Quote
  #4 (permalink)  
Old 02-15-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
You will need to deploy a Glacier router and modify your client to create a session with this Glacier router. You can take a look at the demo/Glacier2/callback demo to see how to modify your client to use Glacier.

Basically, your client will create the IceStorm subscriber object (like the CallbackReceiver object in the demo) and pass its proxy to the IceStorm topic through the session. When IceStorm will invoke on your subscriber, the invocations will be routed to your client transparently through the router.

If you have several private networks connected to the network where IceStorm is deployed, you'll need a Glacier router for each of these private networks.

Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Implementing DAO Pattern using Ice Paul Drummond Help Center 8 03-28-2006 02:06 AM
Is the "thread per connection" model the only choice in ICE? OrNot Help Center 1 06-06-2005 11:00 PM
Does the thread model of ice support SCOPE_SYSTEM semantic genelee Help Center 2 05-17-2005 08:40 AM
Unknown property "IceBox.DBEnvName.IceStorm" for IceStorm wwwtiger Help Center 1 11-05-2004 03:23 PM


All times are GMT -4. The time now is 09:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.