Meta bundles are named entities. Meta bundle names are case-sensitive and they follow the hierarchical naming rule:
- Named Hierarchy
- A meta bundle is said to be an ancestor of another meta bundle if its name followed by a dot is a prefix of the descendant meta bundle name. A meta bundle is said to be a parent of a child meta bundle if there are no ancestors between itself and the descendant meta bundle.
For this reason, metadata at an ancestor MetaBundle will be shared by all its descendant MetaBundles.
But this may not be desirable under certain circumstances, for example, in the previous Brief Demo Application , you may want not to inherit name/desc for Java packages.
There is no way to disable the default Named Hierarchy. The major solution to these problems is by designing your metadata to be accessed via different XPathes, for different objects, instead of a same XPath for a class of instances.
For the Brief Demo Application , if you want a Java package don't inherit its parent package's name/desc, just get the name/desc through XPath like
instead ofpackage/org.w3c.dom/@name+package/org.w3c.dom/description
package/@name+package/description
This means to change the following methods in tutor/meta/Brief.java as (insert the red text):
public String getLocalizedPackageName(String packageName)
{
MetaBundle meta = MetaBundle.get(packageName);
try
{
return meta.getString("package/" + packageName + "/@name", locale);
}
catch (MetaNotFoundException e)
{
}
return "Package Not Localized";
}
public String getLocalizedPackageDescription(String packageName)
{
MetaBundle meta = MetaBundle.get(packageName);
try
{
return meta.getString("package/" + packageName + "/description", locale);
}
catch (MetaNotFoundException e)
{
}
return "Package Not Localized";
}
Note after this change, all .meta XML files annotating Java
packages have to be updated to move those annotations to correct XPath
positions.