Hi Kishanthan, Have we added this to the documentation?. AFAIK we haven't.
Shall we add this to documentation, since now people will write scr components for C5 features and it's better we can make awareness of this new annotation model. And found your blog post which contain more information [1]. [1]. https://kishanthan.wordpress.com/2014/03/29/using-annotation-with-osgi-declarative-services/ Regards, Aruna On Sat, Mar 29, 2014 at 5:01 PM, Kishanthan Thangarajah <[email protected] > wrote: > Hi All, > > C5 project is now following the standardized annotation based model with > declarative service components, which is specified in the OSGi compendium > specification [1]. These standard annotation related classes are available > with the following dependency. > > <dependency> > <groupId>org.eclipse.osgi</groupId> > <artifactId>org.eclipse.osgi.services</artifactId> > </dependency> > > Apache Felix scr.ds-annotations and maven-scr-plugin [2] can be used to > process the annotated class and generate the component descriptors (the > meta files). > > Here is an example usage. > > @*Component*( > name = "org.wso2.carbon.kernel.internal.CommandProvider", > immediate = true > ) > > public class CarbonKernelCommandProvider implements CommandProvider { > > private CarbonRuntime carbonRuntime; > private ServiceRegistration<CommandProvider> serviceRegistration; > > @*Activate* > public void registerCommandProvider(BundleContext bundleContext) { > serviceRegistration = > bundleContext.registerService(CommandProvider.class, this, null); > } > > @*Deactivate* > public void unregisterCommandProvider(BundleContext bundleContext) { > serviceRegistration.unregister(); > } > > @*Reference*( > name = "carbon.runtime.service", > service = CarbonRuntime.class, > cardinality = ReferenceCardinality.MANDATORY, > policy = ReferencePolicy.DYNAMIC, > unbind = "unsetCarbonRuntime" > ) > public void setCarbonRuntime(CarbonRuntime carbonRuntime) { > this.carbonRuntime = carbonRuntime; > } > > public void unsetCarbonRuntime(CarbonRuntime carbonRuntime) { > this.carbonRuntime = null; > } > } > > This will be documented for development with C5. > > Thanks, > Kishanthan. > [1] http://www.osgi.org/download/r5/osgi.cmpn-5.0.0.pdf > [2] > https://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/apache-felix-maven-scr-plugin-use.html > > > <https://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/apache-felix-maven-scr-plugin-use.html> > -- > *Kishanthan Thangarajah* > Senior Software Engineer, > Platform Technologies Team, > WSO2, Inc. > lean.enterprise.middleware > > Mobile - +94773426635 > Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>* > Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>* > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- *Aruna Sujith Karunarathna *| Software Engineer WSO2, Inc | lean. enterprise. middleware. #20, Palm Grove, Colombo 03, Sri Lanka Mobile: +94 71 9040362 | Work: +94 112145345 Email: [email protected] | Web: www.wso2.com
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
