PureMVC single core for Java

PureMVC single core for Java

As I proposed it recently on the PureMVC forums I took some time today to convert the multicore version of the PureMVC for Java port into a single core version.

I recently had to work with PureMVC Java for an Android application I work for the PureMVC community as an example of what we can do with PureMVC in an Android native Java application. I was surprised that the existing single core version didn't have onRegister/onRemove methods over Mediator and Proxy objects. Those methods were present in the multicore version of the port. The single core version was older and some other minor fixes have to be made, so I proposed Cliff to update the existing single core version with the multicore.

I took the best of both world each time possible in code and structure following the last PureMVC best practices for project editing.

I suppose that Cliff Hall will update the single core Java as soon as possible with this update, but for the moment here are the files :

14 Replies to “PureMVC single core for Java”

  1. Pingback: Tweets that mention Tekool.net - PureMVC single core for Java -- Topsy.com

  2. Thanks a million for knocking the dust off the standard port and bringing it up to par with MultiCore and the AS3 reference. I will have this bagged and tagged soon.


  3. Hi! I want use pureMVC for my j2me projects, but after upgrade for 1.0 version i have some error while compile project.

    Error preverifying class org.puremvc.java.core.Controller
    VERIFIER ERROR org/puremvc/java/core/Controller.()V:
    Cannot find class java/util/Map

  4. Hi Nikit!

    Which Java version are you using? It clearly says that it needs java.util.Map class to compile. I’m working on a Java project today with jdk 1.6 and it works perfectly, unit test passes too. JRE/JDK version is probably the origin of your problems as PureMVC for Java previously use Hashtable as I remember.

    If it has no real cost to downgrade Map to Hashtable, I could at least have a look to this and downgrade. As I’m not a professional Java developer have you any advice on this ?

  5. Hi Tekool!
    It’s because java me implementation doesn’t support Map. It’s only support Hashtable, as you sad early. And version of jdk doesn’t affect this.

    I see two ways to resolve this problem: first you can downgrade to hashtable, but i don’t see source for other conflict with java me. May be there are many other problems?
    And the second way is to do branch for java me implementations of pureMVC. May be it would be more correct?

  6. Hi Nikit,

    I agree that the branch idea is the best. I will try talk to Cliff about that and commit this as soon as possible.

    You have no problem using the old version of PureMVC while waiting for the new branch?

  7. Hi, Tekool!

    Yes, of course! But version jump from 0.3 to 1.0 was intriguing me, and i want to use last version)))))

    Thanks for attention to my problem! Good luck!)

  8. Do you have a sample how you used PureMVC with Android?
    Specially I am interested on how you connect a Mediator to it’s Activity.


  9. Hi Mike, to connect an Android PureMVC mediator to its Activity I pass the Activity instance reference as parameter in the Mediator constructor. To get the Activity instance reference I use the Activity Java class with something like :

         * Called when the activity is first created.
        public void onCreate( Bundle savedInstanceState )
            super.onCreate( savedInstanceState );
            facade = ActivityFacade.getInst(ACTIVITY_MULTITON_KEY);

    Hope this helps. Wait for some weeks and I’ll publish my app. It’s near finished but I need to manage resume state and its UI design.

  10. Hi Tekool,

    Could you explain this in a little more detail? What is ‘ActivityFacade’ and why are you passing the activity into the facade?

  11. Just to be a little clearer – is your application a single activity application? If not how are you passing the reference for other activities into the facade (to be mediated)?

  12. Hi Ian, I used the multi-core version of PureMVC and refer to each Activity in my application as a different PureMVC core. What you saw here is repeated for each Activity in my application. I need to take care of GC when the Activity is closed to be sure that PureMVC do not keep a reference to the Activity.

    Since I talk about my project, more and more people ask me for infos about this, I think I will simply push an alpha version of the app during the week and give the SVN url of the project I currently using. It will be a new blog post, I’ll push a comment on this thread too, so stay tuned! 😉

Leave a Reply

Your email address will not be published.