[osgi-dev] How to set up logging in OSGi

2018-08-07 Thread Christian Schneider via osgi-dev
I just finished a small article and example for how to setup logging in
OSGi using the new Apache Felix logback bundle.

Article
http://blog.liquid-reality.de/2018/08/07/logging-osgi.html

Example
https://github.com/cschneider/osgi-ds-hello-world

Apache Felix logback
http://felix.apache.org/documentation/subprojects/apache-felix-logback.html

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Nhut Thai Le via osgi-dev
Thanks Tim,

I overlooked this one will try it out.

Thai

On Tue, Aug 7, 2018 at 12:56 PM, Tim Ward  wrote:

> According to the documentation KeyCloak can be provided as a Servlet
> Filter, which would avoid the need for a web.xml/WAB. https://www.
> keycloak.org/docs/2.5/securing_apps/topics/oidc/
> java/servlet-filter-adapter.html#_servlet_filter_adapter
>
> Best Regards,
>
> Tim
>
> Sent from my iPhone
>
> On 7 Aug 2018, at 17:31, Nhut Thai Le  wrote:
>
> KeycloakSecurityContext
>
>


-- 
Castor Technologies Inc
460 rue St-Catherine St Ouest, Suite 613
Montréal, Québec H3B-1A7
(514) 360-7208 o
(514) 798-2044 f
n...@castortech.com
www.castortech.com

CONFIDENTIALITY NOTICE: The information contained in this e-mail is
confidential and may be proprietary information intended only for the use
of the individual or entity to whom it is addressed. If the reader of this
message is not the intended recipient, you are hereby notified that any
viewing, dissemination, distribution, disclosure, copy or use of the
information contained in this e-mail message is strictly prohibited. If you
have received and/or are viewing this e-mail in error, please immediately
notify the sender by reply e-mail, and delete it from your system without
reading, forwarding, copying or saving in any manner. Thank you.
AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est
confidentiel, peut être protégé par le secret professionnel et est réservé
à l'usage exclusif du destinataire. Toute autre personne est par les
présentes avisée qu'il lui est strictement interdit de diffuser, distribuer
ou reproduire ce message. Si vous avez reçu cette communication par erreur,
veuillez la détruire immédiatement et en aviser l'expéditeur. Merci.
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Tim Ward via osgi-dev
According to the documentation KeyCloak can be provided as a Servlet Filter, 
which would avoid the need for a web.xml/WAB. 
https://www.keycloak.org/docs/2.5/securing_apps/topics/oidc/java/servlet-filter-adapter.html#_servlet_filter_adapter

Best Regards,

Tim

Sent from my iPhone

> On 7 Aug 2018, at 17:31, Nhut Thai Le  wrote:
> 
> KeycloakSecurityContext
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Nhut Thai Le via osgi-dev
Thanks Tim,

My bad not explaining the situation well, it's actually not the filter
itself but rather what the filter uses that prevent me from using
whiteboard .
My servlet filter is using some attributes on the request set by keycloak
authenticator:

