Jeremy,
Thanks for your help,
I was wondering you could please extend this a bit,
public abstract class RuntimeInfo {
public abstract URL getRepositoryURL();
}
public class WarRuntimeInfo {
public URL getRepositoryURL() {
// Get stuff from servlet context
return servletContext.getResource("WEB-INF/tuscany/repository");
}
}
public class StanadloneRuntimeInfo {
public URL getRepositoryURL() {
return new File(getInstallDir(), "repository").toUrl();
}
}
This means, I won't need to subclass MavenArtifactRepository for webapp
host and standalone. I could do something like below and use the common
abstraction for RuntimeInfo (because I am only inteersted in the
repository URL, at least to start with),
public class MavenArtifactRepository {
public MavenArtifactRepository(@Autowire RuntimeInfo runtimeInfo) {
this.runtimeInfo = runtimeInfo}
}
}
Ta
Meeraj
-----Original Message-----
From: Jeremy Boynes [mailto:[EMAIL PROTECTED]
Sent: 19 September 2006 22:13
To: [email protected]
Subject: Re: Update on dependency work
It would set the component up - you would want to define an autowire to
it e.g.
public class WarMavenRepository extends ${some repo baseclass} {
public WarMavenRepository(@Autowire WarRuntimeInfo runtimeInfo) {
this.runtimeInfo = runtimeInfo}
}
}
Injection would be performed by the system component container when
creating your instance (i.e. it is actually done by the fabric not the
host environment).
--
Jeremy
On Sep 19, 2006, at 2:06 PM, Meeraj Kunnumpurath wrote:
> Jeremy,
>
> That should work nicely for me. Also, I guess the host environment
> will inject the right runtime info instnace into the artifcat repo
> instance?
>
> Thanks for your help
> Meeraj
>
>
>> From: Jeremy Boynes <[EMAIL PROTECTED]>
>> Reply-To: [email protected]
>> To: [email protected]
>> Subject: Re: Update on dependency work
>> Date: Tue, 19 Sep 2006 13:12:30 -0700
>>
>> On Sep 19, 2006, at 12:42 PM, Meeraj Kunnumpurath wrote:
>>
>>> Ok, thinking about this further, I have a couple of ideas ...
>>>
>>> Have an abstract class AbstractMavenRepository with two
>>> specializations,
>>>
>>> 1. WarMavenRepository
>>> 2. StandaloneMavenRepository
>>>
>>> Both will get injected an instance of RuntimeInfo that is specific
>>> to the runtime environment in which the repository is used. We
>>> could have WarRuntimeInfo that will give reference to artifacts
>>> like servlet context and StandaloneRuntimeInfo that will provide
>>> info on install dir etc. The host enviornment will inject the
>>> appropriate runtime info object to the repo.
>>
>> I had run into that thinking about how to move the extension loader
>> from WebappRuntimeInfo into a component. Also we have the various
>> problems with how we tried to find the install directory,
>> particularly when there wasn't one (e.g. in a war or in a test case).
>>
>> I think it would be fairly easy to fix this and I've been tinkering
>> with the bootstrap code recently so I'm happy to take this on. At
>> first guess I've been thinking we'd get something like:
>>
>> StandaloneRuntimeInfo extends RuntimeInfo {
>> File getInstallDirectory();
>> }
>>
>> WarRuntimeInfo extends RuntimeInfo {
>> ServletContext getServletContext(); }
>>
>> I'm not quite sure what the current getApplicationRootDirectory()
>> method returns and why we need it - can someone please enlighten me
>> here?
>>
>> Meeraj, if this works for you I should be able to get that in there
>> today or tomorrow.
>> --
>> Jeremy
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> _________________________________________________________________
> Windows Live(tm) Messenger has arrived. Click here to download it for
> free! http://imagine-msn.com/messenger/launch80/?locale=en-gb
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message has been checked for all email viruses by MessageLabs.
*****************************************************
You can find us at www.voca.com
*****************************************************
This communication is confidential and intended for
the exclusive use of the addressee only. You should
not disclose its contents to any other person.
If you are not the intended recipient please notify
the sender named above immediately.
Registered in England, No 1023742,
Registered Office: Voca Limited
Drake House, Three Rivers Court,
Homestead Road, Rickmansworth,
Hertfordshire, WD3 1FX
This message has been checked for all email viruses by MessageLabs.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]