Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Re: Proxy in Proxy on: February 14, 2010, 04:58:18
I use internal proxy only for read required data. Another way create many Command and additional Proxy in business layer.
2  Announcements and General Discussion / Architecture / Proxy in Proxy on: February 14, 2010, 03:10:45
It's normal or not?

:
public class TestProxy extends Proxy
{

private var mainProxy : MainProxy;

override public function onRegister() : void
   {
      mainProxy = facade.retrieveProxy( MainProxy.NAME ) as MainProxy;
   }
}
3  Announcements and General Discussion / Architecture / Re: Targeting for proxie result on: January 25, 2010, 12:51:16
Yes, if I interested in routing the message, some part must be available for all time message live cycle.
Some requests in my system is SOAP requests. It's look like

:
soap.createElement.addEventListener( SoapEvent.RESULT, resultHandler );
soap.createElement.addEventListener( SoapEvent.ERROR, errorHandler );
soap.createElement( rootID, typeID );

This part contained into core proxies. If module wants to get the query result, he send message:

ModuleJunctionMediator:

:
var message : MyMessage = new MyMessage( Places.SERVER, Operations.CREATE, Targets.ELEMENT, { rootID: 111, typeID: 222 } /*<----some untyped properties*/ );
junction.sendMessage( PipeNames.TO_CORE, message );

It's REST-like SQL-based message system :)

Now I confused how implement this:

"soap.createElement.addEventListener( SoapEvent.ERROR, errorHandler );" :)

I have two important chains:

                                      -> [ async req. result ] -> [ core to module message ]
[ module to core message ]
                                      -> [ async req. error ] -> [ core to module message ]

and some main task:
1. Detect "my message". Discuss in previous post "how track result"
2. Error messages it's look like "track result" but have some differences.

For my "answer message" I create message the same type:

CoreJunctionMediator:

:
var message : MyMessage = new MyMessage( Places.SERVER, Operations.CREATE, Targets.ELEMENT, { elementVO: elementVO } /*<----result of async req.*/ );
junction.sendMessage( PipeNames.TO_MODULE, message );

The first way, create new ErrorMessage class like:

var errorMessage : ErrorMessage = new ErrorMessage( Places.SERVER, Operations.CREATE, Targets.ELEMENT, "Error Message" );

Difficult for me, where the place to "truck implementation":
1. Create unique ID for all messages.
myMessage.UID,
errorMessage.UID and errorMessage.sourceMessageID = [ myMessage.UID ] <-- this message generate error. But this way cant use for track normal messages, because MyMessage haven't attribute recipientID;
And module must "memorize" each request.

2. Create not errorMessage.sourceMessageID, but errorMessage.sourceMessage

3. Create recepientID for MyMessage...

Actually I'm confused :)

Main q.

How create module-core-module communication with track source messages in answers and error messages for sync and async requests :)
4  Announcements and General Discussion / Architecture / Re: Targeting for proxie result on: January 22, 2010, 03:46:25
The same question. What is the best way for modular application.
Example. I have module and core with some proxy.

My module have some mediators working as previous example:

PersonalCardMediator.as

listNotificationInterests() : Array
{
    return [ImageProxy.RESOURCE_LOADED+"/"+PersonalCardMediator.NAME]
}

override public function onRegister() : void
{
   sendNotification( AppFacade.LOAD_RES, { resourceID : resourceID, recepientName : NAME} );
}

in JunctionMediator:

handleNotification( note : INotification ) : void
{
   switch ( note.getName() )
   {
      case AppFacade.LOAD_RES:
      {
         var message : Message = new Message( MessageNames.LOAD_RES, id: note.getBody().resourceID );
         junction.sendMessage( PipeNames.STDCORE, message );
      }
   }
}

when answer is recieved, how I know who recepent?

OK, actually I can send message with recepientID, and later send this attribute back. But I do not think that this is a good way. Because it's unnecessary information for Proxy.

Second way I can organize que in JuncationMediator:

...
case AppFacade.LOAD_RES:
      {
         if( myQue[ resourceID ] )
            myQue[ resourceID ] = [];
         myQue[ resourceID ].push( recepientName );
         var message : Message = new Message( MessageNames.LOAD_RES, id: note.getBody().resourceID
      }
override public function handlePipeMessage( message : IPipeMessage ) : void
{
   var resourceID = ResourceVO(message.getBody).id;
   if ( myQue[ resourceID ] )
      sendNotification( [AppFacade.RESOURCE_LOADED+"/"+myQue[ resourceID ][0], message.getBody() );
}

But in this way I store "myQue" in mediator, maybe it's not best place and I must create special Proxy for this data?
5  PureMVC Manifold / MultiCore Version / Re: One proxy for all modules on: November 05, 2009, 05:03:36
Another question: how I can create and connect new pipe within module?

I have shell with some Proxies - CarProxy, DriverProxy and TownProxy and 3 types of modules: BigModule, SmallModule, NonVisualModule. Not all Proxies needed in each module. For each Proxy I create different pipe (Proxy generate notification, and different notification sended with different pipes).

BigModule use all my pipes, SmallModule use one and NonVisualModule use no one pipe. All module have one super class StandartModule, and I use this Class in ShellJunctionMediator when I create and connect pipe between each module and shell. If I connect all pipes to all module, handlePipeMessage executed all, times when I send message.
I want send message to module who needed CarProxy, but this message receive all my modules (executed all handlePipeMessage() in modules also in NonVisualModule).

I see some way to solve this problem:
1) Override JunctionMediator.ACCEPT_INPUT_PIPE, JunctionMediator.ACCEPT_OUTPUT_PIPE in module.
2) Create special property in StandartModule "neededPopes" and check this property in ShellJunctionMediator.
3) Connect pipes not in ShellJunctionMediator, but in ModuleJunctionMediator(I dont know how, because in module I cant see shell).
6  Announcements and General Discussion / Architecture / Targeting for proxie result on: April 24, 2009, 02:32:19
I have proxie class wihch load binary data from server. It's look like image downloader. Some parts of my application ask proxie to load some resources:

PersonalCardMediator.as

listNotificationInterests() : Array
{
   return [ ImageProxy.RESOURCE_LOADED ];
}

handleNotification( note : INotification ) : void
{
   switch ( note.getName() )
   {
      case ImageProxy.RESOURCE_LOADED:
      {
         if( firstUID == note.getBody().UID )
            ...
}

getImage()
{
   imageProxy.getResource( firstUID );
}

---------------------------

MainWindowMediator.as

listNotificationInterests() : Array
{
   return [ ImageProxy.RESOURCE_LOADED ];
}

handleNotification( note : INotification ) : void
{
   switch ( note.getName() )
   {
      case ImageProxy.RESOURCE_LOADED:
      {
         var UID = note.getBody().UID;
         if( secondUID == UID || thirdUID == UID || ... )
            ...
}

getListImages()
{
   imageProxy.getResource( secondUID );
   imageProxy.getResource( thirdUID );
   ....
   imageProxy.getResource( zUID );
}

and more
---------------------------

Problem is: If I send notify when complete load each resource, all my subscribed components must check, is needed resource or not. How I can optimize this?
Sorry for my English.
Pages: [1]