[Dev] Clarification needed on reading annotation information from .Java files

2014-02-03 Thread Jayanga Dissanayake
Hi,

I am currently involved in the Development Governance project for C5. One
of my task is to represent services (Axis, Jax rs, Jax ws) in the registry
as a service asset instances and link them to corresponding module assets
via associations.

To do this I am planning to parse the files of modules and classify them
based on the annotations,
i. Create a service (asix2 service), if a services.xml is found
ii. Create a service (jax ws), if @WebService annotation is found
iii. Create a service (jax rs), if @Path annotation is found

Please comment on this approach and suggest if there is any better way.

Thanks.
*Jayanga Dissanayake*
Senior Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
email: jaya...@wso2.com
mobile: +94772207259
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-03 Thread Harsha Thirimanna
For the axis2 service, we create aar file, then can't we differentiate it
using that extension ?


*Harsha Thirimanna*
Senior Software Engineer; WSO2, Inc.; http://wso2.com
* *
* email: **hars...@wso2.com* * cell: +94 71 5186770*
* twitter: **http://twitter.com/ *
*harshathirimann linked-in: **http:
**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
*

 *Lean . Enterprise . Middleware*



On Tue, Feb 4, 2014 at 11:07 AM, Jayanga Dissanayake wrote:

> Hi,
>
> I am currently involved in the Development Governance project for C5. One
> of my task is to represent services (Axis, Jax rs, Jax ws) in the registry
> as a service asset instances and link them to corresponding module assets
> via associations.
>
> To do this I am planning to parse the files of modules and classify them
> based on the annotations,
> i. Create a service (asix2 service), if a services.xml is found
> ii. Create a service (jax ws), if @WebService annotation is found
> iii. Create a service (jax rs), if @Path annotation is found
>
> Please comment on this approach and suggest if there is any better way.
>
> Thanks.
>  *Jayanga Dissanayake*
> Senior Software Engineer
> WSO2 Inc. - http://wso2.com/
> lean . enterprise . middleware
> email: jaya...@wso2.com
> mobile: +94772207259
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Jayanga Dissanayake
Hi Harsha,

Thanks for the suggestion.

In the Development Governance, we are planning to do this with the source
code. Basically get a checkout from the git hub and find the services that
a particular component/module refers to. In this approach we get only the
source, so '.aar' based mechanisms won't work.

Anyway if you think '.aar' based approach has any benefit over
'services.xml' based approach please indicate.

Thanks,

*Jayanga Dissanayake*
Senior Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
email: jaya...@wso2.com
mobile: +94772207259


On Tue, Feb 4, 2014 at 11:27 AM, Harsha Thirimanna  wrote:

> For the axis2 service, we create aar file, then can't we differentiate it
> using that extension ?
>
>
> *Harsha Thirimanna*
> Senior Software Engineer; WSO2, Inc.; http://wso2.com
> * *
> * email: **hars...@wso2.com* * cell: +94 71 5186770*
> * twitter: **http://twitter.com/ *
> *harshathirimann linked-in: **http:
> **//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122
> *
>
>  *Lean . Enterprise . Middleware*
>
>
>
> On Tue, Feb 4, 2014 at 11:07 AM, Jayanga Dissanayake wrote:
>
>> Hi,
>>
>> I am currently involved in the Development Governance project for C5. One
>> of my task is to represent services (Axis, Jax rs, Jax ws) in the registry
>> as a service asset instances and link them to corresponding module assets
>> via associations.
>>
>> To do this I am planning to parse the files of modules and classify them
>> based on the annotations,
>> i. Create a service (asix2 service), if a services.xml is found
>> ii. Create a service (jax ws), if @WebService annotation is found
>> iii. Create a service (jax rs), if @Path annotation is found
>>
>> Please comment on this approach and suggest if there is any better way.
>>
>> Thanks.
>>  *Jayanga Dissanayake*
>> Senior Software Engineer
>> WSO2 Inc. - http://wso2.com/
>> lean . enterprise . middleware
>> email: jaya...@wso2.com
>> mobile: +94772207259
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Udara Liyanage
Let's say a service.XML is found but without any service definition. Is it
still a axis2 service?

Touched, not typed. Erroneous words are a feature, not a typo.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Jayanga Dissanayake
Hi Udara,

Agreed with your point.
Its not just enough to have a file having the name 'services.xml' to create
a service assert.

