
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68
410 lines
No EOL
17 KiB
HTML
410 lines
No EOL
17 KiB
HTML
|
|
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<META name="description" content="Apache Tuscany">
|
|
<META name="keywords" content="apache, apache tuscany, tuscany, service, services, fabric, soa, service oriented architecture, sca, service component architecture, das, sdo, csa, ruby, opensource">
|
|
|
|
<LINK type="text/css" rel="stylesheet" href="http://tuscany.apache.org/stylesheets/default.css">
|
|
<LINK rel="SHORTCUT ICON" href="https://cwiki.apache.org/confluence/display/TUSCANYxDOCx2x/$images/favicon.ico">
|
|
<TITLE>SCA Java Deployment : Apache Tuscany</TITLE>
|
|
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
|
|
|
|
<STYLE>
|
|
.spacetree * ul {
|
|
padding-left:0px;
|
|
margin-left: 0px;
|
|
}
|
|
.spacetree * li {
|
|
margin-left: 5px;
|
|
padding-left:5px;
|
|
}
|
|
</STYLE>
|
|
|
|
<BODY onload="init()">
|
|
<!-- topNav -->
|
|
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
|
|
<TR class="topBar">
|
|
<TD align="left" valign="middle" class="topBarDiv" align="left" nowrap="">
|
|
<A href="https://cwiki.apache.org/geronimo"> Home</A> > <A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="development-guides.html" title="Development Guides">Development Guides</A> > <A href="" title="SCA Java Deployment">SCA Java Deployment</A>
|
|
</TD>
|
|
<TD align="right" valign="middle" nowrap="">
|
|
<FORM name="search" action="http://www.google.com/search" method="get">
|
|
<INPUT type="hidden" name="ie" value="UTF-8">
|
|
<INPUT type="hidden" name="oe" value="UTF-8">
|
|
<INPUT type="hidden" name="domains" value="">
|
|
<INPUT type="hidden" name="sitesearch" value="">
|
|
<INPUT type="text" name="q" maxlength="255" value="">
|
|
<INPUT type="submit" name="btnG" value="Google Search">
|
|
</FORM>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
|
|
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
|
|
<TR class="topBar">
|
|
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
|
|
<A href="index.html" title="Apache Tuscany Docs 2.x">Apache Tuscany Docs 2.x</A> > <A href="index.html" title="Index">Index</A> > <A href="development-guides.html" title="Development Guides">Development Guides</A> > <A href="" title="SCA Java Deployment">SCA Java Deployment</A>
|
|
</TD>
|
|
|
|
<TD align="right" valign="middle" class="topBarDiv" align="left" nowrap="true">
|
|
<A href="http://tuscany.apache.org/">Tuscany Home</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
|
|
<TR>
|
|
<TD valign="top" align="left" width="22%" bgcolor="#F9F9F9" class="noprint">
|
|
<DIV class="tabletitle">Table of Contents</DIV>
|
|
<DIV class="spacetree">
|
|
|
|
|
|
</DIV>
|
|
</TD>
|
|
<TD align="left" valign="top" width="78%">
|
|
<!-- pageContent -->
|
|
<DIV id="PageContent">
|
|
<DIV class="pageheader" style="padding: 6px 0px 0px 0px;">
|
|
<!-- We'll enable this once we figure out how to access (and save) the logo resource -->
|
|
<!--img src="http://geronimo.apache.org/images/confluence_logo.gif" style="float: left; margin: 4px 4px 4px 10px;" border="0"-->
|
|
<DIV style="margin: 0px 10px 0px 10px" class="smalltext">Apache Tuscany Docs 2.x</DIV>
|
|
<DIV style="margin: 0px 10px 8px 10px" class="pagetitle">SCA Java Deployment</DIV>
|
|
|
|
<DIV class="greynavbar" align="right" style="padding: 2px 10px; margin: 0px;">
|
|
<!-- -->
|
|
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=5965425">
|
|
<IMG src="http://geronimo.apache.org/images/icons/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
|
|
<A href="https://cwiki.apache.org/confluence/pages/editpage.action?pageId=5965425">Edit Page</A>
|
|
|
|
<A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x">
|
|
<IMG src="http://geronimo.apache.org/images/icons/browse_space.gif" height="16" width="16" border="0" align="absmiddle" title="Browse Space"></A>
|
|
<A href="https://cwiki.apache.org/confluence/pages/listpages.action?key=TUSCANYxDOCx2x">Browse Space</A>
|
|
|
|
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5965425">
|
|
<IMG src="http://geronimo.apache.org/images/icons/add_page_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add Page"></A>
|
|
<A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5965425">Add Page</A>
|
|
|
|
<A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5965425">
|
|
<IMG src="http://geronimo.apache.org/images/icons/add_blogentry_16.gif" height="16" width="16" border="0" align="absmiddle" title="Add News"></A>
|
|
<A href="https://cwiki.apache.org/confluence/pages/createblogpost.action?spaceKey=TUSCANYxDOCx2x&fromPageId=5965425">Add News</A>
|
|
<!-- -->
|
|
</DIV>
|
|
</DIV>
|
|
|
|
<DIV class="pagecontent">
|
|
<DIV class="wiki-content">
|
|
<H1><A name="SCAJavaDeployment-Overview"></A>Overview</H1>
|
|
<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-deployment.data/sca_java_deployment_overview.jpg" style="border: 0px solid black"></SPAN></P>
|
|
|
|
|
|
<H1><A name="SCAJavaDeployment-DeployerImplementation"></A>Deployer Implementation</H1>
|
|
|
|
<P>The Deployer is available in multiple modules in Tuscany Java SCA 2.x</P>
|
|
|
|
<H2><A name="SCAJavaDeployment-ContributionModules"></A>Contribution Modules</H2>
|
|
|
|
<P><SPAN class="image-wrap" style="display: block; text-align: center"><IMG src="sca-java-deployment.data/sca_java_deployment_modules.jpg" style="border: 0px solid black"></SPAN></P>
|
|
|
|
<UL>
|
|
<LI><B>Deployer</B>
|
|
<UL>
|
|
<LI>Responsible to process contribution lifecycle</LI>
|
|
</UL>
|
|
</LI>
|
|
<LI><B>Contribution Extensions</B>
|
|
<UL>
|
|
<LI>Extension point to add imports/exports
|
|
<UL>
|
|
<LI>Currently available : namespace and java import/export</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
</LI>
|
|
<LI><B>Contribution Processors</B>
|
|
<UL>
|
|
<LI>Extension point to add contribution artifact processors</LI>
|
|
</UL>
|
|
</LI>
|
|
<LI><B>Contribution Scanners</B>
|
|
<UL>
|
|
<LI>Extension point to add package scanners to process contribution contents
|
|
<UL>
|
|
<LI>Currently available : directory, zip and jar</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
</LI>
|
|
<LI><B>Contribution Model Resolvers</B>
|
|
<UL>
|
|
<LI>Extension point to add artifact model resolvers</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
|
|
|
|
<H2><A name="SCAJavaDeployment-Deployerlifecycle"></A>Deployer life cycle</H2>
|
|
|
|
<UL>
|
|
<LI><B>Initialize</B>
|
|
<UL>
|
|
<LI>Load definitions.xml and store in a system contribution</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
|
|
|
|
<UL>
|
|
<LI><B>Load</B>
|
|
<UL>
|
|
<LI>Read contribution artifacts utilizing the Contribution Scanner</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
|
|
|
|
<UL>
|
|
<LI><B>Build</B>
|
|
<UL>
|
|
<LI>Pre-resolve the contribution artifacts</LI>
|
|
<LI>Build contribution dependencies by processing contribution imports/exports</LI>
|
|
<LI>Resolve contribution artifacts</LI>
|
|
</UL>
|
|
</LI>
|
|
</UL>
|
|
|
|
|
|
<H2><A name="SCAJavaDeployment-DeployerInterface"></A>Deployer Interface</H2>
|
|
|
|
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
|
|
<PRE class="code-java">
|
|
/**
|
|
* A utility that provides system functions to handle Tuscany SCA application deployment
|
|
*/
|
|
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> Deployer <SPAN class="code-keyword">extends</SPAN> LifeCycleListener {
|
|
/**
|
|
* Attach a deployment composite to the given contribution
|
|
* @param contribution The target contribution
|
|
* @param composite The deployment composite
|
|
* @param appending A flag to indicate <SPAN class="code-keyword">if</SPAN> existing deployable composites in the contribution should be appended or replaced
|
|
*/
|
|
void attachDeploymentComposite(Contribution contribution, Composite composite, <SPAN class="code-object">boolean</SPAN> appending);
|
|
|
|
/**
|
|
* Configure a list of contributions to create a composite representing a view of the domain
|
|
* @param contributions
|
|
* @param bindingBaseURIs
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionResolveException
|
|
* @<SPAN class="code-keyword">throws</SPAN> CompositeBuilderException
|
|
*/
|
|
Composite build(List<Contribution> contributions, Map<QName, List<<SPAN class="code-object">String</SPAN>>> bindingBaseURIs, Monitor monitor)
|
|
<SPAN class="code-keyword">throws</SPAN> ContributionResolveException, CompositeBuilderException;
|
|
|
|
/**
|
|
* Load an artifact from the given location
|
|
* @param uri
|
|
* @param location
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
*/
|
|
Artifact loadArtifact(URI uri, URL location, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> ContributionReadException;
|
|
|
|
/**
|
|
* Load a contribution from the given location
|
|
* @param uri
|
|
* @param location
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
*/
|
|
Contribution loadContribution(URI uri, URL location, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> ContributionReadException;
|
|
|
|
/**
|
|
* @param <T>
|
|
* @param uri
|
|
* @param location
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
*/
|
|
<T> T loadDocument(URI uri, URL location, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> ContributionReadException;
|
|
|
|
/**
|
|
* @param <T>
|
|
* @param reader
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> XMLStreamException
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
*/
|
|
<T> T loadXMLDocument(Reader reader, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> XMLStreamException, ContributionReadException;
|
|
|
|
/**
|
|
* @param <T>
|
|
* @param location
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> XMLStreamException
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
*/
|
|
<T> T loadXMLDocument(URL location, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> XMLStreamException, ContributionReadException;
|
|
|
|
/**
|
|
* @param <T>
|
|
* @param reader
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionReadException
|
|
* @<SPAN class="code-keyword">throws</SPAN> XMLStreamException
|
|
*/
|
|
<T> T loadXMLElement(XMLStreamReader reader, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> ContributionReadException, XMLStreamException;
|
|
|
|
/**
|
|
* Save the model as XML
|
|
* @param model
|
|
* @param writer
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">throws</SPAN> XMLStreamException
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionWriteException
|
|
*/
|
|
void saveXMLDocument(<SPAN class="code-object">Object</SPAN> model, Writer writer, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> XMLStreamException,
|
|
ContributionWriteException;
|
|
|
|
/**
|
|
* Save the model as XML
|
|
* @param model
|
|
* @param writer
|
|
* @param monitor
|
|
* @<SPAN class="code-keyword">throws</SPAN> XMLStreamException
|
|
* @<SPAN class="code-keyword">throws</SPAN> ContributionWriteException
|
|
*/
|
|
void saveXMLElement(<SPAN class="code-object">Object</SPAN> model, XMLStreamWriter writer, Monitor monitor) <SPAN class="code-keyword">throws</SPAN> XMLStreamException,
|
|
ContributionWriteException;
|
|
|
|
/**
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
*/
|
|
<SPAN class="code-object">boolean</SPAN> isSchemaValidationEnabled();
|
|
/**
|
|
* @param schemaValidationEnabled
|
|
*/
|
|
void setSchemaValidationEnabled(<SPAN class="code-object">boolean</SPAN> schemaValidationEnabled);
|
|
|
|
/**
|
|
*
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
*/
|
|
Monitor createMonitor();
|
|
|
|
/**
|
|
* Create an instance of {@link BuilderContext}
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
*/
|
|
BuilderContext createBuilderContext();
|
|
|
|
/**
|
|
* Create an instance of {@link ProcessorContext}
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
*/
|
|
ProcessorContext createProcessorContext();
|
|
|
|
/**
|
|
* Get the {@link ExtensionPointRegistry}
|
|
* @<SPAN class="code-keyword">return</SPAN>
|
|
*/
|
|
ExtensionPointRegistry getExtensionPointRegistry();
|
|
|
|
/*
|
|
* @see org.apache.tuscany.sca.core.LifeCycleListener#start()
|
|
*/
|
|
void start();
|
|
|
|
/*
|
|
* @see org.apache.tuscany.sca.core.LifeCycleListener#stop()
|
|
*/
|
|
void stop();
|
|
|
|
}
|
|
</PRE>
|
|
</DIV></DIV>
|
|
|
|
<H1><A name="SCAJavaDeployment-DeployingacontributionusingtheNodeAPI"></A>Deploying a contribution using the Node API</H1>
|
|
|
|
<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
|
|
<PRE class="code-java">
|
|
|
|
/**
|
|
* This client program shows how to create an SCA runtime, start it,
|
|
* and locate and invoke a SCA component
|
|
*/
|
|
<SPAN class="code-keyword">public</SPAN> class CalculatorClient {
|
|
<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main(<SPAN class="code-object">String</SPAN>[] args) <SPAN class="code-keyword">throws</SPAN> Exception {
|
|
|
|
<SPAN class="code-object">String</SPAN> contribution = ContributionLocationHelper.getContributionLocation(CalculatorClient.class);
|
|
Node node = NodeFactory.newInstance().createNode(<SPAN class="code-quote">"Calculator.composite"</SPAN>, <SPAN class="code-keyword">new</SPAN> Contribution(<SPAN class="code-quote">"calculator"</SPAN>, contribution));
|
|
|
|
node.start();
|
|
|
|
CalculatorService calculatorService = ((Client)node).getService(CalculatorService.class, <SPAN class="code-quote">"CalculatorServiceComponent"</SPAN>);
|
|
|
|
<SPAN class="code-comment">// Calculate
|
|
</SPAN> <SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">"3 + 2="</SPAN> + calculatorService.add(3, 2));
|
|
<SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">"3 - 2="</SPAN> + calculatorService.subtract(3, 2));
|
|
<SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">"3 * 2="</SPAN> + calculatorService.multiply(3, 2));
|
|
<SPAN class="code-object">System</SPAN>.out.println(<SPAN class="code-quote">"3 / 2="</SPAN> + calculatorService.divide(3, 2));
|
|
|
|
node.stop();
|
|
}
|
|
|
|
}
|
|
|
|
</PRE>
|
|
</DIV></DIV>
|
|
|
|
</DIV>
|
|
|
|
</DIV>
|
|
</DIV>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- footer -->
|
|
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
|
|
<TR>
|
|
<TD align="left" valign="middle" class="footer">
|
|
|
|
<IMG src="http://static.delicious.com/img/delicious.small.gif" height="10" width="10" alt="Delicious">
|
|
<A href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'delicious','toolbar=no,width=550,height=550'); return false;">Bookmark this on Delicious</A>
|
|
|
|
<IMG src="http://digg.com/img/badges/16x16-digg-guy.gif" width="16" height="16" alt="Digg!">
|
|
<A href="" onclick="window.open('http://digg.com/submit?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&topic=programming');">Digg this</A>
|
|
<!-- Slicker, but no text
|
|
<script type="text/javascript">
|
|
digg_skin = 'icon';
|
|
digg_window = 'new';
|
|
digg_title = 'Apache Geronimo v2.2 Documentation : SCA Java Deployment';
|
|
digg_topic = 'programming';
|
|
</script>
|
|
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
|
|
-->
|
|
|
|
</TD>
|
|
<TD align="right" valign="middle" class="footer">
|
|
<A href="http://cwiki.apache.org/GMOxPMGT/geronimo-privacy-policy.html">Privacy Policy</A> -
|
|
Copyright © 2003-2010, The Apache Software Foundation, Licensed under <A href="http://www.apache.org/licenses/LICENSE-2.0">ASL 2.0.</A>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
</BODY>
|
|
</HTML> |