public void doFilter(final ServletRequest request, final ServletResponse
response, final FilterChain chain)
throws IOException, ServletException {

Object kcSecurityContext =
request.getAttribute(KeycloakSecurityContext.class.getName());

Keycloak authenticator is registered with the web container by the
following tag in web.xml:

KEYCLOAK
realm1

it also need a special json file in the WEB-INF providing info about of the
authentication server.
The keycloak authenticator seem to be applied to the whole web app instead
of a servlet.


Thai

On Tue, Aug 7, 2018 at 11:37 AM, Tim Ward  wrote:

> You are aware that Servlet Filters are also supported by the whiteboard?
> See https://osgi.org/specification/osgi.cmpn/7.0.0/
> service.http.whiteboard.html#d0e121055
>
> Just to reiterate my warning, continuing to develop a WAB will
> significantly affect your ability to reliably take advantage of OSGi
> specifications and services from your web code going forward. If you do
> have more problems then you will likely find that the future advice from
> this list is that you should migrate away from using a WAB.
>
> Best Regards,
>
> Tim
>
> On 7 Aug 2018, at 16:12, Nhut Thai Le  wrote:
>
> Thanks Tim,
>
> I'll stick with the WAB for now and use the BundleContext to get my
> service since I need to config some security filter on the web.xml.
>
> Thai
>
> On Tue, Aug 7, 2018 at 4:15 AM, Tim Ward  wrote:
>
>> Hi,
>>
>> I’m afraid that if you’re using a WAB file then you absolutely can’t use
>> DS, and vice versa. The Web Application Bundle specification exists as a
>> mechanism to allow people to move from a non-OSGi world into OSGi, and
>> there are a number of restrictions as a result. The one that you’re hitting
>> is that in a Web Application the Servlet container is responsible for
>> instantiating and managing the lifecycle of the Servlet instances. As a
>> result you are getting two instances created, one by DS which is injecting
>> the AdminBroker service, and one by the Servlet Container which isn’t
>> injecting anything.
>>
>> Assuming that this is a new project then by far the simplest way to fix
>> this is to completely avoid making a WAB, and just to use the Http
>> Whiteboard. This will simplify things immensely, and handle the service
>> dynamics easily. If you can’t avoid using the WAB then you do have access
>> to the BundleContext in your ServletContext (see
>> https://osgi.org/specification/osgi.cmpn/7.0.0/service.war.html#d0e101441).
>> You would have to use this to get the service you want to use (and release
>> it, and deal with what happens if it isn’t available).
>>
>> In summary, WABs exist for specific use cases when you can’t be properly
>> modular, or for when you have to work both inside and outside OSGi. It’s
>> not recommended to use them as your first development option.
>>
>> I wish you luck with your experiments!
>>
>> Best Regards,
>>
>> Tim
>>
>> On 6 Aug 2018, at 22:10, Nhut Thai Le  wrote:
>>
>> Hi Tim,
>>
>> The servlet is inside a WAB file which has a web.xml:
>>
>> 
>> http://java.sun.com/xml/ns/javaee;
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd;
>>  version="3.0">
>> 
>> HelloWorld
>> com.webapp.HelloWorld
>> 
>>
>> 
>> HelloWorld
>> /
>> 
>> 
>>
>> I'm not trying to use the whiteboard pattern in the first place but
>> rather looking for a way to inject my AdminBroker service into my servlet
>> so I turn my servlet into a component in order to use the reference.
>>
>> Thai
>>
>>
>> On Mon, Aug 6, 2018 at 4:44 PM, Tim Ward  wrote:
>>
>>> I don’t see any Http Service whiteboard properties on the Servlet
>>> component. How are you registering it with the Servlet container?
>>>
>>> Tim
>>>
>>> Sent from my iPhone
>>>
>>> On 6 Aug 2018, at 16:22, Nhut Thai Le via osgi-dev <
>>> osgi-dev@mail.osgi.org> wrote:
>>>
>>> Hello,
>>>
>>> I have a servlet defined like this:
>>>
>>> @Component(service = Servlet.class)
>>> public class HelloWorld extends HttpServlet {
>>> @Reference(cardinality = ReferenceCardinality.MANDATORY)
>>> private AdminBroker adminBroker;
>>>
>>> protected void doGet(HttpServletRequest request, HttpServletResponse
>>> response) throws ServletException, IOException {
>>> adminBroker.doSomething();
>>> }
>>> }
>>>
>>> My AdminBroker implementation looks like:
>>> @Component(service=AdminBroker.class)
>>> public class AdminBrokerImpl implements AdminBroker {
>>> @Activate
>>> private void init() {
>>> String param1 = "some text";
>>> }
>>> }
>>>
>>> When I started the env (felix 6 with pax-web), I can see the AdminBroker
>>> instantiated (hit a break point 

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Tim Ward via osgi-dev
You are aware that Servlet Filters are also supported by the whiteboard? See 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121055
 


Just to reiterate my warning, continuing to develop a WAB will significantly 
affect your ability to reliably take advantage of OSGi specifications and 
services from your web code going forward. If you do have more problems then 
you will likely find that the future advice from this list is that you should 
migrate away from using a WAB.

Best Regards,

Tim

> On 7 Aug 2018, at 16:12, Nhut Thai Le  wrote:
> 
> Thanks Tim,
> 
> I'll stick with the WAB for now and use the BundleContext to get my service 
> since I need to config some security filter on the web.xml.
> 
> Thai
> 
> On Tue, Aug 7, 2018 at 4:15 AM, Tim Ward  > wrote:
> Hi,
> 
> I’m afraid that if you’re using a WAB file then you absolutely can’t use DS, 
> and vice versa. The Web Application Bundle specification exists as a 
> mechanism to allow people to move from a non-OSGi world into OSGi, and there 
> are a number of restrictions as a result. The one that you’re hitting is that 
> in a Web Application the Servlet container is responsible for instantiating 
> and managing the lifecycle of the Servlet instances. As a result you are 
> getting two instances created, one by DS which is injecting the AdminBroker 
> service, and one by the Servlet Container which isn’t injecting anything.
> 
> Assuming that this is a new project then by far the simplest way to fix this 
> is to completely avoid making a WAB, and just to use the Http Whiteboard. 
> This will simplify things immensely, and handle the service dynamics easily. 
> If you can’t avoid using the WAB then you do have access to the BundleContext 
> in your ServletContext (see 
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.war.html#d0e101441 
> ). 
> You would have to use this to get the service you want to use (and release 
> it, and deal with what happens if it isn’t available).
> 
> In summary, WABs exist for specific use cases when you can’t be properly 
> modular, or for when you have to work both inside and outside OSGi. It’s not 
> recommended to use them as your first development option.
> 
> I wish you luck with your experiments!
> 
> Best Regards,
> 
> Tim
> 
>> On 6 Aug 2018, at 22:10, Nhut Thai Le > > wrote:
>> 
>> Hi Tim,
>> 
>> The servlet is inside a WAB file which has a web.xml:
>> 
>> 
>> http://java.sun.com/xml/ns/javaee 
>> "
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>> "
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
>>  
>> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd 
>> "
>>  version="3.0">
>>  
>>  HelloWorld
>>  com.webapp.HelloWorld
>>  
>> 
>>  
>>  HelloWorld
>>  /
>>  
>> 
>> 
>> I'm not trying to use the whiteboard pattern in the first place but rather 
>> looking for a way to inject my AdminBroker service into my servlet so I turn 
>> my servlet into a component in order to use the reference.
>> 
>> Thai
>> 
>> 
>> On Mon, Aug 6, 2018 at 4:44 PM, Tim Ward > > wrote:
>> I don’t see any Http Service whiteboard properties on the Servlet component. 
>> How are you registering it with the Servlet container?
>> 
>> Tim
>> 
>> Sent from my iPhone
>> 
>> On 6 Aug 2018, at 16:22, Nhut Thai Le via osgi-dev > > wrote:
>> 
>>> Hello,
>>> 
>>> I have a servlet defined like this:
>>> 
>>> @Component(service = Servlet.class)
>>> public class HelloWorld extends HttpServlet {
>>> @Reference(cardinality = ReferenceCardinality.MANDATORY)
>>> private AdminBroker adminBroker;
>>> 
>>> protected void doGet(HttpServletRequest request, HttpServletResponse 
>>> response) throws ServletException, IOException {   
>>> adminBroker.doSomething();
>>> }
>>> }
>>> 
>>> My AdminBroker implementation looks like:
>>> @Component(service=AdminBroker.class)
>>> public class AdminBrokerImpl implements AdminBroker {
>>> @Activate
>>> private void init() {
>>> String param1 = "some text";
>>> }
>>> }
>>> 
>>> When I started the env (felix 6 with pax-web), I can see the AdminBroker 
>>> instantiated (hit a break point in the init of my AdminBroker 
>>> implementation) but when the web request arrives and the doGet method is 
>>> called, the adminBroker is null.
>>> 
>>> Does anyone have an idea what may go wrong here?
>>> 
>>> Thai Le
>>> 
>>> -- 
>>> Castor Technologies Inc
>>> 460 rue St-Catherine St 
>>> 

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Nhut Thai Le via osgi-dev
Thanks Tim,

I'll stick with the WAB for now and use the BundleContext to get my service
since I need to config some security filter on the web.xml.

Thai

On Tue, Aug 7, 2018 at 4:15 AM, Tim Ward  wrote:

> Hi,
>
> I’m afraid that if you’re using a WAB file then you absolutely can’t use
> DS, and vice versa. The Web Application Bundle specification exists as a
> mechanism to allow people to move from a non-OSGi world into OSGi, and
> there are a number of restrictions as a result. The one that you’re hitting
> is that in a Web Application the Servlet container is responsible for
> instantiating and managing the lifecycle of the Servlet instances. As a
> result you are getting two instances created, one by DS which is injecting
> the AdminBroker service, and one by the Servlet Container which isn’t
> injecting anything.
>
> Assuming that this is a new project then by far the simplest way to fix
> this is to completely avoid making a WAB, and just to use the Http
> Whiteboard. This will simplify things immensely, and handle the service
> dynamics easily. If you can’t avoid using the WAB then you do have access
> to the BundleContext in your ServletContext (see https://osgi.org/
> specification/osgi.cmpn/7.0.0/service.war.html#d0e101441). You would have
> to use this to get the service you want to use (and release it, and deal
> with what happens if it isn’t available).
>
> In summary, WABs exist for specific use cases when you can’t be properly
> modular, or for when you have to work both inside and outside OSGi. It’s
> not recommended to use them as your first development option.
>
> I wish you luck with your experiments!
>
> Best Regards,
>
> Tim
>
> On 6 Aug 2018, at 22:10, Nhut Thai Le  wrote:
>
> Hi Tim,
>
> The servlet is inside a WAB file which has a web.xml:
>
> 
> http://java.sun.com/xml/ns/javaee;
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd;
>  version="3.0">
> 
> HelloWorld
> com.webapp.HelloWorld
> 
>
> 
> HelloWorld
> /
> 
> 
>
> I'm not trying to use the whiteboard pattern in the first place but rather
> looking for a way to inject my AdminBroker service into my servlet so I
> turn my servlet into a component in order to use the reference.
>
> Thai
>
>
> On Mon, Aug 6, 2018 at 4:44 PM, Tim Ward  wrote:
>
>> I don’t see any Http Service whiteboard properties on the Servlet
>> component. How are you registering it with the Servlet container?
>>
>> Tim
>>
>> Sent from my iPhone
>>
>> On 6 Aug 2018, at 16:22, Nhut Thai Le via osgi-dev <
>> osgi-dev@mail.osgi.org> wrote:
>>
>> Hello,
>>
>> I have a servlet defined like this:
>>
>> @Component(service = Servlet.class)
>> public class HelloWorld extends HttpServlet {
>> @Reference(cardinality = ReferenceCardinality.MANDATORY)
>> private AdminBroker adminBroker;
>>
>> protected void doGet(HttpServletRequest request, HttpServletResponse
>> response) throws ServletException, IOException {
>> adminBroker.doSomething();
>> }
>> }
>>
>> My AdminBroker implementation looks like:
>> @Component(service=AdminBroker.class)
>> public class AdminBrokerImpl implements AdminBroker {
>> @Activate
>> private void init() {
>> String param1 = "some text";
>> }
>> }
>>
>> When I started the env (felix 6 with pax-web), I can see the AdminBroker
>> instantiated (hit a break point in the init of my AdminBroker
>> implementation) but when the web request arrives and the doGet method is
>> called, the adminBroker is null.
>>
>> Does anyone have an idea what may go wrong here?
>>
>> Thai Le
>>
>> --
>> Castor Technologies Inc
>> 460 rue St-Catherine St
>> 
>> Ouest, Suite 613
>> Montréal, Québec H3B-1A7
>> (514) 360-7208 o
>> (514) 798-2044 f
>> n...@castortech.com
>> www.castortech.com
>>
>> CONFIDENTIALITY NOTICE: The information contained in this e-mail is
>> confidential and may be proprietary information intended only for the use
>> of the individual or entity to whom it is addressed. If the reader of this
>> message is not the intended recipient, you are hereby notified that any
>> viewing, dissemination, distribution, disclosure, copy or use of the
>> information contained in this e-mail message is strictly prohibited. If you
>> have received and/or are viewing this e-mail in error, please immediately
>> notify the sender by reply e-mail, and delete it from your system without
>> reading, forwarding, copying or saving in any manner. Thank you.
>> AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est
>> confidentiel, peut être protégé par le secret professionnel et est réservé
>> à l'usage exclusif du destinataire. Toute autre personne est par les
>> présentes avisée qu'il lui est strictement interdit de diffuser, distribuer
>> ou reproduire ce message. Si vous avez reçu cette communication par erreur,
>> veuillez la détruire immédiatement et en aviser 

Re: [osgi-dev] Enabling debug of SCR with Equinox

2018-08-07 Thread Alain Picard via osgi-dev
Thanks Ray and Cristiano. will try that shortly.

Alain


On Tue, Aug 7, 2018 at 9:24 AM Raymond Auge via osgi-dev <
osgi-dev@mail.osgi.org> wrote:

> Here's a few additional comments to Critiano's suggestion:
>
>
> On Mon, Aug 6, 2018 at 8:38 PM, Cristiano via osgi-dev <
> osgi-dev@mail.osgi.org> wrote:
>
>> hi,
>>
>> if you are using the latest equinox, one good alternative is to use the
>> recently released org.apache.felix.logback.
>>
> You can even use it now with the latest Felix + latest Felix Log Service
> (1.2.0).
>
> See these integration tests [1] & [2]
>
>>
>> you just need to set a proper logback configuration file defining the
>> appenders and log level and then use the vm argument as below (I used to
>> debug inside eclipse ide):
>>
>> -Dlogback.configurationFile=${workspace_loc:your_project}/logback-test.xml
>>
>>
>> Also, it is better to set org.apache.felix.logback's start level to one,
>> so you won't miss any log entry.
>>
>
> You don't need to use start levels at all if you place felix.logback onto
> the classpath of the framework. For equinox see [3] and for felix (you need
> the org.apache.felix.log.extension bundle installed) see [2].
>
> Sincerely,
> - Ray
>
> [1]
> https://github.com/apache/felix/blob/trunk/logback/itests/standard-felix-logservice/itest.bndrun
> [2]
> https://github.com/apache/felix/blob/trunk/logback/itests/immediate-felix-logservice/itest.bndrun
> [3]
> https://github.com/apache/felix/blob/trunk/logback/itests/immediate-equinox-logservice/itest.bndrun
>
>
>
>> See an example:
>>
>> 21:23:29,959 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
>> Setting level of logger [Events.Service.org.eclipse.osgi] to DEBUG
>>
>> 21:36:13||DEBUG|bundle org.apache.felix.scr:2.1.2 (20)bundle
>> org.eclipse.equinox.console:1.3.0.v20180119-0630 (22) : Starting extension
>> synchronously|L.org.apache.felix.scr||L.o.a.f.scr@?[main]
>>
>> 21:36:13||INFO|BundleEvent
>> STARTED|E.B.o.e.equinox.console||E.B.o.e.e.console@?[Framework Event
>> Dispatcher: Equinox Container: f558dbee-500a-4400-ae8a-0e68b1b46f2e]
>>
>> 21:36:18||DEBUG|ServiceEvent MODIFIED
>> {org.osgi.service.component.runtime.ServiceComponentRuntime}={service.changecount=19,
>> service.id=39, service.bundleid=20,
>> service.scope=singleton}|E.S.org.apache.felix.scr||E.S.o.a.f.scr@
>> ?[Timer-1]
>>
>>
>>
>
>>
>> regards,
>>
>> Cristiano
>>
>>
>> On 06/08/2018 12:28, Alain Picard via osgi-dev wrote:
>>
>> I want to enable debug logging / tracing of SCR when running with
>> Equinox. I tried to use config admin to configure
>> "org.apache.felix.scr.ScrService" but to no avail. Not sure if even if
>> Eclipse now uses felix scr if that is the way to go. Or it is the whole log
>> redirection thing (https://io7m.com/documents/brutal-felix-logging/).
>> Just looking for console debug.
>>
>> Thanks
>> Alain
>>
>>
>>
>> ___
>> OSGi Developer Mail 
>> listosgi-...@mail.osgi.orghttps://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>>
>>
>> ___
>> OSGi Developer Mail List
>> osgi-dev@mail.osgi.org
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>
>
>
> --
> *Raymond Augé* 
>  (@rotty3000)
> Senior Software Architect *Liferay, Inc.* 
>  (@Liferay)
> Board Member & EEG Co-Chair, OSGi Alliance 
> (@OSGiAlliance)
> ___
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Enabling debug of SCR with Equinox

2018-08-07 Thread Raymond Auge via osgi-dev
Here's a few additional comments to Critiano's suggestion:


On Mon, Aug 6, 2018 at 8:38 PM, Cristiano via osgi-dev <
osgi-dev@mail.osgi.org> wrote:

> hi,
>
> if you are using the latest equinox, one good alternative is to use the
> recently released org.apache.felix.logback.
>
You can even use it now with the latest Felix + latest Felix Log Service
(1.2.0).

See these integration tests [1] & [2]

>
> you just need to set a proper logback configuration file defining the
> appenders and log level and then use the vm argument as below (I used to
> debug inside eclipse ide):
>
> -Dlogback.configurationFile=${workspace_loc:your_project}/logback-test.xml
>
>
> Also, it is better to set org.apache.felix.logback's start level to one,
> so you won't miss any log entry.
>

You don't need to use start levels at all if you place felix.logback onto
the classpath of the framework. For equinox see [3] and for felix (you need
the org.apache.felix.log.extension bundle installed) see [2].

Sincerely,
- Ray

[1]
https://github.com/apache/felix/blob/trunk/logback/itests/standard-felix-logservice/itest.bndrun
[2]
https://github.com/apache/felix/blob/trunk/logback/itests/immediate-felix-logservice/itest.bndrun
[3]
https://github.com/apache/felix/blob/trunk/logback/itests/immediate-equinox-logservice/itest.bndrun



> See an example:
>
> 21:23:29,959 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
> Setting level of logger [Events.Service.org.eclipse.osgi] to DEBUG
>
> 21:36:13||DEBUG|bundle org.apache.felix.scr:2.1.2 (20)bundle
> org.eclipse.equinox.console:1.3.0.v20180119-0630 (22) : Starting
> extension synchronously|L.org.apache.felix.scr||L.o.a.f.scr@?[main]
>
> 21:36:13||INFO|BundleEvent STARTED|E.B.o.e.equinox.
> console||E.B.o.e.e.console@?[Framework Event Dispatcher: Equinox
> Container: f558dbee-500a-4400-ae8a-0e68b1b46f2e]
>
> 21:36:18||DEBUG|ServiceEvent MODIFIED {org.osgi.service.component.runtime.
> ServiceComponentRuntime}={service.changecount=19, service.id=39,
> service.bundleid=20, service.scope=singleton}|E.S.
> org.apache.felix.scr||E.S.o.a.f.scr@?[Timer-1]
>
>
>

>
> regards,
>
> Cristiano
>
>
> On 06/08/2018 12:28, Alain Picard via osgi-dev wrote:
>
> I want to enable debug logging / tracing of SCR when running with Equinox.
> I tried to use config admin to configure "org.apache.felix.scr.ScrService"
> but to no avail. Not sure if even if Eclipse now uses felix scr if that is
> the way to go. Or it is the whole log redirection thing (
> https://io7m.com/documents/brutal-felix-logging/). Just looking for
> console debug.
>
> Thanks
> Alain
>
>
>
> ___
> OSGi Developer Mail 
> listosgi-...@mail.osgi.orghttps://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
>
> ___
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>



-- 
*Raymond Augé* 
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* 
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance  (@OSGiAlliance)
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Liferay Portlet created with BndTools and Gradle not outputting the right package versioning when building the JAR file

2018-08-07 Thread Raymond Auge via osgi-dev
Forgive me for misspelling your name Ramazan.

Sincerely,
- Ray

On Tue, Aug 7, 2018 at 9:01 AM, Raymond Auge 
wrote:

> Hello Raman,
>
> Since many of the aspects could be related to Liferay specifics, you may
> have better luck asking on the Liferay forums here [1] or even on the
> Liferay community slack group here [2].
>
> Sincerely,
> - Ray
>
> [1] https://community.liferay.com/forums
> [2] https://liferay-community.slack.com
>
> On Mon, Aug 6, 2018 at 10:56 AM, Ramazan Bekrek (Extern) via osgi-dev <
> osgi-dev@mail.osgi.org> wrote:
>
>> I would like to know why when I’m running an OSGi compiled JAR Bundle
>> inside of Liferay OSGi environment I get this error:
>>
>>
>>
>> *This is the bnd.bnd file*
>>
>>
>>
>> Bundle-Name: Liferay Portal Portlet Bridge Soy
>>
>> Bundle-SymbolicName: com.liferay.portal.portlet.bridge.soy
>>
>> Bundle-Version: 3.2.0
>>
>> Export-Package: com.liferay.portal.portlet.bridge.soy
>>
>> Liferay-Releng-Module-Group-Description:
>>
>> Liferay-Releng-Module-Group-Title:
>>
>> Web-ContextPath: /portal-portlet-bridge-soy
>>
>>
>>
>> *This ist he build.gradle file*
>>
>>
>>
>> sourceCompatibility = "1.8"
>>
>> targetCompatibility = "1.8"
>>
>>
>>
>> configJSModules {
>>
>> include "**/*.js*"
>>
>> }
>>
>>
>>
>> dependencies {
>>
>> compileOnly group: "com.liferay", name:
>> "com.liferay.osgi.util", version: "3.2.0"
>>
>> compileOnly group: "com.liferay", name:
>> "com.liferay.petra.function", version: "1.0.0"
>>
>> compileOnly group: "com.liferay", name:
>> "com.liferay.petra.string", version: "1.0.0"
>>
>> compileOnly group: "com.liferay.portal", name:
>> "com.liferay.portal.impl", version: "2.0.0"
>>
>> compileOnly group: "com.liferay.portal", name:
>> "com.liferay.portal.kernel", version: "2.13.0"
>>
>> compileOnly group: "com.liferay.portal", name:
>> "com.liferay.util.bridges", version: "2.0.0"
>>
>> compileOnly group: "javax.portlet", name: "portlet-api",
>> version: "2.0"
>>
>> compileOnly group: "javax.servlet", name:
>> "javax.servlet-api", version: "3.0.1"
>>
>> compileOnly group: "org.osgi", name: "org.osgi.core",
>> version: "6.0.0"
>>
>> // Added this
>>
>> compileOnly project(":modules:portal-template-soy-api")
>>
>> // commented this provided project(":apps:foundation:port
>> al-template:portal-template-soy-api")
>>
>>
>>
>> testCompile group: "com.liferay", name:
>> "com.liferay.petra.lang", version: "1.0.0"
>>
>> testCompile group: "com.liferay", name:
>> "com.liferay.registry.api", version: "1.1.0"
>>
>> testCompile group: "com.liferay", name: "org.jabsorb",
>> version: "1.3.1.LIFERAY-PATCHED-1"
>>
>> testCompile group: "com.redhat.qe", name: "json-java",
>> version: "20110202"
>>
>> testCompile group: "org.jodd", name: "jodd-bean",
>> version: "3.6.4"
>>
>> testCompile group: "org.jodd", name: "jodd-json",
>> version: "3.6.4"
>>
>> testCompile group: "org.slf4j", name: "slf4j-api",
>> version: "1.7.2"
>>
>> }
>>
>>
>>
>> transpileJS {
>>
>> srcIncludes = "**/*.js"
>>
>> }
>>
>>
>>
>> *What comes out in the MANIFEST.MF in the compiled JAR is *
>>
>>
>>
>> Manifest-Version: 1.0
>>
>> Bnd-LastModified: 1533564551530
>>
>> Bundle-ManifestVersion: 2
>>
>> Bundle-Name: Liferay Portal Portlet Bridge Soy
>>
>> Bundle-SymbolicName: com.liferay.portal.portlet.bridge.soy
>>
>> Bundle-Version: 3.2.0
>>
>> Created-By: 1.8.0_171 (Oracle Corporation)
>>
>> Export-Package: com.liferay.portal.portlet.bridge.soy;version="2.2.0";
>>
>> uses:="com.liferay.portal.kernel.portlet.bridges.mvc,com.liferay.port
>>
>> al.kernel.template,javax.portlet"
>>
>> Import-Package: com.liferay.osgi.util.service;version="[2.1,3)",com.li
>>
>> feray.petra.function;version="[1.0,2)",com.liferay.portal.kernel.io.u
>>
>> nsync;version="[6.2,7)",com.liferay.portal.kernel.json;version="[7.0,
>>
>> 8)",com.liferay.portal.kernel.log;version="[7.0,8)",com.liferay.porta
>>
>> l.kernel.model;version="[1.0,2)",com.liferay.portal.kernel.portlet;ve
>>
>> rsion="[7.5,8)",com.liferay.portal.kernel.portlet.bridges.mvc;version
>>
>> ="[1.4,2)",com.liferay.portal.kernel.service;version="[1.5,2)",com.li
>>
>> feray.portal.kernel.servlet;version="[7.2,8)",com.liferay.portal.kern
>>
>> el.servlet.taglib.aui;version="[7.0,8)",com.liferay.portal.kernel.tem
>>
>> plate;version="[7.1,8)",com.liferay.portal.kernel.theme;version="[1.1
>>
>> ,2)",com.liferay.portal.kernel.util;version="[7.10,8)",com.liferay.po
>>
>> rtal.template.soy.utils;version="[2.0,3)",com.liferay.portlet;version
>>
>> ="[1.0,2)",javax.portlet;version="[2.0,3)",javax.servlet;version="[3.
>>
>> 0,4)",javax.servlet.http;version="[3.0,4)",org.osgi.framework;version
>>
>> ="[1.8,2)"
>>
>> Javac-Debug: on
>>
>> Javac-Deprecation: 

Re: [osgi-dev] Angular New Enroute

2018-08-07 Thread Matthews, Kevin via osgi-dev
Hi David, I am going to try what Joao suggested with ng maven plugin. I think 
that direction should work.

From: David Leangen [mailto:o...@leangen.net]
Sent: Friday, August 03, 2018 7:42 PM
To: Matthews, Kevin; OSGi Developer Mail List
Subject: Re: [osgi-dev] Angular New Enroute


Hi,

Angular 2+ works very differently from AngularJS. In enRoute (or at least in 
v2, I am not yet familiar with the current enRoute), it used AngularJS. You 
used to be able to just include the JS file, and that was it. Angular 2+ 
requires you to build/compile your application first, so you cannot just ship 
the source code (unless you include some kind of interpreter, but I’ve never 
attempted that).

What we do is build the files at some point during the build process, and ship 
the entire dist directory.

It works for us as a deployment mechanism. Never tried it as a DS component, 
though. Because of the way an Angular 2+ app works, I don’t immediately see how 
you could do that. If you figure it out, I’d be interested in hearing your 
solution.


Cheers,
=David



On Aug 4, 2018, at 4:55, Matthews, Kevin via osgi-dev 
mailto:osgi-dev@mail.osgi.org>> wrote:

Hello,

Has anyone integrated the new angular 2+/6 into the enroute project as a 
separate UI module/DS component? I have added the contents of my angular src 
folder into the static folder  of the enroute sample but doesn’t seem to render 
the static pages. Should I add the entire angular folder to static folder or 
just the src folder of my angular generate project?

Kevin Matthews
Senior Application Analyst
First Data, 3975 NW 120 Ave, Coral Springs, FL 33065
Office: 954-845-4222 | Mobile: 561-465-6694

kevin.matth...@firstdata.com | 
firstdata.com

The information in this message may be proprietary and/or confidential, and 
protected from disclosure. If the reader of this message is not the intended 
recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited. If you 
have received this communication in error, please notify First Data immediately 
by replying to this message and deleting it from your computer.
___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

___
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Re: [osgi-dev] Angular New Enroute

2018-08-07 Thread Matthews, Kevin via osgi-dev
Thanks Joao, this helps the maven plugin. I will use REST as endpoint for 
communication layer between angular and server side as shown in the sample 
enroute project.

From: João Assunção [mailto:joao.assun...@exploitsys.com]
Sent: Monday, August 06, 2018 12:12 PM
To: OSGi Developer Mail List
Cc: Matthews, Kevin; David Leangen
Subject: Re: [osgi-dev] Angular New Enroute

As David mentioned you will need to include the "ng build" step in your build 
process. I include a portion of the pom where exec-maven-plugin is used to 
invoke "npm install" and "ng build".
To expose the angular app we are using HTTP whiteboard. The bundle activator 
exports a  ResourceMapping service configured with the path of the ngapp 
directory. We are doing it in the bundle activator but it could be done in 
@Activate of a DS component. In our case, the communication between the angular 
side and the server side (a DS component) is done using web sockets, but I 
think it would be easy to make a DS component expose a REST service..


DefaultResourceMapping rootResourceMapping = new DefaultResourceMapping();
rootResourceMapping.setAlias("/myApp");
rootResourceMapping.setPath("/ng");
rootResourceMappingRegistration = 
bundleContext.registerService(ResourceMapping.class, rootResourceMapping, null);

// Redirect 404 errors to the default page
DefaultErrorPageMapping errorpageMapping = new DefaultErrorPageMapping();
errorpageMapping.setError("404");
errorpageMapping.setLocation("/myApp/index.html");
errorpage404Registration = 
bundleContext.registerService(ErrorPageMapping.class, errorpageMapping, null);

// Registers a filter to rewrite the URL "myApp/" to
// index.html
RedirectMatchFilter filter = new RedirectMatchFilter("/myApp/", 
"/myApp/index.html");
props = new Hashtable<>();
props.put(ExtenderConstants.PROPERTY_URL_PATTERNS, "/myApp/*");
filtrerRegistration = bundleContext.registerService(Filter.class, filter, 
props);





org.codehaus.mojo
exec-maven-plugin
1.5.0


   exec-npm-install
   generate-sources
   
${maven.exec.skip}
${project.basedir}/src/main/ngapp
${npm.executable}

   install

   
   
exec
   


   exec-npm-ng-build
   generate-sources
   
${maven.exec.skip}
${project.basedir}/src/main/ngapp
${ng.executable}

   build
   --target=${build.target}
   --base-href=/myApp/
   --no-progress
   --output-hashing=all

   
   
exec
   






João Assunção

Email: joao.assun...@exploitsys.com
Mobile: +351 916968984
Phone: +351 211933149
Web: 
www.exploitsys.com



On Fri, Aug 3, 2018 at 11:42 PM, David Leangen via osgi-dev 
mailto:osgi-dev@mail.osgi.org>> wrote:

Hi,

Angular 2+ works very differently from AngularJS. In enRoute (or at least in 
v2, I am not yet familiar with the current enRoute), it used AngularJS. You 
used to be able to just include the JS file, and that was it. Angular 2+ 
requires you to build/compile your application first, so you cannot just ship 
the source code (unless you include some kind of interpreter, but I’ve never 
attempted that).

What we do is build the files at some point during the build process, and ship 
the entire dist directory.

It works for us as a deployment mechanism. Never tried it as a DS component, 
though. Because of the way an Angular 2+ app works, I don’t immediately see how 
you could do that. If you figure it out, I’d be interested in hearing your 
solution.


Cheers,
=David



On Aug 4, 2018, at 4:55, Matthews, Kevin via osgi-dev 
mailto:osgi-dev@mail.osgi.org>> wrote:

Hello,

Has anyone integrated the new angular 2+/6 into the enroute project as a 
separate UI module/DS component? I have added the contents of my angular src 
folder into the static folder  of the enroute sample but doesn’t seem to render 
the static pages. Should I add the entire angular folder to static folder or 
just the src folder of my angular generate project?

Kevin Matthews
Senior Application Analyst
First Data, 3975 NW 120 Ave, Coral Springs, FL 33065
Office: 954-845-4222 | Mobile: 561-465-6694

kevin.matth...@firstdata.com | 
firstdata.com

The information in this message may be proprietary and/or confidential, and 
protected from disclosure. If the reader of this message is not the intended 
recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this communication is strictly prohibited. If you 
have received this communication in error, please notify First Data immediately 
by replying to this message and deleting it from your computer.

Re: [osgi-dev] Reference not injected to component

2018-08-07 Thread Tim Ward via osgi-dev
Hi,

I’m afraid that if you’re using a WAB file then you absolutely can’t use DS, 
and vice versa. The Web Application Bundle specification exists as a mechanism 
to allow people to move from a non-OSGi world into OSGi, and there are a number 
of restrictions as a result. The one that you’re hitting is that in a Web 
Application the Servlet container is responsible for instantiating and managing 
the lifecycle of the Servlet instances. As a result you are getting two 
instances created, one by DS which is injecting the AdminBroker service, and 
one by the Servlet Container which isn’t injecting anything.

Assuming that this is a new project then by far the simplest way to fix this is 
to completely avoid making a WAB, and just to use the Http Whiteboard. This 
will simplify things immensely, and handle the service dynamics easily. If you 
can’t avoid using the WAB then you do have access to the BundleContext in your 
ServletContext (see 
https://osgi.org/specification/osgi.cmpn/7.0.0/service.war.html#d0e101441 
). 
You would have to use this to get the service you want to use (and release it, 
and deal with what happens if it isn’t available).

In summary, WABs exist for specific use cases when you can’t be properly 
modular, or for when you have to work both inside and outside OSGi. It’s not 
recommended to use them as your first development option.

I wish you luck with your experiments!

Best Regards,

Tim

> On 6 Aug 2018, at 22:10, Nhut Thai Le  wrote:
> 
> Hi Tim,
> 
> The servlet is inside a WAB file which has a web.xml:
> 
> 
> http://java.sun.com/xml/ns/javaee 
> "
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
> "
>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
>  
> http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd 
> "
>  version="3.0">
>   
>   HelloWorld
>   com.webapp.HelloWorld
>   
> 
>   
>   HelloWorld
>   /
>   
> 
> 
> I'm not trying to use the whiteboard pattern in the first place but rather 
> looking for a way to inject my AdminBroker service into my servlet so I turn 
> my servlet into a component in order to use the reference.
> 
> Thai
> 
> 
> On Mon, Aug 6, 2018 at 4:44 PM, Tim Ward  > wrote:
> I don’t see any Http Service whiteboard properties on the Servlet component. 
> How are you registering it with the Servlet container?
> 
> Tim
> 
> Sent from my iPhone
> 
> On 6 Aug 2018, at 16:22, Nhut Thai Le via osgi-dev  > wrote:
> 
>> Hello,
>> 
>> I have a servlet defined like this:
>> 
>> @Component(service = Servlet.class)
>> public class HelloWorld extends HttpServlet {
>>  @Reference(cardinality = ReferenceCardinality.MANDATORY)
>>  private AdminBroker adminBroker;
>> 
>>  protected void doGet(HttpServletRequest request, HttpServletResponse 
>> response) throws ServletException, IOException {   
>>  adminBroker.doSomething();
>>  }
>> }
>> 
>> My AdminBroker implementation looks like:
>> @Component(service=AdminBroker.class)
>> public class AdminBrokerImpl implements AdminBroker {
>>  @Activate
>>  private void init() {
>>  String param1 = "some text";
>>  }
>> }
>> 
>> When I started the env (felix 6 with pax-web), I can see the AdminBroker 
>> instantiated (hit a break point in the init of my AdminBroker 
>> implementation) but when the web request arrives and the doGet method is 
>> called, the adminBroker is null.
>> 
>> Does anyone have an idea what may go wrong here?
>> 
>> Thai Le
>> 
>> -- 
>> Castor Technologies Inc
>> 460 rue St-Catherine St 
>>  
>> Ouest, Suite 613 
>> Montréal, Québec H3B-1A7
>> (514) 360-7208 o
>> (514) 798-2044 f
>> n...@castortech.com 
>> www.castortech.com  
>> 
>> CONFIDENTIALITY NOTICE: The information contained in this e-mail is 
>> confidential and may be proprietary information intended only for the use of 
>> the individual or entity to whom it is addressed. If the reader of this 
>> message is not the intended recipient, you are hereby notified that any 
>> viewing, dissemination, distribution, disclosure, copy or use of the 
>> information contained in this e-mail message is strictly prohibited. If you 
>> have received and/or are viewing this e-mail in error, please immediately 
>> notify the sender by reply e-mail, and delete it from your system without 
>> reading, forwarding, copying or saving in any manner. Thank you.
>> AVIS DE CONFIDENTIALITE: L’information contenue dans ce message est 
>> confidentiel, peut être protégé par le secret professionnel et est réservé à