Tuscany 2.0 documentation

MATLAB代码及接受套件:《沿轨速度预算管控饱和无人机群中的编队误差》.zip 1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。 立即下载

 

Apache Tuscany Docs 2.x

2.0-beta-Samples documentation

Tuscany 2.0-Beta1 Samples

The Tuscany samples are shipped with Tuscany binary and source releases (see the /samples directory). If you are using Tuscany from a release distribution then make sure you are looking at the documentation that corresponds to the samples as they stood at the time of the release.

The contents of the Samples page contains links to the various different versions of samples documentation.

In a distribution, the samples source code is found in the samples directory, directly under the root directory. The following sections are laid out to match the structure of the samples directory and its subdirectories.

If you're new to Tuscany SCA start with the getting-started. Samples are generally presented in the form on an SCA contribution (look for directories ending in "-contribution") or as a webapp (look for directories ending in "-webapp"). The directories getting-started, learning-more and applications all contain sample SCA contributions of increasing complexity. The running-tuscany directory describes the various different ways you can start the Tuscany runtime and install contributions. The extending-tuscany directory contains some examples of how to build new binding and implementation extensions for using in Tuscany.

In the following text we use <some_text> to mean you have to replace it with whatever is appropriate in your environment. For example <tuscany_bin_distro> means the directory in which you install the Tuscany binary distribution.

Instructions are colour coded as follows:

Instructions in pink boxes are for the Ant user

Instructions in silver boxes are for the Maven user

Note. As some of these samples create and use local network connections you may need to configure your firewall, if you are running one, to allow the test to run successfully.

getting-started

SCA defines a concept called a Contribution which is the way that SCA composite applications are packed for deployment. See SCA Introduction for more information on SCA concepts.

The getting-started samples consist of simple SCA contributions that you can build and run as your first step to getting up and running with the Tuscany SCA Java runtime.

You can build the sample contributions with either Maven or Ant and the running-tuscany directory contains information about the various ways you can start Tuscany and run these contributions.

helloworld-contribution

This is a simple SCA contribution. It describes a composite application with a single component, HelloWorldComponent, implemented in Java. The component's Java implementation provides service "business logic" for saying hello to a person whose name is supplied as input to the service. The component is described in a composite called helloworld.composite as follows:

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
           targetNamespace="http://sample"
           name="helloworld">

    <component name="HelloworldComponent">
        <implementation.java class="sample.HelloworldImpl"/>
    </component>

</composite>

The contribution also contains a composite called helloworldws.composite which describes a component, HelloworldWSComponent, that uses the same implementation but uses a web services binding:

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
           targetNamespace="http://sample"
           name="helloworldws">

    <component name="HelloworldWSComponent">
        <implementation.java class="sample.HelloworldImpl"/>
        <service name="Helloworld">
           <binding.ws />
        </service>
    </component>

</composite>

This gives us a number of options for interacting with the components in this application.

Firstly there is a JUnit test inside this project called HelloworldTestCase.java. This starts the Tuscany runtime and loads the contribution. It then talks to the HelloworldComponent over the default SCA binding (binding.sca) using a local Java proxy.

Secondly the HelloworldWSComponent exposes a service with a web services binding. You can talk to this component using your favourite web services client. You can retrieve the WSDL for the web service automatically (see later)

To build this contribution using Ant do the following:

TODO

To build this contribution using Maven do the following:

cd helloworld-contribution
mvn

This will produce the contribution as follows:

helloworld-contribution/target/helloworld-contribution.jar

As the JUnit test deploys and runs the contribution we can use it as a first simple example of a running SCA application.

To run the JUnit test using Ant do the following:

TODO

The contribution will be run automatically during the Maven build step and you will see the output from the JUnit test printed on the console in amongst the other output:

Response from helloworld.sayHello("Petra") = Hello Petra

To access the web service that the HelloworldWSComponent exposes we have to keep the runtime runntime running.

To run the sample Ant so that you can access the web service do the following:

TODO

We have a Maven plugin that will run SCA contributions. You use it in Maven as follows:

cd helloworld-contribution
mvn tuscany:run

You will note that in the console output you can see a web service being exposed by the binding.ws JAXWS provider:

Binding.ws JAXWS provider - Service URI: http://localhost:8085/HelloworldWSComponent/Helloworld

If you point you web browser at this address and add ?wsdl on the end:

http://localhost:8085/HelloworldWSComponent/Helloworld?wsdl

You'll see the WSDL for the service returned. Using you're favourite web services client, for example, the Web Services Explorer in Eclipse, you can send messages to this web service.

When you're done use CTRL-C to stop the sample.

For more information on getting started with the Apache Tuscany SCA Java runtime see the Getting Started page.

helloworld-webapp

This sample is not a contribution in it's own right but demonstrates how to run the helloworld-contribution inside a web application. As it's the same contribution the same two components, HelloworldComponent and HelloworldWSComponnet, will be started.

To build this contribution using Ant do the following:

TODO

To build this contribution using Maven do the following:

cd helloworld-webapp
mvn

This will produce a webapp as follows:

helloworld-webapp/target/helloworld.war

You can run this webapp by deploying it to you're favourite webapp container. For example, you can deploy to Tomcat and run as follows:

cp helloworld-webapp/target/helloworld.war my_tomcat_install/webapps
my_tomcat_install/bin/catalina run

Once running point your web browser at:

http://localhost:8080/helloworld/hello.html

You'll see a link there to the WSDL that's automatically generated for the web service binding of the HelloworldWSComponent. Again you can use your favourite web services client to send messages to the service.