We have to read the file and get the service name and other information
from the file.
As Axis2 support , A single 'services.xml' file sometimes may
contain information about several services, hence several service assert
instances may have to be created.

Thanks,

*Jayanga Dissanayake*
Senior Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
email: jaya...@wso2.com
mobile: +94772207259


On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:

> Let's say a service.XML is found but without any service definition. Is it
> still a axis2 service?
>
> Touched, not typed. Erroneous words are a feature, not a typo.
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Nirmal Fernando
Hi Jayanga,

I wonder this approach would help us. There could be lot of issues.

Why not thinking of introducing a meta file which represents basic set of
information that you require in order to generate these assets? Then the
relevant components would need to configure this meta file, if it wants to
be registered as an asset.


On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:

> Hi Udara,
>
> Agreed with your point.
> Its not just enough to have a file having the name 'services.xml' to
> create a service assert.
>
> We have to read the file and get the service name and other information
> from the file.
> As Axis2 support , A single 'services.xml' file sometimes
> may contain information about several services, hence several service
> assert instances may have to be created.
>
> Thanks,
>
> *Jayanga Dissanayake*
> Senior Software Engineer
> WSO2 Inc. - http://wso2.com/
> lean . enterprise . middleware
> email: jaya...@wso2.com
> mobile: +94772207259
>
>
> On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:
>
>> Let's say a service.XML is found but without any service definition. Is
>> it still a axis2 service?
>>
>> Touched, not typed. Erroneous words are a feature, not a typo.
>>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Kasun Gajasinghe
Hi Jayanga,

As per your first mail, I take it that a service hosting product like AS,
DSS etc. will do the task of determining the service type? Then, how about
patching into the runtime environment to determine the service type instead
of depending on reading the file-system to determine a service? You can
determine the axis2 services by patching into the AxisConfiguration.
JAX-WS/RS can be detemine by writing a CXF deployment interceptor or a
Tomcat listener.

Reading services.xml only works for AAR based services. It doesn't work for
data services, proxy services, and other the service types that are in use.

KasunG


On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:

> Hi Jayanga,
>
> I wonder this approach would help us. There could be lot of issues.
>
> Why not thinking of introducing a meta file which represents basic set of
> information that you require in order to generate these assets? Then the
> relevant components would need to configure this meta file, if it wants to
> be registered as an asset.
>
>
> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:
>
>> Hi Udara,
>>
>> Agreed with your point.
>> Its not just enough to have a file having the name 'services.xml' to
>> create a service assert.
>>
>> We have to read the file and get the service name and other information
>> from the file.
>> As Axis2 support , A single 'services.xml' file sometimes
>> may contain information about several services, hence several service
>> assert instances may have to be created.
>>
>> Thanks,
>>
>> *Jayanga Dissanayake*
>> Senior Software Engineer
>> WSO2 Inc. - http://wso2.com/
>> lean . enterprise . middleware
>> email: jaya...@wso2.com
>> mobile: +94772207259
>>
>>
>> On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:
>>
>>> Let's say a service.XML is found but without any service definition. Is
>>> it still a axis2 service?
>>>
>>> Touched, not typed. Erroneous words are a feature, not a typo.
>>>
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Kasun Gajasinghe*
Software Engineer;
WSO2 Inc.; http://wso2.com


 ,
*email: *
*kasung AT spamfree wso2.com    ** cell: **+94 (77)
678-0813*
*linked-in: *http://lk.linkedin.com/in/gajasinghe



*blog: **http://kasunbg.org* 



*twitter: **http://twitter.com/kasunbg* 
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Jayanga Dissanayake
Hi Nirmal,

Thanks for the suggestion.

Our first approach is to extract relevant information from the source
without adding any burden on the developer.

Using an additional meta file to indicate the information needed by the
governance purposes will simplify the governance process and we could use a
unified process to create service assets across all types of services.

We can even embed the extra information to the pom.xml as properties.

Thanks,

*Jayanga Dissanayake*
Senior Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
email: jaya...@wso2.com
mobile: +94772207259


On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:

