You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Andy Piper (JIRA)" <tu...@ws.apache.org> on 2006/09/06 20:28:24 UTC

[jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

     [ http://issues.apache.org/jira/browse/TUSCANY-699?page=all ]

Andy Piper updated TUSCANY-699:
-------------------------------

    Attachment: springlaunch.patch

> Allow bootstrap of tuscanny from spring web apps / struts apps etc
> ------------------------------------------------------------------
>
>                 Key: TUSCANY-699
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-699
>             Project: Tuscany
>          Issue Type: Improvement
>          Components: Java SCA Core
>    Affects Versions: Java-M2
>            Reporter: Andy Piper
>         Attachments: springlaunch.patch
>
>
> Spring provides a wealth of web app integration components. To reimplement these in Tuscany would be prohibitive, instead we need to allow Spring to bootstrap Tuscany and use its standard extension mechanisms. 
> I have a patch.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

Posted by Andy Piper <an...@bea.com>.
Hi Jim/Jeremey

I understand the intent, but this doc doesn't really tell me how I 
configure this.
I don't want to define my own log API I just want to use one. Do you 
have an example of this kind of usage?

@Monitor
setMonitor(java.util.logging.Logger mylogger)

?

If so how do I configure this with log4j for instance? I just want 
something that works and doesn't require me to implement a logging 
framework on the back end.

Thanks

andy

At 15:35 07/09/2006, Jim Marino wrote:

>On Sep 7, 2006, at 6:07 AM, Jeremy Boynes wrote:
>
>>>
>>>Can you point me at the recommended way of logging? I could not
>>>immediately find any code that did this.
>>
>>We need to write logging guidelines I guess. There have been
>>various emails about this, look for MonitorFactory. The basic idea
>>is that to log a component:
>>* defines a monitoring interface that it will call to emit events
>>* marks that as a dependency with a @Monitor annotation
>>* an implementation of that interface is injected by the runtime
>>* the component makes the calls as needed
>Here's a writeup: http://incubator.apache.org/tuscany/monitoring.htm
>
>We've basically externalized logging/monitoring in the runtime.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: tuscany-dev-help@ws.apache.org

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

Posted by Jim Marino <jm...@myromatours.com>.
On Sep 7, 2006, at 6:07 AM, Jeremy Boynes wrote:

>>
>> Can you point me at the recommended way of logging? I could not  
>> immediately find any code that did this.
>
> We need to write logging guidelines I guess. There have been  
> various emails about this, look for MonitorFactory. The basic idea  
> is that to log a component:
> * defines a monitoring interface that it will call to emit events
> * marks that as a dependency with a @Monitor annotation
> * an implementation of that interface is injected by the runtime
> * the component makes the calls as needed
>
Here's a writeup: http://incubator.apache.org/tuscany/monitoring.htm

We've basically externalized logging/monitoring in the runtime.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

Posted by Jeremy Boynes <jb...@apache.org>.
On Sep 7, 2006, at 1:06 AM, Andy Piper wrote:

> At 06:25 07/09/2006, Jeremy Boynes wrote:
snipping a little ...
>
>> Would it be possible to break this down a little - there are changes
>> in there to the startup code and to the Spring container - is it
>> possible to separate those so that there is less to tackle in one go?
>
> Sure, although separating these out in patches is a pain. It means  
> keeping multiple workspaces which then creates merge headaches for me.
>
>> For example, are the startup changes really coupled to renaming the
>> SpringSCA XSD?
>
> Well, the latter are just obvious typos. Barring those the patch in  
> its totality supports a specific feature for Spring apps. I can  
> break it up, but I must admit I was assuming that you or Jim would  
> want to massage it somewhat anyway. Things move so fast in svn at  
> the moment that if you don't get patches out quick the world has  
> changed :)

I would rather have small patches to review/apply than a large one  
that conflates several issues. It also makes it easier for any  
committer to review/apply which means you will get a quicker turn  
around making the merge easier.

>> Some of the changes seem cosmetic (e.g. JavaDoc changes) and these
>> really are easier to review if kept separate.
>
> ? I'm not aware of those.

Stuff like
@@ -248,8 +245,6 @@
      /**
       * Sets the root to point to a composite in the hierarchy  
specified by the given path
-     *
-     * @throws InvalidCompositePath
       */
      private void setCurrentComposite(String compositePath,  
CompositeComponent<?> root) throws InvalidCompositePath {
          if (compositePath != null) {

in ServletLauncherListener.

>
>> Also some of the changes don't seem to fit our coding style
>> guidelines. I know we're often lax about that but I felt I should
>> mention it as we're actively trying to improve. You can check this
>> fairly easily using the "sourcecheck" profile in Maven ("mvn -o -  
>> Psourcecheck").
>
>
> [ERROR] BUILD ERROR
> [INFO]  
> ---------------------------------------------------------------------- 
> --
> [INFO] The plugin 'org.apache.maven.plugins:maven-checkstyle- 
> plugin' does not ex
> ist or no valid version could be found

Try without the -o (you may need to rm ~/.m2/repository/org/apache/ 
maven/plugins/maven-checkstyle-plugin now that the install failed).

> I'm happy to plug in to IntelliJ whatever is appropriate, I had  
> assumed that the idea:idea target would do that, but evidently not.  
> I tried to adjust my settings based on other code (4 spaces for  
> indent, no tabs) but obviously something is not quite right. Can  
> you point me at what needs to go in IntelliJ?
>
> I work on 5 or 6 different open source projects, each with their  
> own coding styles, so bear with me while I context switch.

Nice thing with IDEA is that you can have separate style sheets per  
project. There is one checked in to Tuscany at ~/java/etc/tuscany- 
idea-codestyle.xml that can be imported into your project (if you can  
figure out how to have idea:idea do that automatically that would be  
great).

>
> Can you point me at the recommended way of logging? I could not  
> immediately find any code that did this.

We need to write logging guidelines I guess. There have been various  
emails about this, look for MonitorFactory. The basic idea is that to  
log a component:
* defines a monitoring interface that it will call to emit events
* marks that as a dependency with a @Monitor annotation
* an implementation of that interface is injected by the runtime
* the component makes the calls as needed

Look for usages of o.a.t.api.annotation.Monitor for examples  
(although there aren't many unfortunately).

>> Getting to the technical stuff, the big question I have is about
>> passing in a Map of properties. This seems to go against the IoC
>> principles of SCA, Tuscany and Spring. Did you consider extending
>> RuntimeInfo e.g. as SpringRuntimeInfo, adding in something like
>> getApplicationContext() ? Or perhaps better, adding the
>
> Yeah, if there is a better way of doing this I would be glad to use  
> it. I did what I could to get stuff working without introducing  
> core dependencies on spring. Extending RuntimeInfo is fine, it  
> means more changes to the Launcher but I guess that's ok.
>
>> ApplicationContext as a component in the runtime that could be
>> directly used as a dependency?
>
> Not sure how I inject this from outside the runtime. This was my  
> big problem. In this specific use case, Spring needs to be in the  
> driving seat, passing to the Tuscany runtime what it needs to do  
> further wiring. If you can outline an example of how this would  
> work that would be great. I must admit that the operation of these  
> various pieces is far from clear from the javadoc, so I'm sure my  
> understanding is far less than perfect. Do you have any design docs  
> for the new architecture?

There are some in SVN in ~/java/sca/doc.

There is a way to take an existing Java object and add it in as a  
Tuscany component. The LauncherImpl does this with the  
LauncherRuntimeInfo object that it creates - see LauncherImpl near  
line 86. Services this component exposes can be wired just like those  
from any other component, usually through autowire.

Your Spring host (I'm assuming its a host as you say its in the  
driving seat) can add itself or its ApplicationContext as a component  
in Tuscany and that would allow any other component to wire to it.  
So, for example, SpringComponentTypeLoader would just have an  
@Autowire dependency to a AbstractRefreshableApplicationContext (or  
whatever interface is implemented by it) that it could use directly.


>> Once again, thanks for the patch. If you do get a chance to look at a
>> couple of these things I'll be online tomorrow and able to help get
>> the changes in.
>
> Thanks. I'll be looking at some of the Spring issues Jim came  
> across, so the patch will be getting bigger :) This is the problem  
> in a fast moving environment with deadlines to meet...
>
> BTW the patch does actually solve the problem I was aiming at - we  
> are now able to run Spring webapps and struts apps with Tuscany  
> wiring at the back end.

Great - let's work on getting it into SVN. I'll be on IRC today if  
that helps, or ping me directly if you want my google address.
--
Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

Posted by Andy Piper <an...@bea.com>.
At 06:25 07/09/2006, Jeremy Boynes wrote:
>Thanks for the patch Andy. I do have a few comments that I hope you
>can address :-)

I would be the first to admit that its an egregious hack. 
Unfortunately some of the things I am trying to do do not yet have 
supporting functionality in Tuscany. I'm hoping your expertise can be 
brought to bear on some of these issues.

>Would it be possible to break this down a little - there are changes
>in there to the startup code and to the Spring container - is it
>possible to separate those so that there is less to tackle in one go?

Sure, although separating these out in patches is a pain. It means 
keeping multiple workspaces which then creates merge headaches for me.

>For example, are the startup changes really coupled to renaming the
>SpringSCA XSD?

Well, the latter are just obvious typos. Barring those the patch in 
its totality supports a specific feature for Spring apps. I can break 
it up, but I must admit I was assuming that you or Jim would want to 
massage it somewhat anyway. Things move so fast in svn at the moment 
that if you don't get patches out quick the world has changed :)

>Some of the changes seem cosmetic (e.g. JavaDoc changes) and these
>really are easier to review if kept separate.

? I'm not aware of those.

>Also some of the changes don't seem to fit our coding style
>guidelines. I know we're often lax about that but I felt I should
>mention it as we're actively trying to improve. You can check this
>fairly easily using the "sourcecheck" profile in Maven ("mvn -o - 
>Psourcecheck").


[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-checkstyle-plugin' 
does not ex
ist or no valid version could be found

I'm happy to plug in to IntelliJ whatever is appropriate, I had 
assumed that the idea:idea target would do that, but evidently not. I 
tried to adjust my settings based on other code (4 spaces for indent, 
no tabs) but obviously something is not quite right. Can you point me 
at what needs to go in IntelliJ?

I work on 5 or 6 different open source projects, each with their own 
coding styles, so bear with me while I context switch.

>On a legal front, please can you make sure new files have the correct
>header block on them (the new one without a (c) statement). Apache
>also prefers that files do not contain @author tags we are following
>that guideline.

Sure, sorry. That's a hangover from hacking on Spring.

>We've tried real hard to avoid a dependency on a particular logging
>framework, clogging in particular due to the conflicts that occur
>between different projects (for example, you're including 1.1 but
>some of our other dependencies are using older versions).

Can you point me at the recommended way of logging? I could not 
immediately find any code that did this.

>Getting to the technical stuff, the big question I have is about
>passing in a Map of properties. This seems to go against the IoC
>principles of SCA, Tuscany and Spring. Did you consider extending
>RuntimeInfo e.g. as SpringRuntimeInfo, adding in something like
>getApplicationContext() ? Or perhaps better, adding the

Yeah, if there is a better way of doing this I would be glad to use 
it. I did what I could to get stuff working without introducing core 
dependencies on spring. Extending RuntimeInfo is fine, it means more 
changes to the Launcher but I guess that's ok.

>ApplicationContext as a component in the runtime that could be
>directly used as a dependency?

Not sure how I inject this from outside the runtime. This was my big 
problem. In this specific use case, Spring needs to be in the driving 
seat, passing to the Tuscany runtime what it needs to do further 
wiring. If you can outline an example of how this would work that 
would be great. I must admit that the operation of these various 
pieces is far from clear from the javadoc, so I'm sure my 
understanding is far less than perfect. Do you have any design docs 
for the new architecture?

>Once again, thanks for the patch. If you do get a chance to look at a
>couple of these things I'll be online tomorrow and able to help get
>the changes in.

Thanks. I'll be looking at some of the Spring issues Jim came across, 
so the patch will be getting bigger :) This is the problem in a fast 
moving environment with deadlines to meet...

BTW the patch does actually solve the problem I was aiming at - we 
are now able to run Spring webapps and struts apps with Tuscany 
wiring at the back end.

Thanks

andy 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Re: [jira] Updated: (TUSCANY-699) Allow bootstrap of tuscanny from spring web apps / struts apps etc

Posted by Jeremy Boynes <jb...@apache.org>.
Thanks for the patch Andy. I do have a few comments that I hope you  
can address :-)

Would it be possible to break this down a little - there are changes  
in there to the startup code and to the Spring container - is it  
possible to separate those so that there is less to tackle in one go?  
For example, are the startup changes really coupled to renaming the  
SpringSCA XSD?

Some of the changes seem cosmetic (e.g. JavaDoc changes) and these  
really are easier to review if kept separate.

Also some of the changes don't seem to fit our coding style  
guidelines. I know we're often lax about that but I felt I should  
mention it as we're actively trying to improve. You can check this  
fairly easily using the "sourcecheck" profile in Maven ("mvn -o - 
Psourcecheck").

On a legal front, please can you make sure new files have the correct  
header block on them (the new one without a (c) statement). Apache  
also prefers that files do not contain @author tags we are following  
that guideline.

We've tried real hard to avoid a dependency on a particular logging  
framework, clogging in particular due to the conflicts that occur  
between different projects (for example, you're including 1.1 but  
some of our other dependencies are using older versions).

Getting to the technical stuff, the big question I have is about  
passing in a Map of properties. This seems to go against the IoC  
principles of SCA, Tuscany and Spring. Did you consider extending  
RuntimeInfo e.g. as SpringRuntimeInfo, adding in something like  
getApplicationContext() ? Or perhaps better, adding the  
ApplicationContext as a component in the runtime that could be  
directly used as a dependency?

Once again, thanks for the patch. If you do get a chance to look at a  
couple of these things I'll be online tomorrow and able to help get  
the changes in.

--
Jeremy

On Sep 6, 2006, at 11:28 AM, Andy Piper (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/TUSCANY-699?page=all ]
>
> Andy Piper updated TUSCANY-699:
> -------------------------------
>
>     Attachment: springlaunch.patch
>
>> Allow bootstrap of tuscanny from spring web apps / struts apps etc
>> ------------------------------------------------------------------
>>
>>                 Key: TUSCANY-699
>>                 URL: http://issues.apache.org/jira/browse/TUSCANY-699
>>             Project: Tuscany
>>          Issue Type: Improvement
>>          Components: Java SCA Core
>>    Affects Versions: Java-M2
>>            Reporter: Andy Piper
>>         Attachments: springlaunch.patch
>>
>>
>> Spring provides a wealth of web app integration components. To  
>> reimplement these in Tuscany would be prohibitive, instead we need  
>> to allow Spring to bootstrap Tuscany and use its standard  
>> extension mechanisms.
>> I have a patch.
>
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the  
> administrators: http://issues.apache.org/jira/secure/ 
> Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/ 
> software/jira
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org