📄 propertydatabase.java
字号:
* @return property definition
* @throws Exception on any error.
*/
public PropertyDefinition getPropertyDefinition(String name) throws Exception;
/**
* Get a property profile given its ID. <code>null</code> will be returned
* if no such property profile exists.
*
* @param id id
* @return property profile
* @throws Exception
*/
public PropertyProfile getPropertyProfile(int id) throws Exception;
/**
* Set the value of a property.
* <p>
* Note, It is up to the implementation to test if the property definition
* for the provided name is of type {@link PropertyDefinition#CONTEXT_CONFIGURATION}.
* If it is then the value should be set in the context using
* {@link com.sslexplorer.boot.Context#setContextProperty(String, String)}.
* <p>
* Note, this method should never be called directly, to set a property
* use {@link com.sslexplorer.core.PropertyUtil#setProperty(int, String, String, String, SessionInfo)}
* as this also fires events.
*
* @param profile profile id or 0 for default profile, system configuration, context or hidden property
* @param username username for personal profiles or <code>null</code> for a global profile / system
* @param name name (id) of property
* @param value value to set
* @return original value
* @throws Exception if property cannot be set
*/
public String setProperty(int profile, String username, String name, String value) throws Exception;
/**
* Create a new property profile given its basic details
*
* @param username username under which to create the property profile or <code>null</code> for default profiles.
* @param shortName short name for the profile
* @param description a description of the profile
* @param baseOn ID of profile to base values on
* @param parentResourcePermission id of the parent {@link com.sslexplorer.policyframework.ResourcePermission} that allowed creation of this resource
* @return created property profile object
* @throws Exception if profile cannot be created
*/
public PropertyProfile createPropertyProfile(String username, String shortName, String description, int baseOn, int parentResourcePermission)
throws Exception;
/**
* Update the basic details of a property profile
*
* @param id id of profile
* @param shortName short name
* @param description description
* @param parentResourcePermission id of the parent {@link com.sslexplorer.policyframework.ResourcePermission} that allowed creation of this resource
* @throws Exception if profile cannot be updated
*/
public void updatePropertyProfile(int id, String shortName, String description, int parentResourcePermission) throws Exception;
/**
* Delete a property profile given its ID
*
* @param id id of property profile to delete
* @return deleted profile
* @throws Exception if profile cannot be deleted
*/
public PropertyProfile deletePropertyProfile(int id) throws Exception;
/**
* Get a property profile given a username and short name. Profiles should
* have unique names withing their scope (global / user) and this method
* is used to check whether a profile of the same name already exists.
* <p>
* <code>null</code> will be returned if no such profile exists.
*
* @param username username or <code>null</code> for global profiles
* @param name name of profilke
* @return property profile or <code>null</code> if it does not exist.
* @throws Exception if profile cannot be retrieved
*/
public PropertyProfile getPropertyProfile(String username, String name) throws Exception;
/**
* Add a new category definition. Categories may be nested so you must also
* provide the parent category ID of the category to add. Use <code>-1</code>
* to add categories to the root of the tree.
*
* @param parentId parent category ID or -1 for root
* @param category category to add
*/
public void addPropertyDefinitionCategory(int parentId, PropertyDefinitionCategory category);
/**
* Remove a category from its parent. Use -1 to remove categories at the
* root of the tree.
*
* @param parentId parent category ID or -1 for root
* @param category category to remove
*/
public void removePropertyDefinitionCategory(int parentId, PropertyDefinitionCategory category);
/**
* Get a category definition given its ID. <code>null</code> will be
* returned if no such category exists.
*
* @param id id of category definition to retrieve
* @return category definition.
*/
public PropertyDefinitionCategory getPropertyDefinitionCategory(int id);
/**
* Register a new property definition.
*
* @param def definition to register
*/
public void registerPropertyDefinition(PropertyDefinition def);
/**
* De-register a property definition.
*
* @param name name of property definition to de-register
*/
public void deregisterPropertyDefinition(String name);
/**
* Get a property as an integer. The value will be retrieved as a string
* then converted to a primitive int.
* <p>
* If the property has never been set then
* the default value provided in the {@link PropertyDefinition} will
* be returned.
* <p>
* Note, It is up to the implementation to test if the property definition
* for the provided name is of type {@link PropertyDefinition#CONTEXT_CONFIGURATION}.
* If it is then the value should be retrieved from the context using
* {@link com.sslexplorer.boot.Context#getContextProperty(String)}.
*
*
* @param profile profile id or 0 for default profile, system configuration, context or hidden property
* @param username username for personal profiles or <code>null</code> for a global profile / system
* @param name name (id) of property
* @return value
* @throws Exception on any error
*/
public int getPropertyInt(int profile, String username, String name) throws Exception;
/**
* Get a property as an integer. The value will be retrieved as a string
* then converted to a primitive boolean, <code>true</code> if the string
* value is <i>true</i> otherwise <code>false</code>.
* <p>
* If the property has never been set then
* the default value provided in the {@link PropertyDefinition} will
* be returned.
* <p>
* Note, It is up to the implementation to test if the property definition
* for the provided name is of type {@link PropertyDefinition#CONTEXT_CONFIGURATION}.
* If it is then the value should be retrieved from the context using
* {@link com.sslexplorer.boot.Context#getContextProperty(String)}.
*
*
* @param profile profile id or 0 for default profile, system configuration, context or hidden property
* @param username username for personal profiles or <code>null</code> for a global profile / system
* @param name name (id) of property
* @return value
* @throws Exception on any error
*/
public boolean getPropertyBoolean(int profile, String username, String name) throws Exception;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -