Size: 1189
Comment:
|
Size: 2960
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
From Cytoscape 3.0, the entire system is based on OSGi, and this modularizes Cytoscape into a collection of bundles. OSGi bundles are just regular jar files plus a simple metadata file (MANIFEST.MF) and they can be used in other non-OSGi systems. However, once we use raw OSGi API, the bundle is coupled with OSGi environment, and it is not easy to port the bundle to non-OSGi environments. [http://www.springframework.org/osgi Spring Dynamic Modules] is one of the solutions to achine maximum modulality. |
From Cytoscape 3.0, the entire system is based on OSGi, and this modularizes Cytoscape into a collection of bundles. OSGi bundles are just regular jar files plus a simple metadata file (MANIFEST.MF) and they can be used in other non-OSGi systems. However, once we use raw OSGi API, the bundle is coupled with OSGi environment, and it is not easy to port the bundle to non-OSGi environments. [http://www.springframework.org/osgi Spring Dynamic Modules (Spring DM)] is one of the solutions to achive maximum modulality. Spring DM is a part of [http://www.springframework.org/ Spring Framework], which is a defacto standard framework for enterprise-level systems. Because of its populality, lots of documents and tools are available. |
Line 9: | Line 11: |
The core feature/concept of Spring Framework is Inversion of Control (IoC) or Dependency Injection (DI). The point is, keep objects independent from specific framework (those objects are called POJO, Plain Old Java Objects), and use metadata to configure system. There are many usecases of Spring DM for Cytoscape: === Service Management === In an OSGi environment, objects shared by multiple bundles are usually managed by [http://www.knopflerfish.org/osgi_service_tutorial.html OSGi Service Registory]. There are lots of Cytoscape objects which should be managed by a central registory, such as layout algorithms, commands, etc. OSGi service registory can manages those objects, but export/import OSGi service is a OSGi API dependent. By using Spring DM, we can do this without directly accessing OSGi API. {{{#!java public class HelloCommand extends AbstractCommand { public void execute() throws Exception { System.out.println("Hello Cytoscape"); } } }}} |
|
Line 15: | Line 29: |
=== Interface-Based Programming === One of the goals of Cytoscape 3 is a clean and easy-to-understand set of API accessible from all plugin developers. Currently, lots of implementations are published as public API and this tides actual implementations to the API design. In this case, API is tightly coupled with the current implementation. Spring is designed to solve this problem. |
|
Line 16: | Line 33: |
=== OSGi Service Management === Some of the functions in Cytoscape 3 will be implemented as ''OSGi Services''. This requires exporting |
|
Line 20: | Line 35: |
Aspect Oriented Programming (AOP) is a technique to manage cross-cutting concerns shared by multiple objects (note: AOP and object oriented programming are not mutually exclusive!) | |
Line 21: | Line 37: |
==== Benchmarking ==== | |
Line 29: | Line 45: |
* == References == === Spring Framework === === OSGi === === Aspect Oriented Programming === |
Spring Dynamic Modules for Cytoscape
(Under construction) TableOfContents
Introduction
From Cytoscape 3.0, the entire system is based on OSGi, and this modularizes Cytoscape into a collection of bundles. OSGi bundles are just regular jar files plus a simple metadata file (MANIFEST.MF) and they can be used in other non-OSGi systems. However, once we use raw OSGi API, the bundle is coupled with OSGi environment, and it is not easy to port the bundle to non-OSGi environments. [http://www.springframework.org/osgi Spring Dynamic Modules (Spring DM)] is one of the solutions to achive maximum modulality.
Spring DM is a part of [http://www.springframework.org/ Spring Framework], which is a defacto standard framework for enterprise-level systems. Because of its populality, lots of documents and tools are available.
Usecases
The core feature/concept of Spring Framework is Inversion of Control (IoC) or Dependency Injection (DI). The point is, keep objects independent from specific framework (those objects are called POJO, Plain Old Java Objects), and use metadata to configure system. There are many usecases of Spring DM for Cytoscape:
Service Management
In an OSGi environment, objects shared by multiple bundles are usually managed by [http://www.knopflerfish.org/osgi_service_tutorial.html OSGi Service Registory]. There are lots of Cytoscape objects which should be managed by a central registory, such as layout algorithms, commands, etc. OSGi service registory can manages those objects, but export/import OSGi service is a OSGi API dependent. By using Spring DM, we can do this without directly accessing OSGi API.
1 public class HelloCommand extends AbstractCommand {
2 public void execute() throws Exception {
3 System.out.println("Hello Cytoscape");
4 }
5 }
6
Testing
Good starting point to use Spring for Cytoscape. We can use DI to make mock objects to do integration test.
Integration Test
Mock Object
Interface-Based Programming
One of the goals of Cytoscape 3 is a clean and easy-to-understand set of API accessible from all plugin developers. Currently, lots of implementations are published as public API and this tides actual implementations to the API design. In this case, API is tightly coupled with the current implementation. Spring is designed to solve this problem.
Aspect Oriented Programming
Aspect Oriented Programming (AOP) is a technique to manage cross-cutting concerns shared by multiple objects (note: AOP and object oriented programming are not mutually exclusive!)
Logging
Benchmarking
Example: Command Parameter Intercepter
Managing Instances by Setter Injection
Open Issues / Problems
- Inter-bundle aspect management.
References
Spring Framework
OSGi