All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.customware.license.jira.prefs.JiraSystemPreferences Maven / Gradle / Ivy

The newest version!
package net.customware.license.jira.prefs;

import java.util.prefs.AbstractPreferences;

import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.config.properties.PropertiesManager;
import com.opensymphony.module.propertyset.PropertySet;

/**
 * This is an incomplete implementation of the Preferences API, with only enough
 * implemented to support the TrueLicense API.
 * 
 * When this class is used as the Preferences implementation for TrueLicense,
 * the license key will be stored in Bandana, available across the whole server.
 * 
 * @author David Peterson
 */
public class JiraSystemPreferences extends AbstractPropertySetPreferences {
	private  PropertiesManager propertiesManager; 
   
	public JiraSystemPreferences() {
		initPropertiesManager(); 
    }

    protected JiraSystemPreferences( JiraSystemPreferences parent, String name  ) {
    	 super( parent, name );
    	 initPropertiesManager();
    }

    @Override protected AbstractPreferences childSpi( String name ) {
        return new JiraSystemPreferences( this, name  );
    }

    @Override protected PropertySet getPropertySet() {
        return propertiesManager.getPropertySet(); 
    }
    
    private void initPropertiesManager() { 
    	try{ 
    	 Object res =  ComponentManager.getComponentInstanceOfType(PropertiesManager.class);
    	 propertiesManager =  (PropertiesManager) res; 
    	} catch (Exception ex){
    		ex.printStackTrace();     		
    	}
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy