You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/03/25 18:50:25 UTC
svn commit: r640913 - in
/felix/sandbox/clement/ipojo/examples/tutorial-maven:
hello.client.annotation/src/main/java/ipojo/example/hello/client/
hello.client/src/main/java/ipojo/example/hello/client/
hello.impl.annotation/src/main/java/ipojo/example/he...
Author: clement
Date: Tue Mar 25 10:50:04 2008
New Revision: 640913
URL: http://svn.apache.org/viewvc?rev=640913&view=rev
Log:
Add headers.
Modified:
felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java
felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java
felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java
felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java
felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java
Modified: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java?rev=640913&r1=640912&r2=640913&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java (original)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client.annotation/src/main/java/ipojo/example/hello/client/HelloClient.java Tue Mar 25 10:50:04 2008
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package ipojo.example.hello.client;
import org.apache.felix.ipojo.annotations.Component;
@@ -7,15 +25,27 @@
import ipojo.example.hello.Hello;
+/**
+ * A simple Hello service client.
+ * This client use annotation instead of XML metadata.
+ */
@Component(name="AnnotatedHelloClient", architecture=true)
public class HelloClient implements Runnable {
+/** The m_hello. */
@Requires
private Hello[] m_hello; // Service Dependency
+/** The Constant DELAY. */
private final static int DELAY=10000;
+
+/** The end. */
private boolean end;
+ /**
+ *
+ * @see java.lang.Runnable#run()
+ */
public void run() {
while (!end) {
try {
@@ -26,13 +56,22 @@
}
}
+/**
+ * Invoke hello services.
+ */
public void invokeHelloServices() {
for (int i = 0; i < m_hello.length; i++) { System.out.println(i + " :" + m_hello[i].sayHello("Clement")); }
}
+ /**
+ * Starting.
+ */
@Validate
public void starting() { Thread T = new Thread(this); end = false; T.start(); }
+ /**
+ * Stopping.
+ */
@Invalidate
public void stopping() { end = true; }
}
Modified: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java?rev=640913&r1=640912&r2=640913&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java (original)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.client/src/main/java/ipojo/example/hello/client/HelloClient.java Tue Mar 25 10:50:04 2008
@@ -1,29 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package ipojo.example.hello.client;
import ipojo.example.hello.Hello;
+/**
+ * Hello Service simple client.
+ */
public class HelloClient implements Runnable {
-private Hello[] m_hello; // Service Requirement
-private final static int DELAY=10000;
-private boolean end;
-
-private String m_name;
-
- public void run() {
- while (!end) {
- try {
- invokeHelloServices();
- Thread.sleep(DELAY);
- } catch (InterruptedException ie) { }
- /* will recheck end */
- }
-}
-
-public void invokeHelloServices() {
- for (int i = 0; i < m_hello.length; i++) { System.out.println(m_hello[i].sayHello(m_name)); }
-}
+ /** The m_hello. */
+ private Hello[] m_hello; // Service Requirement
+
+ /** The Constant DELAY. */
+ private final static int DELAY = 10000;
- public void starting() { Thread T = new Thread(this); end = false; T.start(); }
- public void stopping() { end = true; }
+ /** The end. */
+ private boolean end;
+
+ /** The m_name. */
+ private String m_name;
+
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ while (!end) {
+ try {
+ invokeHelloServices();
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ie) {
+ }
+ /* will recheck end */
+ }
+ }
+
+ /**
+ * Invoke hello services.
+ */
+ public void invokeHelloServices() {
+ for (int i = 0; i < m_hello.length; i++) {
+ System.out.println(m_hello[i].sayHello(m_name));
+ }
+ }
+
+ /**
+ * Starting.
+ */
+ public void starting() {
+ Thread T = new Thread(this);
+ end = false;
+ T.start();
+ }
+
+ /**
+ * Stopping.
+ */
+ public void stopping() {
+ end = true;
+ }
}
Modified: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java?rev=640913&r1=640912&r2=640913&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java (original)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl.annotation/src/main/java/ipojo/example/hello/impl/HelloImpl.java Tue Mar 25 10:50:04 2008
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package ipojo.example.hello.impl;
import ipojo.example.hello.Hello;
@@ -6,10 +24,17 @@
import org.apache.felix.ipojo.annotations.Provides;
/**
- * Component implementing the Hello service.
- **/
+ * Component implementing the Hello service.
+ * This class used annotations to describe the component type.
+ */
@Component
@Provides
public class HelloImpl implements Hello {
+
+ /**
+ * @param name
+ * @return
+ * @see ipojo.example.hello.Hello#sayHello(java.lang.String)
+ */
public String sayHello(String name) { return "hello " + name + " @"; }
}
Modified: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java?rev=640913&r1=640912&r2=640913&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java (original)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.impl/src/main/java/ipojo/example/hello/impl/HelloImpl.java Tue Mar 25 10:50:04 2008
@@ -1,10 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package ipojo.example.hello.impl;
import ipojo.example.hello.Hello;
/**
- * Component implementing the Hello service.
- **/
+ * Component implementing the Hello service.
+ */
public class HelloImpl implements Hello {
+
+ /**
+ * @param name
+ * @return
+ * @see ipojo.example.hello.Hello#sayHello(java.lang.String)
+ */
public String sayHello(String name) { return "hello " + name; }
}
Modified: felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java?rev=640913&r1=640912&r2=640913&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java (original)
+++ felix/sandbox/clement/ipojo/examples/tutorial-maven/hello.service/src/main/java/ipojo/example/hello/Hello.java Tue Mar 25 10:50:04 2008
@@ -1,9 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package ipojo.example.hello;
+
+/**
+ * Hello Interface.
+ */
public interface Hello {
+
/**
- * Return a message like: "Hello $user_name"
- * @param name: the name of the user
- * @return the hello message
- **/
+ * Return a message like: "Hello $user_name".
+ * @param name the name
+ * @return the hello message
+ */
public String sayHello(String name);
}