Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
$URL: https://source.sakaiproject.org/svn/help/tags/sakai-10.4/help-component/src/java/org/sakaiproject/component/app/help/DefaultGlossary.java $ $Id: DefaultGlossary.java 106357 2012-03-28 23:18:54Z matthew.buckett@oucs.ox.ac.uk $ Copyright (c) 2003, 2004, 2005, 2006, 2008 The Sakai Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 
 package org.sakaiproject.component.app.help;
 
 import java.net.URL;
 import java.util.Map;
 
default glossary

Version:
$Id: DefaultGlossary.java 106357 2012-03-28 23:18:54Z matthew.buckett@oucs.ox.ac.uk $
 
 public class DefaultGlossary implements Glossary
 {
 
   private String file;
   private String url;
   private Map<StringGlossaryEntryglossary = new TreeMap<StringGlossaryEntry>();
   private boolean initialized = false;
   protected final Log logger = LogFactory.getLog(getClass());

  
initialize glossary
 
   protected void init()
   {
     URL glossaryFile = this.getClass().getResource(getFile());
     Properties glossaryTerms = new Properties();
     try
     {
       glossaryTerms.load(glossaryFile.openStream());
       
       for (String term : glossaryTerms.stringPropertyNames())
       {
         .put(term.toLowerCase(), new GlossaryEntryBean(term
             .toLowerCase(), glossaryTerms.getProperty(term)));
       }
        = true;
     }
     catch (IOException e)
     {
       .error(e);
     }
   }

  
 
   public GlossaryEntry find(String keyword)
   {
     if (!init();
     return .get(keyword.toLowerCase());
   }

  
 
   {
     if (!init();
     return .values();
   }

  
 
   public String getUrl()
   {
     return ;
   }

  
set url

Parameters:
url
  public void setUrl(String url)
  {
    this. = url;
  }

  
get file

Returns:
file name
  public String getFile()
  {
    return ;
  }

  
set file name

Parameters:
file
  public void setFile(String file)
  {
    if (!file.startsWith("/"))
    {
      this. = "/" + file;
    }
    else
    {
      this. = file;
    }
  }
New to GrepCode? Check out our FAQ X