Eclipse, Equinox and OSGi

Posted 2007. 1. 12. 13:18
Eclipse, Equinox, and OSGi


January 2007

Discussion


Eclipse has been enormously popular as a tooling platform. With the use of Eclipse as a Rich Client Platform (RCP), Eclipse made a step towards being a runtime platform. Now, with the emergence of Eclipse on the server, Eclipse clearly has leapt into the runtime world. So what makes Eclipse capable of adapting to these different environments – what makes Eclipse tick?

At its core, Eclipse has a modular Java runtime called Equinox ( http://eclipse.org/equinox). Equinox in turn is an implementation of the OSGi Alliance’s Service Platform R4 specification ( http://osgi.org). In fact, it is the reference implementation for the framework portion of that specification. At the heart of the OSGi specification is the notion of bundles.

Bundles are used to capture modularity for Java. A bundle is just a standard Java JAR whose manifest contains extra markup identifying the bundle and laying out its dependencies. As such, each bundle is fully self-describing. Below is an example.

Bundle-SymbolicName: org.eclipse.equinox.registry
Bundle-Version: 3.2.100.v20060918
Bundle-Name: Eclipse Extension Registry
Bundle-Vendor: Eclipse.org

Bundle-ClassPath: .

Bundle-Activator: org.eclipse.core.internal.registry.osgi.Activator

Export-Package: org.eclipse.equinox.registry

Import-Package: javax.xml.parsers,
org.xml.sax,
org.osgi.framework;version=1.3
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3

The first section identifies the bundle giving it a symbolic name, version and various human-readable descriptive values. The symbolic name and version go together to uniquely identify the bundle.

The classpath entry details where, inside the bundle itself, the bundle’s code can be found. Specifying ‘.’ is the default and indicates that the bundle’s code is at the root of the bundle JAR itself.

The OSGi architecture is highly dynamic. Bundles can come and go at any time in a session. The bundle activator allows bundles to hook the start() and stop() lifecycle events and thus perform initialization and cleanup as needed.

Bundles that provide function to the rest of the system must expose the API for that function by exporting the API package. Exporting a package allows other bundles to reference the classes in the package. Notice that bundles can hide packages simply by not exporting them.

Finally, bundles can express their dependence on code supplied by other bundles. This is done either indirectly using Import-Package statements or directly using the Require-Bundle header. Importing packages allows bundles to be bound (or wired as we say) to arbitrary providers of the needed packages. Conversely, directly requiring bundles allows for implementation-specific dependencies. In both cases the prerequisite can be qualified by version ranges and other markup to refine the dependency. Note also that bundles can specify dependencies on the underlying JRE used to run them. The bundle in this example can run on J2ME Foundation 1.0 or higher or J2SE 1.3 or higher.

Given a set of bundles, Equinox resolves the dependencies and wires together the bundles. Bundles missing prerequisites are not resolved and are not eligible to be run. In the end each bundle has a dynamically computed and unique classpath that tells it exactly where to get its prerequisite code. Typically the standard Java application classpath is ignored and everything is computed from the expressed dependencies. Gone are the days of fighting with the global classpath.

How do I program and run an Equinox based system?

Developing bundles with Eclipse is the same as developing an Eclipse plug-in. In fact, there is no difference between bundles and plug-ins. While running the Eclipse SDK, simply use the New > Project > Plug-in Project wizard, enter a project name and select “OSGi framework” as the intended target platform (at the bottom of the wizard). Click Next until you get to the last page. Here you can choose from a set of templates. For your first bundle, choose the Hello OSGi Bundle template. Click Finish and you have a new bundle project.

To run the bundle, right click on the bundle project and choose Run As… > Equinox. You should see a console appear with an “osgi>” prompt and the message “Hello World!!”. That message was printed by your new bundle. At the osgi> prompt you can type various commands. For example, you can stop your bundle by typing “stop <your bundle symbolic name>”. Note that by default the project name is used as the bundle’s symbolic name. You should see the “Goodbye World!!” message. You can of course restart the bundle using “start <bundle name>”. Go take a look at the code the wizard generated and you will see an Activator class with start() and stop() methods that print the corresponding messages. There are many more details and capabilities but this should get you running.

What did I just do?

An Equinox-based system consists of; Equinox itself, a set of bundles, and a configuration. The configuration is a list of bundles to run. This list is drawn from the pool of bundles available on the user’s machine. In the example above, the tooling created a configuration that included your bundle and all the bundles the system knew about and launched it. Note that in the simple workflow used here there are many extra bundles added to the configuration. For this example, you really only need your bundle and the org.eclipse.osgi bundle in the configuration.

When Equinox is launched, it installs all of the bundles listed in the configuration, resolves them and starts any bundles listed as needed to be started. Since your bundle was installed and resolved and is listed (by default) as needing to be started, it was started and the Activator.start() method called and message printed.

Equinox and OSGi in the larger context

Both Equinox and OSGi are seeing a surge in interest from a wide range of communities from embedded, the traditional domain of OSGi, to desktop tools and applications to mobile devices and servers. The server side work is of particular interest.

The Equinox project has a server side effort that seeks to integrate the dynamic module capabilities of OSGi into standard application server scenarios (see http://eclipse.org/equinox/server). There are two main approaches; embedding Equinox in the servlet container or embedding the servlet container in Equinox. To a large extent the choice made here does not impact your server application or functionality. The choice is more a function of the infrastructure needs of your environment. For example, are there other standard web applications running, are you using clustering or other infrastructure, …

The following three diagrams illustrate the traditional
web application server setup and contrasts it with the Equinox in Container approach and the Container in Equinox approach. Equinox is embedded in an existing servlet container as shown in Figure 2 by installing a very thin web application. This application contains a Bridge Servlet that launches an Equinox instance inside the application and then forwards all requests to the Equinox-based application (servlets, JSPs, …) via a very lightweight HTTP service.

In Figure 3, the approach is turned around and Equinox runs an application container (e.g., embedded Jetty) and provides some glue code that wires Equinox-based applications into the application container.

Figure 1: Traditional web application server structure

Figure 2: Embedding Equinox in an existing application container

Figure 3: Embedding an application container in Equinox

In both Equinox-based scenarios, writing your application is the same. You create a bundle project using the Eclipse plug-in development environment (PDE) and add the static content, servlets and JSPs as needed. Then add traditional Eclipse extension markup to surface your content in the user’s URL space. The snippet below shows an example.

<plugin>
  <extension point="org.eclipse.equinox.http.registry.resources">
    <resource
      alias="/files"
      base-name="/web_files"/>
  </extension>
  <extension point="org.eclipse.equinox.http.registry.servlets">
    <servlet
      alias="/test"
      class="com.example.servlet.MyServlet"/>
  </extension>
</plugin>

The first extension places the content of the “web_files” directory of the bundle at /files in the user’s URL space (e.g., http://localhost/files/...). The second extension places MyServlet at /test in the URL space (e.g., http://localhost/test).

The easiest way of running you application is to launch directly from Eclipse using the Container in Equinox approach. This is the same process you used with the example bundle above and allows you to run without setting up an application server or deploying the code. As a result it is much faster and easier to test and debug. For complete instructions, see the Server-side QuickStart Guide at http://eclipse.org/equinox/documents/http_quickstart.php.

Since your function is defined in bundles and running in Equinox, everything is dynamic and extensible. You can add, remove and update dynamically without taking down the server, the URL space is updated as you modify the function available and your business logic can be reused on the server, the desktop and in mobile clients.

What’s next for Equinox and OSGi?

Equinox is a mature codebase with millions of users – after all, every Eclipse user is running Equinox. Nonetheless the Equinox team is continually refining the implementation and adding support for new use cases.

OSGi on the server and in the enterprise is becoming increasingly interesting. The next version of IBM’s flagship WebSphere Application Server is actually based on Equinox under the covers. The OSGi Alliance is responding to the increased interest by creating an Enterprise Expert Group (EEP) to look at issues such as distributed computing, multi-language support and enterprise wide provisioning.

The general Java community has recognized that it too can benefit from the modularity that OSGi brings. While JSR 277 seeks to add a level of modularity in the Java 7 timeframe, JSRs 232 and 291 provide OSGi-based dynamic Java modularity to Java today. These two JSRs enable OSGi-based modularity at all levels of Java from J2ME CDC/Foundation 1.0 to J2SE 1.3 and up.

The explosion in interest in Equinox and OSGi should not have surprised us but it did. Many people in the Java community are struggling with system complexity and management issues. With Eclipse, Equinox and OSGi you too can enjoy the benefits of modular, componentized Java wherever you compute.

Biographies

Jeff McAffer leads the Eclipse RCP and Runtime teams and is one of the Eclipse Platform's original architects and committers. Prior to his work at IBM's Ottawa Software Lab, he was a developer at Object Technology International focusing on areas such as distributed/parallel OO computing, expert systems, and meta-level architectures. Jeff holds a Ph.D. from the University of Tokyo.

Simon Kaegi works at Cognos as a developer looking at the run-time provisioning of enterprise software. A committer on the Eclipse Equinox project his current focus is on enabling the many use-cases for OSGi in server-side environments.


PRINTER FRIENDLY VERSION

2월까지 봐야 할 책들

Posted 2007. 1. 12. 00:13

사용자 삽입 이미지
1. 오늘 막 도착한 Head First Object-Oriented Analysis&Design 시간이 되어서 꼭 봐줘야 하는책 보고나서.... 나와 가장 친한 J군에게 모든걸 알려주려는 바로 그책...

다 읽고 J군에게 브레인덤프를 약속한 ......
1:1 강의를 해주기로 한 바로 이책... 2월이 가기전에 2번을 꼭 봐야 한다....



사용자 삽입 이미지

2. 요즈음 보고 있는 POSA 1 -
몇해전 보다가 포기했던 그 문제의 책...
답답하고 짜증나던 이 책...
몇권의 S/W 아키텍처 서적을 보고나서 이책이 조금씩 쉬워졌는데....그런데 지금은 너무나 흥미진진하고 재미있어지는 문제의 책... 또다른 J군과 같이 보는 이책....

최근들어서 애착이가는 바로 그책....
2번이상 정독해야 맛이 우러난다는 바로 이책....
쉬운 영어로 보이기 시작한 바로 이책....
아름다운 ( G 교수는 아름답다 했지만 B 교수는 아름다운게 아키텍처가 아니라고 했던 ) 문제의 이책....POSA 1



사용자 삽입 이미지

3. 앨빈토플러의 부의 미래 - 보고있으면 한없이 졸리다는 바로 그책.... 원칙적으로는 가장 먼저 봐야 하는 책이지만... 미루고 있는... 부끄럽다. T.T


사용자 삽입 이미지

4. IT ROI 투자가치 분석 - 한달째 쌓아두고 계속 봐야지 하고 있는 바로 그책...

5. 보기 싫은 주말작업을 위한 가트너 레포트, 포레스터 레포트 PDF 30개 분석.......

6. 그리고....화장실갈때 나의 성경처럼 나를 지켜주고....그래서  들고다니는 피터 드러커 흉아의 바로 그책.... 나에게 변비를 선물한 이책이 오늘의 핵심이라는거...
에센셜 드러커.... 안보신 분은 꼭 보시길....


그리고 아무도 모르게 순식간에 봐야 하는 그책....T.T 어쩌다..이런....
읽어야 하는 우선순위는

1. POSA
2. 헤드퍼스트
3. IT ROI
4. 부의미래

순으로 읽어야....
그리고 2월부터 공부하는 경영공부...전략경영 , 이건 놓치지 말고 해야 하는....

■ 오늘 여러가지 레포트와 JBOSS아키텍처를 연구하다 오픈소스란 이런거야...
아.... 아름답다.... JBOSS의 아키텍처... 스프링을 보고 한번 감탄했다면.... 다른것도 엄청난게 많지만...JBOSS의 마이크로커널개념....
이전에도 그랬지만 오늘 또 놀라게 된다.

2000년 초반에 생각해낸것도 놀랍지만...커널 개념의 아키텍처라니... 이놈 혹시.... 어제 공부한 그 커널이 이 커널 아닐까....??? 현재 진행중인 모든 프로젝트들이 하나처럼 움직이는 건 이 커널때문일 것이다.
이미 소스에 오픈정신이 가득해 보인다.

JBOSS의 아키텍처가 오픈소스에 최적화(?) 되었다는 느낌이 또 들었고...
다시 솜털이 돋는다. Oracle이 탐낼만 하였다는....

사용자 삽입 이미지


<<----- 여자모델 맘에 안들어

PointCut 예제, Advice등의 모음

Posted 2007. 1. 11. 01:40
클릭
나름 좋아 보임... 정리 잘되었음...

스프링의 Pointcut 아래와 같음 위의 예제는 몇개밖에 없지만 꼭 필요한 것들임
org.springframework.aop.support.ComposablePointcut
org.springframework.aop.support.ControlFlowPointcut
org.springframework.aop.support.DynamicMethodMatcherPointcut
org.springframework.aop.support.JdkRegexpMethodPointcut
org.springframework.aop.support.NameMatchMethodPointcut
org.springframework.aop.support.Perl5RegexpMethodPointcut
org.springframework.aop.support.StaticMethodMatcherPointcut


advice도 5가지 - 이것도 예제 참조
Before Advice : org.springframework.aop.MethodBeforeAdvice
After returning Advice : org.springframework.aop.AfterReturningAdvice
Around Advice : org.springframework.aop.MethodInterceptor
Throws Advice : org.springframework.aop.ThrowsAdvice
Introduction : org.springframework.aop.IntroductionInterceptor



checked unchecked exception

Posted 2007. 1. 10. 23:44
갑자기 심기 불편 .... 용어때문에...머리가 나빠서 맵핑하면서 읽으려니깐..힘듬....끙끙...
용어정리가 AOP엔 아직 잘 안된듯.... 조만간 되었으면....

2007년 들어 잘한 짓...
Best 3

1. 클럽에서의 드럼 치기 - 와이프가 적극적으로 협찬 중... 역시 예술을 알아야....
     장가를 매우 잘간듯....
2. 와이프와 화목해지기 ^^ - 그러나 잦은 야근으로 화목해지기 어려움 T.T
3. 경영전략 강의 - 매우 기대됨


드럼을 치니까 좋은점
드럼치면서 많은 노래를 감상...jazz부터 팝 가요..기타등등...
드럼치면서 소리를 많이 지름
드럼치면서 누구를 생각하면서 열나 두두림 씨뎅씨뎅...T.T
스트레스가 누그러짐....
좋은점 많음.... 그러나.... 나쁜점은.... 계속 치고 싶다는거....
또 병이 발병하나....T.T

PS : POSA 1 브로커패턴 정리중 하기 싫지만... 오기로 POSA파는중....
좀더 많은 것을 하고 싶은데... 그러지 못해서 매우 화가남...

토비형은 내가 Spring을 x하고 다닌다고 하지만..그렇지 않다고 다시 말함. 절대 x하고 다닌적 없음. 다만 무조건 쓰는 사람을 x한적은 있음.... spring훌륭함...

올해의 계획

Posted 2007. 1. 1. 21:25

1. 체력 관리
2. 스터디
3. 경제력

자세한 내용은 다른곳에 기술함.

2006년에 건강을 해침. 매우 많이...
어찌하다 보니... 쯪... 현재 턱밑과 귀밑이 퉁퉁 부었음. 내일 아침에 당장 검진들어가야 할듯
와이프도 걱정을 많이 함... 저번주에 몸을 너무 부려먹었나... 일단 와이프에게 너무나 미안함
미안해... 여보야.... 내일부터는 일찍 퇴근해야 할듯.....


정초부터 화가 나기 시작하는군.... 열심히 일한 결과가 당장 보인다는게 병이라니....
기가 막힘...

이상태에서 조금만 틀어져도 화가 많이 날듯....걸리면 재미없어.... 누구든....
몸을 조심해야 겠군.... 어차피 몸 버려봐야 보상도 없자나.... 누가 알아주는 것도 아니고...

1. ITIL, ITSM

Posted 2006. 12. 30. 15:31

지금은 회사에서 근무중...
몸이 많이 안좋음...

오늘은 ITIL에 대해서 간단히 적어보기로....

IT가 비지니스를 서포팅하는데 힘을 쏟는다. 라는 문장에서 오늘의 의문을 정리중....

도데체 이게 뭔가...하는 사람들도 많이 있을듯...


ITIL은 IT서비스 관리를 위해 사람, 프로세스 기술간의 상관관계를 정의해 고객중심
비지니스 중심, 프로세스중심, 프로세스간 연관성 중심의 모범을 제시 한다라고 되어 있음
즉...비지니스 관점에서의 IT관리를 뜻하는 것임.


위의 문장에서 IT서비스 라는 말의 뜻은....ITIL을 참고하면
IT서비스는 기업의 비지니스 프로세스를 가능하게 하는 하나 또는 다수의 IT시스템(하드웨어, 소프트웨어, 설비, 프로세스, 조직) 임

엉성한 프로세스를 가진 조직은 일도 엉성하게 하고 >> 프로세스는 정립되어야 하며 >> 전세계검증모델이 필요함 이것이 itil


ITIL의 구조는 아래와 같이 되어 있음

사용자 삽입 이미지



1. ITIL의 Service Support : IT서비스 제공의 융통성과 안정성을 보장하는 일련의 IT프로세스로 고객이 IT서비스를 끊임없이 지속적으로 제공받을수 있게 하는데 촛점이 있음.
위의 그림에 항목 참고...

2. ITIL Service Delivery : 고객과의 서비스 수준계약(SLA)과 이 계약에 따라 IT서비스 제공자가 비지니스 고객에게 충분하고 만족할 만한 지원을 제공하기 위한 서비스 프로세스를 정의 -- 위의 그림참조

3. ICT Infastructure Management : 안정된 IT서비스 제공을 위한 Service Management의 근간을 이루는 Infrastructure의 설계/기획, 전계, 운영, 기술지원을 위한 프로세스, 조직 도구를 정의

여기까지....

결론 사용자위주의 서비스가 IT의 존재 가치....

Spring JDBC Template

Posted 2006. 12. 28. 00:36
http://www.oracle.com/technology/global/kr/pub/articles/marx_spring.html
갑자기 패턴 생각이 나서 링크 걸었음.


어제는 친구에게 전화가 와서 대뜸 물어보는것이 ....
친구 : Spring을 쓰면 좋냐 ??
나 : 쓰기 나름이지.... 좋고 나쁘고는 없어....

가끔 느끼는 것이지만.... 아무런 대책도 없이 기술들을 마구 접하고 업무에 적용하다 보면 안쓰는것 보다도 더 안좋다고 생각한다. 즉 땜빵식 기술 접함..... 스터디는 좋다.
이것을 에자일 하다고 표현하는 이가 있기도 하다. 정말 에자일인가 ? 모르겠다. 알아서 생각하면 될듯....

외국 사이트에서  무슨 글을 읽다가 발견한....스프링을 안쓰는 이유가 "몰라서" 라고 한것 같다. 배워도 안되는 것이 있다. 경험인 것이다. 이것을 얼만큼 많은 업무에 써보고 그것을 아는가.... 라는..... 대안은 얼마나 있고..... 어디서 정보를 얻어야 하며....
기타 등등 생각할것이 많은 것이 고민거리이다.....
만일 우리집 홈페이지라면 그냥 암거나 써서 만들겠지만 말야....

친구에게 답해줬다.
"네가 하고 있는 프로젝트에 20% 이상 파일럿을 진행하고...check list 만들고 ....
안되는 것에 대해서 Gap분석을 한후 대안을 찾아.... 어차피 기술이나 아키텍처는 대안 이 매우 중요해서 대안이 없다면  억지로 기술을 적용할 필요는 없어, 최신기술을 쓰려다 비지니스를 서포팅 못한다면...안하느니 못하지....
네가 하고 있는 것에 안 맞을 지도 몰라... 좀더 많은 자원과 시간이 필요 하겠지...공짜가 어디있어...!!... 문서화도 해라... 간단하게 라도 해둬야 나중에 뭐했는지 알꺼 아냐... 나한테 대강 이란말 쓰지마... 그게 재앙을 가져온다....생각할게 얼마나 많은지 알아 ??? 이게 다가 아니라고.... 정말 내 도움이 받고 싶다면 문서화 해서 보내.... "

내가 보기엔 프레임워크가 문제가 아니라.... 사람의 마인드가 문제인듯...
좋다면 무조건 질러버리고 만다는... 지금 그래서 나또한 손해본게 한두개가 아니자나....
여전히 계속...쭈욱.. 그러고 있다. 나도 그러했다.


문서화를 하라는게 아니고 최소한 생각이나 한번은 해봤는지....
부끄럽지도 않은 모양이다..... 그때 그때 머리에서 생각나면 하는게 에자일이라고 우기는 인간도 간간히 있었음....

지금까지 본 몇몇 미신은 이러했다.
DDD면 다 해결 된다. :  네가 말하는 DDD는 국제전화임이 틀림이 없을 것이다.
Spring이면 다 해결된다 . : 봄에 뭐 어쩐다고....
웹서비스가 연동의 모든것이다. 그리고 나선 트렌젠션 어케 하냐고 나에게 묻는다. 질러놓고 보냐 ??
오픈소스는 소스가 공짜여서 맘대로 고치고 피드백도 빠르니깐 적용하고 본다.
IoC를 반드시 적용한다. AOP를 반드시 적용한다.


어떤 이에게는 이렇게 말해주고 싶다.
집에 홈페이지나  그렇게 만드세요..... 회사 피해주지 말공... 집에가셔서.....

크리스마스 이브에 책상앞에서

Posted 2006. 12. 24. 00:50
오늘은 레포팅을 마무리 하려고 책상 머리에 있다. 놋북 켜고...
처형댁에서....

경영관점에서의 과거 비지니스들이 프로세스화 되고...이젠 컴포넌트화에서 서비스화로 되어가고 있다는 생각이 바싹 든다. 그런데 내 머리속에선 그러한 것들이 받고 싶진 않다.
이러한 겝을 IT에서 줄이기 위해 SOA라는 추상화 도구를 만들었고...나는 지금 레포트에 이 추상화 도구가 벤더 집약이어야 한다고 적고 있다.
벌써 SOA의 원칙을 하나 깨고 있지만
직접 구현해야 하는 웹서비스들의 트레이드 오프때문이다. 직접 구현하려면 적어도 좀더 많은 아키텍처를 위한 대안들이 필요하고 서비스간의 오케스트레이션 (어플리케이션말고 서비스레이어에서의) 에 문제가 있어 보인다. 그런데 더 황당한건 벤더 제품을 쓴다고 완전해 보이지도 않는다. 암튼 문제점이 아닐 수 없다.


경영 + 아키텍처...
엔터프라이즈 환경에서의 비지니스와 기술에서 최고이다.
그러나 두개의 관계를 만족하는 것은 세상에 없나....
맨날 싸움만 하니....그런데 더 웃긴건 SOA가 이러한 갭을 매꾸려고 생겼고...벤더들의 잔치가 되고 있는듯 한 생각이 든다.  어쩌냐... 내가 막는다고 되는것도 아닌데 T.T

오히려 경영자들은 모델링툴에 관심만 보인다.... 아흑.....
툴이 이것들의 갭을 매꾸어 줄것이라고 믿는것 같다. 물론 맞는 것도 있지만...
그다지 인정하고 싶진 않다.


메리크리스마스 ^^

한번에 하나씩...

Posted 2006. 12. 20. 21:50
한번에 하나씩....
요즈음 가장 생각이 많이 드는 문구...
연말이어서 좀더 생각이 나는 걸까 ??

피터드러커의 책을 보면 이런 말이 나온다. First things first
도데체 무엇이 가장중요한 것인가?
가장 먼저 해야 하는 것인가?
지금 내가 해야 할 우순 순위는.... 무엇인가?


지금 당장 마인드를 바꾸어야 하는것 ?
1) 미래를 준비
2) 과거 청산
3) 용기
4) 창의
5) 지속성


ps : 지금까지의 안좋은 과거는 잊어라. !!!
It is more productive to convert an opportunity into results than to solve problem - which only restores the equilibriium of yesterday - 피터드러커
« PREV : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : ··· : 14 : NEXT »