ace-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erik van der velden <Erik.vanderVel...@tomtom.com>
Subject Starting the refactored Management Agent in ACE 1.0.0
Date Wed, 14 Aug 2013 09:16:34 GMT
Hi all,

I'm quite new to ACE and OSGi, so I hope I do not embarrass myself too
much with stupid questions :-)

I've downloaded ACE 1.0.0 and am trying to start the management agent
using the org.apache.ace.agent.launcher package.
Mainly because I thought this was an improved version of the old
management agent which had code scattered all over the place.

I had some problems that I fixed and some questions. I hope you can help
me out.

1) there seems to be a bug in the reading of the framework properties;

          Map<String, Object> frameworkProperties = new HashMap<String,
Object>();
          for (Entry<String, String> entry : m_configuration.entrySet())
{
              if (entry.getKey().startsWith("framework.")) {
                  String frameworkKey =
entry.getKey().replaceFirst("framework.", "");
                  String frameworkValue =
m_configuration.get(entry.getValue());
                  frameworkProperties.put(frameworkKey, frameworkValue);
              }
          }

should be 

          Map<String, Object> frameworkProperties = new HashMap<String,
Object>();
          for (Entry<String, String> entry : m_configuration.entrySet())
{
              if (entry.getKey().startsWith("framework.")) {
                  String frameworkKey =
entry.getKey().replaceFirst("framework.", "");
                  String frameworkValue = entry.getValue(); // use entry
value directly
                  frameworkProperties.put(frameworkKey, frameworkValue);
              }
          }


2) The agent that is started does not properly report all the audit
events.
I managed to trace this back to the fact that no EventAdmin was present.
Which means that the deployment events were lost.
I updated the bnd.bnd file of the agent to include the felix eventadmin
(and related stuff, like the concurrent library).
With this packaged, it now reports the events and in the ACE web client
I can now also see the installed version.


3) I do not like the default packaging of the MA, but I do like the
configurability and the fact that configuration does not go via system
properties.
What I do not like is that the MA is started as part of the framework. 
I thought that for later upgradability it should be just a bundle,
right?
I tried to change the launcher to installing MA as  a bundle; e.g.,

Bundle agent = context.installBundle("file:org.apache.ace.agent.jar");
agent.start();

However, then I do not seem to be able to invoke the
ManagementAgentFactory from the main due to class loading problems.
I can lookup the service from the main, but not invoke it;
>  java.lang.ClassCastException:
org.apache.ace.agent.impl.ManagementAgentFactoryImpl cannot be cast to
org.apache.ace.agent.ManagementAgentFactory
Probably due to two different versions of the ManagementAgentFactory
class.

This is where my knowledge of OSGi lacks.
I need to get the configuration from the command-line to the MA bundle
somehow, but I do not know I can get the framework to import (?) from
the MA bundle so they share the same definition of the
ManagentAgentFactory class.
I tried exporting it from the framework by adding the agent package to
packages.extra configuration and importing it from the MA again. This
did not work. The classcase is gone, instead the service can not be
found anymore. But to be honest, I do not know exactly what I'm
doing :-)

Any help would be appreciated. Or you can convince me that it is right
to start the MA as part of the framework : -)

4) The next step was going to be to deploy the eventadmin and dependancy
manager etc as separate bundles instead of combining all in a big MA
bundle and have a lean and mean MA bundle.

Is that a good way to go?


Thanks for any advice you can give me.

Kind regards,   Erik van der Velden


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message