TODO
There is no example of accessing binding.sca from within the webapp. Do we want to include this?
TODO
For more information on creating webapps to run SCA contributions with Tuscany see - ?

callback-api

TODO
This feels like a learning-more sample. I wouldn't focus on callbacks with the first time user

sca-scopes

TODO
This feels like a learning-more sample. I wouldn't focus on scopes with the first time user

sca-include-contribution

TODO
This feels like a learning-more sample. I wouldn't focus on inclusion with the first time user

learning-more

TODO
All of the run instructions here are subject to change. I just picked ones that works but ideally we'd use the command line consistently when that is operating correctly. Also Mike commented that it's unnatural and confusing to "cd running-tuscany/xyz" to run a sample. This should also be solved if we can go with the command line.

The samples found in the contributions below illustrate more of SCA and Tuscany's features in action. The contributions here are primarily focused on demonstrating the various SCA extensions that the Tuscany runtime supports, for example, bindings and implementations. The directories are named to let you easily find a sample of the extension you're interested in.

You can identify contributions here as the name of the directory from which they are built ends with "-contribution". There are also webapp samples here. The names of these directories end with "-webapp".

async

This sample demonstrates the SCA asynchronous progamming model in action as typified by services that are configured with the asyncInvocation intent. For example, from calculator-contribution

@Remotable
@AsyncInvocation
public interface CalculatorServiceAsync {
    void calculateAsync(Integer n1, ResponseDispatch<String> response);
}

A client component can access an asynchronous service either synchronously or asynchronously. Asynchronous reference interfaces also have a special form, again from calculator-contribution:

@Remotable
public interface CalculateReferenceAsync {
	// Sync
	public String calculate(Integer i1);

	// Aysnc Poll
	public Response<String> calculateAsync(Integer i1);

	// Async Callback
	public Future<String> calculateAsync(Integer i1, AsyncHandler<String> handler);
}
calculator-contribution

This contribution defines synchronous and asynchronous component services and a client component which references both. During the test the client component exercise all three styles of reference interface operation against both the synchronous and asynchronous service.

The contribution can be built using Ant as follows:

cd learning-more/async/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows

cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-async-contribution

The contribution can be built using Maven as follows:

cd learning-more/async/calculator-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the sample-implementation-java-calculator-async-contribution.

binding-comet

The Comet protocol allows a servlet to process IO asynchronously, receiving events when data is available for reading on the connection (rather than always using a blocking read), and writing data back on connections asynchronously (most likely responding to some event raised from some other source).

weather-webapp

Executing the command "mvn" in this sample project creates a web archive suitable for deployment to Tomcat. It makes use of the tuscany comet binding.

The webapp can be built using Maven as follows:

cd learning-more/binding-commet/weather-webapp
mvn

The webapp can be installed and run as follows:

cd learning-more/binding-commet/weather-webapp
cp target/sample-binding-comet-1.0.war <your_container_deployment-dir>
start the container as appropriate

binding-jms

This binding supports message orient communication via the JMS API.

helloworld-webapp

This contribution packages an SCA application inside a webapp. The application has two components which exchange helloworld style messages over the JMS binding.

The webapp can be built using Maven as follows:

cd learning-more/binding-jms/helloworld-webapp
mvn

The webapp can be installed and run as follows:

cd learning-more/binding-jms/helloworld-webapp
cp target/helloworld-jms.war <your_container_deployment-dir>
start the container as appropriate
TODO
By rights the webapp should be called sample-binding-jms-helloworld-webapp.war

Once the webapp is deployed point your browser at:

http://localhost:8080/helloworld-jms/

binding-jsonrpc

This binding supports communication over the JSON-RPC protocol.

calculator-contribution

This sample demonstrates using the simple calculator service component which makes use of four other services for add, subtract, multiply and divide functions. In this variant of the calculator sample the AddService is configured to be invoked using the JSON-RPC protocol. You can see the configuration by looking in the src/main/resources/Calculator.composite xml file.

The contribution Jar can be built using Ant as follows:

cd learning-more/binding-jsonrpc/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-async-contribution

The contribution Jar can be built using Maven as follows:

cd learning-more/binding-jsonrpc/calculator-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the sample-implementation-java-calculator-async-contribution.

calculator-webapp

This contribution packages the same calculator-contribution inside a webapp.

The webapp can be built using Maven as follows:

cd learning-more/binding-jsonrpc/calculator-webapp
mvn

The webapp can be installed and run as follows:

cd learning-more/binding-jsonrpc/calculator-webapp
cp target/sample-binding-jsonrpc-calculator-webapp.war <your_container_deployment-dir>
start the container as appropriate

Once the webapp is deployed point your browser at:

http://localhost:8080/sample-binding-jsonrpc-calculator-webapp/

binding-rmi

In this example the calculator function is split over two contributions in order to demonstrate the remote method invocation binding (binding.rmi). The calculator-service-contribution contains a composite which defines a CalculatorServiceComponent which exposes a CalculatorService using binding.rmi. The calculator-reference-contribution contains a composite which also defines a CalculatorServiceComponent but which in this case calls the add, subtract, multiple and divide operations offered by the component in the calculator-service-contribution. The two contributions are run using separate Tuscany nodes and the resulting components communicate over RMI. Both contributions must be deployed and started for the sample to work;

The contributions can be installed and the composite they contain run using Ant as follows:

cd running-tuscany/embedded-jse
ant sample-binding-rmi-calculator-contribution

The contributions can be installed and the composite they contain run using Ant as follows:

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the binding-rmi sample contributions

calculator-service-contribution

