geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Silv <>
Subject how to use the persistence flag in addAttribute?
Date Tue, 31 Mar 2009 12:41:57 GMT


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("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";
			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);
			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:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message