Class DefaultResourceDataBroker

java.lang.Object
org.languagetool.databroker.DefaultResourceDataBroker
All Implemented Interfaces:
ResourceDataBroker

public class DefaultResourceDataBroker extends Object implements ResourceDataBroker
Responsible for getting any items from the grammar checker's resource directories. This default data broker assumes that they are accessible directly via class-path and the directory names are like specified in:

If you'd like to determine another resource directory location this default data broker provides proper methods. Assuming your /rules and /resource directories are accessible via class-path with following path information:

  • /res/grammarchecker/rulesdirname
  • /res/grammarchecker/resourcedirname
In this case you have to use the constructor with the following arguments:
  • /res/grammarchecker/rulesdirname
  • /res/grammarchecker/resourcedirname

Make sure that you never obtain any grammar checker resources by calling Object.class.getResource(String) or Object.class.getResourceAsStream(String) directly. If you would like to obtain something from these directories do always use JLanguageTool.getDataBroker() which provides proper methods for reading the directories above.

For example, if you want to get the URL of /rules/de/grammar.xml just invoke ResourceDataBroker.getFromRulesDirAsUrl(String) and pass /de/grammar.xml as a string. Note: The /rules directory's name isn't passed because its name might have changed. The same usage does apply for the /resource directory.

Since:
1.0.1
See Also: