JSmooth is a Java Executable Wrapper. It creates native Windows launchers (standard .exe) for your java applications.
http://jsmooth.sourceforge.net/index.php
Friday, March 13, 2009
Converting Jar into Exe
Filter and Ranking attributes in OSGi
In a dynamic system we can have multiple services of same bean type. In that case a consumer of a service can specify a filter to qualify the required bean as follows:
In one bundle publish the service as:
<bean id="helloService" class="com.ivy.example.service.factory.HelloServiceFactory" factory-method="getHelloService" />
<osgi:service ref="helloService" interface="com.ivy.example.service.HelloService">
<osgi:service-properties>
<entry key="product" value="account" />
</osgi:service-properties>
</osgi:service>
To consume the service in another bundle:
<osgi:reference id="helloService" filter="(product=account)" interface="com.ivy.example.service.HelloService" />
<bean id="testData" class="com.ivy.data.TestData" init-method="start" destroy-method="stop">
<property name="helloService" ref="helloService" /> <- dependency injection of the referenced bean
</bean>
Ranking attribute can be specified while advertising a bean:
the one with the higest rank if obtained i case of two similar services
<osgi:service ref="helloService" interface="com.ivy.example.service.HelloService" ranking=”1” >
The ranking attribute is useful for determining the 'best matching' OSGi service in case multiple candidates are available.
If one needs to pin point a service then a filter should be used.
Spring in a Nutshell
Features
The Inversion of Control (IoC) container - For Dependency Injection
Xml Configuration,Java Configeration and Property File Based Configeration
Instantiation using a static factory method,Instance factory method
Injecting dependencies - Constructor Injection,Setter Injection
Dependencies and configuration -Inner beans,Collections (list, set, map, and props elements allow properties)
Other features- depends-on,Lazy-init,Autowiring
Method Injection- for Injecting prototypes into singletons objects
Bean scopes- singleton,prototype,global,session,request,Custom scopes
Lifecycle callbacks- init,destroy
Shutting down the Spring IoC container gracefully in non-web applications
Bean definition inheritance
Container extension points- BeanPostProcessors,PropertyPlaceholderConfigurer etc
Annotation-based configuration- @Required, @Autowired, @Qualifier, @Component, @Service, @Repository
Using filters to customize scanning
Registering a LoadTimeWeaver
Aspect Oriented Programming with Spring
AOP- Aspect,Joint Point,Advice,PointCut,target,Weaving,AOP Proxy
Choosing which AOP declaration style - Spring AOP or full AspectJ
Spring AOP -- @AspectJ or XML for Spring AOP
Spring AOP APIs
Support for AspectJ load-time weaving
Transaction Managemnt
ORM Data Access - Hibernate,JDO,Oracle TopLink,IBatis,JPA etc
Spring MVC
View Technology - JSp & JSTL , Tile,Velocity,FreeMarker,XSTl , Jasper Reports
Spring Remoting
Intergration with Quartz for Scheduling
MethodInvokingFactoryBean - > to call methods of instantiated beans .
Example
<bean id="RequestObject" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="createdBean"/>
<property name="targetMethod" value="methodToBecalled"/>
<property name="arguments">
<map>
<entry key="xxxxxx" value-ref="yyyyyyyy" />
</map>
</property>
</bean>
Thursday, March 5, 2009
Log4j Slf4j issues in Spring Dm
If you try to use log4j in any application under Spring DM we may get some ClassNotFound exceptions . The issue could be the following
com.springsource.slf4j.org.apache.log4j-1.5.6.jar - is present in
springsource-dm-server-ee-1.0.2.RELEASE\repository\bundles\ext directory and it shares a package org.apache.log4j
Now when you put your log4j jar into repository\bundles\usr - it also shares the same package
org.apache.log4j .
Hence one in the repository is resolved first . So all requests to classes in the log4j jar within package org/apache/log4j will give ClassNotFound Exceptions as it looks for these classes in slf4j jar .
The easiest way i resolved this was by deleting com.springsource.slf4j.org.apache.log4j-1.5.6.ja from the repository . This change did not affect any logging of the spring Dm server.
Another way to solve this is
Import-Package: org.apache.log4j;bundle-symbolic-name="com.springsource.org.apache.log4j"
http://forum.springsource.org/showthread.php?t=73354
Updating bundle inside a PAR
Currently it is possible to update a bundle within a PAR only through spring tool suite.
This is done through the Deployer MBean - JMX.
This flexibility is not available running a standalone spring Dm server.
May be the future versions of the Spring DM server will support this.
http://forum.springsource.org/showthread.php?t=62293
Tomcat Version In Spring Dm OSGi
Spring DM Server comes with Tomcat 6.0.18, which I believe is the latest one.
You can see the latest version by looking at
DM_SERVER_HOME/repository/bundles/ext/ and
look at Catalina bundles (i.e., com.springsource.org.apache.catalina-6.0.18.jar)
Log4j/Struts Behaviour in OSGi
Log4j/Struts behaves weird if the these jar are put under repository, because this single static instance inside these jars are shared by all other bundles.
Example: Struts(struts properties),log4j(log4/properties)
All the properties are written into static members.Since the single instance is shared by both the bundles applications, the value of static references will be overridden and both the application will use the same settings.
This case is not specific to spring Dm , it will also occur when common configuration object
is put under common lib in tomcat.
Example: log4j/struts jar in tomcat common lib
.jpg)