Posts

Apache Karaf + Pax CDI + OSGI Command and Function

Image
OSGI Command and Function In the Previous post we saw how to implement OSGI Service PAX CDI Implementation http://opensourceappexample.blogspot.ca/2017/06/apache-karaf-pax-cdi-osgi-service.html Let us see how we can use OSGI Command osgi.command.scope osgi.command.function pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>osgi.example</groupId> <artifactId>osgi-example-parent</artifactId> <version>1.0</version> </parent> <artifactId>osgi-example-cmd</artifactId> <packaging>bundle</packaging> <dependencies> <dep...

Apache Karaf + Pax CDI OSGI Service

Image
OSGI OSGi  (Open Service Gateway Initiative) is a Java framework for developing and deploying modular software programs and libraries.  OSGi  has two parts. The first part is a specification for modular components called bundles.  W hich are commonly referred to as plug-ins Contexts and Dependency Injection for OSGi Applications PAX CDI https://ops4j1.jira.com/wiki/display/PAXCDI/Pax+CDI PAX CDI is a Dependency  injection  implementation  in OSGI Let us a sample for how to implement the OSGI Service How to use @Inject   @OsgiService @OsgiServiceProvider etc., Pax CDI API pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> ...

EQUALS AND HASHCODE RELATION

Image
The Equals and hashcode has the following relation you can see from the image The Equals method in the above program is return false even though  hashcode method is giving same value as 3185. So we can find that hash value of two object need not be same.

HOW TO CREATE A JAVA APPLICATION IN SIMPLE SPRING FRAMEWORK

Image
What is Spring The Spring Framework is a very comprehensive framework. The fundamental functionality provided by the Spring Container is dependency injection. Spring provides a light-weight container, e.g. the Spring core container, for dependency injection (DI). This container allows to inject required objects into other objects. This results in a design in which the Java class are not hard-coupled. The injection in Spring is either done via setter injection of via construction injection. These classes which are managed by Spring must conform to the JavaBean standard. In the context of Spring classes are also referred to as beans or as spring beans. The Spring core container: handles the configuration, generally based on annotations or on an XML file (XMLBeanFactory) manages the selected Java classes via the BeanFactory The core container uses the so-called bean factory to create new objects. New objects are generally created as Singleton...