This contribution defines a CalculatorServiceComponent whose add, subtract, multiply and divide operations are available over RMI.

The contribution Jar can be built using Ant as follows:

cd learning-more/binding-rmi/calculator-service-contribution
ant

The contribution Jar can be built using Maven as follows:

cd learning-more/binding-rmi/calculator-service-contribution
mvn
calculator-reference-contribution

This sample extends the calculator sample by replacing the local wired connections with RMI bindings. Instead of local add, subtract, multiply and divide components, an RMI service implementation now provides the add, subtract, multiply and divide interfaces and is hosted as an RMI server. References specified in the .composite file include an RMI binding which targets
this RMI server.

The contribution Jar can be built using Ant as follows:

cd learning-more/binding-rmi/calculator-reference-contribution
ant

The contribution Jar can be built using Maven as follows:

cd learning-more/binding-rmi/calculator-reference-contribution
mvn

binding-sca

This sample is the simplest sample other than that shown in the getting starting section. It uses the default SCA protocol for communicating between the various components of the caluclator application.

calculator-contribution

The service and reference definitions in the Calculator.composite and CalculatorClient.composite files have no binding attributes, thereby defaulting to the SCA binding for communication between the running instances of the components.

The contribution Jar can be built using Ant as follows:

cd learning-more/binding-sca/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

cd running-tuscany/embedded-jse
ant sample-binding-sca-calculator-contribution

The contribution Jar can be built using Maven as follows:

cd learning-more/binding-sca/calculator-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the sample-binding-sca-calculator-contribution.

binding-ws

The web service binding allows components to expose and call services using SOAP formatted messages primarily over HTTP.

calculator-contribution

This contribution provides the four arithmetic operations in the calculator service, with the AddService being accessible as a web service via the URLhttp://localhost:8085/AddServiceComponent, as configured in the Calculator.composite file.

The contribution Jar can be built using Ant as follows:

cd learning-more/binding-ws/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

cd running-tuscany/embedded-jse
ant sample-binding-ws-calculator-contribution

The contribution Jar can be built using Maven as follows:

cd learning-more/binding-ws/calculator-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the sample-binding-sca-calculator-contribution.

contribution-helloworld-ws-sdo

This sample demonstrates an SCA reference that uses a web service binding which works with SDO. Instead if using JAXB style Java beans in the service interface they are replaced with SDO object.

TODO
Sample not currently enabled - awaiting SDO support

distributed-osgi

These samples demonstrate the execution of Tuscany contributions in a OSGI environment. In particular the two bundle project in this directory define calculator objects that communicate with one another using the mechanisms defined in the OSGi remote services specifications. Here the Tuscany SCA runtime provides dynamic service discovery functionality. The calculator objects are registered as services directly with the OSGi bundle context by the bundle activator. Under the covers SCA provides the remote service disovery features that allow OSGi registered service to discover and communicate with one another across two JVMs.

To run the sample each bundle must be build using maven and then loaded into a separate OSGi environment into which the Tuscany SCA runtime has already been installed (See "osgi" under running-tuscany)

dosgi-dynamic-calculator-operations

This bundle provides the calculator add, subtract, multiple, divide operations services.

The bundle Jar can be built using Maven as follows:

cd learning-more/distributed-osgi/dosgi-dynamic-calculator-operations
mvn
TODO
projects should be called dosgi-dynamic-calculator-operations-bundle

To run the bundle see "osgi" under running-tuscany. In short do the following:

On Windows, run

java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console

You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.

osgi> ss

Then you can install and start the bundle that's just been built:

osgi> install file:./target/sample-dosgi-dynamic-calculator-operations.jar
dosgi-dynamic-calculator

The bundle Jar can be built using Maven as follows:

cd learning-more/distributed-osgi/dosgi-dynamic-calculator
mvn
TODO
projects should be called dosgi-dynamic-calculator-bundle

To run the bundle see "osgi" under running-tuscany. In short do the following:

On Windows, run

java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console

You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.

osgi> ss

Then you can install and start the bundle that's just been built:

osgi> install file:./target/sample-dosgi-dynamic-calculator.jar

You should see the calculator service start.

implementation-bpel

BPEL component implementations will be useful to those who wish to describe a sequence of calls that must be made to other component services.

contribution-helloworld-bpel

The contribution Jar can be built using Ant as follows:

cd learning-more/implementation-bpel/helloworld-bpel-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

????

The contribution Jar can be built using Maven as follows:

cd learning-more/implementation-bpel/helloworld-bpel-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

????
helloworld-bpel-webapp

implementation-composite

TODO
Understand and Document
helloworld-recursive
TODO
Understand and Document
helloworld-recursive-ws
TODO
Understand and Document

implementation-java

The sample provides a single calculator service with a default SCA binding. The CalculatorClient exercises this interface by calling add, subtract, multiply and divide operations. This results in messages passing to the appropriate components in the composite across the local wires.

contribution-calculator

The contribution Jar can be built using Ant as follows:

cd learning-more/implementation-java/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

cd running-tuscany/embedded-jse
ant sample-implementation-java-calculator-contribution

The contribution Jar can be built using Maven as follows:

cd learning-more/implementation-java/calculator-contribution
mvn

The contribution can be installed and the composite it contains run using Maven as follows

cd running-tuscany/embedded-jse
mvn

This will run several contributions including the sample-implementation-java-calculator-contribution.

implementation.osgi

dosgi-calculator

The bundle Jar can be built using Maven as follows:

cd learning-more/implementation-osgi/dosgi-calculator
mvn
TODO
projects should be called dosgi-calculator-bundle