> Hi Jayanga,
>
> I wonder this approach would help us. There could be lot of issues.
>
> Why not thinking of introducing a meta file which represents basic set of
> information that you require in order to generate these assets? Then the
> relevant components would need to configure this meta file, if it wants to
> be registered as an asset.
>
>
> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:
>
>> Hi Udara,
>>
>> Agreed with your point.
>> Its not just enough to have a file having the name 'services.xml' to
>> create a service assert.
>>
>> We have to read the file and get the service name and other information
>> from the file.
>> As Axis2 support , A single 'services.xml' file sometimes
>> may contain information about several services, hence several service
>> assert instances may have to be created.
>>
>> Thanks,
>>
>> *Jayanga Dissanayake*
>> Senior Software Engineer
>> WSO2 Inc. - http://wso2.com/
>> lean . enterprise . middleware
>> email: jaya...@wso2.com
>> mobile: +94772207259
>>
>>
>> On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:
>>
>>> Let's say a service.XML is found but without any service definition. Is
>>> it still a axis2 service?
>>>
>>> Touched, not typed. Erroneous words are a feature, not a typo.
>>>
>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Senaka Fernando
-1 for another meta file.

Guys, we don't want this to change anything that we are doing today. What
we need is to read the existing code and try to understand what it is. As a
developer debugging the code you can read the services.xml and the
corresponding class and whatever other information that we have right now
in the POM and determine that a particular bundle is publishing an Axis2
service.

The introspection Jayanga is writing should follow the same pattern like a
human trying to read the code and understand whether this is a Axis2
service or a JAX-WS service or a JAX-RS service. If a human can't read
source code and figure out whether it is a Data Service or a ESB Proxy
Service we cannot be implementing a governance process around that. But I'm
pretty sure that's not the case. Given the project and given the type of
files in there you can figure out what it is doing. We just need to code
that introspection logic. Of course there can be complications like the
same project producing two or more types of services. We need to handle
things like that.

Also, Kasun et al, we are talking about source code here, and not the
compiled AAR file etc.

Thanks,
Senaka.


On Tue, Feb 4, 2014 at 7:41 PM, Jayanga Dissanayake wrote:

> Hi Nirmal,
>
> Thanks for the suggestion.
>
> Our first approach is to extract relevant information from the source
> without adding any burden on the developer.
>
> Using an additional meta file to indicate the information needed by the
> governance purposes will simplify the governance process and we could use a
> unified process to create service assets across all types of services.
>
> We can even embed the extra information to the pom.xml as properties.
>
> Thanks,
>
> *Jayanga Dissanayake*
> Senior Software Engineer
> WSO2 Inc. - http://wso2.com/
> lean . enterprise . middleware
> email: jaya...@wso2.com
> mobile: +94772207259
>
>
> On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:
>
>> Hi Jayanga,
>>
>> I wonder this approach would help us. There could be lot of issues.
>>
>> Why not thinking of introducing a meta file which represents basic set of
>> information that you require in order to generate these assets? Then the
>> relevant components would need to configure this meta file, if it wants to
>> be registered as an asset.
>>
>>
>> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:
>>
>>> Hi Udara,
>>>
>>> Agreed with your point.
>>> Its not just enough to have a file having the name 'services.xml' to
>>> create a service assert.
>>>
>>> We have to read the file and get the service name and other information
>>> from the file.
>>> As Axis2 support , A single 'services.xml' file sometimes
>>> may contain information about several services, hence several service
>>> assert instances may have to be created.
>>>
>>> Thanks,
>>>
>>> *Jayanga Dissanayake*
>>> Senior Software Engineer
>>> WSO2 Inc. - http://wso2.com/
>>> lean . enterprise . middleware
>>> email: jaya...@wso2.com
>>> mobile: +94772207259
>>>
>>>
>>> On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:
>>>
 Let's say a service.XML is found but without any service definition. Is
 it still a axis2 service?

 Touched, not typed. Erroneous words are a feature, not a typo.

>>>
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> Thanks & regards,
>> Nirmal
>>
>> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
>> Mobile: +94715779733
>> Blog: http://nirmalfdo.blogspot.com/
>>
>>
>>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 


