680 likes | 810 Views
C2B2 and geWorkbench present. The Tom Garben Anniversary Lecture. Component Configuration Manager (CCM) overview. A look at how users can manage their geWorkbench plugin components and what Java Containers are used in geWorkbench to support the functionality of these components.
E N D
C2B2 and geWorkbench present
The Tom Garben Anniversary Lecture
Component Configuration Manager (CCM) overview A look at how users can manage their geWorkbench plugin components and what Java Containers are used in geWorkbench to support the functionality of these components.
CCM GUI • Component Attributes (On/Off, Name, Author, Version, Author URL, Tool URL)
CCM GUI • Component Description. • Also configured in the *.ccm.xml file.
CCM GUI • Filters: • Display - Loaded, Unloaded • Show by type - AnalysisPlugins,Visualizers • Keyword search - Full Context Search
CCM GUI • Extra Detail Buttons: View License, View Documentation, View External Site.
CCM GUI • License acceptance.
CCM GUI • Dependency Checking for required or related components.
CCM GUI • Click Apply after making selections.
User Configuration Files at the Plugin-Component level • User Plugin-Component selections are saved in the following files: ..\[usersettings]\.geworkbench\[componentfolder]\ [componentname]component.ccmproperties • Each Plugin-Component gets its own file.
CCM Folders • Plugin Components are kept in appropriately named folders under geworkbench\components • The name of the folder is not used functionally within geworkbench and the folder name does not show up visually in the GUI. • Components in different folders are loaded via different Class Loaders, so they may be run with their own set of jar files. • If multiple Plugin Components exist in sub folders under a common folder, they will be loaded by one Class Loader and use a common set of jar files.
EnhancerByCGLIB • As part of the geWorkbench messaging system, Plugin Components have been wrapped by a EnhancerByCGLIB class. • Using EnhancerByCGLIB, @publish & @subscribe annotations, the type of the first argument of a method and an Interceptor, the method ComponentRegistry.publishToSubscriberHelper ()is called. • This helper method publishes an Event from one @publish method to all @subscribe methods.
CCM Configuration Files • The Plugin Component configuration file is no longer all.xml, but all.xml is still used for some core components. • Each Plugin Component now has its own configuration file which has a name of the form *.ccm.xml • The *.ccm.xml files are located in the Plugin folders.
CCM Configuration Files • There are three main sections inside the root tag of the *.ccm.xml file • The root tag <geaw-config> • The <component> tag. • The <plugin> tag. • And the <component-descriptor> tag.
CCM Configuration Files • The <Component> tag section has been created to support new functionality of the CCM GUI that was described in the beginning of the presentation.
CCM Configuration Files • The <plugin> tag is of the same format as in the legacy all.xml file. • It is used to configure Plugin Components with attributes need to run within geWorkbench.
CCM Configuration Files • The <component-descriptor> tag is the same as that from the legacy *.cwb.xml file. • This tag contains attributes for configuring the Java Help and the Menu Bar in geWorkbench. • *.cwb.xml files are no longer used.
<geaw-config xmlns:xsi=http://www.w3.org/2001/XMLSchema-instancexsi:noNamespaceSchemaLocation="ConfigurationFile Schema.xsd"> • <component name="AnalysisPanel“ class="org.geworkbench.components.analysis.AnalysisPanel" version="1.0" author="C2B2" authorURL="http://wiki.c2b2.columbia.edu/workbench/index.php/Home" toolURL="http://wiki.c2b2.columbia.edu/workbench/index.php/Home" description="The Analysis Panel component provides a framework which supports numerous, individually loadable analysis methods." loadByDefault="true“ analysis="true“ visualizer=“false" hidden=“false” mustAccept="false" • > <required-component class="org.geworkbench.components.xxx" /> <related-component class="org.geworkbench.components.yyy" /> <license><![CDATA[ <html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"></head> <body>----</body> </html> ]]></license> • </component> • <plugin id="AnalysisPanel" name="Analysis Panel" class="org.geworkbench.components.analysis.AnalysisPanel" source="analysis"> <gui-area name="CommandArea"/> • </plugin> • <component-descriptor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Descriptor Schema.xsd"> • <component class="org.geworkbench.components.analysis.AnalysisPanel"> • <online-help helpSet="org/geworkbench/components/analysis/help/clustering/analysisPanelHelpSet.hs"/> • </component> • </component-descriptor> • </geaw-config>
End of Part I • This concludes the GUI, Configuration portion of this presentation. • Feel free to stay for the more technical part of the presentation, • Or run for the door as fast as you can.
Loading Plugin Components • Plugin Components are loaded in one of two ways: • First by UILauncher.main() method on geWorkbench startup. • Second when Apply is clicked in the CCM window by ComponentConfigurationManager.loadSelectedComponents()
Loading Plugin Components • Components are loaded using org.apache.commons.digester.Digester • The Digester Class lets a developer create an object that maps XML tags to Java classes and methods. • When digester.parse((FileInputStream) “..\folderX\x.ccm.xml”) is called, Constructors and Methods, along with configured method arguments, associated with XML tags, get executed in an independent Thread bringing the Plugin Component to life. • Immediately after loading, the Plugin Component is able to be displayed and send/receive events.
geWorkbench Glue • geWorkbench uses the following Containers to manage Plugin Components and communications between them. • Interfaces: List, Map. • Standard Java Container: ArrayList, Vector, HashMap. • Internally built Container: TypeMap TypeMap is a HashMap that supports polymorphism.
geWorkbench Glue • The functionality that is supported by these containers: • To support Component Attribute Management, including a) Component type. (E.g. Visual Component lists.) b) Component resource. (E.g. Folder locations.) c) Component extension points. (Currently not used.) • Maintain Event Publish/Subscribe associations. (@Publish, @Subscribe annotations) • Facilitate the Data Dependant Display of components (E.g. Component/Dataset mappings) • Support Synchronicity Level Based Method Execution.
Container Summary • geWorkbench Classes where containers are stored: • ComponentRegistry • PluginRegistry • PluginClassRegistry • IdentifiableImpl:PluginDescriptor • In general, the term Component refers to Plugin resources, such as folders and class loaders. • In general the term Plugin refers to the actual Plugin Component. • The PluginDescriptor is the main Wrapper for Plugin Components. It contains EnhancerByCGLIB Objects which contain Plugin Components.
Container Summary • ComponentRegistry Member Variables: • listeners • acceptors • synchModels • Components • idToDescriptor • nameToComponentResource
Container Summary • PluginRegistry Member Variables: • extensionPointsMap • visualAreaMap • componentVector • pluginClasses • nameMap
Container Summary • IdentifiableImpl:PluginDescriptor Member Variable: • usedIds
Container Summary • PluginClassRegistry • pluginClasses
1 ComponentRegistry.listeners • TypeMap< Event.class, List<EnhancerByCGLIB>> • The ComponentRegistry listeners registry, sometimes synonymous with the term subscriber. • - The Map key is the Class of an Event. • - The Map value is a List of Enhanced Components geWorkbench components which have at least one @Subscribe annotated method.
2 ComponentRegistry.acceptors • HashMap<DSDataSet.class, List<Component.class (unenhanced)>> • This HashMap holds lists of geWorkbench components that are registered to accept specified data types. • Used in Skin.java for deciding which Visual Components are to be displayed when certain data types are selected in the Project Panel. acceptors
3 ComponentRegistry.synchModels • HashMap< SynchModel.class, SynchModel> • SyncModels allowed when creating Events: • Asynchronous • Overflow • SwingModel • Synchronous
4 ComponentRegistry.components • List<EnhancerByCGLIB> • A List of Enhanced Components. • Used only in a couple of places.
5 ComponentRegistry.idToDescriptor • HashMap<String IdentifiableImpl :PluginDescriptor.id, PluginDescriptor> • geWorkbench is now supposed to have its components addressed uniquely via their fully-qualified class name, not their ID. • Deprecation candidate.
7 PluginRegistry.extensionPointsMap • HashMap<VisualPlugin, String visualAreaName> • None used right now.
8 PluginRegistry.visualAreaMap • HashMap<VisualPlugin, String visualAreaName> • Used for displaying visualAreaNames in GUI.
9 PluginRegistry.componentVector • Vector< PluginDescriptor > • Looks redundant to ComponentRegistry.idToDescriptor • HashMap<String IdentifiableImpl :PluginDescriptor.id, PluginDescriptor>
9 PluginRegistry.nameMap • HashMap<String className, String name> • Stores information about Plugin Component, so a Plugin can query it's own name in it's constructor. • Newly added.
10 IdentifiableImpl:PluginDescriptor.usedIds • Vector <String IdentifiableImpl:PluginDescriptor.id> • Even though the PluginDescriptor class is primarily used as a Plugin Component wrapper, there is a static Vector of usedIds in its base class IdentifiablImpl. • geWorkbench is now supposed to have its components addressed uniquely via their fully-qualified class name, not their ID. • Deprecation candidate.
11 PluginClassRegistry.pluginClasses • HashMap <String, PluginClassRegistry> • I don’t see where this is used.
Still Awake • If not, we can stop here. • If so, we can go into more detail about each Container.
OK!! • That’s what I like to hear. • Let’s move on.
1 ComponentRegistry.listeners • The ComponentRegistry listeners registry, sometimes synonymous with the term subscriber, is of type TypeMap< Event.class, List<EnhancerByCGLIB>> • - The Map key is the Class of an Event. • - The Map value is a List of enhanced components geWorkbench components which have at least one @Subscribe annotated method. • But you’ve seen this already.
1 ComponentRegistry.listeners • If an Enhanced Component has multiple unique subscriber methods, ie different first Event type areguments, then that Enhanced Component will appear in multiple Lists in ComponentRegistry.listeners. • This TypeMap is loaded, by the PluginObject.finish() method, with Enhanced Objects contained in PluginDescriptors.plugin member variables, which 1) have @Subscribe annotated methods and 2) have an Event as the first argument of the same method. • The “Home Grown” TypeMap extends HashMap and is implemented to support polymorphism. So if a subclass is passed into the TypeMap.get(subClass) method, that value will be returned.
1 ComponentRegistry.listeners • The ComponentRegistry.registerSubscriptions() method builds the ComponentRegistry.listener by: • Key: A) Using the subclass of Event.class of the first argument of component methods that are annotated with @Subscribe as the TypeMap key. • Value: B) Using the EnhancerByCGLIB wrapped component of PluginDescriptor.plugin, as the TypeMap value. • Note: There is a specific check to see that any subscriber method used has two arguments, when it appears that only the first argument is being used.
1 ComponentRegistry.listeners • Example from the ProjectPanel.java and AnalysisPanel.java: • @Subscribe public void receive(org.geworkbench.events.PhenotypeSelectorEvent e, Object source) { • Key: • class org.geworkbench.events.PhenotypeSelectorEvent • Value: • [org.geworkbench.builtin.projects.ProjectPanel$$EnhancerByCGLIB$$fbdd@19d09f • …… org.geworkbench.components.analysis.AnalysisPanel$$EnhancerByCGLIB$$36@e992] • Note: $$ indicates a EnhancerByCGLIB wrapped object.
1 ComponentRegistry.listeners During the publish/subscribe process • The publishToSubscriberHelper() method uses the method Subscriptions.getMethodProfiles() to return a components methods which are annotated with @Subscribe • Then the publishToSubscriberHelper() adds these methods to a synchModel for execution. • Note: Right now the only synchModel used is Synchronous. • Note: A Plugin Component’s Class is used by this method. I wonder if it doesn’t need a CGLIB wrapped Class to publish to all subscribers.
2 ComponentRegistry.acceptors • HashMap<DSDataSet.class, List<Component.class (unenhanced)>> • This HashMap holds lists of geWorkbench components that are registered to accept specified data types. • Used in Skin.java for deciding which Visual Components are to be displayed when certain data types are selected in the Project Panel. • But you’ve already seen this.