Index: /documentation/trunk/shared/Dictionary.java
===================================================================
--- /documentation/trunk/shared/Dictionary.java	(revision 27048)
+++ /documentation/trunk/shared/Dictionary.java	(revision 27049)
@@ -29,4 +29,5 @@
     private MacroFile aux_macros = null;
     private HashMap metadata = null;
+  private HashMap gs3_dictionaries = null;
     private Locale locale = null;
     private String lang = null;
@@ -38,7 +39,9 @@
     static final private int PERLMODULES = 5;
     static final private int METADATA = 6;
+  static final private int GS3 = 7;
 
     protected String gsdl_home = null;
-	protected String gsdl_or_gsdl3src_home = null;
+  protected String gsdl_or_gsdl3src_home = null;
+  protected boolean isGS3 = false;
     
     private ClassLoader classloader = null;
@@ -64,7 +67,20 @@
 	} else {
 		gsdl_or_gsdl3src_home = gsdl3_src_home;
+		isGS3 = true;
 	}
 
 	this.classloader = new MyClassLoader(this.getClass().getClassLoader());
+
+	// load up the common dictionaries
+	glidict = ResourceBundle.getBundle("dictionary", this.locale, this.classloader);
+	perldict = ResourceBundle.getBundle("strings", this.locale, this.classloader);
+	metadata = new HashMap();
+	if (isGS3) {
+	  gs3_dictionaries = new HashMap();
+	  
+	} else {
+	  core_macros = new MacroFile(MacroFile.CORE);
+	  aux_macros = new MacroFile(MacroFile.AUX);	    
+	}
     }
     
@@ -74,12 +90,12 @@
     public String get(String key, String args) {
 	
-	boolean isGS3 = false;
-	String gsdl3_src_home = System.getProperty("GSDL3SRCHOME");
-	if(gsdl3_src_home != null && !gsdl3_src_home.equals("")) {
-		File gs3_installation = new File (gsdl3_src_home);
-		if(gs3_installation.exists()) {
-			isGS3 = true;
-		}
-	}
+	// boolean isGS3 = false;
+	// String gsdl3_src_home = System.getProperty("GSDL3SRCHOME");
+	// if(gsdl3_src_home != null && !gsdl3_src_home.equals("")) {
+	// 	File gs3_installation = new File (gsdl3_src_home);
+	// 	if(gs3_installation.exists()) {
+	// 		isGS3 = true;
+	// 	}
+	// }
 	
 	int pos = key.indexOf("::");
@@ -92,19 +108,30 @@
 	//System.err.println("pack = "+package_name+", key="+key_name);
 
+	if (isGS3 && package_name.equals("gs3")) {
+	  pos = key_name.indexOf("::");
+	  if (pos==-1) {
+	    System.err.println("invalid key: "+key+". Should be gs3::properties_filename::key");
+	    return "";
+	  }
+	  String properties_filename = key_name.substring(0, pos);
+	  key_name = key_name.substring(pos+2);
+	  loadGS3Dictionary(properties_filename);
+	  return getGS3DictionaryText(properties_filename, key_name, args);
+	}
 	if (package_name.equals("glidict")) {
-	    loadDictionary(GLIDICT);
+	  //loadDictionary(GLIDICT);
 	    return getDictionaryText(glidict, key_name, args);
 	}
 	if (package_name.equals("perlmodules")) {
-	    loadDictionary(PERLMODULES);
+	  //loadDictionary(PERLMODULES);
 	    return getDictionaryText(perldict, key_name, args);
 	}
 	if(!isGS3) {
 		if (package_name.equals("coredm")) {
-			loadDictionary(COREDM);
+		  //loadDictionary(COREDM);
 			return getMacroText(core_macros, key_name);
 		}
 		if (package_name.equals("auxdm")) {
-			loadDictionary(AUXDM);
+		  //loadDictionary(AUXDM);
 			return getMacroText(aux_macros, key_name);
 		}
@@ -175,4 +202,9 @@
     }
 
+    public String getGS3DictionaryText(String properties_filename, String key_name, String args) {
+      ResourceBundle bundle = (ResourceBundle)gs3_dictionaries.get(properties_filename);
+      return getDictionaryText(bundle, key_name, args);
+    }
+
     private String getMacroText(MacroFile macros, String key) {
 	return macros.get(key);
@@ -228,7 +260,10 @@
 	case GLIDICT:
 	    if (this.glidict == null) {
+	      System.err.println("loading glidict dictionary bundle");
 		glidict = ResourceBundle.getBundle("dictionary", this.locale, this.classloader);
 		
-	    }
+	} else {
+	  System.err.println("glidict already loaded");
+	}
 	    break;
 	case PERLMODULES:
@@ -253,8 +288,23 @@
     }
     
+    private boolean loadGS3Dictionary(String properties_filename) {
+
+      System.err.println("****loading dictionary "+properties_filename);
+      if (gs3_dictionaries.containsKey(properties_filename)) {
+	System.err.println("gs3 dict "+properties_filename+" already loaded");
+	return true; // already loaded
+      }
+	
+      ResourceBundle bundle = ResourceBundle.getBundle(properties_filename, this.locale, this.classloader);
+      if (bundle != null) {
+	gs3_dictionaries.put(properties_filename, bundle);
+	return true;
+      }
+      System.err.println("couldn't load gs3 dict "+properties_filename);
+      return false;
+      
+    }
+
     private boolean loadMetadata(String namespace) {
-	if (metadata == null) {
-	    metadata = new HashMap();
-	}
 
 	if (metadata.containsKey(namespace)) {
@@ -308,4 +358,5 @@
 	private String gliclassesdir = null;
 	private String perldir = null;
+      private String gs3classesdir = null;
 
 	public MyClassLoader(ClassLoader parent) {
@@ -314,8 +365,11 @@
 	    gliclassesdir = gsdl_or_gsdl3src_home+File.separator+"gli"+File.separator+"classes";
 	    perldir = gsdl_home+File.separator+"perllib";
-	    
+	    if (isGS3) {
+	      gs3classesdir = gsdl_or_gsdl3src_home+File.separator+"web"+File.separator+"WEB-INF"+File.separator+"classes";
+	    }
 	}
 
 	public URL findResource(String name) {
+	  
 	    try {
 		File resource_path = new File(this.gliclassesdir, name);
@@ -326,4 +380,10 @@
 		if (resource_path.exists()) {
 		    return new URL("file://"+resource_path.getAbsolutePath());
+		}
+		if (isGS3) {
+		  resource_path = new File(this.gs3classesdir, name);
+		  if (resource_path.exists()) {
+		    return new URL("file://"+resource_path.getAbsolutePath());
+		  }
 		}
 	    } catch (Exception e) {};