*[image: http://wso2.com]  Senaka Fernando*
Senior Technical Lead; WSO2 Inc.; http://wso2.com



* Member; Apache Software Foundation; http://apache.org
E-mail: senaka AT wso2.com **P: +1 408
754 7388; ext: 51736*;


*M: +94 77 322 1818 Linked-In: http://linkedin.com/in/senakafernando
*Lean . Enterprise . Middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Kasun Gajasinghe
Thanks Senaka for the update.

For, JAX-RS services, checking for the @Path annotation doesn't always
work. That's because it's not mandatory to have @Path annotation set in the
class, or in a method in a class. Usually, the *methods* in a jax-rs
resource class would have the @Path annotation set though. So, we have to
write the parsing logic accordingly. But, I think a good way to determine
whether a given code is for a jax-rs /jax-ws service is the following. This
is assuming the service is a CXF-based one.

1. Read the web.xml, and check whether the
org.apache.cxf.transport.servlet.CXFServlet is set as a servlet.
2. If so, then check whether it has a 'config-location' init-param set. Get
its value. If not, the default is set to WEB-INF/cxf-servlet.xml. This is a
spring beans config file.
3. Parse that config file. If you find  tag, then it's a
jax-rs service. If you find  then it's a jax-ws service.

Regards,
KasunG




On Wed, Feb 5, 2014 at 12:37 AM, Senaka Fernando  wrote:

> -1 for another meta file.
>
> Guys, we don't want this to change anything that we are doing today. What
> we need is to read the existing code and try to understand what it is. As a
> developer debugging the code you can read the services.xml and the
> corresponding class and whatever other information that we have right now
> in the POM and determine that a particular bundle is publishing an Axis2
> service.
>
> The introspection Jayanga is writing should follow the same pattern like a
> human trying to read the code and understand whether this is a Axis2
> service or a JAX-WS service or a JAX-RS service. If a human can't read
> source code and figure out whether it is a Data Service or a ESB Proxy
> Service we cannot be implementing a governance process around that. But I'm
> pretty sure that's not the case. Given the project and given the type of
> files in there you can figure out what it is doing. We just need to code
> that introspection logic. Of course there can be complications like the
> same project producing two or more types of services. We need to handle
> things like that.
>
> Also, Kasun et al, we are talking about source code here, and not the
> compiled AAR file etc.
>
> Thanks,
> Senaka.
>
>
> On Tue, Feb 4, 2014 at 7:41 PM, Jayanga Dissanayake wrote:
>
>> Hi Nirmal,
>>
>> Thanks for the suggestion.
>>
>> Our first approach is to extract relevant information from the source
>> without adding any burden on the developer.
>>
>> Using an additional meta file to indicate the information needed by the
>> governance purposes will simplify the governance process and we could use a
>> unified process to create service assets across all types of services.
>>
>> We can even embed the extra information to the pom.xml as properties.
>>
>> Thanks,
>>
>> *Jayanga Dissanayake*
>> Senior Software Engineer
>> WSO2 Inc. - http://wso2.com/
>> lean . enterprise . middleware
>> email: jaya...@wso2.com
>> mobile: +94772207259
>>
>>
>> On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:
>>
>>> Hi Jayanga,
>>>
>>> I wonder this approach would help us. There could be lot of issues.
>>>
>>> Why not thinking of introducing a meta file which represents basic set
>>> of information that you require in order to generate these assets? Then the
>>> relevant components would need to configure this meta file, if it wants to
>>> be registered as an asset.
>>>
>>>
>>> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake 
>>> wrote:
>>>
 Hi Udara,

 Agreed with your point.
 Its not just enough to have a file having the name 'services.xml' to
 create a service assert.

 We have to read the file and get the service name and other information
 from the file.
 As Axis2 support , A single 'services.xml' file sometimes
 may contain information about several services, hence several service
 assert instances may have to be created.

 Thanks,

 *Jayanga Dissanayake*
 Senior Software Engineer
 WSO2 Inc. - http://wso2.com/
 lean . enterprise . middleware
 email: jaya...@wso2.com
 mobile: +94772207259


 On Tue, Feb 4, 2014 at 8:43 PM, Udara Liyanage  wrote:

> Let's say a service.XML is found but without any service definition.
> Is it still a axis2 service?
>
> Touched, not typed. Erroneous words are a feature, not a typo.
>


 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


>>>
>>>
>>> --
>>>
>>> Thanks & regards,
>>> Nirmal
>>>
>>> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
>>> Mobile: +94715779733
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>>
>>>
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
>
> *[image: http://wso2.com]  Senaka Fernando*
> Senior Technical Lead; WSO2 Inc.; htt

Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Nirmal Fernando
Thanks for the clarifications guys... I think what we need is a semantic
analyzer.

On Wednesday, February 5, 2014, Kasun Gajasinghe  wrote:

> Thanks Senaka for the update.
>
> For, JAX-RS services, checking for the @Path annotation doesn't always
> work. That's because it's not mandatory to have @Path annotation set in the
> class, or in a method in a class. Usually, the *methods* in a jax-rs
> resource class would have the @Path annotation set though. So, we have to
> write the parsing logic accordingly. But, I think a good way to determine
> whether a given code is for a jax-rs /jax-ws service is the following. This
> is assuming the service is a CXF-based one.
>
> 1. Read the web.xml, and check whether the
> org.apache.cxf.transport.servlet.CXFServlet is set as a servlet.
> 2. If so, then check whether it has a 'config-location' init-param set.
> Get its value. If not, the default is set to WEB-INF/cxf-servlet.xml. This
> is a spring beans config file.
> 3. Parse that config file. If you find  tag, then it's
> a jax-rs service. If you find  then it's a jax-ws
> service.
>
> Regards,
> KasunG
>
>
>
>
> On Wed, Feb 5, 2014 at 12:37 AM, Senaka Fernando  wrote:
>
> -1 for another meta file.
>
> Guys, we don't want this to change anything that we are doing today. What
> we need is to read the existing code and try to understand what it is. As a
> developer debugging the code you can read the services.xml and the
> corresponding class and whatever other information that we have right now
> in the POM and determine that a particular bundle is publishing an Axis2
> service.
>
> The introspection Jayanga is writing should follow the same pattern like a
> human trying to read the code and understand whether this is a Axis2
> service or a JAX-WS service or a JAX-RS service. If a human can't read
> source code and figure out whether it is a Data Service or a ESB Proxy
> Service we cannot be implementing a governance process around that. But I'm
> pretty sure that's not the case. Given the project and given the type of
> files in there you can figure out what it is doing. We just need to code
> that introspection logic. Of course there can be complications like the
> same project producing two or more types of services. We need to handle
> things like that.
>
> Also, Kasun et al, we are talking about source code here, and not the
> compiled AAR file etc.
>
> Thanks,
> Senaka.
>
>
> On Tue, Feb 4, 2014 at 7:41 PM, Jayanga Dissanayake wrote:
>
> Hi Nirmal,
>
> Thanks for the suggestion.
>
> Our first approach is to extract relevant information from the source
> without adding any burden on the developer.
>
> Using an additional meta file to indicate the information needed by the
> governance purposes will simplify the governance process and we could use a
> unified process to create service assets across all types of services.
>
> We can even embed the extra information to the pom.xml as properties.
>
> Thanks,
>
> *Jayanga Dissanayake*
> Senior Software Engineer
> WSO2 Inc. - http://wso2.com/
> lean . enterprise . middleware
> email: jaya...@wso2.com
> mobile: +94772207259
>
>
> On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:
>
> Hi Jayanga,
>
> I wonder this approach would help us. There could be lot of issues.
>
> Why not thinking of introducing a meta file which represents basic set of
> information that you require in order to generate these assets? Then the
> relevant components would need to configure this meta file, if it wants to
> be registered as an asset.
>
>
> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:
>
> Hi Udara,
>
> Agreed with your point.
> Its not just enough to have a file having the name 'services.xml' to
> create a service assert.
>
> We have to read the file and get the service name and other information
> from the file.
> As Axis2 support , A single 'services.xml' file sometimes
> may contain information about several services, hence several service
> assert instances may have to be created.
>
> Thanks,
>
> *Jayanga Dissanayake*
> Seni
>
> *Kasun Gajasinghe*
> Software Engineer;
> WSO2 Inc.; http://wso2.com
>
>
>  ,
> *email: *
> *kasung AT spamfree wso2.com    ** cell: **+94 (77)
> 678-0813*
> *linked-in: *http://lk.linkedin.com/in/gajasinghe
>
>
>
> *blog: **http://kasunbg.org* 
>
>
>
> *twitter: **http://twitter.com/kasunbg* 
>
>
>
>

-- 

Thanks & regards,
Nirmal

Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
Mobile: +94715779733
Blog: http://nirmalfdo.blogspot.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Clarification needed on reading annotation information from .Java files

2014-02-04 Thread Indika Sampath
Hi Jayanga,

This link might be useful for your work.

https://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html#verifying-the-source-against-rules



On Wed, Feb 5, 2014 at 5:00 AM, Nirmal Fernando  wrote:

> Thanks for the clarifications guys... I think what we need is a semantic
> analyzer.
>
>
> On Wednesday, February 5, 2014, Kasun Gajasinghe  wrote:
>
>> Thanks Senaka for the update.
>>
>> For, JAX-RS services, checking for the @Path annotation doesn't always
>> work. That's because it's not mandatory to have @Path annotation set in the
>> class, or in a method in a class. Usually, the *methods* in a jax-rs
>> resource class would have the @Path annotation set though. So, we have to
>> write the parsing logic accordingly. But, I think a good way to determine
>> whether a given code is for a jax-rs /jax-ws service is the following. This
>> is assuming the service is a CXF-based one.
>>
>> 1. Read the web.xml, and check whether the
>> org.apache.cxf.transport.servlet.CXFServlet is set as a servlet.
>> 2. If so, then check whether it has a 'config-location' init-param set.
>> Get its value. If not, the default is set to WEB-INF/cxf-servlet.xml. This
>> is a spring beans config file.
>> 3. Parse that config file. If you find  tag, then it's
>> a jax-rs service. If you find  then it's a jax-ws
>> service.
>>
>> Regards,
>> KasunG
>>
>>
>>
>>
>> On Wed, Feb 5, 2014 at 12:37 AM, Senaka Fernando  wrote:
>>
>> -1 for another meta file.
>>
>> Guys, we don't want this to change anything that we are doing today. What
>> we need is to read the existing code and try to understand what it is. As a
>> developer debugging the code you can read the services.xml and the
>> corresponding class and whatever other information that we have right now
>> in the POM and determine that a particular bundle is publishing an Axis2
>> service.
>>
>> The introspection Jayanga is writing should follow the same pattern like
>> a human trying to read the code and understand whether this is a Axis2
>> service or a JAX-WS service or a JAX-RS service. If a human can't read
>> source code and figure out whether it is a Data Service or a ESB Proxy
>> Service we cannot be implementing a governance process around that. But I'm
>> pretty sure that's not the case. Given the project and given the type of
>> files in there you can figure out what it is doing. We just need to code
>> that introspection logic. Of course there can be complications like the
>> same project producing two or more types of services. We need to handle
>> things like that.
>>
>> Also, Kasun et al, we are talking about source code here, and not the
>> compiled AAR file etc.
>>
>> Thanks,
>> Senaka.
>>
>>
>> On Tue, Feb 4, 2014 at 7:41 PM, Jayanga Dissanayake wrote:
>>
>> Hi Nirmal,
>>
>> Thanks for the suggestion.
>>
>> Our first approach is to extract relevant information from the source
>> without adding any burden on the developer.
>>
>> Using an additional meta file to indicate the information needed by the
>> governance purposes will simplify the governance process and we could use a
>> unified process to create service assets across all types of services.
>>
>> We can even embed the extra information to the pom.xml as properties.
>>
>> Thanks,
>>
>> *Jayanga Dissanayake*
>> Senior Software Engineer
>> WSO2 Inc. - http://wso2.com/
>> lean . enterprise . middleware
>> email: jaya...@wso2.com
>> mobile: +94772207259
>>
>>
>> On Tue, Feb 4, 2014 at 10:34 PM, Nirmal Fernando  wrote:
>>
>> Hi Jayanga,
>>
>> I wonder this approach would help us. There could be lot of issues.
>>
>> Why not thinking of introducing a meta file which represents basic set of
>> information that you require in order to generate these assets? Then the
>> relevant components would need to configure this meta file, if it wants to
>> be registered as an asset.
>>
>>
>> On Tue, Feb 4, 2014 at 10:17 PM, Jayanga Dissanayake wrote:
>>
>> Hi Udara,
>>
>> Agreed with your point.
>> Its not just enough to have a file having the name 'services.xml' to
>> create a service assert.
>>
>> We have to read the file and get the service name and other information
>> from the file.
>> As Axis2 support , A single 'services.xml' file sometimes
>> may contain information about several services, hence several service
>> assert instances may have to be created.
>>
>> Thanks,
>>
>> *Jayanga Dissanayake*
>> Seni
>>
>> *Kasun Gajasinghe*
>> Software Engineer;
>> WSO2 Inc.; http://wso2.com
>>
>>
>>  ,
>> *email: *
>> *kasung AT spamfree wso2.com    ** cell: **+94 (77)
>> 678-0813 <%2B94%20%2877%29%20678-0813>*
>> *linked-in: *http://lk.linkedin.com/in/gajasinghe
>>
>>
>>
>> *blog: **http://kasunbg.org* 
>>
>>
>>
>> *twitter: **http://twitter.com/kasunbg* 
>>
>>
>>
>>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.bl