You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2011/09/29 09:44:26 UTC

svn commit: r1177194 [1/2] - in /incubator/celix/trunk: ./ examples/ examples/echo_service/client/ examples/osgi-in-action/chapter01-greeting-example/client/ examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/ examples/osgi-in-action/ch...

Author: abroekhuis
Date: Thu Sep 29 07:44:24 2011
New Revision: 1177194

URL: http://svn.apache.org/viewvc?rev=1177194&view=rev
Log:
CELIX-14, CELIX-15, CELIX-16: Added examples from the OSGi in Action book

Added:
    incubator/celix/trunk/Log Listener.launch
    incubator/celix/trunk/Paint Example.launch
    incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square_shape.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/CMakeLists.txt
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/MANIFEST/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/include/triangle_shape.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/activator.c
      - copied, changed from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle.png
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/triangle/private/src/triangle_shape.c
Removed:
    incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/activator.c
Modified:
    incubator/celix/trunk/examples/CMakeLists.txt
    incubator/celix/trunk/examples/echo_service/client/echo_client.c
    incubator/celix/trunk/examples/echo_service/client/echo_client_activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/MANIFEST/MANIFEST.MF
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
    incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt

Added: incubator/celix/trunk/Log Listener.launch
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/Log%20Listener.launch?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/Log Listener.launch (added)
+++ incubator/celix/trunk/Log Listener.launch Thu Sep 29 07:44:24 2011
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB_LIST"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=".gdbinit"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.breakpointsFullPath" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="org.eclipse.cdt.debug.mi.core.standardMacOSCommandFactory"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
+<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
+<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebuggerNew"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
+<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;userData-bundleActivator_stop-(cast)&quot; val=&quot;DEPENDENCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;componentData-bundleActivator_create-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;key-hashMapIterator_remove-(cast)&quot; val=&quot;char *&quot;/&gt;&lt;content id=&quot;userData-userData-fw_startBundle-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;*userData-userData-bundleActivator_create-(cast)&quot; val=&quot;DEPENDENCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;userData-*userData-userData-bundleActivator_create-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;userData-data-bundleActivator_start-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;userData-fw_startBundle-(cast)&quot; val=&quot;DEPENDE
 NCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;userData-userData-bundleActivator_stop-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
+<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList/&gt;&#10;"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/launcher/launcher"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="celix"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.macosx.base.1808592147"/>
+<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${workspace_loc:celix/build/examples/deploy/chapter04-correct-listener}"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ui.ApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/celix"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DYLD_LIBRARY_PATH" value="${workspace_loc:celix/build/framework}:${workspace_loc:celix/build/utils}"/>
+</mapAttribute>
+<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
+<mapEntry key="[debug]" value="org.eclipse.cdt.cdi.launch.localCLaunch"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
+</launchConfiguration>

Added: incubator/celix/trunk/Paint Example.launch
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/Paint%20Example.launch?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/Paint Example.launch (added)
+++ incubator/celix/trunk/Paint Example.launch Thu Sep 29 07:44:24 2011
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB_LIST"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=".gdbinit"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.breakpointsFullPath" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.commandFactory" value="org.eclipse.cdt.debug.mi.core.standardMacOSCommandFactory"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.verboseMode" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
+<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
+<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
+<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
+<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebuggerNew"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
+<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;userData-bundleActivator_stop-(cast)&quot; val=&quot;DEPENDENCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;componentData-bundleActivator_create-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;key-hashMapIterator_remove-(cast)&quot; val=&quot;char *&quot;/&gt;&lt;content id=&quot;userData-userData-fw_startBundle-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;*userData-userData-bundleActivator_create-(cast)&quot; val=&quot;DEPENDENCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;userData-*userData-userData-bundleActivator_create-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;userData-data-bundleActivator_start-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;content id=&quot;userData-fw_startBundle-(cast)&quot; val=&quot;DEPENDE
 NCY_ACTIVATOR_BASE&quot;/&gt;&lt;content id=&quot;userData-userData-bundleActivator_stop-(cast)&quot; val=&quot;log_writer_t&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
+<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList/&gt;&#10;"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/launcher/launcher"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="celix"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.macosx.base.1808592147"/>
+<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${workspace_loc:celix/build/examples/deploy/chapter04-paint-example}"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ui.ApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/celix"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DYLD_LIBRARY_PATH" value="${workspace_loc:celix/build/framework}:${workspace_loc:celix/build/utils}"/>
+</mapAttribute>
+<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
+<mapEntry key="[debug]" value="org.eclipse.cdt.cdi.launch.localCLaunch"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
+</launchConfiguration>

Modified: incubator/celix/trunk/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/CMakeLists.txt?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -30,5 +30,8 @@ add_subdirectory(echo_service)
 add_subdirectory(osgi-in-action/chapter04-correct-lookup)
 add_subdirectory(osgi-in-action/chapter04-correct-listener)
 add_subdirectory(osgi-in-action/chapter01-greeting-example)
+add_subdirectory(osgi-in-action/chapter04-paint-example)
 
-deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service chapter01-greeting-example-client chapter01-greeting-example)
\ No newline at end of file
+deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service chapter01-greeting-example-client chapter01-greeting-example)
+deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service chapter04-correct-listener)
+deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle square triangle shell shell_tui log_service log_writer)

Modified: incubator/celix/trunk/examples/echo_service/client/echo_client.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/echo_client.c?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/echo_service/client/echo_client.c (original)
+++ incubator/celix/trunk/examples/echo_service/client/echo_client.c Thu Sep 29 07:44:24 2011
@@ -23,6 +23,7 @@
  *      Author: alexanderb
  */
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "service_tracker.h"
 

