Difference between revisions of "Beans (extension point)"
From BioUML platform
Tagir Valeev (Talk | contribs) m ({{Class}}) |
Tagir Valeev (Talk | contribs) |
||
Line 1: | Line 1: | ||
{{Extension point|beans|ru.biosoft.access|since=0.9.4|registry=ru.biosoft.access.BeanRegistry}} | {{Extension point|beans|ru.biosoft.access|since=0.9.4|registry=ru.biosoft.access.BeanRegistry}} | ||
=== Description === | === Description === | ||
− | This extension point allows you to resolve Java objects by paths in [[BioUML]] runtime. Objects located in the tree can be resolved via BioUML [[repository]], but sometimes it's desired to have a static link to some other object (even not DataElement). For this purpose | + | This extension point allows you to resolve Java objects by paths in [[BioUML]] runtime. Objects located in the tree can be resolved via BioUML [[repository]], but sometimes it's desired to have a static link to some other object (even not DataElement). For this purpose {{Method|ru.biosoft.access.BeanRegistry.getBean(String)}} method can be used. |
Using this extension point you may register your own prefix to resolve all objects which names start with given prefix. To achieve this you have to implement {{Class|ru.biosoft.access.BeanProvider}} interface and register the created class as an extension. | Using this extension point you may register your own prefix to resolve all objects which names start with given prefix. To achieve this you have to implement {{Class|ru.biosoft.access.BeanProvider}} interface and register the created class as an extension. | ||
Line 18: | Line 18: | ||
=== Notes === | === Notes === | ||
− | * | + | * {{Method|ru.biosoft.access.BeanRegistry.getBean}} method always looks first in the BioUML repository for the supplied path. Thus be careful to avoid names collisions. It's recommended to start prefix with <code>"properties/"</code>. |
− | * When you implement {{Class|ru.biosoft.access.BeanProvider}} interface, please note that parameter passed to | + | * When you implement {{Class|ru.biosoft.access.BeanProvider}} interface, please note that parameter passed to {{Method|ru.biosoft.access.BeanProvider.getBean}} method is not the full path, but the path except the prefix. |
* Currently this extension point is mainly used by [[BioUML web edition]] code. See {{Class|ru.biosoft.server.servlets.webservices.providers.WebBeanProvider}} for details. | * Currently this extension point is mainly used by [[BioUML web edition]] code. See {{Class|ru.biosoft.server.servlets.webservices.providers.WebBeanProvider}} for details. |
Latest revision as of 16:14, 13 May 2013
- Identifier
- ru.biosoft.access.beans
- Plugin
- ru.biosoft.access
- Since
- 0.9.4
- Registry
BeanRegistry
[edit] Description
This extension point allows you to resolve Java objects by paths in BioUML runtime. Objects located in the tree can be resolved via BioUML repository, but sometimes it's desired to have a static link to some other object (even not DataElement). For this purpose BeanRegistry.getBean(String)
method can be used.
Using this extension point you may register your own prefix to resolve all objects which names start with given prefix. To achieve this you have to implement BeanProvider
interface and register the created class as an extension.
[edit] Configuration Markup
<!ELEMENT provider> <!ATTLIST provider class CDATA #REQUIRED prefix CDATA #REQUIRED >
- class
- Fully-qualified name of the class implementing
BeanProvider
interface. - prefix
- Prefix, cannot end with
"/"
. Only latin letters and"/"
are allowed to use in prefix. All paths starting with this prefix will be handled by your class unless more detailed handler is registered. For example, if class A is registered for"properties/myplugin"
prefix and class B is registered for"properties/myplugin/deep"
prefix, then all paths starting with"properties/myplugin/deep"
will be handled by class B, while all other paths starting with"properties/myplugin"
will be handled by class A. If two classes are registered for the same prefix, it's undefined which one will handle it.
[edit] Notes
-
BeanRegistry.getBean
method always looks first in the BioUML repository for the supplied path. Thus be careful to avoid names collisions. It's recommended to start prefix with"properties/"
.
- When you implement
BeanProvider
interface, please note that parameter passed toBeanProvider.getBean
method is not the full path, but the path except the prefix.
- Currently this extension point is mainly used by BioUML web edition code. See
WebBeanProvider
for details.
[edit] Example
<extension point="ru.biosoft.access.beans"> <provider class="ru.biosoft.table.TableCellBeanProvider" prefix="properties/tableCell"/> </extension>
All paths starting with "properties/tableCell" will be handled by TableCellBeanProvider
.