You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Donyee <xy...@gmail.com> on 2008/08/22 05:25:41 UTC

About the ApplicationState??

I tried to implement a ApplicationStatePersistenceStrategy using Memcached.
but in my page Start.java:

@ApplicationState
    private AppState appState;
    @ApplicationState
    private SessionAppState session;

    @Inject
    private Logger log;

    void onActivate() {

        log.info("cache :"+appState.toString());

        log.info("session :"+session.toString());

    }
##################AppModule.java
public void contributeApplicationStateManager(
            MappedConfiguration<Class, ApplicationStateContribution>
configuration) {
        ApplicationStateCreator<AppState> creator = new
ApplicationStateCreator<AppState>() {
            public AppState create() {
                return new AppState(new Date());
            }
        };
        configuration.add(AppState.class, new ApplicationStateContribution(
                "memcached", creator));
        ApplicationStateCreator<SessionAppState> creator2 = new
ApplicationStateCreator<SessionAppState>() {
            public SessionAppState create() {
                return new SessionAppState(new Date());
            }
        };
        configuration.add(SessionAppState.class, new
ApplicationStateContribution(
                "session", creator2));
    }

################
the appState didn't get the right info, and the sessionAppState works fine!
*the question is when i change my sessionAppState, who writes the changed
sessionAppState to  the Session again??
*I search the T5 source,but i didn't find.
Is there a proxy impl?
Any tips will be great!

-- 
Yet Another Java EE Developer!

Re: About the ApplicationState??

Posted by Donyee <xy...@gmail.com>.
I know the answer, my impl does not recache the appState when it changes.
I'm thinking about other way to implement.

2008/8/23 Argo Vilberg <wi...@gmail.com>

> My experience show that only one applicationState object work fine.
>
> With two applicationState object i have this error;
>
>
> Error invoking constructor ee.softpro.data.Role(long, String, String,
> boolean, String, String, String) (at Role.java:20) (for service
> 'ApplicationStateManager'): No service implements the interface long.
>
>
> I dont know yet why!
>
>
>
>
> 2008/8/22 Donyee <xy...@gmail.com>
>
> > I tried to implement a ApplicationStatePersistenceStrategy using
> Memcached.
> > but in my page Start.java:
> >
> > @ApplicationState
> >    private AppState appState;
> >    @ApplicationState
> >    private SessionAppState session;
> >
> >    @Inject
> >    private Logger log;
> >
> >    void onActivate() {
> >
> >        log.info("cache :"+appState.toString());
> >
> >        log.info("session :"+session.toString());
> >
> >    }
> > ##################AppModule.java
> > public void contributeApplicationStateManager(
> >            MappedConfiguration<Class, ApplicationStateContribution>
> > configuration) {
> >        ApplicationStateCreator<AppState> creator = new
> > ApplicationStateCreator<AppState>() {
> >            public AppState create() {
> >                return new AppState(new Date());
> >            }
> >        };
> >        configuration.add(AppState.class, new
> ApplicationStateContribution(
> >                "memcached", creator));
> >        ApplicationStateCreator<SessionAppState> creator2 = new
> > ApplicationStateCreator<SessionAppState>() {
> >            public SessionAppState create() {
> >                return new SessionAppState(new Date());
> >            }
> >        };
> >        configuration.add(SessionAppState.class, new
> > ApplicationStateContribution(
> >                "session", creator2));
> >    }
> >
> > ################
> > the appState didn't get the right info, and the sessionAppState works
> fine!
> > *the question is when i change my sessionAppState, who writes the changed
> > sessionAppState to  the Session again??
> > *I search the T5 source,but i didn't find.
> > Is there a proxy impl?
> > Any tips will be great!
> >
> > --
> > Yet Another Java EE Developer!
> >
>



-- 
Yet Another Java EE Developer!

Re: About the ApplicationState??

Posted by Argo Vilberg <wi...@gmail.com>.
My experience show that only one applicationState object work fine.

With two applicationState object i have this error;


Error invoking constructor ee.softpro.data.Role(long, String, String,
boolean, String, String, String) (at Role.java:20) (for service
'ApplicationStateManager'): No service implements the interface long.


I dont know yet why!




2008/8/22 Donyee <xy...@gmail.com>

> I tried to implement a ApplicationStatePersistenceStrategy using Memcached.
> but in my page Start.java:
>
> @ApplicationState
>    private AppState appState;
>    @ApplicationState
>    private SessionAppState session;
>
>    @Inject
>    private Logger log;
>
>    void onActivate() {
>
>        log.info("cache :"+appState.toString());
>
>        log.info("session :"+session.toString());
>
>    }
> ##################AppModule.java
> public void contributeApplicationStateManager(
>            MappedConfiguration<Class, ApplicationStateContribution>
> configuration) {
>        ApplicationStateCreator<AppState> creator = new
> ApplicationStateCreator<AppState>() {
>            public AppState create() {
>                return new AppState(new Date());
>            }
>        };
>        configuration.add(AppState.class, new ApplicationStateContribution(
>                "memcached", creator));
>        ApplicationStateCreator<SessionAppState> creator2 = new
> ApplicationStateCreator<SessionAppState>() {
>            public SessionAppState create() {
>                return new SessionAppState(new Date());
>            }
>        };
>        configuration.add(SessionAppState.class, new
> ApplicationStateContribution(
>                "session", creator2));
>    }
>
> ################
> the appState didn't get the right info, and the sessionAppState works fine!
> *the question is when i change my sessionAppState, who writes the changed
> sessionAppState to  the Session again??
> *I search the T5 source,but i didn't find.
> Is there a proxy impl?
> Any tips will be great!
>
> --
> Yet Another Java EE Developer!
>