To run the bundle see "osgi" under running-tuscany. In short do the following:

On Windows, run

java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console

You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.

osgi> ss

Then you can install and start the bundle that's just been built:

osgi> install file:./target/sample-dosgi-calculator.jar

You should see the calculator service start.

dosgi-calculator-operations

This bundle provides the calculator add, subtract, multiple, divide operations services.

The bundle Jar can be built using Maven as follows:

cd learning-more/distributed-osgi/dosgi-calculator-operations
mvn
TODO
projects should be called dosgi-calculator-operations-bundle

To run the bundle see "osgi" under running-tuscany. In short do the following:

On Windows, run

java -jar ..\..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\..\features\configuration -clean -console

You should see the osgi console. You can run "ss" command under the osgi> to see the status of the bundles.

osgi> ss

Then you can install and start the bundle that's just been built:

osgi> install file:./target/sample-dosgi-calculator-operations.jar

implementation-script

This sample provides a simple calculator service whose operations are implemented using four different script languages.

contribution-calculator

The bundle Jar can be built using Maven as follows:

cd learning-more/implementation-script/calculator-contribution
mvn

The contribution Jar can be built using Ant as follows:

cd learning-more/implementation-script/calculator-contribution
ant

The contribution can be installed and the composite it contains run using Ant as follows:

????

implementation-spring

The Spring implementation sample contains a simple Hello World service and client using implementation.spring.

contribution-helloworld-spring

The bundle Jar can be built using Maven as follows:

cd learning-more/implementation-spring/helloworld-spring-contribution
mvn
helloworld-spring-webapp

The HelloWorld Spring WebApp sample contains a simple Hello World service implemented using Spring and wrapped in a webApp.

The bundle Jar can be built using Maven as follows:

cd learning-more/implementation-spring/helloworld-spring-webapp
mvn

implementation-web

The Web implementation samples contain examples of a HelloWorld service implemented using implementation.web and accessed with various different technologies.

helloworld-jaxrs-webapp

The HelloWorld JAX-RS WebApp sample uses implementation.web with JAX-RS to display a simple "Hello World" message from a webapp.

helloworld-js-client-webapp

The HelloWorld JavaScript client Webapp sample uses implementation.web and a javascript client to call a simple "Hello World" service and display the results.

helloworld-jsf-webapp

The HelloWorld JSF WebApp sample shows a simple "Hello World" service implemented in a webapp and accessed using Java Server Faces.

helloworld-jsp-webapp

The HelloWorld JSP WebApp sample uses implementation.web and a JSP client to invoke a simple "Hello World" service and display the results.

helloworld-servlet-webapp

The HelloWorld Servlet WebApp sample uses implementation.web with a servlet to return a simple "Hello World" message in response to a request.

helloworld-stripes-webapp

The HelloWorld Stripes WebApp sample uses implementation.web with Stripes to display a simple "Hello World" message from a webapp.

logging-scribe

This Tuscany sample shows how to implement and use a simple Logger component that logs string messages to a Scribe logging server.

Scribe is an open source server for aggregating streaming log data. It is designed to scale to a very large number of nodes and be robust to network and node failures.

See the Scribe Wiki 1 for more information on Scribe.

Getting the requires Apache Thrift library

This sample uses Apache Thrift's libthrift.jar to communicate with Scribe servers. Libthrift is not yet available in a Maven repository, so before building the sample with maven you need to download libthrift 2 and install it in your local maven repository like this:

mvn install:install-file -DgroupId=org.apache.thrift -DartifactId=libthrift -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=libthrift-r917130.jar
Starting a Scribe server

Before running the LoggingTest sample test program, you need to start a Scribe server for the sample program to connect to.

Steps to start a Scribe server are described in the Scribe examples README 3. A simple scribe server configuration can be found in the Scribe examples 4.

LoggingTest will try to connect to a Scribe server at localhost:1463. To use a Scribe server at a different host or port, configure the host and port properties in scribe.composite to match your server.

Running the LoggingTest sample test program

To run the LoggingTest sample test program, do this:

mvn -Dtest=LoggingTest test
Checking the Scribe log output

After running LoggingTest, you should find the logged string "Hello There" in file sample/sample_current under your Scribe log store directory.

If you've used the example1.conf Scribe configuration from the Scribe examples 4, you should find your log message in /tmp/scribetest/sample/sample_current.

1 http://wiki.github.com/facebook/scribe/
2 http://svn.apache.org/repos/asf/cassandra/trunk/lib/libthrift-r917130.jar
3 http://github.com/facebook/scribe/blob/master/examples/README
4 http://github.com/facebook/scribe/blob/master/examples/example1.conf

maven-osgi-junit

TODO
Understand and Document
calculator-osgi
TODO
Understand and Document
calculator-rest-osgi
TODO
Understand and Document

sca-client

Samples that demonstrate the OASIS defined SCA Client API being used in simple Java applications to access SCA components running in the domain.

calculator-scaclient

Disabled in this Beta1 release pending some up-coming changes in 
the way that domains are addressed and accessed.

helloworld-scaclient

Disabled in this Beta1 release pending some up-coming changes in 
the way that domains are addressed and accessed.

running-tuscany

Running something in Tuscany requires one or more contributions, and a method of launching the contributions to make the services they provide available. The sections below describes various means of launching contributions with the Tuscany SCA Java runtime. It's not important that you try all of these but they show you what's possible and hopefully show you how to use Tuscany in an environment that makes sense to you.

