📄 propertydefinition.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.boot;
/**
* Each property that may be stored store is keyed by its <i>id</i>. For
* each unique <i>id</i> there must have been a single <i>Property Definition</i>
* registered with the property database using
* {@link com.sslexplorer.properties.PropertyDatabase#registerPropertyDefinition(PropertyDefinition)}
* <p>
* Each definition contains information about the value that will be stored
* against it. This includes the type of value (string, integer, boolean etc),
* the bundle in which the human readable name and description is held,
* its category ID and other information.
* <p>
* Every property definition consists of the following attributes :-
*
* <h3>Type</h3>
*
* This determines the type of values that will be stored against this definition.
* See {@link #getType()} for a list of the possible values. Properties
* are be stored as strings. The type is then used by the user interface to
* present to appropriate component and convert to and from strings.
*
* <h3>Name</h3>
*
* This is the unique identifier of the property and must be unique.
* All properties are keyed by their name (or ID as it is sometimes known).
*
* <h3>Default Value</h3>
*
* Every property must have a sane default value that is used when no
* value has been set.
*
* <h3>Type Meta</h3>
*
* Meta-data about the property. The contents and format of this string
* will vary depending on the type. For example, {@link #TYPE_TEXT_AREA}
* type meta may contains a string in the format '[rows]X[cols]' that
* specifies the size of the text area the UI should display.
*
* <h3>Category</h3>
*
* The category ID this property exists under. See {@link com.sslexplorer.properties.PropertyDatabase}
* for an explanation of categories.
*
* <h3>Visibility</h3>
*
* Determines where (and if) the property should be displayed and usable in
* the user interface. This may either by {@link #PROFILE}, {@link #SYSTEM_CONFIGURATION},
* {@link #CONTEXT_CONFIGURATION}
*
* <h3>Sort Order</h3>
*
* A hint as to where the property should be placed in relation to others in
* the same category and visibility. The lower the value, the higher up the
* list. The two properties may exists with the same sort order but the
* behaviour is undefined.
*
* <h3>Message Resources Key</h3>
*
* The message resource bundle key as defined in the Struts configuation XML
* files (struts-config.xml).
*
* @author Brett Smith <a href="mailto: brett@3sp.com"><brett@3sp.com></a>
* @version $Revision: 1.2 $
* @see com.sslexplorer.properties.PropertyDatabase
*/
public interface PropertyDefinition {
/**
* The property exists as part of a users <i>Property Profile</i>. Depending
* on policy both administrators and users may set the values of such
* properties.
*/
public final static int PROFILE = 1;
/**
* The property is a system configuration property and may be only
* be set by admistrators.
*/
public final static int SYSTEM_CONFIGURATION = 2;
/**
* The property is a context property and may be only
* be set by admistrators.
*/
public final static int CONTEXT_CONFIGURATION = 3;
/**
* Simple text field
*/
public final static int TYPE_STRING = 0;
/**
* Integer only text field
*/
public final static int TYPE_INTEGER = 1;
/**
* Checkbox
*/
public final static int TYPE_BOOLEAN = 2;
/**
* Combo box
*/
public final static int TYPE_LIST = 3;
/**
* Password text field
*/
public final static int TYPE_PASSWORD = 4;
/**
* Multiple entry list.
*/
public final static int TYPE_MULTI_ENTRY_LIST = 5;
/**
* Text area. Type metadata provides text area size
*/
public final static int TYPE_TEXT_AREA = 6;
/**
* Time field. Meta data determines unit
*/
public final static int TYPE_TIME_IN_MS = 7;
/**
* Colour
*/
public final static int TYPE_COLOR = 8;
/**
* Multiple selection list. Type metadata provides a class name that
* implements
*/
public final static int TYPE_MULTI_SELECT_LIST = 9;
/**
* The type of the constraint. Can be one of
* <code>SystemPropertyDefinition.TYPE_STRING</code>,
* <code>SystemPropertyDefinition.TYPE_INTEGER</code>,
* <code>SystemPropertyDefinition.TYPE_BOOLEAN</code>,
* <code>SystemPropertyDefinition.TYPE_LIST</code>,
* <code>SystemPropertyDefinition.TYPE_PASSWORD</code>,
* <code>SystemPropertyDefinition.TYPE_MULTI_ENTRY_LIST</code>,
* <code>SystemPropertyDefinition.TYPE_TEXT_AREA</code>,
* <code>SystemPropertyDefinition.TYPE_TIME_IN_MS</code>,
* <code>SystemPropertyDefinition.TYPE_COLOR</code> or
* <code>SystemPropertyDefinition.TYPE_MULTI_SELECT_LIST</code>.
*
* @return type
*/
public int getType();
/**
* Get name of the property this definition is to be applied to.
*
* @return name
*/
public String getName();
/**
* The constraint may require additional information. For example, the
* TYPE_LIST constraint requires a list of valid values, which in this case
* would be provided as a comma separated string.
*
* @return constraint type meta data
*/
public String getTypeMeta();
/**
* The constraint may require additional information. For example, the
* TYPE_LIST constraint requires a list of valid values, which in this case
* would be provided as a comma separated string.
*
* @param typeMeta
* constraint type meta data
*/
public void setTypeMeta(String typeMeta);
/**
* Get the default value for this property.
*
* @return default value
*/
public String getDefaultValue();
/**
* Get the category for this property.
*
* @return category
*/
public int getCategory();
/**
* Set the category for this property.
*
* @param category
*/
public void setCategory(int category);
/**
* Get the visibility. Will be one of {@link #CONTEXT_CONFIGURATION},
* {@link #SYSTEM_CONFIGURATION}, {@link #PROFILE}.
*
* @return visibility
*/
public int getVisibility();
/**
* Get the sort order within the category
*
* @return sort order
*/
public int getSortOrder();
/**
* Set the default value
*
* @param name
*/
public void setDefaultValue(String name);
/**
* Some types may provide their meta data thru an object. This
* method should return that object
*
* @return type meta object
*/
public Object getTypeMetaObject();
/**
* Get the key of the message resources bundle that contains the names
* and descriptions of this property
*
* @return messages resources key
*/
public String getMessageResourcesKey();
/**
* Get if this property is hidden
*
* @return hidden
*/
public boolean isHidden();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -