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 ... 4 5 [6] 7
Print
Author Topic: Loadup (formerly StartupManager) - A PureMVC AS3 Utility  (Read 109723 times)
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #75 on: November 21, 2008, 03:35:57 »

The 'Startup Manager / API Docs' link in the manifold project is not right - it refers to an old version.  Until this is corrected, to see the correct api docs, make sure you use the download.
----Philip
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #76 on: November 24, 2008, 07:45:16 »

The 'Startup Manager / API Docs' link in the manifold project IS NOW CORRECT, thanks to Cliff.
----Philip

Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #77 on: January 16, 2009, 04:47:10 »

There is a new version of StartupManager in the code repository; in trunk, not tagged.

The enhancements are minor.  Here is extract from version.txt.

1.6 This release is backward compatible.
    Within asset loader feature, in AssetFactory class: support for
    .css urls as asset type Text, plus defaulting to type Text,
    hence reduced likelihood of 'unexpected url type' as an Error
    condition.
    Within StartupMonitorProxy class: new cleanup method, to remove
    StartupResourceProxy objects from proxy map; also, the reset
    method now includes this cleanup of SRP objects.

So, note that monitor.reset() now does a facade.removeProxy for SRP objects.  If this is a problem for anybody, please let me know.
----Philip
 
Logged
dbasch
Jr. Member
**
Posts: 17


View Profile Email
« Reply #78 on: January 16, 2009, 09:51:13 »

So, note that monitor.reset() now does a facade.removeProxy for SRP objects.  If this is a problem for anybody, please let me know.

I believe this is the correct behavior. I was manually removing them before.

Thanks,
Derek Basch
Logged
zerozero
Newbie
*
Posts: 1


View Profile Email
« Reply #79 on: February 10, 2009, 04:11:08 »

Hi there,
I've been noodling around with the startupManager utility for a pure actionscript, multicore project and I've come across an issue I'd like to run by the forum:

I plugged the startupManager and all dependent libraries into my project (hacked the mx.core classes in just so it would run for the time being.. more on that later). When I run it I am getting an Error: multitonKey for this Notifier not yet initialized! at StartupResourceProxy/get monitor(). Stepping through the debugger I find that this is because the StartupResourceProxy for each resource isn't being registerProxied. The API docs say:

This method offers an alternative to that, as a shortcut for the client app, whereby the app does not have to create the StartupResourceProxy (sup) object for the IStartupProxy object. Instead, the StartupManager (SM) will create the sup object. But note that the app does not then have a reference to it and has not given it a name and has not registered it using registerProxy(). In fact, the SM will not give it a name and hence will not register it. This is fine as regards the SM operations.

I wonder if this is maybe true only for the AS3 Standard version because here in the Multicore version it seems to be necessary to register the proxy in order that the StartupResourceProxy can retrieve the facade in it's get monitor() method.

What I have ended up doing is registering the proxy using the url for the resource as a unique name:

:
public function addResourceViaStartupProxy( px :IStartupProxy ) :void {
var name : String = ( px as AssetProxy ).url ;
        facade.registerProxy( new StartupResourceProxy( name, px ) );
var r :StartupResourceProxy = facade.retrieveProxy( name ) as StartupResourceProxy;
        //var r :StartupResourceProxy = new StartupResourceProxy( "", px );
addResource( r );
}

Which seems to work. I'm just wondering if there is another way around this, or if I'm making some fundamental error or whether I am just the first person to notice this behaviour. Anyway would be interested in any thoughts.

Jon
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #80 on: February 11, 2009, 03:44:10 »

You are right it seems to me.  For a proxy to be viable in multicore, at least as regards using the facade var, the proxy must be registered.  A comparison of Notifier.as in standard and multicore shows this.

This means that the method addResourceViaStartupProxy(), of StartupMonitorProxy, is not valid in multicore.  Instead the addResource() method should be used, and the client app should register the StartupResourceProxy before passing it to addResource.

The addResourceViaStartupProxy method was introduced in version 1.4, as an alternatve to addResource().  In the assetloader feature, the LoadAssetGroupCommand uses this method and hence that command is also not valid for multicore.

I am sorry this problem was not identified by me pre-release.  I will deal with it in the next release.  In the meantime, for users of the LoadAssetGroupCommand, workaround options include
- extend StartupMonitorProxy and override the addResourceViaStartupProxy method
- or extend LoadAssetGroupCommand and override the prepAssetGroupForLoad method.

----Philip
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #81 on: March 02, 2009, 08:37:41 »

Arising from the previous 2 posts, there is a new version of StartupManager in the code repository; in trunk, not tagged.

Here is extract from version.txt.

1.6.1 This release is backward compatible.
      Method addResourceViaStartupProxy() of StartupMonitorProxy
      now registers the new StartupResourceProxy objects.

By way of further description, here is an extract of relevant code
:
        /**
         *  See addResource() above.  This method offers an alternative to that, as a shortcut for the
         *  client app, whereby the app does not have to create the StartupResourceProxy (srp) object for the
         *  IStartupProxy object.  Instead, the StartupManager (SM) will create and register the srp object,
         *  naming it as follows
         *  <ul><li>
         *  use the name supplied as the second, optional argument; if supplied</li>
         *  <li>otherwise, create a name by prefixing a suitable string to the name of the given
         *  IStartupProxy object; the prefix is specified in the var <code>prefixIfAutoSRPName</code>, which
         *  has an initial value that should usually suffice for uniqueness
         *  i.e. const StartupManager.PREFIX_IF_AUTO_SRP_NAME i.e. "smSR_"</li>
         *  </ul>
         *  This shortcut is probably attractive only if there are no dependencies between the resources,
         *  because the app requires references to the srp objects, to express the dependencies.
         */
