Difference: DpHipeRegistry (1 vs. 13)

Revision 132014-02-19 - AlvarGarcia

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->
Line: 36 to 36
 
  • Set INIT_PY = init.py
  • Set SELISTENER = SiteEventListener
Changed:
<
<
  • Set EXTENSION_REGISTRY= ExtensionRegistry
>
>
  • Set EXTENSION_REGISTRY= ExtensionRegistry
 
  • Set EXTENSION = Extension
  • Set VARIABLES_VIEW = VariablesView
  • Set OUTLINE_VIEW = OutlineView
Line: 62 to 62
 ExtensionRegistry.getInstance().register(CLASSIFICATION, Extension(...)) where CLASSIFICATION is one of (pre-defined):
Changed:
<
<
  • ExtensionRegistry.COMPONENT adds a new component to some factory
  • ExtensionRegistry.FACTORY adds a new factory
  • ExtensionRegistry.VIEW adds a new view
  • ExtensionRegistry.PERSPECTIVE adds a new perspective
>
>
  • ExtensionRegistry.COMPONENT adds a new component to some factory.
  • ExtensionRegistry.FACTORY adds a new factory.
  • ExtensionRegistry.VIEW adds a new view.
  • ExtensionRegistry.PERSPECTIVE adds a new perspective.
 or a new type if you deem it necessary.

To keep the code readable, we recommend you to use temporary aliases, which you should clean-up afterwards:

Line: 98 to 98
 

where:

Changed:
<
<
  • id is a unique ID for this extension
  • class is the java class definition
>
>
  • id is a unique ID for this extension.
  • class is the java class definition.
 The meaning of arg1 and arg2 varies depending on the classification of the extension.

Perspective Extension

Line: 135 to 135
 If views are using extendable factories, the API of that view should provide sufficient information about how to add factories. Typically views use factories whenever that view needs to react on a user selection, for example a user selects a variable and that view should show something about that variable. In that case the variable selection is coupled to a factory in that specific view such that other contributors can contribute a component for new types of variables.
Changed:
<
<
An example is the Outline View. It currently can respond to selections of variables, but it could respond to other types of selections such as tools. For that it has uses factories for which applies:
>
>
An example is the Outline View. It currently can respond to selections of variables, but it could respond to other types of selections such as tools. For that it uses factories for which applies:
 
arg1 Specifies the type (class definition) of the selection
arg2 Specifies the unique ID of the view that this factory belongs to

Revision 122012-10-19 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
Added:
>
>
<-- ANALYTICS CODE - DO NOT EDIT -->
<-- Google Analytics script BEGIN -->
<-- Google Analytics script END -->

<-- END OF ANALYTICS CODE -->
 
<-- 
  • Set TOPICTITLE = The extension registry
-->
Line: 195 to 198
 
<-- END OF COMMENT BOX CODE -->

Added:
>
>
META FILEATTACHMENT attachment="GoogleAnalytics.txt" attr="h" comment="Script for Google Analytics" date="1350657678" name="GoogleAnalytics.txt" path="GoogleAnalytics.txt" size="549" stream="GoogleAnalytics.txt" user="Main.DavideRizzo" version="1"
 
META TOPICMOVED by="DavideRizzo" date="1272528194" from="Hcss.DpHipeRegistry" to="Public.DpHipeRegistry"

Revision 112012-05-14 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

Revision 102011-06-24 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"
Changed:
<
<

The Extension Registry

>
>
<-- 
  • Set TOPICTITLE = The extension registry
-->

PDF Version Portrait Landscape

Help Did you spot something wrong or missing on this page? If you have an account on this TWiki, you can fix it yourself by editing the page. If you don't have an account, you can send a message to the Editorial Board to tell us about it. Thank you in advance!

The extension registry

 

<-- summary -->
Line: 166 to 174
 
<-- Author: JorgoBakker -->
Added:
>
>
Please add your comments!
<--/commentPlugin-->
 
<--  
-->

Revision 92010-06-10 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

<-- summary -->
Changed:
<
<
You must register your contribution (whether it is a tool, perspective, view, component to views or component to the editor area) to HIPE to make it part of the application. Registering means that you have to write add an entry to the jython package module (aka __init__.py) within the sub-system that is under your control.
>
>
You must register your contribution (whether it is a tool, perspective, view, component to views or component to the editor area) to HIPE to make it part of the application. Registering means that you have to write add an entry to the jython package module (aka __init__.py) within the sub-system that is under your control.
  This section explains the workings of the registry works and how it can automatically find your contribution.
