Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Running example timeservice in Apache Karaf.

Jan,
Scott's approach below is a good way to get it to run for an initial test. 

I found that exporting from Eclipse was more manual than I wanted.  Since
the host will only be used on Karaf, I elected to build out a maven pom
setup that built the host and exported it into my local m2 repo.  Then I
only install the bundle once in karaf, after that I simply update it, which
is faster for me.  When I finish my current push to get a production release
of my product to testers, I'm going to look at further host side automation
through maven's deploy target.

I use maven with org.apache.felix/maven-bundle-plugin to build OSGi bundles
for non-Eclipse frameworks and Tyco if building for Eclipse clients.

Reply back if you want a couple of simple maven pom files as examples.

Tim


-----Original Message-----
From: ecf-dev-bounces@xxxxxxxxxxx [mailto:ecf-dev-bounces@xxxxxxxxxxx] On
Behalf Of Scott Lewis
Sent: Sunday, March 8, 2015 05:58
To: ecf-dev@xxxxxxxxxxx
Subject: Re: [ecf-dev] Running example timeservice in Apache Karaf.

On 3/7/2015 10:08 AM, Jan J. Roman wrote:
> Hello All,
> I am trying to familiarize myself with ECF and its capabilities.
>
> I succeed in running com.mycorp.examples.timeservice.host and 
> com.mycorp.examples.timeservice.consumer in Eclipse using projects from:
> https://github.com/eclipse/ecf/
>
> Now I would like to run host in karaf and consumer in eclipse to 
> verify service can communicate trough network.
>
> I was able to install ECF in karaf and start service 
> "ecf.rs.examples.timeservice". I guess next step is to start host 
> implementation service in karaf.

Yes.  I've done this myself in Karaf (just yesterday for smoke testing prior
to ECF's 3.9.3 release).  The way that I do it is to just start the
Timeservice Host bundle (com.mycorp.example.timeservice.host) via 
the webconsole.   If you do this also, before doing so you might want to 
turn on the following system property (i.e. set it to true)

-DverboseRemoteServiceAdmin=true

This will result in some more information about the export to the system
console when the timeservice host bundle is started. BTW...just FYI, the use
of this property is in the host bundle Activator class.

>
> Here is my peoblem as I have no idea how to do that ;-) Project 
> com.mycorp.examples.timeservice.host doesn't seem to have any build 
> script (ant/maven/gradle) how I can actually produce artefact which 
> can be used in Karaf runtime?

Assuming you are using Eclipse, you can do a couple of things locally 
via your workspace (as opposed to some sort of shared builder 
infrastructure):

1) If your service host is in a single or a few bundle, you could simply
     a) Select the project in your workspace
     b) Choose File->Export...->Plug-in Development->Deployable plug-ins 
and fragments
This will let you create a jar for each project, and these jars can be 
installed into Karaf directly (via Webconsole again would be my 
suggestion).  Note that you don't/wouldn't have to create any Karaf 
feature meta-data to do this...in Karaf's Web Console you can install 
individual bundles in addition to features.

2) You can create an Eclipse feature with as many bundles as you like, 
and then choose
    a) File->Export...->Plug-in Development->Deployable features
This will create a full p2 repository, which will have the bundle jars 
present in the <repository home>/plugins directory.  You can then 
install into Karaf via the individual bundle technique (as per above), 
OR you can could create a karaf feature.   For example/your reference I 
create a Karaf feature from this template [1].  This is what you used to 
install the ecf.rs.sdk Karaf feature and the ecf.rs.examples.timeservice 
examples into Karaf.

I tried fairly recently to use the Karaf Eclipse Integration plugins 
[2], but I couldn't get them to install into the version of Eclipse that 
I use, so I gave up.   I had thought that perhaps that tooling would 
generate Karaf features more easily that this 'template' approach that 
we are currently using for installing into Karaf. Also, you probably 
want to setup a target platform for Karaf, and I thought that the EI 
tooling might do that.  Perhaps it does, but I haven't gotten far enough 
with it to find out.

I raised a question about this tooling on the Karaf users mailing list, 
but there wasn't much response.   In short I don't know anything more 
about the Karaf Eclipse Integration.  I've contemplated engaging the 
Karaf team on fixing/updating the Karaf Eclipse Integration tooling 
and/or doing some work on it myself, but currently I don't have the 
resources to do.

I imagine that you could use easily the ECF maven repo to install the 
sdk  and/or your own bundles into Karaf as well [3].  I haven't done 
this myself though so I can't really say what's involved. There are 
other ECF committers and contributors that could respond here that know 
far more about maven and/or Tycho than I do.

 >Could you please give me some hints how to build host service and run 
it in karaf?

Hopefully the above helps.  If I can answer any other questions I will 
try to do so, but I'm not one of the Karaf developers so am a little 
limited in that area.

Scott

[1] 
http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/releng/org.eclipse.ecf
.releng.bm/karaf/templates/rssdk
[2] http://karaf.apache.org/index/subprojects/eik.html
[3] http://build.ecf-project.org/maven/3.9.3/

_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/ecf-dev


Back to the top