Some of the running-tuscany sub-directories just contain a README that gives you instructions. For example, maven just tells you how to configure and run contributions using the maven-tuscany-plugin. Others contain code. For example, embedded-jse contains simple Java launchers that show you how to start some of the sample contributions from a Java program.

The sample contributions in getting-started and learning-more should work regardless of which approach you adopt. However some approaches, like embedded-jse, don't have launchers for every single sample contribution.

command-line

You can execute a sample contribution from the command line on Windows or Linux.

TODO
Waiting for tuscany.bat to be reworked before correcting

To execute a sample contribution from the command line

on Windows, from a command prompt in the samples directory, run the command ...

<tuscany_din_distro>\bin\tuscany.bat "contribution-name"

for example

cd <tuscany_din_distro>\samples\learning-more\binding-sca\calculator-contribution
<tuscany_din_distro>\bin\tuscany.bat sample-binding-sca-calculator-contribution.jar

or on *nix platforms, from a shell prompt in the samples directory, run the command ...

cd <tuscany_din_distro>/samples/learning-more/binding-sca/calculator-contribution
<tuscany_din_distro>/bin/tuscany.sh sample-binding-sca-calculator-contribution.jar

eclipse

To import sample contributions into Eclipse you first need to import the Tuscany runtime. You then need to import the sample contribution into Eclipse as a project. Instructions for doing both of these things can be found here

http://tuscany.apache.org/import-existing-tuscany-sca-projects-into-eclipse.html

Note. these instructions refer to our 1.x code base but it holds true for our 2.x code base.

Once you have a contribution imported into Eclipse and cleanly compiling against the Tuscany runtime jars you probably want to be able to run and debug it. The easiest way to do this is with a simple Java launcher. If you import the running-tuscany/embedded-jse project into Eclipse you'll see a number of such launcher programs which you can copy to launch the contribution(s) of your choice. Alternatively you can add a JUnit test case to the contribution that starts Tuscany and launches the contribution. See maven-junit as an example of how to do this.

embedded-jse

This directory contains sample java launchers for the some of the Tuscany sample contributions from the learning-more directory. It shows you how to embed the Tuscany runtime in a Java program. To make you're own launchers simply copy and existing one and change the details of the contribution being loaded. You'll note that the same launcher code is used inside the contribution unit test demonstrated by maven-junit.

To use the sample JSE launchers with ant execute the command

ant <contributionname>

where <contributionname> is one of the targets in the provided build.xml file

To use the sample JSE launchers from Maven do the following:

cd embedded-jse
mvn

This runs a JUnit test case that runs all the launchers in turn.

embedded-osgi

The Tuscany runtime jars will also work within an OSGi enviroment. If you want to load them into a vanilla OSGi environment see the osgi directory. If you want Tuscany to create an OSGi environment for you this directory contains launchers that do just that.

To use the sample OSGI launchers with ant do the following:

cd embedded-osgi
ant <contributionname>

where <contributionname> is one of the targets in the build.xml file

To use the sample JSE launchers from Maven do the following:

cd embedded-osgi
mvn

This runs a JUnit test case that runs all the launchers in turn.

maven

Maven can be used to install contributions. Tuscany has a special plugin (maven-tuscany-plugin) that makes this happen. Look for contributions that have the following configuration in their pom.xml file:

<plugin>
<groupId>org.apache.tuscany.maven.plugins</groupId>
<artifactId>maven-tuscany-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</plugin>

For contributions that have this, for example, learning-more/binding-sca/contribution-calculator, do the following

cd samples/learning-more/binding-sca/contribution-calculator
mvn tuscany:run

This will install the contribution in the Tuscany runtime, start the composite it contains, and then wait. At this point you can use
other clients to send messages to services that the running SCA applcation exposes, for example, try learning-more/sca-client/calculator-scaclient.

maven-junit

Maven will run JUnit tests found in a module's src/test/java directory automatically. If you use embedded-jse style code in the JUnit test to install a contribution and start any composites it contains they you can unit test your contributions. This directory contains a contribution and a unit test which installs the contribution using very similar code to that found in embedded-jse.

To run the contributions unit test do the following:

cd maven-junit/calculator-contribution
mvn

maven-junit-osgi

You can use a special Tuscany Maven plugin (maven-osgi-junit-plugin) to unit test contributions in a JUnit environment. This relies on adding some configuration to the Maven pom.xml. For example, if you look in maven-junit-osgi/calculator-osgi you'll see:

            <plugin>
                <groupId>org.apache.tuscany.maven.plugins</groupId>
                <artifactId>maven-osgi-junit-plugin</artifactId>
                <version>1.0</version>
                <dependencies>
                   <dependency>
                      <groupId>org.apache.tuscany.sca</groupId>
                      <artifactId>tuscany-node-launcher-equinox</artifactId>
                      <version>${pom.version}</version>
                   </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>osgi-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <systemProperties>
                                <property>
                                    <name>osgi.configuration.area</name>
                                    <value>${project.build.directory}/equinox</value>
                                </property>
                            </systemProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

This configures the maven-osgi-junit-plugin to use the tuscany-node-launcher-equinox to install the contribution represented by the calculator-osgi directory. As an alternative to this configuration you could use the contents of tuscany-node-launcher-equinox directly in your JUnit test to launch the Tuscany runtime using OSGi.

To run the contributions unit test do the following:

cd maven-junit/calculator-contribution
mvn

osgi

The Tuscany runtime can be run in a vanilla OSGi container such as Equinox. To do this you have to:

  • launch the OSGi container itself
  • load the Tuscany runtime bundles (all our jars are bundles) into the container
  • install a contribution packaged as an OSGi bundle

For example, to install a contribution in Equinox do the following