Line: 18 to 18
 
Deleted:
<
<
 

Introduction

The registry mechanism relies on the recursive reading of the jython package modules built into the HCSS. The application will execute the following line:
Line: 155 to 154
  It is a component that shows structure of a Product within the Outline View.
Changed:
<
<
Warning, important PaulBalm: Note that for Factory Extensions, arg1 is a classname and arg2 is the ID of the view the factory belongs to. For Component Extensions, arg1 is the ID of the factory and arg2 is a classname. These feel switched with respect to each other, so check the definitions carefully.
>
>
Warning, important Note that for Factory Extensions, arg1 is a classname and arg2 is the ID of the view the factory belongs to. For Component Extensions, arg1 is the ID of the factory and arg2 is a classname. These feel switched with respect to each other, so check the definitions carefully.
  See also the component contribution pages.

Revision 82010-05-17 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 167 to 167
 
<-- Author: JorgoBakker -->
Added:
>
>
<--  
-->
 
META TOPICMOVED by="DavideRizzo" date="1272528194" from="Hcss.DpHipeRegistry" to="Public.DpHipeRegistry"

Revision 72010-04-29 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 22 to 22
 
Changed:
<
<
>
>
 

Line: 32 to 32
 
Changed:
<
<
>
>
  -->
Line: 166 to 166
 

<-- Author: JorgoBakker -->
\ No newline at end of file
Added:
>
>
META TOPICMOVED by="DavideRizzo" date="1272528194" from="Hcss.DpHipeRegistry" to="Public.DpHipeRegistry"

Revision 62009-12-02 - DavideRizzo

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 11 to 11
 
Added:
>
>
 
Line: 161 to 163
 
Added:
>
>
 
<-- Author: JorgoBakker -->
\ No newline at end of file

Revision 52009-07-19 - PaulBalm

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 153 to 153
  It is a component that shows structure of a Product within the Outline View.
Added:
>
>
Warning, important PaulBalm: Note that for Factory Extensions, arg1 is a classname and arg2 is the ID of the view the factory belongs to. For Component Extensions, arg1 is the ID of the factory and arg2 is a classname. These feel switched with respect to each other, so check the definitions carefully.
 See also the component contribution pages.

Revision 42008-04-02 - WernerSalomons

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 59 to 59
 To keep the code readable, we recommend you to use temporary aliases, which you should clean-up afterwards:
# short-cuts

Changed:
<
<
from herschel.ia.kernel import ExtensionRegistry, Extension
>
>
from herschel.ia.gui.kernel import ExtensionRegistry, Extension
 REGISTRY = ExtensionRegistry.getInstance() COMPONENT = ExtensionRegistry.COMPONENT

Revision 32008-02-08 - JorgoBakker

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 11 to 11
 
Deleted:
<
<
 
Added:
>
>
<--
   Some short-cuts  

-->
 

Introduction

The registry mechanism relies on the recursive reading of the jython package modules built into the HCSS. The application will execute the following line:
Line: 21 to 42
 from herschel.all import * That line will read sub-packages (share, ia, spire, hifi, pacs) which read their sub-packages and so forth.
Changed:
<
<
At some point the __init__.py of your sub-system is read. This of course only works if the relevant __init__.py and optionally the all.py files are provided in these packages. Discussion of the workings of these files fall outside the scope of this document.
>
>
At some point the init.py of your sub-system is read. This of course only works if the relevant init.py and optionally the all.py files are provided in these packages. Discussion of the workings of these files fall outside the scope of this document.
 
Changed:
<
<
The idea is that in such a file you call the ExtensionRegistry singleton and add your contribution to it as follows:
>
>
The idea is that in such a file you call the ExtensionRegistry singleton and add your contribution to it as follows:
 
ExtensionRegistry.getInstance().register(CLASSIFICATION, Extension(...))
Line: 59 to 80
 

Extension API

Changed:
<
<
The Extension class is a very simple class with a constructor that takes String arguments (TODO expand it):
>
>
The Extension class is a very simple class with a constructor that takes four String arguments (TODO expand it):
 