public function addResourceViaStartupProxy( px :IStartupProxy, resourceProxyName :String = null ) :void {

----Philip
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #82 on: March 02, 2009, 12:12:15 »

Hi Philip,

Will bag 'n tag this release soon. Send me an email so I can put it in the queue.

Also, on the subject of retry policies which SM deals with, I came across this entry in the Amazon SimpleDB service glossary which I thought was brilliant:

exponential backoff

    A strategy for reducing the load on the system and increasing the likelihood of repeated requests succeeding by incrementally decreasing the rate at which retries are executed. For example, client applications might wait up to 400 milliseconds before attempting the first retry, up to 1600 milliseconds before the second, up to 6400 milliseconds (6.4 seconds) before the third, and so on.

It might be easy to implement a Boolean expBackoff parameter to RetryPolicy/RetryParameters to so that if true, the retryInterval is the initial interval, and subsequent retries are exponential values of that.

Just a thought.

Rock on,
-=Cliff>
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #83 on: March 04, 2009, 02:32:44 »

Cliff, exponential backoff idea, duly noted.
----Philip
Logged
flib
Newbie
*
Posts: 4


View Profile Email
« Reply #84 on: March 12, 2009, 07:55:21 »

Hi guys,

I'm looking into the startup manager and its asset loader.  My app is very sound orientated. 

Any chance that support for mp3s could be added to the next release?

Also, is the asset loader intended to work in flash? Just, I noticed references to flex components in the assetloader/model/assets folder.

Thanks
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #85 on: March 16, 2009, 05:12:32 »

Any chance that support for mp3s could be added to the next release?
Could you help with some information?  This would be a new type of asset.  As a loader, do we have to use flash.media.Sound, rather than Loader or URLLoader? If we have a new asset class, say AssetOfTypeSound, and if it implements IAssetForFlex, what kind of UIComponent would be appropriate?

Also, is the asset loader intended to work in flash?
There are 2 interfaces available for assets: IAsset and IAssetForFlex.  The 3 supplied asset classes implement IAssetForFlex.  If you want to avoid IAssetForFlex, you could use your own asset classes to extend AssetBase and implement just IAsset.  If you do this, it would be great to let us know here on the forum.

Thanks
----Philip
Logged
Helmut Granda
Full Member
***
Posts: 47

Flash Developer.


View Profile WWW Email
« Reply #86 on: March 26, 2009, 12:44:06 »

Hi,

Is there any reason why this code:
:
import mx.collections.ListCollectionView;

    import org.puremvc.as3.utilities.startupmanager.model.RetryParameters;
    import org.puremvc.as3.demos.flex.startupasordered.ApplicationFacade;

    private var facade:ApplicationFacade = ApplicationFacade.getInstance();

    public static const RETRY :String = "retry";
    public static const LOAD :String = "load";
    public static const TRY_TO_COMPLETE :String = "tryToComplete";

    [Bindable] public var customerStatus :String = "";
    [Bindable] public var productStatus :String = "";
    [Bindable] public var salesOrderStatus :String = "";
    [Bindable] public var debtorAccountStatus :String = "";
    [Bindable] public var invoiceStatus :String = "";
    [Bindable] public var overallStatus :String = "...";

    [Bindable] public var notifications :ListCollectionView;
    [Bindable] public var retryIsVisible :Boolean = false;
    [Bindable] public var retryIsEnabled :Boolean = false;

    public var retryParameters :RetryParameters = new RetryParameters();
    [Bindable] public var paramsEntryIsEnabled :Boolean = true;
    [Bindable] public var mode :int =1;

    [Bindable] private var initialMaxRetries :int = retryParameters.maxRetries;
    [Bindable] private var initialRetryInterval :Number = retryParameters.retryInterval;
    [Bindable] private var initialTimeout :Number = retryParameters.timeout;

    private function goLoad() :void {
        updateRetryParameters();
        if (mode == 1)
            sendEvent( LOAD );
        else
            sendEvent( TRY_TO_COMPLETE );       
    }
    private function sendEvent( eventName :String ) :void {
        dispatchEvent( new Event( eventName ));
    }
    private function updateRetryParameters() :void {
        retryParameters = new RetryParameters( maxRetries.value, retryInterval.value, timeout.value );
    }

is placed inside the MXML document rather than in the ApplicationFacade? I am asking this because I am working on a flash application (not Flex) and I use Main.as as my main entry point to the application and ApplicationFacade as the entry point to PureMVC and I'm not sure in this case where exactly the events and properties should be moved into.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #87 on: March 26, 2009, 04:13:55 »

None of this is a responsibility of the facade. A read of the Framework Overview and Best Practices docs will he'll sort out the responsibilities of the framework actors. The examples are in Flex but that is really irrelevant with regard to the roles of the framework classes.

-=Cliff>
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #88 on: April 28, 2009, 05:22:47 »

I want to discuss an enhancement to the SM utility.
Objective
Cater for concurrent instances of StartupMonitorProxy. For general use, this would be more natural. In addition, there are specific types of use that this enhancement would facilitate, for example
  • have a long running instance for loading assets on demand, using the keepResourceListOpen feature
  • create another instance to load some data resources and then, when finished, cleanup and remove reference to it
  • create another instance to load some specific assets blah blah blah.
  • create another instance blah blah blah.
In relation to this example use, see this forum entry
http://forums.puremvc.org/index.php?topic=258.msg4477#msg4477

Preamble to solution
  • the sm commands, StartupResourceLoadedCommand and StartupResourceFailedCommand, must be able to select the correct sm instance when processing the loaded/failed notifications from a client app
  • would like to maintain backward compatibility, so that existing apps will run correctly with this (proposed) new version of sm, for example, notifications sent by sm currently include jobId as notification type and some apps maybe use this feature.

Solution
  • StartupMonitorProxy (smpx) constructor takes proxy name as optional arg
  • disallow setting of jobId when smpx name is not the default, i.e. when not StartupMonitorProxy.NAME; so, jobId is retained for old usage but is not supported for new usage; it is considered redundant when each "job" can have its own sm instance
  • the notification type, on notifications sent by sm, is the smpx name, unless there is a jobId in which case the notification type is the jobId as at present
  • the contract between the sm and the client app is
    • sm guarantees to send notifications with type smpx name unless there is a jobId
    • client guarantees to send the resource loaded/failed notifications with type as smpx name if the smpx name is not the default; thus the sm commands will be able to select the correct sm instance based on the notification type.

Notes
  • the choice of smpx name as notification type, rather than a reference to the smpx instance, facilitates the following usage idiom: a smpx and a progress mediator can be instantiated as a pair, with the same name, enabling name comparison as the selection condition for notifications to be handled in the mediator.

So, any comments? .../ yes it's worth doing / no don't bother / the approach is wrong / ...
----Philip
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #89 on: April 28, 2009, 09:28:18 »

Makes sense to me.

-=Cliff>
Logged
Pages: 1 ... 4 5 [6] 7
Print