On Windows, run

java -jar ..\..\..\modules\osgi-3.5.0-v20090520.jar -configuration ..\..\..\features\configuration -clean -console

On *Unix, run

java -jar ../../../modules/osgi-3.5.0-v20090520.jar -configuration ../../../features/configuration -clean -console

You should see the osgi console:

osgi>

osgi> Jun 22, 2009 1:32:27 PM org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoveryActivator start

INFO: Equinox-based service discoverer is now configured.

You can run "ss" command under the osgi> to see the status of the bundles.

osgi> ss

Then you can install and start contributions as bundles by doing the following:

osgi> install file:./path/to/<contribution_bundle.jar>

Note that <contribution_bundle.jar> will need an activator in order to register the bundle as a SCA contribution

Running on Felix

See http://tuscany.apache.org/documentation-2x/running-tuscany-sca-2x-with-equinox-and-felix.html

shell

This directory contains a sample shell program supporting simple commands to start and stop SCA composites.

TODO
We currently have two similar approaches available (see command-line). We need to merge the two together.

To build the sample shell do this:

mvn install

To run it:

./sca

at the prompt:

start myNode ../../applications/store/target/sample-store.jar

or:

start myNode http://people.apache.org/~jsdelfino/tuscany/java/test/sample-store.jar

also try:

status
stop myNode
bye

Starting and stopping composites is pretty fast. To see that, try the following
two scripts, which start/stop the sample store composite 10 times.

./sca <scripts/test.txt

or

./sca <scripts/test-remote.txt

The shell can also run as a Webapp. To try it install target/scashell.war in
a Web container, point your Web browser to http://localhost:8080/scashell
and try the links on that page.

webapp

Tuscany can be embedded inside a webapp alongside one or more SCA contributions. To execute sample webapp based contributions (contributions that have webapp at the end of their name) you can build the contribution using maven and then copy the resulting war file to your container of choice

For example, for binding-jsonrpc/contribution-calculator-webapp, do the following:

cd samples/binding-jsonrpc/contribution-calculator-webapp
mvn
cp target/sample-contribution-binding-jsonrpc-calculator-webapp.war <your_container_deployment-dir>

As an alternative, sample webapp based contributions can be run within Jetty directly from Maven, look for webapp contributions that have the following configuration in their pom.xml file:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.18</version>
</plugin>

For contributions that have this, for example, binding-jsonrpc/contribution-calculator-webapp, do the following

cd samples/binding-sca/contribution-calculator
mvn jetty:run

This will launch the contribution in the Jetty runtime and then wait. At this point you can use HTTP clients to send messages to services that the running SCA applcation exposes. For this example try pointing your browser at:

http://localhost:8080/sample-binding-jsonrpc-calculator-webapp/

extending-tuscany

binding-extension

TODO
Understand and Document

implementation-extension

TODO
Understand and Document

applications

TODO
Understand and Document

store

TODO
Understand and Document

store-webapp

TODO
Understand and Document

 

Spring Cloud 微服务开发核心工具集 基础工具类、验证码、http、redis、ip2region、xss 等组件 Spring Cloud 微服务开发核心工具集。基础工具类、验证码、http、redis、ip2region、xss 等组件 立即下载

相关推荐

CrewAI 多 Agent 实战包 v1(Mock免Key跑通+通义千问可选+流水线样例)

本资源是 CrewAI 风格多 Agent 可运行工程包:研究→写作→审校等流水线样例。无 API Key 时自动降级 Mock 引擎跑通;有 DASHSCOPE_API_KEY 时可接真实 CrewAI + 通义千问。含中文 README、samples、smoke 留档、单元测试。本包不含密钥。关联博客:https://blog.csdn.net/mtl1994

SCA导航1-Apache Tuscany SCA入门

本文根据Apache Tuscany 1.x文档翻译编写1.   Build Calculator Using Command Line1.1. 前言这篇导航文章使用基于命令行的方式开始Apache Tuscany Java SCA。Tuscany提供了许多样例,其中最简单之一的就是计算器样例(The Calculator Sample)。我们将使用此样例,所以请确保已经正确下载Tus

java619 2712

市场销售总监年终汇报必备PPT.pptx

市场销售总监年终汇报必备PPT

SCA 之Tuscany 11 ——Tuscany小记注意事项

1.再war包安装时,再META-INF中有sca-contribution.xml:文件才能正确的加载,而过滤器报错很有可能是没能绑定sca-contribution.xml。 2.SCA应用与其他的处于不同域内的SCA应用的交互看上去就跟与非SCA应用的交互一样;在域外SC

Chatopera 1560

2263XT开卡工具N48R,威刚S20

2263XT开卡工具N48R,威刚S20可用

半桥LLC谐振变换器开环+闭环仿真设计资料(Simulink仿真实现)

