Difference between revisions of "Moved class (extension point)"
Tagir Valeev (Talk | contribs) (Created page with "__NOTOC__ ;Identifier :ru.biosoft.access.movedClass ;Plugin :ru.biosoft.access ;Since :0.9.4 === Motivation === Sometimes it's desirable to ren...") |
Tagir Valeev (Talk | contribs) ({{Method}}) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{Extension point|movedClass|ru.biosoft.access|since=0.9.4}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
=== Motivation === | === Motivation === | ||
Sometimes it's desirable to rename the Java class or move it to another package/plugin. Usually this operation can be easily performed via IDE refactoring tools. However some classes are referred from the configuration files, collections and so on and it's quite hard to replace all old name occurences on all the living servers. | Sometimes it's desirable to rename the Java class or move it to another package/plugin. Usually this operation can be easily performed via IDE refactoring tools. However some classes are referred from the configuration files, collections and so on and it's quite hard to replace all old name occurences on all the living servers. | ||
− | Usually the classes are loaded via | + | Usually the classes are loaded via {{Method|ru.biosoft.access.CollectionFactory.loadClass}} methods or using the ClassLoader returned by {{Method|ru.biosoft.access.CollectionFactory.getClassLoader}} which actually also uses <code>loadClass</code> method. Thus these methods were changed to allow loading the moved classes by their old names if old names were properly registered via this extension point. |
=== Configuration Markup === | === Configuration Markup === | ||
Line 36: | Line 29: | ||
</extension> | </extension> | ||
− | This example informs BioUML that former class | + | This example informs BioUML that former class <code>ru.biosoft.bsa.Map</code> was moved to <code>ru.biosoft.bsa.AnnotatedSequence</code>. |
− | + | ||
− | + |
Latest revision as of 16:12, 13 May 2013
- Identifier
- ru.biosoft.access.movedClass
- Plugin
- ru.biosoft.access
- Since
- 0.9.4
[edit] Motivation
Sometimes it's desirable to rename the Java class or move it to another package/plugin. Usually this operation can be easily performed via IDE refactoring tools. However some classes are referred from the configuration files, collections and so on and it's quite hard to replace all old name occurences on all the living servers.
Usually the classes are loaded via CollectionFactory.loadClass
methods or using the ClassLoader returned by CollectionFactory.getClassLoader
which actually also uses loadClass
method. Thus these methods were changed to allow loading the moved classes by their old names if old names were properly registered via this extension point.
[edit] Configuration Markup
<!ELEMENT class> <!ATTLIST class name CDATA #REQUIRED oldNames CDATA #REQUIRED >
- name
- Current name of the class
- oldNames
- Comma-separated list of old names the class had
[edit] Notes
- If the class was moved to another plugin, this extension must be registered in the plugin the class is located now.
- It's still preferred to change all configuration files where class name occurs. Use this extension point only if replacing the class name in all the files is hard or impossible. And even if you use this extension point, try to use new class name in as many places as possible.
- Please note that you have to use the new class name in BioUML web edition client-side JavaScript code (*.js, *.json files in ru.biosoft.server.servlets plugin).
[edit] Example
<extension point="ru.biosoft.access.movedClass"> <class name="ru.biosoft.bsa.AnnotatedSequence" oldNames="ru.biosoft.bsa.Map"/> </extension>
This example informs BioUML that former class ru.biosoft.bsa.Map
was moved to ru.biosoft.bsa.AnnotatedSequence
.