Hello,
Looks like currently tuscany supports just the file:// protocol only for
loading contributions- see
org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImp
l.getType() below.
Are there plans to support http:// protocol for loading composites
hosted externally?
-------
public String getType(URL resourceURL, String defaultContentType) {
URLConnection connection = null;
String contentType = defaultContentType;
if (resourceURL.getProtocol().equals("file") &&
FileHelper.toFile(resourceURL).isDirectory()) {
// Special case : contribution is a folder
contentType = ContentType.FOLDER;
} else {
contentType = resolveContentyTypeByExtension(resourceURL);
if (contentType == null) {
try {
connection = resourceURL.openConnection();
contentType = connection.getContentType();
if (contentType == null ||
contentType.equals("content/unknown")) {
// here we couldn't figure out from our registry
or from URL and it's not a special file
// return defaultContentType if provided
contentType = defaultContentType;
}
} catch (IOException io) {
// could not access artifact, just ignore and we
will return
// null contentType
}
}
}
return contentType == null ? defaultContentType : contentType;
}
Radu Marian
CRM Services Architecture Team
Bank of America, Charlotte NC
(980) 387-6233
[EMAIL PROTECTED]
-----Original Message-----
From: Marian, Radu
Sent: Friday, April 25, 2008 12:10 PM
To: '[email protected]'
Subject: RE: loading composite from url
Raymond,
Thanks for your help so far.
I have run the tutorial - at least the store node... I have yet to
understand how things are launched through node launcher ... some
documentation may help.
However, here is what I need to be done and the approach I would like to
take.
1. Lunch sca domain from a servlet. - Do I need the TuscanyServletFilter
in web.xml?
2. Initialize sca domain with artifacts from the runtime of my web app -
all classes are read through DefaultSCADomain.
3. Initialize sca domain with ConsumerFacade.composite served from an
external URL - as a result all the properties values from the
ConsumerFacade.composite will be injected into the referenced classes.
My approach is to:
1. set system property "org.apache.tuscany.sca.host.embedded.SCADomain"
to my own class - a copy of DefaultSCADomain.
2. Add a new method static SCADomain createNewInstance(String domainURI,
String contributionLocation, URL... composites) {
3. Anything else?
Am I on the right track? Would you do this?
Thanks,
Radu Marian
CRM Services Architecture Team
Bank of America, Charlotte NC
(980) 387-6233
[EMAIL PROTECTED]
Radu Marian
CRM Services Architecture Team
Bank of America, Charlotte NC
(980) 387-6233
[EMAIL PROTECTED]
-----Original Message-----
From: Raymond Feng [mailto:[EMAIL PROTECTED]
Sent: Monday, April 21, 2008 4:56 PM
To: [email protected]
Subject: Re: loading composite from url
Hi,
Are you trying to load and run a SCA composite remotely from a HTTP URL?
SCADomain class is not designed for this purpose. We now have the
NodeLauncher which can launch a SCA node to run a deployable composite
with required contributions.
Please see an example at:
https://svn.apache.org/repos/asf/incubator/tuscany/java/sca/tutorial/dom
ain/launch/LaunchStoreNode.java.
In this case, the configuration is provided at
http://localhost:9990/node-image/StoreNode by the domain manager. The
content of the file is basically an ATOM feed which contains the entries
of the deployable composite and a list of contributions:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text">Install Image</title> <entry>
<id>composite:store;http://store;store</id> <!-- the QName of the
composite -->
<title type="text">store - http://store;store</title>
<content type="html" />
<link href="/composite-resolved/composite:store;http://store;store"
/>
<!-- The URL of the resolved composite file --> </entry>
<!-- The contributions -->
<entry>
<id>assets</id>
<title type="text">assets</title>
<content type="html" />
<link href="/contribution/assets" />
<link
href="file:/C:/Tuscany/java/sca/tutorial/domain/../assets/target/tutoria
l-assets.jar"
rel="alternate" />
</entry>
<entry>
<id>store</id>
<title type="text">store</title>
<content type="html" />
<link href="/contribution/store" />
<link
href="file:/C:/Tuscany/java/sca/tutorial/domain/../store/target/tutorial
-store.jar"
rel="alternate" />
</entry>
</feed>
Thanks,
Raymond
--------------------------------------------------
From: "Marian, Radu" <[EMAIL PROTECTED]>
Sent: Monday, April 21, 2008 12:40 PM
To: <[email protected]>
Subject: RE: loading composite from url
> Adriano,
>
> The initial post was corrupted by the Outlook html behavior. So now
> using plain text instead...
>
> In my code I am saying:
>
>
> SCADomain.newInstance("http://localhost:7001/some-web-app/Test.composi
> te
> ");
>
> And it produces the ServiceRuntimeException error (listed below).
>
> Thanks for your prompt reply.
>
> Radu Marian
> CRM Services Architecture Team
> Bank of America, Charlotte NC
> (980) 387-6233
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Adriano Crestani
> Sent: Monday, April 21, 2008 3:32 PM
> To: [email protected]
> Subject: Re: loading composite from url
>
> Hi Marian,
>
> Shouldn`t be
>
> SCADomain.newInstance("http://localhost:7001/some-web-app/Test.composi
> te
> ");
>
> instead of
>
> SCADomain.newInstance("http://localhost:7001/some-web-app/Test.composi
> te <http://localhost:7001/some-web-app/Test.composite> ");
>
> ?
>
> On Mon, Apr 21, 2008 at 3:03 PM, Marian, Radu
> <[EMAIL PROTECTED]>
> wrote:
>
>> Hello,
>>
>> How do I achieve the following:
>> scaDomain =
>> SCADomain.newInstance("http://localhost:7001/some-web-app/Test.compos
>> i te <http://localhost:7001/some-web-app/Test.composite> ");
>>
>> I am getting the following error:
>>
>> org.osoa.sca.ServiceRuntimeException:
>> org.osoa.sca.ServiceRuntimeException:
>> java.lang.IllegalArgumentException: Composite not found:
>> http://localhost:7001/crms-domain/metadata/transformation.service/con
>> s um er.facade/v001/ConsumerFacade.composite
>> <http://localhost:7001/crms-domain/metadata/transformation.service/co
>> n su mer.facade/v001/ConsumerFacade.composite>
>> at
>> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCAD
>> o
>> ma
>> in.java:264)
>> at
>> org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.
>> j
>> av
>> a:69)
>> at DomainTestCase.setUp(DomainTestCase.java:41)
>> ...
>> Caused by: org.osoa.sca.ServiceRuntimeException:
>> java.lang.IllegalArgumentException: Composite not found:
>> http://localhost:7001/crms-domain/metadata/transformation.service/con
>> s um er.facade/v001/ConsumerFacade.composite
>> <http://localhost:7001/crms-domain/metadata/transformation.service/co
>> n su mer.facade/v001/ConsumerFacade.composite>
>> at
>> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(Def
>> a
>> ul
>> tSCADomain.java:117)
>> at
>> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCAD
>> o
>> ma
>> in.java:230)
>> ... 16 more
>> Caused by: java.lang.IllegalArgumentException: Composite not found:
>> http://localhost:7001/crms-domain/metadata/transformation.service/con
>> s um er.facade/v001/ConsumerFacade.composite
>> <http://localhost:7001/crms-domain/metadata/transformation.service/co
>> n su mer.facade/v001/ConsumerFacade.composite>
>> at
>> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getContrib
>> u
>> ti
>> onLocation(DefaultSCADomain.java:299)
>> at
>> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(Def
>> a
>> ul
>> tSCADomain.java:111)
>> ... 17 more
>>
>> Regards,
>> Radu Marian
>> CRM Services Architecture Team
>> Bank of America, Charlotte NC
>> (980) 387-6233
>> [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> 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]