Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
ikylin committed May 29, 2012
1 parent 7e81377 commit cbec270
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hello.impl/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions hello.impl/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hello.impl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions hello.impl/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon May 28 18:34:27 CST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
8 changes: 8 additions & 0 deletions hello.impl/.settings/org.maven.ide.eclipse.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Mon May 28 18:34:27 CST 2012
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1
59 changes: 59 additions & 0 deletions hello.impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<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>

<groupId>iPOJOTutorial</groupId>
<artifactId>hello.impl</artifactId>
<version>1.0.0</version>
<packaging>bundle</packaging>

<name>hello.impl</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency> <!--Compilation (i.e. class) dependency on the service interface -->
<groupId>iPOJOTutorial</groupId>
<artifactId>hello.service</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Private-Package>ipojo.example.hello.impl</Private-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<goals>
<goal>ipojo-bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ipojo.example.hello.impl;

import ipojo.example.hello.DictionaryService;

/**
* An implementation of the Dictionary service containing English words see
* DictionaryService for details of the service.
**/
public class EnglishDictionary implements DictionaryService {
// The set of words contained in the dictionary.
String[] m_dictionary = { "welcome", "to", "the", "ipojo", "tutorial" };

/**
* Implements DictionaryService.checkWord(). Determines if the passed in
* word is contained in the dictionary.
*
* @param word
* the word to be checked.
* @return true if the word is in the dictionary, false otherwise.
**/
public boolean checkWord(String word) {
word = word.toLowerCase();
// This is very inefficient
for (int i = 0; i < m_dictionary.length; i++) {
if (m_dictionary[i].equals(word)) {
return true;
}
}
return false;
}
}
22 changes: 22 additions & 0 deletions hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ipojo.example.hello.impl;

/**
* Component implementing the Hello service.
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
import ipojo.example.hello.Hello;

public class HelloImpl implements Hello {

/**
* Returns an 'Hello' message.
*
* @param name
* : name
* @return Hello message
* @see ipojo.example.hello.Hello#sayHello(java.lang.String)
*/
public String sayHello(String name) {
return "hello " + name;
}
}
9 changes: 9 additions & 0 deletions hello.impl/src/main/resources/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd"
xmlns="org.apache.felix.ipojo">
<component classname="ipojo.example.hello.impl.EnglishDictionary">
<provides />
</component>
<instance component="ipojo.example.hello.impl.EnglishDictionary" />
</ipojo>
Binary file added hello.impl/target/hello.impl-1.0.0.jar
Binary file not shown.

0 comments on commit cbec270

Please sign in to comment.