Extension(id, class, arg1, arg2)
Line: 77 to 98
 An example for the JIDE perspective:
Extension("site.perspective.classic",

Changed:
<
<
"herschel.ia.gui.perspectives.ClassicPerspective",
>
>
"herschel.ia.gui.apps.perspectives.ClassicPerspective",
  "Classic (JIDE)",
Changed:
<
<
None)
>
>
None));
 
Line: 91 to 112
 An example for the Console View:
Extension("site.view.console",

Changed:
<
<
"herschel.ia.gui.views.ConsoleView",
>
>
"herschel.ia.jconsole.views.ConsoleView",
  "Console",
Changed:
<
<
"herschel/ia/kernel/icons/Console.gif")
>
>
"herschel/ia/gui/kernel/icons/Console.gif"));
 
Line: 109 to 130
 For variable selections, a factory is defined:
Extension("factory.outline.variable",

Changed:
<
<
"herschel.ia.kernel.VariableSelectionFactory", "herschel.ia.kernel.VariableSelection",
>
>
"herschel.ia.gui.kernel.VariableSelectionFactory", "herschel.ia.gui.kernel.VariableSelection",
  "site.view.outline")
Line: 125 to 146
  An example of such a component:

Changed:
<
<
Extension("herschel.ia.gui.components.outline.ProductOutline", "herschel.ia.gui.components.outline.ProductOutline",
>
>
Extension("herschel.ia.gui.apps.components.outline.ProductOutline", "herschel.ia.gui.apps.components.outline.ProductOutline",
  "factory.outline.variable", "herschel.ia.dataset.Product") It is a component that shows structure of a Product within the Outline View.
Added:
>
>
See also the component contribution pages.
 

Revision 22008-01-16 - JaimeSaiz

Line: 1 to 1
 
META TOPICPARENT name="DpHipe"

The Extension Registry

Line: 24 to 24
 At some point the __init__.py of your sub-system is read. This of course only works if the relevant __init__.py and optionally the all.py files are provided in these packages. Discussion of the workings of these files fall outside the scope of this document.
Changed:
<
<
The idea is that in such a file you call the ExtensionRegistry singleton and add your contribution to it as follows:
>
>
The idea is that in such a file you call the ExtensionRegistry singleton and add your contribution to it as follows:
 

Changed:
<
<
ExtensionRegistry.getInstance().register(CLASSIFICATION, Extension(....))
>
>
ExtensionRegistry.getInstance().register(CLASSIFICATION, Extension(...))
  where CLASSIFICATION is one of (pre-defined):
  • ExtensionRegistry.COMPONENT adds a new component to some factory
Line: 38 to 38
 To keep the code readable, we recommend you to use temporary aliases, which you should clean-up afterwards:
# short-cuts

Changed:
<
<
from herschel.ia.core import ExtensionRegistry, Extension
>
>
from herschel.ia.kernel import ExtensionRegistry, Extension
 REGISTRY=ExtensionRegistry.getInstance() COMPONENT=ExtensionRegistry.COMPONENT
Line: 93 to 93
 Extension("site.view.console", "herschel.ia.gui.views.ConsoleView", "Console",
Changed:
<
<
"herschel/ia/core/icons/Console.gif")
>
>
"herschel/ia/kernel/icons/Console.gif")
 
Line: 109 to 109
 For variable selections, a factory is defined:
Extension("factory.outline.variable",

Changed:
<
<
"herschel.ia.core.VariableSelectionFactory", "herschel.ia.core.VariableSelection",
>
>
"herschel.ia.kernel.VariableSelectionFactory", "herschel.ia.kernel.VariableSelection",
  "site.view.outline")

Revision 12008-01-15 - JorgoBakker

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="DpHipe"

The Extension Registry

<-- summary -->
You must register your contribution (whether it is a tool, perspective, view, component to views or component to the editor area) to HIPE to make it part of the application. Registering means that you have to write add an entry to the jython package module (aka __init__.py) within the sub-system that is under your control.

This section explains the workings of the registry works and how it can automatically find your contribution.


Introduction