内容概要:本文档系统性地介绍了半桥LLC谐振变换器的开环与闭环仿真设计方法,基于Simulink平台构建完整的仿真模型,涵盖系统建模、关键参数设计、控制策略实现及动态性能验证全过程。重点阐述了LLC谐振变换器的工作原理、谐振腔参数(Lr、Cr、Lm)的优化设计方法、零电压开关(ZVS)与零电流开关(ZCS)等软开关技术的实现机制,并深入探讨电压/电流双闭环控制策略,特别是恒压恒流双竞争控制逻辑的切换机制与稳定性保障。资料配套提供完整的仿真模型、详细说明文档及参考文献,有助于全面掌握其在启停过程、负载突变等工况下的动态响应特性与系统鲁棒性调控方法。; 适合人群:具备电力电子技术基础理论知识和Simulink仿真操作能力的高校研究生、科研机构研究人员,以及从事高频高效开关电源、新能源汽车车载充电机(OBC)、充电桩电源、数据中心供电等领域的工程技术人员。; 使用场景及目标:① 掌握LLC谐振变换器在实际工程中的精确建模与仿真分析流程;② 深入理解并独立实现从开环频率调制到闭环反馈控制的平滑切换逻辑;③ 应用于高效率DC-DC变换器、电动汽车充电系统、可再生能源并网电源等场景下的控制系统设计与性能优化; 阅读建议:建议结合所提供的仿真模型进行分步调试与参数扫描实验,重点关注控制器带宽设计、谐振元件参数匹配对效率的影响以及系统上电过程中的软启动策略设计,同时推荐对比学习全桥LLC、CLLC等衍生拓扑的相关资料,以建立完整的谐振变换器控制体系认知。

ActiveMQ JMS生产者消费者模式收发通用类

jms提供者为ActiveMQ   import java.util.Map; import java.util.UUID; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.ac

VirusFu的专栏 1570

SOP 配电网故障重构方法研究【IEEE33节点】(Matlab代码实现)

内容概要:本文围绕基于SOP(Soft Open Point)的配电网故障重构方法展开研究,采用IEEE33节点标准配电系统作为仿真测试平台,利用Matlab进行代码实现与仿真验证。研究重点在于通过SOP这一柔性电力电子装置实现故障后网络拓扑的快速重构,提升供电恢复能力与系统可靠性。文中详细阐述了故障重构的数学建模过程,结合优化算法实现负荷转供与孤岛划分的协同决策,在保证辐射状运行约束的前提下,最大限度恢复失电负荷,并降低网络损耗。该方法充分体现了SOP在主动配电网中的灵活调控优势,为现代智能配电网的自愈控制提供了有效技术路径。; 适合人群:电气工程及相关专业的高校研究生、从事配电网自动化与智能电网研究的科研人员,以及具备一定Matlab编程基础和电力系统分析背景的研发技术人员。; 使用场景及目标:① 掌握基于SOP的配电网故障恢复机制与重构策略设计;② 学习如何在Matlab环境下构建IEEE33节点系统模型并实现故障重构算法;③ 深入理解含分布式电源与柔性装置的主动配电网优化运行方法; 阅读建议:建议结合电力系统分析基础知识,重点关注SOP的建模方式、故障重构的优化目标与约束条件设定,并动手实践Matlab代码以加深对算法流程和仿真结果的理解。

SCA简单本地调用案例

1.先到http://tuscany.apache.org/sca-java-1x-releases.html SCA Java 1.6.2  2.从sca\apache-tuscany-sca-1.6.2\tuscany-sca-1.6.2\samples\calculator\src\main\java 目录下找到 calculator案例 3.eclipse下创建一个java项目,导入l

VirusFu的专栏 980

一份外盘期货历史高频tick数据,涵盖能源、贵金属、股指等主要品种的逐笔成交与盘口快照 每条记录包含精确至毫秒的时间戳、合约代码、成交价格、成交量以及主动买卖方向标识 同时提供该时刻的最优申买价、申卖

一份外盘期货历史高频tick数据,涵盖能源、贵金属、股指等主要品种的逐笔成交与盘口快照。每条记录包含精确至毫秒的时间戳、合约代码、成交价格、成交量以及主动买卖方向标识。同时提供该时刻的最优申买价、申卖价及对应挂单量,用于还原盘口深度变化,数据时间覆盖连续的多个交易日。 数据源:CMES金融数据库

基于变频控制的多相交错LLC谐振变换器闭环仿真(Simulink仿真实现)

内容概要:本文档聚焦于电力电子与控制系统领域的仿真研究,核心内容为“基于变频控制的多相交错LLC谐振变换器闭环仿真”的Simulink实现。系统阐述了LLC谐振变换器的开环与闭环控制策略、软开关技术、恒压恒流双竞争控制机制、多相交错结构设计及变频调制原理,通过建模仿真深入剖析高频DC-DC变换器的工作特性与动态响应。文档整合了丰富的科研资源,涵盖双向CLLC、DAB变换器、PWM整流器、微电网优化调度、状态估计(EKF/UKF/PF)等多个前沿方向的仿真案例,形成一个体系完整、技术覆盖面广的综合性技术资料库,适用于高水平科研与工程实践。; 适合人群:电气工程、自动化、电力电子及相关专业的研究生、高校科研人员,以及从事新能源发电、电动汽车、智能电网、工业电源等领域的技术研发工程师。; 使用场景及目标:①开展高频谐振变换器拓扑结构与先进控制策略的深入研究;②完成复杂电力电子系统的建模、仿真与性能验证;③支撑SCI/EI论文撰写、科研项目申报与关键技术攻关;④辅助高校课程设计、研究生课题实践与毕业设计的仿真实验环节。; 阅读建议:建议结合文中提供的网盘资源与微信公众号资料进行系统学习,优先掌握LLC变换器的基本工作模态与谐振原理,再逐步深入闭环控制器设计与参数整定,仿真过程中应重点关注关键波形分析与系统稳定性判据,以全面提升对高频变换器动态特性的理解与工程应用能力。

探讨分布式系统与集群的区别

简单说,分布式是以缩短单个任务的执行时间来提升效率的,而集群则是通过提高单位时间内执行的任务数来提升效率。   例如:如果一个任务由10个子任务组成,每个子任务单独执行需1小时,则在一台服务器上执行改任务需10小时。   采用分布式方案,提供10台服务器,每台服务器只负责处理一个子任务,不考虑子任务间的依赖关系,执行完这个任务只需一个小时。   而采用集群方案,同样提供10台服务

