← Revision 3 as of 2014-12-16 21:05:09
3405
Comment:
|
← Revision 4 as of 2014-12-16 21:08:33 →
3389
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
== Introduction to Cytoscape App Development == | = Introduction to Cytoscape App Development = |
Line 3: | Line 3: |
=== Overview === | == Overview == |
Line 5: | Line 5: |
==== Cytoscape and OSGi ==== | === Cytoscape and OSGi === |
Line 28: | Line 28: |
===== Anatomy of a Bundle ===== | ==== Anatomy of a Bundle ==== |
Line 36: | Line 36: |
==== Cytoscape 3 Architecture ==== | === Cytoscape 3 Architecture === |
Line 43: | Line 43: |
===== Example: HelloWorld ===== | ==== Example: HelloWorld ==== |
Line 55: | Line 55: |
===== Maven Project Layout ===== | ==== Maven Project Layout ==== |
Line 64: | Line 64: |
===== Core Bundles ===== | ==== Core Bundles ==== |
Introduction to Cytoscape App Development
Overview
Cytoscape and OSGi
Cytoscape 3 design goals:
- Scalability
- Performance
- Stability
- Application stability
- API stability
- Modularity (Enforced by OSGi)
Definition of OSGi from Wikipedia:
"The OSGi framework is a module system and service platform for the Java programming language that implements a complete and dynamic component model, something that does not exist in standalone Java/VM environments. Applications or components (coming in the form of bundles for deployment) can be remotely installed, started, stopped, updated, and uninstalled without requiring a reboot; management of Java packages/ classes is specified in great detail. Application life cycle management (start, stop, install, etc.) is done via APIs that allow for remote downloading of management policies. The service registry allows bundles to detect the addition of new services, or the removal of services, and adapt accordingly."
Important definitions:
- OSGi is service-oriented
A bundle is the unit of access
- Bundles can be started and stopped independently
- Bundles implement services
- Can be registered and unregistered
- Generally, inter-bundle access is through a service
- Enforced separation of API and Implementation – Rules are that you can depend on API bundles, but not implementation bundles
Anatomy of a Bundle
A bundle is a JAR with extra metadata:
- Imports: The Java packages used by the bundle
- Exports: Java packages in the bundle that other bundles are allowed to use (usually just API)
- Activator: Triggered when bundle is started/stopped
Cytoscape 3 Architecture
- Service-oriented microkernel
- OSGi core
- Dynamically loads and unloads modules, a.k.a. bundles
- Each subsystem in Cy3 has separate OSGi bundle(s)
- Apps can also be packaged as bundles
Example: HelloWorld
- pom.xml!
- Maven project descriptor
- Maven identifier
- Group id
- Artifact id
- Version
- OSGi identifier
Bundle-SymbolicName
- Describes imports/ exports
- Activator.java! - Bundle activator
Maven Project Layout
- pom.xml!
- Project descriptor
- src/main/java! - Bundle code
- src/test/java!
- Test code
- Not included in bundle JAR
- src/main/resources! - Non-code files that should be included in bundle JAR
Core Bundles
- app
- application
- command-executor
- core-task
- custom-graphics
- datasource
- equations
- event
- group
- io
- layout
- model
- presentation
- property
- service
- session
- swing-u/l
- viewmodel
- vizmap
- vizmap-gui
- webservice
- work
- Core Bundles usually come in sets:
- API (optional) - No activator
- Implementation
- At least one per API bundle
- No exports
- Separate API so we can keep implementation modular
- Desktop application
- Console application, for scripts
- Nothing should import implementation bundles, unless it’s for unit testing
- Task bundles
- work-api
- work-swing-api
- work-impl
- work-swing-impl
- work-headless-impl
VizMapper bundles
- vizmap-api
- vizmap-gui-api
- vizmap-gui-core-impl
- vizmap-gui-impl
- vizmap-impl