Could you show us the codes that how you get the Dictionary GBean from
Kernel ?
I think you should get the Dictionary object via ProxyManager, so that
Kernel will monitor the changes of dir property.
Thanks !
Ivan

2009/3/31 Silv <silvio-pe...@gmx.de>

>
> hello,
>
> i'm new in the development with java/geronimo/beans.
>
> for exercise I have written a jsp and added a spellcheck.
> to manage this and change e.g. the dictionary i wrote a gbean and added an
> attribute and set the persistence flag true.
>
> i thought that geronimo save the value of "dir" ( in my case )  if the
> state
> changend ( stop, offline? ) and reload the last value automatic if the
> state
> goes to start/running but it doesn't work. after stop/start of my
> application in geronimo the value of dir is empty.
>
> does anyone knows the problem? probably it is an beginner's mistake but i
> hope u can explain me how it works.
>
> here is the code from my gbean class:
>
> public class Dictionary implements GBeanLifecycle {
>        public static final GBeanInfo GBEAN_INFO;
>
>        static {
>            GBeanInfoBuilder infoBuilder =
> GBeanInfoBuilder.createStatic("Dictionary", Dictionary.class);
>            infoBuilder.addAttribute("dir", String.class, true);
>            infoBuilder.addAttribute("sc", String.class, true);
>            infoBuilder.addOperation("loadDict",new
> Class[]{String.class},"String");
>            infoBuilder.addOperation("createInstance", "String");
>            GBEAN_INFO = infoBuilder.getBeanInfo();
>        }
>        public static GBeanInfo getGBeanInfo() {
>            return GBEAN_INFO;
>        }
>
>        private SpellCheck sc;
>        private String dir;
>
>        public String createInstance(){
>                sc = new SpellCheck();
>                if(sc != null)
>                {
>                        dir = sc.getDir();
>                        return "new Instance of Spellcheck successfully
> created";
>                }
>                else
>                        return "failed!";
>        }
>        public String getdir(){
>                return dir;
>        }
>        public void setdir(String str){
>                dir = str;
>        }
>        public String getsc(){
>                return sc.toString();
>        }
>        public String loadDict(String str) throws FileNotFoundException,
> UnsupportedEncodingException, Exception {
>                if(sc != null)
>                        return (String) sc.changeDict(str);
>                else
>                        return "First createInstance()!";
>        }
>
>        public void doFail() {
>                // TODO Auto-generated method stub
>
>        }
>
>        public void doStart() throws Exception {
>                // TODO Auto-generated method stub
>
>        }
>
>        public void doStop() throws Exception {
>                // TODO Auto-generated method stub
>
>        }
> }
> --
> View this message in context:
> http://www.nabble.com/how-to-use-the-persistence-flag-in-addAttribute--tp22804332s134p22804332.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>


-- 
Ivan

Reply via email to