The registry mechanism relies on the recursive reading of the jython package modules built into the HCSS. The application will execute the following line:
from herschel.all import *
That line will read sub-packages (share,==ia==,==spire==,==hifi==,==pacs==) which read their sub-packages and so forth. At some point the __init__.py of your sub-system is read. This of course only works if the relevant __init__.py and optionally the all.py files are provided in these packages. Discussion of the workings of these files fall outside the scope of this document.

The idea is that in such a file you call the ExtensionRegistry singleton and add your contribution to it as follows:

ExtensionRegistry.getInstance().register(CLASSIFICATION, Extension(....))
where CLASSIFICATION is one of (pre-defined):
  • ExtensionRegistry.COMPONENT adds a new component to some factory
  • ExtensionRegistry.FACTORY adds a new factory
  • ExtensionRegistry.VIEW adds a new view
  • ExtensionRegistry.PERSPECTIVE adds a new perspective
or a new type if you deem it necessary.

To keep the code readable, we recommend you to use temporary aliases, which you should clean-up afterwards:

# short-cuts
from herschel.ia.core import ExtensionRegistry, Extension
REGISTRY=ExtensionRegistry.getInstance()
COMPONENT=ExtensionRegistry.COMPONENT

# registry
REGISTRY.register(COMPONENT,Extension(...))
REGISTRY.register(COMPONENT,Extension(...))
REGISTRY.register(COMPONENT,Extension(...))
REGISTRY.register(COMPONENT,Extension(...))
REGISTRY.register(COMPONENT,Extension(...))
REGISTRY.register(COMPONENT,Extension(...))

# clean-up
del(ExtensionRegistry, Extension, REGISTRY, COMPONENT)

The registry mechanism is made loosely in such way that it does not matter in which order the packages are read (and therefor the extensions are being added). At run-time all extensions are read first; once done it starts interpreting the contents of the registry.

Extension API

The Extension class is a very simple class with a constructor that takes String arguments (TODO expand it):
Extension(id,class, arg1, arg2)

where:

  • id is a unique ID for this extension
  • class is the java class definition
The meaning of arg1 and arg2 varies depending on the classification of the extension.

Perspective Extension

arg1 Human readable title of the perspective as it should appear in the menu, e.g. "Hello World"
arg2 Resource location of a 16x16 Icon for this perspective, e.g. "herschel/spire/icon/hello.gif" or None

An example for the JIDE perspective:

Extension("site.perspective.classic",
          "herschel.ia.gui.perspectives.ClassicPerspective",
          "Classic (JIDE)",
          None)

View Extension

arg1 Human readable title of the view as it should appear in the menu and in the title bar of the view, e.g. "Hello World"
arg2 Resource location of a 16x16 Icon for this view, e.g. "herschel/spire/icon/hello.gif" or None

An example for the Console View:

Extension("site.view.console",
          "herschel.ia.gui.views.ConsoleView",
          "Console",
          "herschel/ia/core/icons/Console.gif")

Factory Extension

If views are using extendable factories, the API of that view should provide sufficient information about how to add factories. Typically views use factories whenever that view needs to react on a user selection, for example a user selects a variable and that view should show something about that variable. In that case the variable selection is coupled to a factory in that specific view such that other contributors can contribute a component for new types of variables.

An example is the Outline View. It currently can respond to selections of variables, but it could respond to other types of selections such as tools. For that it has uses factories for which applies:

arg1 Specifies the type (class definition) of the selection
arg2 Specifies the unique ID of the view that this factory belongs to

For variable selections, a factory is defined:

Extension("factory.outline.variable",
          "herschel.ia.core.VariableSelectionFactory",
          "herschel.ia.core.VariableSelection",
          "site.view.outline")

Component Extension

Contributors can add components to existing factories. Taking the example of the "factory.outline.variable" factory that coupled to the Outline View, the syntax of an extension becomes as follows:
arg1 Specifies the unique ID of the factory to which this component belongs to
arg2 Specifies class definition of the object that this component can show

An example of such a component:

Extension("herschel.ia.gui.components.outline.ProductOutline",
          "herschel.ia.gui.components.outline.ProductOutline",
          "factory.outline.variable",
          "herschel.ia.dataset.Product")
It is a component that shows structure of a Product within the Outline View.

<-- Author: JorgoBakker -->
 
This site is powered by the TWiki collaboration platform Powered by Perl