|
|||||||
| Blog | / | OSGi Alliance Blog: 200706 | |||||
|
Call To Arms: OSGi Community Event2007-06-08
The OSGi Alliance has a community event in Munich on June 26th - 27th, 2007 that you must attend. The program is turning out to be quite interesting! Many of the key players in the OSGi eco system will be around. This is clearly the place to be if you work with OSGi Technology.
Obviously we will have a lot of attention for Enterprise software. Manfred Hutt, (Siemens), and Nicole Wengatz (Siemens) will demonstrate and talk about their use of OSGi in creating large Enterprise applications for business phone exchanges. BEA will show their microService Architecture based on OSGi and how it benefits their customers. Gunnar Wagenknecht (Truition), and Jochen Hiller (Business Operation Systems) will talk about server side Eclipse. Pierre Dubois (Requea) will talk about how to modularize Web Applications using OSGi Technology. The chief architect of the DB4Objects, Carl Rosenberger, will discuss OSGi Technology and persistence. A crucial subject for Enterprise applications. One of the most exciting OSGi based developments is JSR-232 and the adoption by Sprint. Brandon Annan, their Lead Chief Java Architect, will explain what the plans are with OSGi. For any OSGi developer, these plans are very interesting, even if you never thought about programming for mobiles. The mobile phone is finally becoming a viable application platform for more than games. Just think what you could do if you could easily integrate mobile phone based solutions in your applications? In the home automation markets we will have an experience reports from Miguel García Longarón (Telefónica). He shows real applications being used in the field. Andre Bottaro, Software Engineer, France Telecom, Sylvain Marie, Software Engineer, Schneider Electric will show how UPnP+OSGi can be used to finally make the home plug and play dream come true. Abdallah Bushnaq from Ricoh will give an overview of how OSGi is used in printers. Interestingly, there are several printer manufacturers that have OSGi inside, for example Canon has an OSGi runtime that can be used to download print applications. I am curious how Ricoh will use this technology. Industrial automation is one of my favorite application areas for OSGi. I think it is an almost perfect fit, especially because this market is less cost sensitive than consumer products. Daniel Grossmann, Research Assistant, Information Technology in Mechanical Engineering, will give a very interesting presentation of how OSGi technology can be used in the automation of very large plants like refineries. Roman Roelofsen (IONA) will discuss how Service Oriented Archictures also fit embedded systems, and OSGi Technology makes this straightforward. Cross industry, there is the need for remote management. Joachim Ritter, ProSyst Software, will give a presentation how you can use OSGi Technology to manage large number of runtimes. A key component of remote management is the software repository. It is nice to have a framework that resolves bundles, but where do those bundles come from? Richard S. Hall will give a presentation about the OSGi Bundle Repository under the intriguing title: "The Bundle Dilemma." And of course we have lots of sessions for the people that are busy with the technology itself. First we will give an overview of the state of the OSGi specifications. The chairs of the expert groups will present their progress: BJ Hargrave (IBM), Kai Hackbarth (Prosyst), and Eric Newcomer (IONA). There is lots of progress in the Enterprise group and the Requirements group at the moment. If you plan to use OSGi technology in the future, you better be there. We have some very interesting lightning talks for OSGi developers. BJ Hargrave will elucidate the changes for v4.1. Maven, the Apache build tool, has been extended with OSGi support. Stuart McCulloch (Jayway Malaysia), will show how these tools can be used to create OSGi bundles. Ales Justin (JBoss) will tell about the work that JBoss is doing adapting their microkernel to support OSGi. Services, extensions? Neil Bartlett, famous from the popular beginner tutorials. will give a talk comparing the Eclipse Extension Registry (which is a service!) with the OSGi Service Registry. These two concepts are quite close and still wildly different. Puzzled? Neil will make it crystal clear. And if you have decided for services, then you should not miss the talk of Clément Escoffier about iPOJO. He worked with Richard Hall to develop a next generation component model for OSGi. This project can be seen as the successor of Service Binder that was the basis for OSGi Declarative Services. Obviously, if you program for OSGi Technology you should not miss the OSGi best practices talk that BJ Hargrave and I are giving! The day after the community event, Thursday the 28th, we will have EG meetings. The Enterprise Expert Group meeting will be for members only but there will also be a Remote Management and Automotive requirements gathering meeting presided by Kai Hackbarth. These two meetings are also open for non-members. Really, if you are involved with OSGi technology you have very little excuse to not show up. There will be plenty of time to talk to the speakers and other participants. I really hope I will meet you there! If you register before the 12th, you still get the early bird discount. Peter Kriens
Add a comment
OSGi and Hibernate2007-06-04 A long time Dutch friend of mine, Petr van Blokland and me are working on a yet another web framework. I will not go into the reasons for YAWFW, except that his background is graphic design which means aesthetics play a large role in this framework. However, this focus does not exclude us from having to handle mundane details like web requests, models, views, and databases. I am participating because it is a good way to get some enterprise systems experience. Obviously the whole infrastructure is based around OSGi.To get the picture, a short sketch of the architecture. Incoming requests are dispatched to a servlet by the HOST header to a service. This makes it possible to handle multiple sites in the same OSGi framework. We call this servlet the site servlet.The servlet we dispatch to can be anything, but so far we are using a hand made servlet that uses Groovy classes as pages. The first part of the path is the class name, the second part is the method name and the remainder are parameters. That is, a request like http://www.acme.com/home/index is a call to the class index() method in the home class. The Groovy class is a normal class that does not have to extend or implement anything. When we create it, we assign it a special meta class which we call the Builder. It is a bit different from a Groovy builder, but tries to achieve the same goal: merge code and html. The Builder is setup by the site servlet. Each site can have its own specialized builder. The builder can provide methods to the page class, this makes it easy to provide high level tags to the page. For example, you can make your own tag for a navigation bar. Builders in Groovy are a marvelous concept, they merge the power of a full blown language with the power of declarative programming à la HTML. The achieve this goals using closures. Closures are blocks of code that have access to their surrounding context but that can be manipulated as objects.
As a Smalltalker, the absence of closures in Java is one of the most painful experiences in my professional life. Anyway, closures allow you to parametrize functions. In Groovy, closures allow you to write code like:
This is actually quite an interesting approach but it is not the purpose of this blog. We also needed a database for our web framework ... Groovy provides some very interesting SQL capabilities and I was really tempted. However, Groovy uses some weird trick to recompile the source code in runtime to prevent one from having to write SQL statements (see findAllCommentsMike :
Hi Peter,
Thanks for articulating your design so clearly. Always interesting to see what others are doing with the technology. Some points to raise: 1. Security would concern me about the possibility of invoking any Goovy method from a URI typed in a web browser. Large scale systems developed by many people will likely have some code (that manipulates the DB) that I would not like people to be able to remotely invoke so easily without at least being able to validate the input (arguments to the method) first. 2. Your HibernateService should support getting the current session instead of getting "fresh" sessions. This allows code to be written with no knowledge of the transaction logic. See: http://blog.hibernate.org/cgi-bin/blosxom.cgi/2005/09/30/ This would require providing a Hibernate CurrentSessionContext implementation that uses your HibernateService. 2.5 It was not clear from your description if multiple database contributions could be specified in the manifest. If not then that seems limiting. If so then the database contribution name has to be hardcoded as well in some code. The database contribution name smells to me like the name of a Spring bean that provides a SessionFactory. Why not just use a Spring 2.0 namespace extension? Perhaps Spring is too heavy-weight on dependencies? Costin from the Spring OSGi newsgroup linked to this blog but I am interested in hearing why you are not integrating with Spring. 3. Bundles defining database contributions in MANIFEST.MF, while flexible, seems suited only for the scenario where the DB is treated like "some place for applications to store stuff". In many large businesses, the DB is the most vital application they run. Allowing any deployer of an OSGi bundle to the runtime to declare classes (or heaven forbid update the schema) seems irrelevant. The SessionFactories are managed for the entire OSGi runtime independent of what the applications want (see J2EE). Likely JMX would be easier to use than deploying OSGi bundles with metadata. I would take the Spring approach on this - the deployed application simply depends on a SessionFactory. It shouldn't be in the business of declaring the SessionFactory at runtime. 4. I would be interested to know your thoughts on why DynamicImport-Package: * is not ideal for solving your classloading problem. It is abit slower for resolving classes but Hibernate proxy class creation happens so infrequently (only at SessionFactory creation time?) that it can't matter that much (or am I wrong about that)? Thanks for your thoughts on this subject... -mike Peter :
1. This is a standard security issue and the language is irrelevant. Input validation and escaping are crucial in all cases.
2. Fresh session. Well, what I meant it gets the "current" fresh session. You actually get a fresh SessionFactory when the underlying configuration or contributions are changed. Obviously, all participants in the transaction must share the same session or things will horribly fail. It was one of the design goals of this bundle to share the same session without having ahead of time knowledge of all the possible combinations 2.5 I started hardcoding the configuration name, figuring that in most cases there would only be one. However, my friend made it clear each site has its own db. I therefore do an indirection. Bundles contribute to a logical name and the database "uses" that logical name. This is quite flexible and prevents hardcoded configuration names. I do not use Spring because I want to avoid a God file that has to know all. The purpose of the exercise is let the available bundles define the configuration instead of a central configuration file. That is, if bundle A is present, it can participate, if not, it can not, without changing any configuration data. 3. I think the configuration defines all the issues you worry about. The bundles with domain objects only provide contributions to a logical name. It is up to the configuration to name them. Obviously for an industry strength implementation security permissions must be added. However, if you do not know what bundles are running in your system, your in deep trouble anyway, I think :-) Richard Hall once said: "The set of installed bundles is your configuration." This has always been very true for OSGi based systems, it was therefore a bit of a surprise to see enterprise people thinking more in traditional one-process applications with a central control. So far, I really like this model that the system adapts to what I install. 4. DynamicImport-Package is a last resort attempt. We spent an incredible effort to get rid of many classloading problems caused by a linear classpath. Dynamic-ImportPackage is back to this class loading hell when used on a large scale. We added it because it is sometimes the only (sad) solution but when used on a larger scale you kill all the advantages of modularity. For example, DynamicImport-Package can not handle versions in any reasonable way. (I know you add the attribute, but if you know the version, why shouldnt you know the class). Kind regards, Peter Kriens Cameron Taggart :
Hi Peter,
I'm glad smart people like you are trying to figure out how to get libraries like Hibernate to work with OSGi. A similar tool is Oracle Toplink which may become a part of an Eclipse project named EclipseLink. They wish to build on top of OSGi. You can find out more here: http://www.eclipse.org/proposals/eclipselink/ cheers, Cameron aharris :
Hi Peter,
Thanks for an excellent article. In your comment you said, 2. Fresh session. Well, what I meant it gets the "current" fresh session. You actually get a fresh SessionFactory when the underlying configuration or contributions are changed. Since, SessionFactory objects are immutable you must be building a new one. How did you ensure the existing SessionFactory was properly disposed of (i.e. closed) and that all of the Sessions it had created were not still in use? Regards, Adam Peter :
I think it is no problem that existing sessions are continue to be used. If they could use the session a micro session before, they can use it a microsecond after the configuration changed. Hibernate specifically indicates that sessions are relatively cheap entities that should be used on the level of a web request or other high level "request" concepts.
This of course leaves the problem of garbage collecting the SessionFactory ... I leave that as a convenient secret :-), which is another way of saying I have not addressed this in the prototype. Kind regards, Peter Kriens aharris :
Yes, it's the issue of the garbage collection of the SessionFactory that I'm raising. The Javadoc for SessionFactory.close() states:
Destroy this SessionFactory and release all resources (caches, connection pools, etc). It is the responsibility of the application to ensure that there are no open Sessions before calling close(). Hence, calling close() could interfere with transactions in progress on the existing Sessions. Not calling close() could lead to leaked resources...I think! :) I've been looking into this same sort of design, and I'm not sure how well suited Hibernate is in its current incarnation. Regards, Adam Peter :
The easiest solution is to return a proxy to the Hibernate SessionFactory and then count the number of sessions you hand out and get back. It is a solvable problem I think.
Kind regards, Peter Kriens James :
Hi Peter,
I have been working with Apache felix + Apache Cayenne for the past few months. Regarding your various concerns, I am certain that Apache Cayenne should serve your purpose. Otherwise, GPL db40 will work fine too. Regards, James Yong Loedolff :
Hi Peter and others,
I have implemented a sample OSGi/Hibernate/Spring DM/Spring project loosely based on the pattern described above. I'm not using the extender model yet, but the Hibernate SessionFactory is dynamically updated as bundles are started and stopped. The project is described here: http://code.google.com/p/voluble/wiki/OsgiHibernateSpringSpringDMSample The linked page includes instructions for getting and running the code. If anyone gets a chance to look at it, I would love to get some feedback while the example gets build out a bit further!
|
||||||