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

Pages: [1]
Print
Author Topic: LibraryDelegate - Manage few Service Sources  (Read 3323 times)
yeremy
Jr. Member
**
Posts: 11


View Profile Email
« on: July 29, 2008, 12:21:19 »

hi All!

i've been working in the login component..and it is done,  now i need work with another remote object..i've used a LibraryDelegate to manage a service with differents sources...but i'm not sure about it is a good way to do that.

the following code is that i've used :

-----------------Login Proxy ------------------------------------
this is a method inside the LoginProxy Class.

public function login(tryLoggin: LoginVO):void
      {
         var delegate:LibraryDelegate = new LibraryDelegate( new Responder( onLoginResult, onLoginFault ) );
         delegate.setSourceService( LibraryDelegate.SERVICE_USER );
         delegate.login( tryLoggin );
         
      }

-----------------Library Delegate ------------------------------------
package com.me.myapp.model.business

             public class LibraryDelegate
   {
      private var responder: IResponder;
      private var service : RemoteObject;
      
      public var currentService : int;
      
      public static const SERVICE_USER : uint = 1;
      public static const SERVICE_PRODUCT : uint = 2;
      
      public function LibraryDelegate( pResponder : IResponder )
      {
         service = new RemoteObject();
         
         //service.endpoint = "";
         service.destination = "GenericDestination";
         service.showBusyCursor = true;
         service.makeObjectsBindable = true;
         
         responder = pResponder;
      }
      
      public function setSourceService(pSelectorSource : uint):void
      {
         currentService = pSelectorSource;
         switch ( currentService )
         {
            case SERVICE_PRODUCT :
               service.source = "WebOrbTestBusinessLogic.Entities.Product";
               break;
            case SERVICE_USER :
               service.source = "WebOrbTestBusinessLogic.Entities.User";
            default :      
         }
         
      }

}


i hope somebody can help me with this!

Thanks!
« Last Edit: July 29, 2008, 12:26:02 by yeremy » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: July 29, 2008, 07:43:33 »

No problem with using a delegate. I don't see your LibraryDelegate.login method here, but I assume it works for you and you're just looking for a thumbs up that its a good idea?

-=Cliff> 
Logged
Pages: [1]
Print