From dfeff33366430447f8abe6300d5271dc9f2e2300 Mon Sep 17 00:00:00 2001 From: rfeng Date: Fri, 24 Oct 2008 23:15:04 +0000 Subject: Add pom, mf and activator git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@707779 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/calculator-osgi/META-INF/MANIFEST.MF | 19 +++ .../sca-equinox/samples/calculator-osgi/pom.xml | 147 +++++++++++++++++++++ .../main/java/calculator/CalculatorActivator.java | 50 +++++++ 3 files changed, 216 insertions(+) create mode 100644 branches/sca-equinox/samples/calculator-osgi/META-INF/MANIFEST.MF create mode 100644 branches/sca-equinox/samples/calculator-osgi/pom.xml create mode 100644 branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java (limited to 'branches/sca-equinox/samples/calculator-osgi') diff --git a/branches/sca-equinox/samples/calculator-osgi/META-INF/MANIFEST.MF b/branches/sca-equinox/samples/calculator-osgi/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..bb6c2d4d35 --- /dev/null +++ b/branches/sca-equinox/samples/calculator-osgi/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Private-Package: calculator;version="1.4" +Tool: Bnd-0.0.255 +Bundle-Name: Apache Tuscany SCA Calculator OSGi Sample +Created-By: 1.6.0_07 (Sun Microsystems Inc.) +Bundle-Vendor: The Apache Software Foundation +Eclipse-LazyStart: false +Bundle-Version: 1.4 +Bnd-LastModified: 1223949424781 +Bundle-Activator: calculator.CalculatorActivator +Bundle-ManifestVersion: 2 +Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt +Bundle-Description: Apache Tuscany SCA Calculator RCP Sample +Import-Package: org.apache.tuscany.sca.node;version="1.4", + org.osgi.framework;version="1.4", + org.osoa.sca.annotations;version="1.4" +Bundle-SymbolicName: sample-calculator-osgi +Bundle-DocURL: http://www.apache.org/ + diff --git a/branches/sca-equinox/samples/calculator-osgi/pom.xml b/branches/sca-equinox/samples/calculator-osgi/pom.xml new file mode 100644 index 0000000000..fe32b773a7 --- /dev/null +++ b/branches/sca-equinox/samples/calculator-osgi/pom.xml @@ -0,0 +1,147 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + ../../pom.xml + + sample-calculator-osgi + Apache Tuscany SCA Calculator OSGi Sample + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-api + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 1.4-SNAPSHOT + runtime + + + + org.eclipse + osgi + 3.3.0-v20070530 + compile + + + + org.apache.tuscany.sca + tuscany-extensibility-equinox + 1.4-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + maven-eclipse-plugin + 2.5.1 + + + org.eclipse.pde.ManifestBuilder + org.eclipse.jdt.core.javabuilder + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + + org.eclipse.jdt.launching.JRE_CONTAINER + + + + + + + org.apache.felix + maven-bundle-plugin + 1.4.3 + true + + + bundle-manifest + process-classes + + manifest + + + + 1.4 + sample.calculator.rcp;singleton:=true + ${pom.name} + calculator.rcp.Activator + true + + + ${basedir}/META-INF + + + + + + + maven-jar-plugin + + + ${basedir}/META-INF/MANIFEST.MF + + + + + + diff --git a/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java b/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java new file mode 100644 index 0000000000..384ae99fff --- /dev/null +++ b/branches/sca-equinox/samples/calculator-osgi/src/main/java/calculator/CalculatorActivator.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * Bundle Activator for Calculator + * + */ +public class CalculatorActivator implements BundleActivator { + private Node node; + + public void start(BundleContext context) throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + String url = ContributionLocationHelper.getContributionLocation(getClass()); + Contribution contrib = new Contribution("c1", url); + node = factory.createNode("Calculator.composite", contrib); + node.start(); + } + + public void stop(BundleContext context) throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} -- cgit v1.2.3