001package org.nuxeo.sample; 002 003import org.nuxeo.runtime.model.ComponentContext; 004import org.nuxeo.runtime.model.ComponentInstance; 005import org.nuxeo.runtime.model.DefaultComponent; 006 007public class SampleServiceImpl extends DefaultComponent implements SampleService { 008 009 /** 010 * Component activated notification. 011 * Called when the component is activated. All component dependencies are resolved at that moment. 012 * Use this method to initialize the component. 013 * 014 * @param context the component context. 015 */ 016 @Override 017 public void activate(ComponentContext context) { 018 super.activate(context); 019 } 020 021 /** 022 * Component deactivated notification. 023 * Called before a component is unregistered. 024 * Use this method to do cleanup if any and free any resources held by the component. 025 * 026 * @param context the component context. 027 */ 028 @Override 029 public void deactivate(ComponentContext context) { 030 super.deactivate(context); 031 } 032 033 /** 034 * Application started notification. 035 * Called after the application started. 036 * You can do here any initialization that requires a working application 037 * (all resolved bundles and components are active at that moment) 038 * 039 * @param context the component context. Use it to get the current bundle context 040 * @throws Exception 041 */ 042 @Override 043 public void applicationStarted(ComponentContext context) { 044 // do nothing by default. You can remove this method if not used. 045 } 046 047 @Override 048 public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { 049 // Add some logic here to handle contributions 050 } 051 052 @Override 053 public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { 054 // Logic to do when unregistering any contribution 055 } 056}