Difference between revisions of "Moved class (extension point)"

From BioUML platform
Jump to: navigation, search
(Template used)
({{Method}})
 
Line 3: Line 3:
 
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 <code>ru.biosoft.access.CollectionFactory.loadClass</code> methods or using the ClassLoader returned by <code>ru.biosoft.access.CollectionFactory.getClassLoader</code> 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.
+
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 29: Line 29:
 
  </extension>   
 
  </extension>   
  
This example informs BioUML that former class "ru.biosoft.bsa.Map" was moved to "ru.biosoft.bsa.AnnotatedSequence".
+
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.

[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.

Personal tools
Namespaces

Variants
Actions
BioUML platform
Community
Modelling
Analysis & Workflows
Collaborative research
Development
Virtual biology
Wiki
Toolbox