Modified: incubator/celix/trunk/examples/echo_service/client/echo_client_activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/echo_client_activator.c?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/echo_service/client/echo_client_activator.c (original)
+++ incubator/celix/trunk/examples/echo_service/client/echo_client_activator.c Thu Sep 29 07:44:24 2011
@@ -49,7 +49,8 @@ celix_status_t bundleActivator_create(BU
 celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
 	struct echoActivator * act = (struct echoActivator *) userData;
 
-	SERVICE_TRACKER tracker = tracker_create(context, ECHO_SERVICE_NAME, NULL);
+	SERVICE_TRACKER tracker = NULL;
+	tracker_create(context, ECHO_SERVICE_NAME, NULL, &tracker);
 	act->tracker = tracker;
 
 	ECHO_CLIENT client = echoClient_create(tracker);

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -17,8 +17,6 @@
 
 add_library(chapter01-greeting-example-client SHARED private/src/client)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("public/include")
-include_directories("private/include")
 include_directories("../greeting/public/include")
 target_link_libraries(chapter01-greeting-example-client framework)
 

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/MANIFEST.MF?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/MANIFEST.MF (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/MANIFEST/MANIFEST.MF Thu Sep 29 07:44:24 2011
@@ -2,5 +2,3 @@ Bundle-SymbolicName: chapter01-greeting-
 Bundle-Version: 1.0.0
 library: chapter01-greeting-example-client
 Import-Service: greeting-service
-
-

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/client/private/src/client.c Thu Sep 29 07:44:24 2011
@@ -19,7 +19,6 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <apr_general.h>
 
 #include "bundle_activator.h"
 #include "bundle_context.h"
@@ -27,6 +26,7 @@
 
 
 celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	*userData = NULL;
 	return CELIX_SUCCESS;
 }
 
@@ -37,7 +37,7 @@ celix_status_t bundleActivator_start(voi
 		if (ref == NULL) {
 			printf("Greeting service reference not available\n");
 		} else {
-			GREETING_SERVICE greeting = NULL;
+			greeting_service_t greeting = NULL;
 			bundleContext_getService(ctx, ref, (void *) &greeting);
 			if (greeting == NULL){
 				printf("Greeting service not available\n");

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/MANIFEST/MANIFEST.MF?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/MANIFEST/MANIFEST.MF (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/MANIFEST/MANIFEST.MF Thu Sep 29 07:44:24 2011
@@ -3,4 +3,3 @@ Bundle-Version: 1.0.0
 library: chapter01-greeting-example
 Export-Service: greeting-service
 Import-Service: greeting-service
-

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/include/greeting_impl.h Thu Sep 29 07:44:24 2011
@@ -19,11 +19,13 @@
 #ifndef GREETING_IMPL_H_
 #define GREETING_IMPL_H_
 
+#include "greeting_service.h"
+
 struct greeting {
 	char *name;
 };
 
-extern void greeting_sayHello(struct greeting *instance);
+extern void greeting_sayHello(greeting_t instance);
 
 
 #endif /* GREETING_IMPL_H_ */

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c Thu Sep 29 07:44:24 2011
@@ -32,43 +32,56 @@ struct greetingActivator {
 	apr_pool_t *pool;
 };
 
-typedef struct greetingActivator *GREETING_ACTIVATOR;
+typedef struct greetingActivator *greeting_activator_t;
 
 celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
 	apr_pool_t *pool;
-	GREETING_ACTIVATOR activator;
+	greeting_activator_t activator;
 	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
 	if (status == CELIX_SUCCESS) {
 		*userData = apr_palloc(pool, sizeof(struct greetingActivator));
-		activator = *userData;
-		activator->reg = NULL;
-		activator->pool = pool;
+		if (userData) {
+			activator = *userData;
+			activator->reg = NULL;
+			activator->pool = pool;
+		} else {
+			status = CELIX_ENOMEM;
+		}
 	}
 	return status;
 }
 
 celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
 	celix_status_t status = CELIX_SUCCESS;
-	GREETING_SERVICE es = apr_palloc(act->pool, sizeof(*es));
-	es->instance = apr_palloc(act->pool, sizeof(*es->instance));
-	es->instance->name = GREETING_SERVICE_NAME;
-	es->greeting_sayHello = greeting_sayHello;
 
-    status = bundleContext_registerService(context, GREETING_SERVICE_NAME, es, NULL, &act->reg);
+	greeting_activator_t act = (greeting_activator_t) userData;
+
+	greeting_service_t greetingService = apr_palloc(act->pool, sizeof(*greetingService));
+
+	if (greetingService) {
+		greetingService->instance = apr_palloc(act->pool, sizeof(*greetingService->instance));
+		if (greetingService->instance) {
+			greetingService->instance->name = GREETING_SERVICE_NAME;
+			greetingService->greeting_sayHello = greeting_sayHello;
+
+			status = bundleContext_registerService(context, GREETING_SERVICE_NAME, greetingService, NULL, &act->reg);
+		} else {
+			status = CELIX_ENOMEM;
+		}
+	} else {
+		status = CELIX_ENOMEM;
+	}
 	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
 	celix_status_t status = CELIX_SUCCESS;
-	struct greetingActivator * act = (struct greetingActivator *) userData;
+	greeting_activator_t act = (greeting_activator_t) userData;
 	serviceRegistration_unregister(act->reg);
 	act->reg = NULL;
 	return CELIX_SUCCESS;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	act->reg = NULL;
 	return CELIX_SUCCESS;
 }

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/greeting_impl.c Thu Sep 29 07:44:24 2011
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include "greeting_impl.h"
 
-void greeting_sayHello(struct greeting *instance){
+void greeting_sayHello(greeting_t instance){
 	printf("Greetings from %s\n", instance->name);
 }
 

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/public/include/greeting_service.h Thu Sep 29 07:44:24 2011
@@ -22,11 +22,12 @@
 
 #define GREETING_SERVICE_NAME "greeting-service"
 
-typedef struct greeting *GREETING;
-typedef struct greeting_service * GREETING_SERVICE;
+typedef struct greeting *greeting_t;
+typedef struct greeting_service *greeting_service_t;
 
 struct greeting_service {
-	GREETING instance;
-	void (*greeting_sayHello)(GREETING instance);
+	greeting_t instance;
+	void (*greeting_sayHello)(greeting_t instance);
 };
+
 #endif /* GREETING_H_ */

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt?rev=1177194&r1=1177193&r2=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-add_library(chapter04-correct-listener SHARED private/src/activator)
+add_library(chapter04-correct-listener SHARED private/src/listener_example)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
 target_link_libraries(chapter04-correct-listener framework)

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/private/src/listener_example.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,180 @@
+/*
+ * listener_example.c
+ *
+ *  Created on: Sep 22, 2011
+ *      Author: alexander
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <apr_general.h>
+
+#include "bundle_activator.h"
+#include "log_service.h"
+
+struct listenerActivator {
+	apr_pool_t *pool;
+
+	BUNDLE_CONTEXT context;
+	SERVICE_LISTENER listener;
+
+	apr_thread_mutex_t *logServiceReferencesLock;
+	ARRAY_LIST logServiceReferences;
+
+	bool running;
+	apr_thread_t *logger;
+};
+
+void listenerExample_serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT event);
+celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_t *service);
+
+static void *APR_THREAD_FUNC listenerExample_logger(apr_thread_t *thd, void *activator);
+
+celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message);
+
+celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	celix_status_t status = CELIX_SUCCESS;
+	apr_pool_t *pool;
+	apr_pool_t *subpool;
+
+	status = bundleContext_getMemoryPool(context, &pool);
+	if (status == CELIX_SUCCESS) {
+		if (apr_pool_create(&subpool, pool) == APR_SUCCESS) {
+			*userData = apr_palloc(subpool, sizeof(struct listenerActivator));
+			if (!userData) {
+				status = CELIX_ENOMEM;
+			} else {
+				struct listenerActivator *activator = (*userData);
+				activator->pool = subpool;
+				activator->context = context;
+				activator->listener = NULL;
+				apr_thread_mutex_create(&activator->logServiceReferencesLock, 0, subpool);
+				activator->logServiceReferences = arrayList_create();
+				activator->running = false;
+				activator->logger = NULL;
+			}
+		} else {
+			status = CELIX_BUNDLE_EXCEPTION;
+		}
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct listenerActivator *activator = userData;
+
+	SERVICE_LISTENER listener = apr_palloc(activator->pool, sizeof(struct listenerActivator));
+	if (!listener) {
+		status = CELIX_ENOMEM;
+	} else {
+		char filter[30];
+		sprintf(filter, "(objectClass=%s)", LOG_SERVICE_NAME);
+
+		listener->handle = activator;
+		listener->serviceChanged = (void *) listenerExample_serviceChanged;
+		status = bundleContext_addServiceListener(context, listener, filter);
+		if (status == CELIX_SUCCESS) {
+			activator->listener = listener;
+		}
+
+		ARRAY_LIST logServices = NULL;
+		status = bundleContext_getServiceReferences(context, NULL, filter, &logServices);
+		if (status == CELIX_SUCCESS) {
+			int i;
+			for (i = 0; i < arrayList_size(logServices); i++) {
+				SERVICE_REFERENCE logService = (SERVICE_REFERENCE) arrayList_get(logServices, i);
+				SERVICE_EVENT event = apr_palloc(activator->pool, sizeof(*event));
+				event->reference = logService;
+				event->type = REGISTERED;
+
+				listenerExample_serviceChanged(listener, event);
+			}
+		}
+
+		activator->running = true;
+		apr_thread_create(&activator->logger, NULL, listenerExample_logger, activator, activator->pool);
+	}
+
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct listenerActivator *activator = userData;
+	apr_status_t stat;
+
+	activator->running = false;
+	apr_thread_join(&stat, activator->logger);
+
+	bundleContext_removeServiceListener(context, activator->listener);
+
+	return status;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	celix_status_t status = CELIX_SUCCESS;
+	struct listenerActivator *activator = userData;
+	arrayList_destroy(activator->logServiceReferences);
+	return status;
+}
+
+void listenerExample_serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT event) {
+	struct listenerActivator *activator = listener->handle;
+	apr_thread_mutex_lock(activator->logServiceReferencesLock);
+
+	switch (event->type) {
+	case REGISTERED:
+		arrayList_add(activator->logServiceReferences, event->reference);
+		break;
+//	case MODIFIED:
+//		// only the service metadata has changed, so no need to do anything here
+//		break;
+	case UNREGISTERING:
+		arrayList_remove(activator->logServiceReferences,
+				arrayList_indexOf(activator->logServiceReferences, event->reference));
+		break;
+	default:
+		break;
+	}
+	apr_thread_mutex_unlock(activator->logServiceReferencesLock);
+}
+
+celix_status_t listenerExample_getLogService(struct listenerActivator *activator, log_service_t *service) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	apr_thread_mutex_lock(activator->logServiceReferencesLock);
+	if (arrayList_size(activator->logServiceReferences) > 0) {
+		SERVICE_REFERENCE reference = arrayList_get(activator->logServiceReferences, 0);
+		status = bundleContext_getService(activator->context, reference, (void *) service);
+	}
+	apr_thread_mutex_unlock(activator->logServiceReferencesLock);
+
+	return status;
+}
+
+static void *APR_THREAD_FUNC listenerExample_logger(apr_thread_t *thd, void *data) {
+	struct listenerActivator *activator = data;
+
+	while (activator->running) {
+		log_service_t logService = NULL;
+		listenerExample_getLogService(activator, &logService);
+		if (logService != NULL) {
+			(*(logService->log))(logService->logger, LOG_INFO, "ping");
+		} else {
+			listenerExample_alternativeLog(activator, "No LogService available. Printing to standard out.");
+		}
+		sleep(5);
+	}
+
+	return NULL;
+}
+
+celix_status_t listenerExample_alternativeLog(struct listenerActivator *activator, char *message) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	printf("%s\n", message);
+
+	return status;
+}
+

Copied: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt (from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt?p2=incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt&p1=incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt&r1=1177180&r2=1177194&rev=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -15,9 +15,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
-add_library(chapter04-correct-listener SHARED private/src/activator)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-listener framework)
+add_subdirectory(circle)
+add_subdirectory(paint)
+add_subdirectory(square)
+add_subdirectory(triangle)
 
-bundle(chapter04-correct-listener)

Copied: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt (from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt?p2=incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt&p1=incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt&r1=1177180&r2=1177194&rev=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -14,10 +14,31 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+cmake_minimum_required(VERSION 2.8)
+INCLUDE(FindPkgConfig)
+cmake_policy(SET CMP0014 NEW)
+pkg_search_module (GLIB  REQUIRED glib-2.0)
+pkg_search_module (GTHR  REQUIRED gthread-2.0)
+pkg_search_module (GTK   REQUIRED gtk+-2.0)
+include_directories(
+	private/include
+	public/include
+	../simple//public/include
+)
+include_directories(${GTK_INCLUDE_DIRS})
+include_directories(${GLIB_INCLUDE_DIRS})
+include_directories(${GTHR_INCLUDE_DIRS})
 
-add_library(chapter04-correct-listener SHARED private/src/activator)
+link_directories(${GTK_LIBRARY_DIRS})
+link_directories(${GLIB_LIBRARY_DIRS})
+link_directories(${GTHR_LIBRARY_DIRS})
+
+add_library(circle SHARED 
+ private/src/activator
+ private/src/circle_shape
+ )
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-listener framework)
+target_link_libraries(circle framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
 
-bundle(chapter04-correct-listener)
+bundle(circle FILES private/src/circle.png)

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/MANIFEST.MF?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/MANIFEST/MANIFEST.MF Thu Sep 29 07:44:24 2011
@@ -0,0 +1,7 @@
+Bundle-SymbolicName: circle
+Bundle-Version: 1.0.0
+library: circle
+Export-Service: simple_shape
+Import-Service: simple_shape
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/include/circle_shape.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,14 @@
+/*
+ * default_shape.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef CIRCLE_SHAPE_H_
+#define CIRCLE_SHAPE_H_
+
+
+extern SIMPLE_SHAPE circleShape_create(BUNDLE_CONTEXT context);
+
+#endif /* CIRCLE_SHAPE_H_ */

Copied: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c (from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c?p2=incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c&p1=incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c&r1=1177180&r2=1177194&rev=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/activator.c Thu Sep 29 07:44:24 2011
@@ -20,12 +20,15 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <apr_general.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
 
 #include "bundle_activator.h"
 #include "bundle_context.h"
-#include "greeting_impl.h"
-#include "greeting_service.h"
-#include "service_registration.h"
+#include "simple_shape.h"
+#include "circle_shape.h"
+#include "simple_shape.h"
 
 struct greetingActivator {
 	SERVICE_REGISTRATION reg;
@@ -44,31 +47,25 @@ celix_status_t bundleActivator_create(BU
 		activator->reg = NULL;
 		activator->pool = pool;
 	}
+	printf("Circle created %d\n", status);
 	return status;
 }
 
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
 	struct greetingActivator * act = (struct greetingActivator *) userData;
 	celix_status_t status = CELIX_SUCCESS;
-	GREETING_SERVICE es = apr_palloc(act->pool, sizeof(*es));
-	es->instance = apr_palloc(act->pool, sizeof(*es->instance));
-	es->instance->name = GREETING_SERVICE_NAME;
-	es->greeting_sayHello = greeting_sayHello;
-
-    status = bundleContext_registerService(context, GREETING_SERVICE_NAME, es, NULL, &act->reg);
+	SIMPLE_SHAPE es = circleShape_create(ctx);
+	PROPERTIES props = properties_create();
+	properties_set(props, "name", "circle");
+    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
+	printf("Circle activated %d\n", status);
 	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	serviceRegistration_unregister(act->reg);
-	act->reg = NULL;
 	return CELIX_SUCCESS;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	act->reg = NULL;
 	return CELIX_SUCCESS;
 }

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png?rev=1177194&view=auto
==============================================================================
Files incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png (added) and incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle.png Thu Sep 29 07:44:24 2011 differ

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/circle/private/src/circle_shape.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,76 @@
+/*
+ * simple_shape.c
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include "bundle_context.h"
+#include "bundle.h"
+#include "hash_map.h"
+#include "simple_shape.h"
+#include "circle_shape.h"
+
+#define CIRCLE_FILE "circle.png"
+
+void circleShape_draw(SIMPLE_SHAPE shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
+
+SIMPLE_SHAPE circleShape_create(BUNDLE_CONTEXT context) {
+	BUNDLE bundle;
+	apr_pool_t *pool;
+	SIMPLE_SHAPE shape = (SIMPLE_SHAPE) malloc(sizeof(*shape));
+	bundleContext_getBundle(context, &bundle);
+	bundleContext_getMemoryPool(context, &pool);
+	shape->icon_path = NULL;
+	celix_status_t status = bundle_getEntry(bundle, CIRCLE_FILE, pool, &shape->icon_path);
+	shape->simpleShape_draw = circleShape_draw;
+	if (status == CELIX_SUCCESS) {
+		// no error
+	} else {
+		printf("Could not find resource %s\n", CIRCLE_FILE);
+	}
+	return shape;
+}
+
+void circleShape_draw(SIMPLE_SHAPE shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
+	GdkRectangle update_rect;
+	GError *gerror = NULL;
+	gsize rd = 0, wr = 0;
+	if (shape->icon_path == NULL) {
+		printf("error message: icon path unknown\n");
+	} else {
+		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
+		GdkPixbuf*curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
+		if(!curr_pix_buf) {
+			g_printerr("error message: %s\n", (gchar *) gerror->message);
+		}
+		update_rect.x = x - 5;
+		update_rect.y = y - 5;
+		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
+		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
+		gdk_pixbuf_render_to_drawable(
+				curr_pix_buf,
+				pixMap,
+				widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+				0, 0,
+				update_rect.x, update_rect.y,
+				update_rect.width,
+				update_rect.height,
+				GDK_RGB_DITHER_NONE,
+				0, 0);
+		gtk_widget_queue_draw_area (widget,
+				update_rect.x, update_rect.y,
+				update_rect.width, update_rect.height);
+	}
+}
+
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -0,0 +1,50 @@
+# 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.
+cmake_minimum_required(VERSION 2.8)
+INCLUDE(FindPkgConfig)
+cmake_policy(SET CMP0014 NEW)
+pkg_search_module (GLIB  REQUIRED glib-2.0)
+pkg_search_module (GTHR  REQUIRED gthread-2.0)
+pkg_search_module (GTK   REQUIRED gtk+-2.0)
+include_directories(
+	../circle/public/include
+	../square/public/include
+	../triangle/public/include
+	private/include
+	public/include
+	../simple/public/include
+)
+
+include_directories(${GTK_INCLUDE_DIRS})
+include_directories(${GLIB_INCLUDE_DIRS})
+include_directories(${GTHR_INCLUDE_DIRS})
+
+link_directories(${GTK_LIBRARY_DIRS})
+link_directories(${GLIB_LIBRARY_DIRS})
+link_directories(${GTHR_LIBRARY_DIRS})
+
+add_library(chapter04-paint-example SHARED 
+	private/src/activator
+	private/src/default_shape
+	private/src/paint_frame
+	private/src/shape_component
+ )
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
+target_link_libraries(chapter04-paint-example framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
+
+bundle(chapter04-paint-example FILES private/src/underc.png)

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/MANIFEST.MF?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/MANIFEST/MANIFEST.MF Thu Sep 29 07:44:24 2011
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: chapter04-paint-example
+Bundle-Version: 1.0.0
+library: chapter04-paint-example
+Import-Service: simple_shape
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/default_shape.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,15 @@
+/*
+ * default_shape.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef DEFAULT_SHAPE_H_
+#define DEFAULT_SHAPE_H_
+
+#define PAINT_FRAME_SERVICE_NAME "paint"
+
+extern SIMPLE_SHAPE defaultShape_create(BUNDLE_CONTEXT context);
+
+#endif /* DEFAULT_SHAPE_H_ */

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/paint_frame.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,40 @@
+/*
+ * paint_frame.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef PAINT_FRAME_H_
+#define PAINT_FRAME_H_
+
+static const int BOX = 54;
+
+#define PAINT_FRAME_SERVICE_NAME "paint"
+
+struct paint_frame {
+	GtkWidget *m_toolBar;
+	char *m_selected;
+	GtkWidget *m_mainPanel, *m_window, *m_drawingArea;
+	GdkPixmap *m_pixMap;
+	//SHAPE_COMPONENT *m_selectedComponent;
+	HASH_MAP m_shapes;
+	//private ActionListener m_reusableActionListener = new ShapeActionListener();
+	SIMPLE_SHAPE m_defaultShape;
+	LINKED_LIST m_shapeComponents;
+	/* methods */
+	void (*paintFrame_show)(void);
+	void (*paintFrame_selectShape)(char *name);
+	SIMPLE_SHAPE (*paintFrame_getShape)(char *name);
+	void (*paintFrame_addShape)(BUNDLE_CONTEXT context, char* name, void *icon, SIMPLE_SHAPE shape);
+	void (*paintFrame_removeShape)(char *name);
+};
+
+
+typedef struct paint_frame *PAINT_FRAME;
+extern PAINT_FRAME paintFrame_create(BUNDLE_CONTEXT context, apr_pool_t *pool);
+
+
+
+
+#endif /* PAINT_FRAME_H_ */

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/include/shape_component.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,23 @@
+/*
+ * shape_component.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef SHAPE_COMPONENT_H_
+#define SHAPE_COMPONENT_H_
+typedef struct shape_component *SHAPE_COMPONENT;
+
+struct shape_component {
+	char shapeName[30];
+	PAINT_FRAME m_frame;
+	gdouble x, y, w, h;
+	void (*shapeComponent_paintComponent)(SHAPE_COMPONENT shapeComponent, PAINT_FRAME frame,
+			GdkPixmap *pixMap, GtkWidget *widget);
+};
+
+extern SHAPE_COMPONENT shapeComponent_create(PAINT_FRAME frame, char *shapeName,
+		gdouble x, gdouble y);
+
+#endif /* SHAPE_COMPONENT_H_ */

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,113 @@
+/**
+ *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.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <apr_general.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+
+#include "bundle_activator.h"
+#include "bundle_context.h"
+#include "simple_shape.h"
+#include "paint_frame.h"
+#include "service_tracker.h"
+
+struct paintFrameActivatorData {
+	SERVICE_REGISTRATION reg;
+	apr_pool_t *pool;
+	SERVICE_TRACKER tracker;
+	BUNDLE_CONTEXT context;
+	PAINT_FRAME paint_frame;
+};
+void *addingServ(void * handle, SERVICE_REFERENCE reference);
+void addedServ(void * handle, SERVICE_REFERENCE reference, void * service);
+void modifiedServ(void * handle, SERVICE_REFERENCE reference, void * service);
+void removedServ(void * handle, SERVICE_REFERENCE reference, void * service);
+
+typedef struct paintFrameActivatorData *GREETING_ACTIVATOR;
+
+celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
+	apr_pool_t *pool;
+	GREETING_ACTIVATOR activator;
+	SERVICE_TRACKER_CUSTOMIZER cust;
+	printf("Paint_frame create\n");
+	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
+	if (status == CELIX_SUCCESS) {
+		*userData = apr_palloc(pool, sizeof(struct paintFrameActivatorData));
+		activator = *userData;
+		activator->reg = NULL;
+		activator->pool = pool;
+		activator->context = context;
+		activator->paint_frame = paintFrame_create(context, pool);
+        cust = (SERVICE_TRACKER_CUSTOMIZER) apr_palloc(pool, sizeof(*cust));
+        cust->handle = activator;
+        cust->addedService = addedServ;
+        cust->addingService = addingServ;
+        cust->modifiedService = modifiedServ;
+        cust->removedService = removedServ;
+		tracker_create(context, SIMPLE_SHAPE_SERVICE_NAME, cust, &activator->tracker);
+		tracker_open(activator->tracker);
+	}
+	return status;
+}
+
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
+	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
+	celix_status_t status = CELIX_SUCCESS;
+    status = bundleContext_registerService(ctx, PAINT_FRAME_SERVICE_NAME,
+    		act->paint_frame, NULL, &act->reg);
+	return status;
+}
+
+celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
+	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
+	tracker_close(act->tracker);
+	return CELIX_SUCCESS;
+}
+
+celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
+	struct paintFrameActivatorData * act = (struct paintFrameActivatorData *) userData;
+	return CELIX_SUCCESS;
+}
+
+void *addingServ(void * handle, SERVICE_REFERENCE ref) {
+	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
+    void *svc = NULL;
+    bundleContext_getService(data->context, ref, &svc);
+    return svc;
+}
+
+void addedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
+	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
+	char * serviceName = properties_get(ref->registration->properties, "name");
+	data->paint_frame->paintFrame_addShape(data->context, serviceName, NULL, service);
+ }
+
+void modifiedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
+	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
+	char * serviceName = properties_get(ref->registration->properties, "name");
+}
+
+void removedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
+	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
+	char * serviceName = properties_get(ref->registration->properties, "name");
+	data->paint_frame->paintFrame_removeShape(serviceName);
+}

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/default_shape.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,76 @@
+/*
+ * simple_shape.c
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include "bundle_context.h"
+#include "bundle.h"
+#include "hash_map.h"
+#include "simple_shape.h"
+#include "default_shape.h"
+#define DEFAULT_FILE "underc.png"
+
+void defaultShape_draw(SIMPLE_SHAPE shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
+
+SIMPLE_SHAPE defaultShape_create(BUNDLE_CONTEXT context) {
+	BUNDLE bundle;
+	apr_pool_t *pool;
+	SIMPLE_SHAPE shape = (SIMPLE_SHAPE) malloc(sizeof(*shape));
+	bundleContext_getBundle(context, &bundle);
+	bundleContext_getMemoryPool(context, &pool);
+	shape->icon_path = NULL;
+	celix_status_t status = bundle_getEntry(bundle, DEFAULT_FILE, pool, &shape->icon_path);
+	shape->simpleShape_draw = defaultShape_draw;
+	if (status == CELIX_SUCCESS){
+		// no error
+	} else {
+		printf("Could not find resource %s\n", DEFAULT_FILE);
+	}
+	return shape;
+}
+
+void defaultShape_draw(SIMPLE_SHAPE shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y){
+	GdkRectangle update_rect;
+	GdkPixbuf *curr_pix_buf;
+	GError *gerror = NULL;
+	gsize rd = 0, wr = 0;
+	if (shape->icon_path == NULL) {
+		printf("error message: icon path unknown\n");
+	} else {
+		gchar *gfn = g_locale_to_utf8(shape->icon_path, strlen(shape->icon_path), &rd, &wr, &gerror);
+		curr_pix_buf = gdk_pixbuf_new_from_file(gfn, &gerror);
+		if(!curr_pix_buf) {
+			g_printerr("error message: %s\n", (gchar *) gerror->message);
+		}
+		update_rect.x = x - 5;
+		update_rect.y = y - 5;
+		update_rect.width = gdk_pixbuf_get_width(curr_pix_buf);
+		update_rect.height = gdk_pixbuf_get_height(curr_pix_buf);
+		gdk_pixbuf_render_to_drawable(
+				curr_pix_buf,
+				pixMap,
+				widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+				0, 0,
+				update_rect.x, update_rect.y,
+				update_rect.width,
+				update_rect.height,
+				GDK_RGB_DITHER_NONE,
+				0, 0);
+		gtk_widget_queue_draw_area (widget,
+				update_rect.x, update_rect.y,
+				update_rect.width, update_rect.height);
+	}
+}
+
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,340 @@
+/*
+ * paint_frame.c
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+
+/**
+ * This class represents the main application class, which is a JFrame subclass
+ * that manages a toolbar of shapes and a drawing canvas. This class does not
+ * directly interact with the underlying OSGi framework; instead, it is injected
+ * with the available <tt>SimpleShape</tt> instances to eliminate any
+ * dependencies on the OSGi application programming interfaces.
+ **/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include "bundle_context.h"
+#include "bundle.h"
+#include "utils.h"
+#include "hash_map.h"
+#include "simple_shape.h"
+#include "linked_list_iterator.h"
+#include "linkedlist.h"
+#include "paint_frame.h"
+#include "shape_component.h"
+#include "default_shape.h"
+
+static PAINT_FRAME this = NULL;
+
+struct gtk_thread_data {
+	apr_pool_t *pool;
+	BUNDLE_CONTEXT context;
+};
+struct shape_info {
+	char *name;
+	SIMPLE_SHAPE m_shape;
+	GtkWidget *button;
+};
+
+typedef struct shape_info *SHAPE_INFO;
+
+
+static SHAPE_INFO shapeInfo_create(char* name, GtkWidget *button, SIMPLE_SHAPE shape){
+	SHAPE_INFO info = malloc(sizeof(*info));
+	info->m_shape = shape;
+	info->name = name;
+	info->button = button;
+	return info;
+}
+static void paintFrame_show() {
+	gtk_widget_show (this->m_drawingArea);
+	gtk_widget_show (this->m_mainPanel);
+	gtk_widget_show (this->m_toolBar);
+	gtk_widget_show (this->m_window);
+}
+
+/* main function */
+static gpointer _gtkthread(gpointer a_data) {
+	gdk_threads_enter();
+	gtk_main ();
+	gdk_threads_leave();
+	return NULL;
+}
+
+static void redraw(GtkWidget *widget, GdkModifierType state){
+	if (this->m_pixMap != NULL) {
+		GdkRectangle update_rect;
+
+		update_rect.x = 0;
+		update_rect.y = 0;
+		update_rect.width = widget->allocation.width;
+		update_rect.height = widget->allocation.height;
+		gdk_draw_rectangle (this->m_pixMap,
+				widget->style->white_gc,
+				TRUE,
+				update_rect.x, update_rect.y,
+				update_rect.width, update_rect.height);
+		gtk_widget_draw(widget, &update_rect);
+		LINKED_LIST_ITERATOR it = linkedListIterator_create(this->m_shapeComponents, 0);
+		while (linkedListIterator_hasNext(it)){
+			SHAPE_COMPONENT sc = linkedListIterator_next(it);
+			(*sc->shapeComponent_paintComponent)(sc, this, this->m_pixMap, widget);
+		}
+	}
+}
+
+
+static void button_handler( GtkWidget *widget,
+                   	   gpointer   data )
+{
+    this->m_selected = (gchar *) data;
+}
+static void destroy( GtkWidget *widget,
+                     gpointer   data )
+{
+    gtk_main_quit ();
+}
+static gboolean delete(GtkWidget *widget,
+                     gpointer   data )
+{
+    gtk_main_quit ();
+    return TRUE;
+}
+/******************************** mouse event handler *******************/
+/**
+ * notification of a mouse motion
+ */
+static gboolean
+motion_notify_event( GtkWidget *widget, GdkEventMotion *event )
+{
+  int x, y;
+  GdkModifierType state;
+  printf("motion notify event\n");
+  if (event->is_hint) {
+    gdk_window_get_pointer (event->window, &x, &y, &state);
+  } else {
+      x = event->x;
+      y = event->y;
+      state = event->state;
+    }
+  return TRUE;
+}
+/******************************** drawable event handler *******************/
+/* Redraw the screen from the backing pixmap */
+static gboolean
+expose_event( GtkWidget *widget, GdkEventExpose *event )
+{
+	printf("expose event\n");
+	gdk_draw_drawable(widget->window,
+			widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+			this->m_pixMap,
+			event->area.x, event->area.y,
+			event->area.x, event->area.y,
+			event->area.width, event->area.height);
+	return TRUE;
+}
+/* configuration events  */
+static gboolean
+configure_event( GtkWidget *widget, GdkEventConfigure *event )
+{
+  printf("configure event\n");
+  if (this->m_pixMap) {
+    g_object_unref(this->m_pixMap);
+  }
+
+  this->m_pixMap = gdk_pixmap_new(widget->window,
+              widget->allocation.width,
+              widget->allocation.height,
+              -1);
+  redraw(widget, 0);
+  return TRUE;
+}
+
+static gboolean
+button_press_event( GtkWidget *widget, GdkEventButton *event )
+{
+  if (event->button == 1 && this->m_pixMap != NULL) {
+	  if (this->m_selected == NULL){
+		 printf("no button selected yet\n");
+	  } else {
+	    SHAPE_COMPONENT sc = shapeComponent_create(this, this->m_selected, event->x, event->y);
+	    linkedList_addFirst(this->m_shapeComponents, sc);
+	    (*sc->shapeComponent_paintComponent)(sc, this, this->m_pixMap, widget);
+	  }
+  }
+  return TRUE;
+}
+
+
+/**
+ * This method sets the currently selected shape to be used for drawing on the
+ * canvas.
+ *
+ * @param name The name of the shape to use for drawing on the canvas.
+ **/
+void paintFrame_selectShape(char *name) {
+	gdk_threads_enter();
+	this->m_selected = name;
+	gdk_threads_leave();
+}
+
+/**
+ * Retrieves the available <tt>SimpleShape</tt> associated with the given
+ * name.
+ *
+ * @param name The name of the <tt>SimpleShape</tt> to retrieve.
+ * @return The corresponding <tt>SimpleShape</tt> instance if available or
+ *         <tt>null</tt>.
+ **/
+SIMPLE_SHAPE paintFrame_getShape(char *name) {
+	SHAPE_INFO info = (SHAPE_INFO) hashMap_get(this->m_shapes, name);
+	if (info == NULL) {
+		return this->m_defaultShape;
+	} else {
+		return info->m_shape;
+	}
+}
+
+/**
+ * Injects an available <tt>SimpleShape</tt> into the drawing frame.
+ *
+ * @param name The name of the injected <tt>SimpleShape</tt>.
+ * @param icon The icon associated with the injected <tt>SimpleShape</tt>.
+ * @param shape The injected <tt>SimpleShape</tt> instance.
+ **/
+void paintFrame_addShape(BUNDLE_CONTEXT context, char* name, void *icon, SIMPLE_SHAPE shape) {
+	gdk_threads_enter();
+	char png_file[30], *path;
+	GError *gerror = NULL;
+	BUNDLE bundle;
+	apr_pool_t *pool;
+	/* Add the buttons to the graph navigation panel. */
+	GtkWidget *button = gtk_button_new();
+	sprintf(png_file, "%s.png", name);
+	bundleContext_getBundle(context, &bundle);
+	bundleContext_getMemoryPool(context, &pool);
+	celix_status_t status = bundle_getEntry(bundle, png_file, pool, &path);
+	if (status == CELIX_SUCCESS) {
+		GtkWidget *im = gtk_image_new_from_file(path);
+		gtk_button_set_image((GtkButton *) button, im);
+		gsize rd = 0, wr = 0;
+		gchar *gfn = g_locale_to_utf8(name, strlen(name), &rd, &wr, &gerror);
+		//gtk_widget_set_size_request(button, 10, 10);
+		gtk_button_set_label((GtkButton *) button, gfn);
+		gtk_box_pack_start (GTK_BOX(this->m_toolBar), button, TRUE, TRUE, 0);
+	} else {
+		printf("Cannot find resource %s\n", png_file);
+	}
+	g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (button_handler), name);
+	gtk_widget_show(button);
+	if (hashMap_get(this->m_shapes, name) == NULL) {
+		hashMap_put(this->m_shapes, name, shapeInfo_create(name, button, shape));
+	}
+	redraw(this->m_drawingArea, 0);
+	paintFrame_show();
+	gdk_threads_leave();
+}
+
+/**
+ * Removes a no longer available <tt>SimpleShape</tt> from the drawing frame.
+ *
+ * @param name The name of the <tt>SimpleShape</tt> to remove.
+ **/
+void paintFrame_removeShape(char *name) {
+	gdk_threads_enter();
+	SHAPE_INFO shape = (SHAPE_INFO) hashMap_remove(this->m_shapes, name);
+	this->m_selected = NULL;
+	gtk_container_remove(GTK_CONTAINER(this->m_toolBar), shape->button);
+	gtk_widget_show_all(this->m_toolBar);
+	redraw(this->m_drawingArea, 0);
+	paintFrame_show();
+	gdk_threads_leave();
+}
+
+
+/**
+ * Default constructor that populates the main window.
+ **/
+PAINT_FRAME paintFrame_create(BUNDLE_CONTEXT context, apr_pool_t *pool) {
+	GError *error = NULL;
+	GThread *l_th;
+	struct gtk_thread_data *data = apr_palloc(pool, sizeof(*data));
+	data->pool = pool;
+	data->context = context;
+	this = malloc(sizeof(*this));
+	/* set the methods */
+	this->paintFrame_addShape = paintFrame_addShape;
+	this->paintFrame_getShape = paintFrame_getShape;
+	this->paintFrame_removeShape = paintFrame_removeShape;
+	this->paintFrame_selectShape = paintFrame_selectShape;
+	this->paintFrame_show = paintFrame_show;
+	this->m_selected = NULL;
+	this->m_pixMap = NULL;
+	g_thread_init(NULL);
+	gdk_threads_init();
+	gtk_init(NULL, NULL);
+	this->m_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	gtk_container_set_border_width (GTK_CONTAINER (this->m_window), 10);
+	gtk_window_set_title (GTK_WINDOW (this->m_window), "OSGi in Action, Paint-Example");
+
+	g_signal_connect (G_OBJECT (this->m_window), "delete_event",
+			G_CALLBACK (delete), NULL);
+
+	g_signal_connect (G_OBJECT (this->m_window), "destroy",
+			G_CALLBACK (destroy), NULL);
+	/* Create the graph navigation panel and add it to the window. */
+	this->m_toolBar = gtk_hbox_new (FALSE, 0);
+	this->m_mainPanel = gtk_vbox_new(FALSE, 0);
+
+	gtk_container_add  (GTK_CONTAINER (this->m_window), this->m_mainPanel);
+
+
+	this->m_drawingArea = gtk_drawing_area_new();
+
+	gtk_signal_connect (GTK_OBJECT (this->m_drawingArea), "expose_event",
+			(GtkSignalFunc) expose_event, NULL);
+	gtk_signal_connect (GTK_OBJECT(this->m_drawingArea),"configure_event",
+			(GtkSignalFunc) configure_event, NULL);
+	gtk_signal_connect (GTK_OBJECT (this->m_drawingArea), "motion_notify_event",
+			(GtkSignalFunc) motion_notify_event, NULL);
+	gtk_signal_connect (GTK_OBJECT (this->m_drawingArea), "button_press_event",
+			(GtkSignalFunc) button_press_event, NULL);
+
+	gtk_widget_set_events (this->m_drawingArea, GDK_EXPOSURE_MASK
+			| GDK_LEAVE_NOTIFY_MASK
+			| GDK_BUTTON_PRESS_MASK
+			| GDK_POINTER_MOTION_MASK
+			| GDK_POINTER_MOTION_HINT_MASK);
+
+	gtk_drawing_area_size(this->m_drawingArea, 200, 200);
+
+	/*Add the graph navigation panel to the main panel. */
+	gtk_box_pack_start (GTK_BOX(this->m_mainPanel), this->m_toolBar, TRUE, TRUE, 0);
+	/* Add the draw-able area to the main panel. */
+	gtk_box_pack_start (GTK_BOX(this->m_mainPanel), this->m_drawingArea, TRUE, TRUE, 0);
+
+	this->m_shapes = hashMap_create(string_hash, NULL, string_equals, NULL);
+	linkedList_create(data->pool, &this->m_shapeComponents);
+	this->m_defaultShape = defaultShape_create(data->context);
+	paintFrame_show();
+	if( g_thread_supported()) {
+		l_th = g_thread_create(_gtkthread, data, TRUE, &error);
+		if (l_th == NULL){
+			g_printerr ("Failed to create thread: %s\n", error->message);
+			return NULL;
+		}
+	} else {
+		g_printerr("g_thread NOT supported\n");
+	}
+	return this;
+}
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/shape_component.c Thu Sep 29 07:44:24 2011
@@ -0,0 +1,50 @@
+/*
+ * shape_component.c
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#include <stdio.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include "bundle_context.h"
+#include "utils.h"
+#include "linkedlist.h"
+#include "hash_map.h"
+#include "simple_shape.h"
+#include "paint_frame.h"
+#include "shape_component.h"
+
+extern void shapeComponent_paintComponent(SHAPE_COMPONENT shapeComponent, PAINT_FRAME frame,
+		GdkPixmap *pixMap, GtkWidget *widget);
+
+SHAPE_COMPONENT shapeComponent_create(PAINT_FRAME frame, char *shapeName,
+		gdouble x, gdouble y) {
+	SHAPE_COMPONENT shape = malloc(sizeof(*shape));
+	shape->m_frame = frame;
+	strcpy(shape->shapeName, shapeName);
+	shape->x = x - BOX /2;
+	shape->y = y - BOX /2;
+	shape->w = BOX;
+	shape->h = BOX;
+	/* methods */
+	shape->shapeComponent_paintComponent = shapeComponent_paintComponent;
+	return shape;
+}
+
+void shapeComponent_paintComponent(SHAPE_COMPONENT shapeComponent, PAINT_FRAME frame,
+		GdkPixmap *pixMap, GtkWidget *widget) {
+	SIMPLE_SHAPE shape = frame->paintFrame_getShape(shapeComponent->shapeName);
+	if (shape == NULL) {
+		g_printerr("cannot find shape %s\n", shapeComponent->shapeName);
+	} else {
+		(*shape->simpleShape_draw)(shape, pixMap, widget,
+				shapeComponent->x, shapeComponent->y);
+	}
+}

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png?rev=1177194&view=auto
==============================================================================
Files incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png (added) and incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/underc.png Thu Sep 29 07:44:24 2011 differ

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/simple/public/include/simple_shape.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,22 @@
+/*
+ * simple_shape.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef SIMPLE_SHAPE_H_
+#define SIMPLE_SHAPE_H_
+
+struct simple_shape {
+	char *icon_path;
+	char *name;
+	void (*simpleShape_draw) (struct simple_shape *shape, GdkPixmap *pixMap, GtkWidget *widget, gdouble x, gdouble y);
+};
+
+typedef struct simple_shape *SIMPLE_SHAPE;
+
+#define SIMPLE_SHAPE_SERVICE_NAME "simple_shape"
+
+
+#endif /* SIMPLE_SHAPE_H_ */

Copied: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt (from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt?p2=incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt&p1=incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt&r1=1177180&r2=1177194&rev=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-correct-listener/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/CMakeLists.txt Thu Sep 29 07:44:24 2011
@@ -14,10 +14,31 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+cmake_minimum_required(VERSION 2.8)
+INCLUDE(FindPkgConfig)
+cmake_policy(SET CMP0014 NEW)
+pkg_search_module (GLIB  REQUIRED glib-2.0)
+pkg_search_module (GTHR  REQUIRED gthread-2.0)
+pkg_search_module (GTK   REQUIRED gtk+-2.0)
+include_directories(
+	private/include
+	public/include
+	../simple/public/include
+)
+include_directories(${GTK_INCLUDE_DIRS})
+include_directories(${GLIB_INCLUDE_DIRS})
+include_directories(${GTHR_INCLUDE_DIRS})
 
-add_library(chapter04-correct-listener SHARED private/src/activator)
+link_directories(${GTK_LIBRARY_DIRS})
+link_directories(${GLIB_LIBRARY_DIRS})
+link_directories(${GTHR_LIBRARY_DIRS})
+
+add_library(square SHARED 
+ private/src/activator
+ private/src/square_shape
+)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(chapter04-correct-listener framework)
+target_link_libraries(square framework ${GLIB_LIBRARIES} ${GTK_LIBRARIES} ${GTHR_LIBRARIES})
 
-bundle(chapter04-correct-listener)
+bundle(square FILES private/src/square.png)

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/MANIFEST.MF?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/MANIFEST.MF (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/MANIFEST/MANIFEST.MF Thu Sep 29 07:44:24 2011
@@ -0,0 +1,7 @@
+Bundle-SymbolicName: square
+Bundle-Version: 1.0.0
+library: square
+Export-Service: simple_shape
+Import-Service: simple_shape
+
+

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h?rev=1177194&view=auto
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h (added)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/include/square_shape.h Thu Sep 29 07:44:24 2011
@@ -0,0 +1,13 @@
+/*
+ * default_shape.h
+ *
+ *  Created on: Aug 22, 2011
+ *      Author: operator
+ */
+
+#ifndef SQUARE_SHAPE_H_
+#define SQUARE_SHAPE_H_
+
+extern SIMPLE_SHAPE squareShape_create(BUNDLE_CONTEXT context);
+
+#endif /* SQUARE_SHAPE_H_ */

Copied: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c (from r1177180, incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c?p2=incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c&p1=incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c&r1=1177180&r2=1177194&rev=1177194&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter01-greeting-example/greeting/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/activator.c Thu Sep 29 07:44:24 2011
@@ -20,55 +20,52 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <apr_general.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
 
 #include "bundle_activator.h"
 #include "bundle_context.h"
-#include "greeting_impl.h"
-#include "greeting_service.h"
-#include "service_registration.h"
+#include "simple_shape.h"
+#include "square_shape.h"
+#include "simple_shape.h"
 
-struct greetingActivator {
+struct squareActivator {
 	SERVICE_REGISTRATION reg;
 	apr_pool_t *pool;
 };
 
-typedef struct greetingActivator *GREETING_ACTIVATOR;
+typedef struct squareActivator *GREETING_ACTIVATOR;
 
 celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
 	apr_pool_t *pool;
 	GREETING_ACTIVATOR activator;
 	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
 	if (status == CELIX_SUCCESS) {
-		*userData = apr_palloc(pool, sizeof(struct greetingActivator));
+		*userData = apr_palloc(pool, sizeof(struct squareActivator));
 		activator = *userData;
 		activator->reg = NULL;
 		activator->pool = pool;
+		printf("Square created\n");
 	}
 	return status;
 }
 
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
+celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT ctx) {
+	struct squareActivator * act = (struct squareActivator *) userData;
 	celix_status_t status = CELIX_SUCCESS;
-	GREETING_SERVICE es = apr_palloc(act->pool, sizeof(*es));
-	es->instance = apr_palloc(act->pool, sizeof(*es->instance));
-	es->instance->name = GREETING_SERVICE_NAME;
-	es->greeting_sayHello = greeting_sayHello;
-
-    status = bundleContext_registerService(context, GREETING_SERVICE_NAME, es, NULL, &act->reg);
+	SIMPLE_SHAPE es = squareShape_create(ctx);
+	PROPERTIES props = properties_create();
+	properties_set(props, "name", "square");
+    status = bundleContext_registerService(ctx, SIMPLE_SHAPE_SERVICE_NAME, es, props, &act->reg);
+	printf("Square start\n");
 	return status;
 }
 
 celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	celix_status_t status = CELIX_SUCCESS;
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	serviceRegistration_unregister(act->reg);
-	act->reg = NULL;
 	return CELIX_SUCCESS;
 }
 
 celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	struct greetingActivator * act = (struct greetingActivator *) userData;
-	act->reg = NULL;
 	return CELIX_SUCCESS;
 }

Added: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png?rev=1177194&view=auto
==============================================================================
Files incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png (added) and incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/square/private/src/square.png Thu Sep 29 07:44:24 2011 differ