components/template-mgt/org.wso2.carbon.identity.template.mgt/src/main/java/org/wso2/carbon/identity/template/mgt/internal/TemplateManagerComponent.java
/**
     * Register Template Manager as an OSGi service.
     *
     * @param componentContext OSGi service component context.
     */
Register Template Manager as an OSGi service.
@param componentContext OSGi service component context.
Register Template Manager as an OSGi service . @param componentContext OSGi service component context .
@Activate
    protected void activate(ComponentContext componentContext) {
        try {
            BundleContext bundleContext = componentContext.getBundleContext();
            bundleContext.registerService(TemplateManager.class, new TemplateManagerImpl(), null);
            ReadOnlyTemplateHandler fileBasedTemplateHandler =  new FileBasedTemplateHandler();
            TemplateManagerDataHolder.getInstance().addReadOnlyTemplateHandler(fileBasedTemplateHandler);
            TemplateHandler configStoreBasedTemplateHandler =  new ConfigStoreBasedTemplateHandler();
            TemplateManagerDataHolder.getInstance().addReadOnlyTemplateHandler(configStoreBasedTemplateHandler);
            if (log.isDebugEnabled()) {
                log.debug("Template Manager bundle is activated.");
            }
        } catch (Throwable e) {
            log.error("Error while activating TemplateManagerComponent.", e);
        }
    }
@ Activate protected void activate ( ComponentContext componentContext ) { try { BundleContext bundleContext = componentContext . getBundleContext ( ) ; bundleContext . registerService ( TemplateManager . class , new TemplateManagerImpl ( ) , null ) ; ReadOnlyTemplateHandler fileBasedTemplateHandler = new FileBasedTemplateHandler ( ) ; TemplateManagerDataHolder . getInstance ( ) . addReadOnlyTemplateHandler ( fileBasedTemplateHandler ) ; TemplateHandler configStoreBasedTemplateHandler = new ConfigStoreBasedTemplateHandler ( ) ; TemplateManagerDataHolder . getInstance ( ) . addReadOnlyTemplateHandler ( configStoreBasedTemplateHandler ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Template Manager bundle is activated." ) ; } } catch ( Throwable e ) { log . error ( "Error while activating TemplateManagerComponent." , e ) ; } }
Register Template Manager as an OSGi service.
Register Template Manager as an OSGi service .
//Add default template handlers