diff options
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyStartMojo.java | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyStartMojo.java b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyStartMojo.java index be7c90e7c8..c3d8e0e9d8 100644 --- a/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyStartMojo.java +++ b/sca-java-2.x/trunk/maven/maven-tuscany-plugin/src/main/java/org/apache/tuscany/maven/plugin/TuscanyStartMojo.java @@ -30,7 +30,11 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
+import org.apache.tuscany.sca.Node;
import org.apache.tuscany.sca.TuscanyRuntime;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.monitor.ValidationException;
+import org.apache.tuscany.sca.runtime.ActivationException;
import org.apache.tuscany.sca.shell.Shell;
/**
@@ -95,7 +99,7 @@ public class TuscanyStartMojo extends AbstractMojo { private String id;
/**
- * @parameter expression="${domainURI}" default-value="default"
+ * @parameter expression="${domainURI}" default-value="uri:default"
*/
private String domainURI;
@@ -110,27 +114,33 @@ public class TuscanyStartMojo extends AbstractMojo { private String[] contributions;
public void execute() throws MojoExecutionException, MojoFailureException {
- }
-
- private void executeShell() throws MojoExecutionException {
- getLog().info("Starting Tuscany Shell...");
-
- List<String> contributionList = new ArrayList<String>();
-
- addProjectContribution(contributionList);
-
- addAdditionalContributions(contributionList);
-
- contributionList.add(0, "-help");
- contributionList.add(0, domainURI);
-
- try {
- Shell.main(contributionList.toArray(new String[contributionList.size()]));
- } catch (Exception e) {
- throw new MojoExecutionException("Exception in Shell", e);
+ getLog().info("Starting Tuscany Runtime...");
+
+ TuscanyRuntime runtime = TuscanyRuntime.newInstance();
+ runtimes.put(id, runtime);
+
+ if (nodeConfig != null && nodeConfig.length() > 0) {
+ try {
+ runtime.createNodeFromXML(nodeConfig);
+ } catch (Exception e) {
+ throw new MojoExecutionException("Exception creating node", e);
+ }
+ } else {
+ List<String> contributionList = new ArrayList<String>();
+
+ addProjectContribution(contributionList);
+
+ addAdditionalContributions(contributionList);
+
+ Node node = runtime.createNode(domainURI);
+ for (String c : contributionList) {
+ try {
+ node.installContribution(null, c, null, null, true);
+ } catch (Exception e) {
+ throw new MojoExecutionException("Exception installing contribution", e);
+ }
+ }
}
-
- getLog().info("Tuscany Shell stopped.");
}
private void addAdditionalContributions(List<String> contributionList) throws MojoExecutionException {
|