VirusFu的专栏 808

产业园区运营负责人如何助力园区内企业与高校科研成果高效对接?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

双向全桥CLLC拓扑变频控制仿真模型(Simulink仿真实现)

内容概要:本文详细介绍了一套基于Simulink的双向全桥CLLC拓扑变频控制仿真模型,重点实现双闭环PWM控制策略下的谐振变换器系统仿真。该模型融合变频控制与移相控制技术,具备高频软开关特性,适用于电动汽车V2G充放电、高效DC-DC能量转换等高效率电力电子应用场景。资源涵盖闭环控制系统设计、关键参数整定方法、动态响应分析及完整的仿真验证流程,并提供配套PPT说明与参考文献,帮助深入理解控制逻辑与工程实现细节。此外,资源包还集成多种LLC、CLLC及PFC拓扑的仿真案例,具有较强的系统扩展性与科研参考价值,支持拓扑复用、控制算法迭代与多工况验证。; 适合人群:具备电力电子、自动控制理论基础,从事新能源、电动汽车、电源系统等领域研究的研究生、科研人员及电气工程师;熟悉Matlab/Simulink仿真环境者尤佳。; 使用场景及目标:①深入学习CLLC谐振变换器的工作机理与变频调制策略;②支撑科研项目中的拓扑选型、控制算法开发与系统级仿真验证;③用于毕业设计、学术论文复现或工业级电源产品的前期技术预研。; 阅读建议:建议结合文档中提供的多个仿真模型进行对比分析,重点关注双闭环结构(电压外环+电流内环)的设计原理与稳定性优化,同时利用配套资料系统掌握参数设计方法、谐振腔建模技巧及系统动态性能评估手段。

【顶级EI复现】基于KKT条件与分段解析优化的双有源桥DC-DC变换器软开关协同最小应力闭环控制方法(Simulink仿真实现)

内容概要:本文详细介绍了一种基于KKT条件与分段解析优化的双有源桥DC-DC变换器软开关协同最小应力闭环控制方法,属于高端电力电子系统控制领域的“顶级EI复现”级别研究。该方法融合最优控制理论与工程实践,通过构建精确的数学模型,在Simulink环境中实现了闭环仿真,有效解决了软开关实现过程中器件电压/电流应力过大的问题,达成了高效率与低损耗的协同优化目标。研究成果可广泛应用于新能源汽车、智能电网、工业电源等对功率密度和可靠性要求极高的电力转换场景。; 适合人群:面向具备电力电子、自动控制或电气工程等相关专业背景,从事科研仿真工作的硕士、博士研究生及高校科研人员,尤其适合熟悉双有源桥(DAB)拓扑结构、掌握Simulink建模技能,并具有优化控制与非线性系统分析基础的研发人员。; 使用场景及目标:①复现高水平EI期刊论文中的先进控制算法,提升科研竞争力;②深入理解KKT条件在电力电子实时优化控制中的数学机制与物理意义;③掌握DAB变换器中软开关与器件应力最小化的协同设计方法;④为撰写学术论文、开展课题研究或工程原型开发提供可运行的仿真模型与完整的技术路线支撑。; 阅读建议:建议结合文中提到的“顶级EI复现”背景,系统学习KKT最优性条件的推导过程及其在约束优化问题中的应用逻辑,并在Simulink中动手调试仿真模型,重点关注分段解析控制策略的实现细节与参数整定方法。推荐访问所提供的资源链接,获取YALMIP工具包及相关代码资料,以提高复现效率与研究深度。

【顶级EI复现】新扩展移相角下的双有源桥DC-DC 变换器优化控制策略(Simulink仿真实现)

内容概要:本文围绕Plecs平台构建的全桥LLC谐振变换器闭环仿真模型展开,系统阐述了基于变频与移相混合控制策略的设计与实现方法。模型深入剖析了LLC谐振变换器的工作机理,涵盖谐振腔关键参数设计、软开关实现条件、变频调制与移相控制的协同作用机制,并实现了完整的闭环控制系统仿真,能够有效验证变换器在不同负载与输入电压条件下的动态响应、效率表现及稳态性能。研究还整合了配套的参数设计资料与计算工具,支持从理论分析、参数设计到仿真验证的一体化开发流程,为高性能LLC变换器的研发提供了全面的技术支撑。; 适合人群:具备电力电子与电源变换基础知识的工程师、高校研究生,以及从事开关电源、DC-DC变换器研发的技术人员,特别适合需要掌握LLC谐振变换器建模、仿真与优化控制策略的科研与工程人员。; 使用场景及目标:①应用于LLC谐振变换器的科研教学与课程设计,深化对谐振工作模式、软开关机理及混合控制策略的理解;②作为实际产品研发中的仿真验证平台,用于优化控制算法、评估系统效率与动态性能;③支持对变频+移相协同控制、闭环稳定性、软开关范围拓展及最小化应力等关键技术进行深入研究与方案迭代。; 阅读建议:建议结合经典电力电子教材与LLC变换器专业设计手册进行学习,重点研读谐振参数设计与控制环路建模章节。实际应用时,应依据具体的硬件规格(如开关器件、磁性元件参数)精确调整仿真模型,并通过多轮仿真结果对比,不断优化系统设计方案。

上一篇: 探讨分布式系统与集群的区别
下一篇: PLSQL Developer V9 注册码
VirusFu
博客等级 码龄21年 51粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值