mil.dod.th.ose.core/src/mil/dod/th/ose/core/impl/mp/TemplateProgramManagerImpl.java
@Activate
    public void activate(final BundleContext context)
    {
        // load saved templates
        final Collection<? extends PersistentData> query = m_PersistentDataStore.query(this.getClass());
        //if no templates are found in the database
        if (query.isEmpty())
        {
            m_Logging.info("No templates were found in the data store to restore");
        }
        else
        {
            //restore each entity
            for (PersistentData entity : query)
            {
                final byte[] data = (byte[])entity.getEntity();
                //add the deserialized entities to the list of managed templates
                m_Templates.put(((MissionProgramTemplate)(XmlUtils.fromXML(data, MissionProgramTemplate.class))).
                    getName(), entity.getUUID());
            }            
        }
        
        //look in templates folder for templates
        final File dataDir = new File(context.getProperty(SystemConfigurationConstants.DATA_DIR_PROPERTY));
        final File templateDir = m_FileService.getFile(dataDir, "templates");
        
        loadFromDirectory(templateDir);
        
        //recap, if there are no templates
        if (getMissionTemplateNames().isEmpty())
        {
            m_Logging.info("Templates were not found in template directory nor the datastore");
        }
        else
        {
            m_Logging.info("Mission templates restored: %s", getMissionTemplateNames());
        }
    }
/**
     * This activates the component. It loads all the templates from the database, and provides the
     * service of making templates available to the {@link mil.dod.th.core.mp.MissionProgramManager}.
     * 
     * @param context
     *      context of the bundle that contains this component
     */
This activates the component. It loads all the templates from the database, and provides the
service of making templates available to the  mil.dod.th.core.mp.MissionProgramManager.

@param context
context of the bundle that contains this component
This activates the component . It loads all the templates from the database and provides the service of making templates available to the mil . dod . th . core . mp . MissionProgramManager . @param context context of the bundle that contains this component
@Activate
    public void activate(final BundleContext context)
    {
        final Collection<? extends PersistentData> query = m_PersistentDataStore.query(this.getClass());
        if (query.isEmpty())
        {
            m_Logging.info("No templates were found in the data store to restore");
        }
        else
        {
            for (PersistentData entity : query)
            {
                final byte[] data = (byte[])entity.getEntity();
                m_Templates.put(((MissionProgramTemplate)(XmlUtils.fromXML(data, MissionProgramTemplate.class))).
                    getName(), entity.getUUID());
            }            
        }
        final File dataDir = new File(context.getProperty(SystemConfigurationConstants.DATA_DIR_PROPERTY));
        final File templateDir = m_FileService.getFile(dataDir, "templates");
        loadFromDirectory(templateDir);
        if (getMissionTemplateNames().isEmpty())
        {
            m_Logging.info("Templates were not found in template directory nor the datastore");
        }
        else
        {
            m_Logging.info("Mission templates restored: %s", getMissionTemplateNames());
        }
    }
@ Activate public void activate ( final BundleContext context ) { final Collection < ? extends PersistentData > query = m_PersistentDataStore . query ( this . getClass ( ) ) ; if ( query . isEmpty ( ) ) { m_Logging . info ( "No templates were found in the data store to restore" ) ; } else { for ( PersistentData entity : query ) { final byte [ ] data = ( byte [ ] ) entity . getEntity ( ) ; m_Templates . put ( ( ( MissionProgramTemplate ) ( XmlUtils . fromXML ( data , MissionProgramTemplate . class ) ) ) . getName ( ) , entity . getUUID ( ) ) ; } } final File dataDir = new File ( context . getProperty ( SystemConfigurationConstants . DATA_DIR_PROPERTY ) ) ; final File templateDir = m_FileService . getFile ( dataDir , "templates" ) ; loadFromDirectory ( templateDir ) ; if ( getMissionTemplateNames ( ) . isEmpty ( ) ) { m_Logging . info ( "Templates were not found in template directory nor the datastore" ) ; } else { m_Logging . info ( "Mission templates restored: %s" , getMissionTemplateNames ( ) ) ; } }
This activates the component.
This activates the component .
// load saved templates //if no templates are found in the database //restore each entity //add the deserialized entities to the list of managed templates //look in templates folder for templates //recap, if there are no templates