com.novell.sentinel.client.bean
Class SentinelBean

java.lang.Object
  extended by com.novell.sentinel.client.bean.SentinelBean
Direct Known Subclasses:
AccountBean, AdvAttackDetailsBean, AdvisorContainerBean, AdvisorEventDataBean, AnnotationBean, AssetDataBean, AssetDataContainerBean, AssetEventDataBean, AttachmentBean, AttackSummaryBean, AttributeSchemaBean, AuthenticationConfigBean, AuthenticationTestBean, BackupCommandBean, CollectorBean, ConsoleSLMBean, ContactDataBean, CorrelatedEventsBean, DatabaseConnectionConfigBean, DatabaseIndexColumnBean, DatabasePlatformInfoBean, DatabasePlatformPropertyBean, DatabaseTableBean, DatabaseTableColumnBean, DeltaCountsBean, DiskUsageBean, DistSearchAuthBean, EsmNodeConfigurationBean, EventBean, EventDataSyncPolicyBean, EventDataSyncPolicyMetaDataBean, EventDataSyncScheduleItemBean, EventFieldToColumnMappingBean, EventSearchBean, EventSourceBean, EventSourceGroupBean, EventSourceManagerBean, EventSourceServerBean, ExternalDataBean, GlobalDataSyncConfigBean, GlobalDataSyncMetaDataBean, GlobalFilterBean, HistoricalDiskUsageBean, IdentityBean, IdentityExtAttributesBean, IncidentBean, IncidentCategoryBean, IncidentsEventsBean, IndexedLogPartitionBean, IndexedLogRetentionPolicyBean, IndexedLogRetentionPolicyMetaDataBean, IpDataBean, ItemBean, ObjectSchemaBean, PermissionBean, PluginBean, PortReferenceBean, PropertyBean, ProtocolReferenceBean, SchemaPermBean, SentinelBean, SentinelHostBean, SoftAssetDataBean, TagBean, TargetSLMBean, TrustBean, TrustTypeBean, UserBean, UserGroupBean, UserGroupPermissionBean, UserPermissionsBean, UserSessionBean, VulnerabilityBean, VulnerabilityCodeBean, VulnerabilityContainerBean, VulnerabilityEventDataBean, VulnerabilityInfoBean, VulnerabilityRsrcBean, VulnerabilityScannerBean, WFEProcessDefinitionInfoBean, WorkflowInfoBean

public abstract class SentinelBean
extends Object

The base class for "bean" objects that represent Sentinel data items.

Sentinel data object "beans" are classes designed to be used in client code (Java or GWT). The bean classes are generated automatically from metadata descriptions of the data objects.

A Sentinel bean class is a container for data. Each Sentinel data object is a collection of named values and, optionally, of named relationships to other data objects. These named items are referred to as fields.

Getting Beans To and From the Server

Generated bean instances are transported to and from the Sentinel server using an implementation of BeanTransporter.

Field Values

Each field may have a value. A field value is represented in the generated bean classes as a value of a Java type, or as an instance of a bean class. Java value types include java.lang.String, boolean, long, int, java.util.Date, java.util.Collection, etc.

A field that represents a relationship to another data object is presented either as the URL of the related object, or as a contained bean instance.

The Special Value Null

Each field may also have a special value: Null. This value is different than the Java language null and is used when sending a bean to the server via an HTTP PUT operation to indicate to the server that a field's value should be removed.

The reason Null exists is to allow less than the full set of values to be written to the server when updating a data object.

Without Null the client would have to get the entire set of values from the server, modify the value or values of interest, and then write back the entire set of values representing the complete state of the object. (A limited set of fields can be obtained by using the fields parameter in certain overrides of list and listFromURL in the BeanTransporter interface.)

With Null the client can send only those fields that are to be modified fields to the server. Setting a field's value to Null indicates something different than simply clearing the field's value. A cleared value is not sent to the server; a "nulled" value is sent to the server.

Cleared Values

A "cleared" is simply a value that has no value in the bean. A cleared value is not sent to the server and so can be used to reduce network traffic.

A cleared value in a bean received from the server may, or may not, indicate that the underlying Sentinel data object has no value value for the field. If all fields for the data object type are requested from the server and a field in the resulting bean has no value, then the data object does not have a value for that field. If, however, a particular field is not requested from the server, then there is no way to tell from the bean whether or not the data object has a value for that particular field.

Field Accessor Methods

Each field has a set of accessor methods associated with it in the generated bean class. For a standard field (single value, read-write) the accessor method functions are: Fields that are writable collections of values have an additional method: Read-only fields, do not have the "set", "clear", "set Null", and "add to" methods.

Object Type Names and Field Names

Both Sentinel data object types and their contained fields have two names: an "internal" name and a "bean" name. In many cases these names are different.

The internal name is the name by which the object or field is referred to by Sentinel server code. Internal names may not always reflect exactly the current use of an object or field, nor the names by which an object or field is referred to in the Sentinel user interface. The internal name reflects many years of Sentinel development and so may reflect terminology formerly in use (e.g., GlobalFilter objects are referred to in the user interface as "Event Routing Rules").

The generated bean class names and their associated constant and method names are based on the internal names. The values of the constants are from the bean names.

Bean names are typically shorter than the internal name in an effort to minimize the amount of data that must be transported over the network when using the Sentinel REST interface.

See Also:
BeanTransporter

Constructor Summary
protected SentinelBean(BeanMetaData<? extends SentinelBean> _metadata)
           
 
Method Summary
 void clearField(String fieldName)
          Remove any existing value of the specified field from this instance.
static
<B extends SentinelBean>
B
cloneBean(B bean)
           
 boolean equals(Object o)
           
 Iterable<Map.Entry<String,BeanValue>> fields()
          Return the fields (name-value pairs) set in this instance.
 String getBeanName()
          Return the "bean name" of the data item (e.g., "identity").
 BeanValue getBeanValue(String fieldName)
          Get the value holder for the specified field's value.
 BeanValue getField(String fieldName)
          Get the value holder for the specified field.
 BeanValue getFieldNoNull(String fieldName)
          Get the value holder for the specified field, or if the field is clear (doesn't exist in this instance), get a special value holder that returns appropriate values for the various types.
 String getLink()
          Get the URL which refers to the data represented by this instance.
<B extends SentinelBean>
BeanMetaData<B>
getMetaData()
           
 boolean isFieldClear(String fieldName)
          Return if the specified field is not set in this instance.
 boolean isFieldNull(String fieldName)
          Return if the specified field is set but Null.
 boolean isLinkClear()
          Returns if the URL addresses the data item represented by this bean is present or not.
 void setField(String fieldName, BeanValue value)
          Set a field to the passed value.
 void setFieldNull(String fieldName)
          Set any existing value of the specified field to Null.
 String toString()
          Return a String representation of this bean.
 Iterable<BeanValue> values()
          Return the values (no names) of the data set in this instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SentinelBean

protected SentinelBean(BeanMetaData<? extends SentinelBean> _metadata)
Method Detail

getMetaData

public <B extends SentinelBean> BeanMetaData<B> getMetaData()

getBeanName

public String getBeanName()
Return the "bean name" of the data item (e.g., "identity").

Returns:
The name.

getLink

public String getLink()
Get the URL which refers to the data represented by this instance. It may be null if this bean hasn't been loaded from the server.

Returns:
The URL.

isLinkClear

public boolean isLinkClear()
Returns if the URL addresses the data item represented by this bean is present or not.

Returns:
true if the URL is present.

getField

public BeanValue getField(String fieldName)
Get the value holder for the specified field.

Parameters:
fieldName - The name of the field.
Returns:
The BeanValue instance, or null.

getFieldNoNull

public BeanValue getFieldNoNull(String fieldName)
Get the value holder for the specified field, or if the field is clear (doesn't exist in this instance), get a special value holder that returns appropriate values for the various types.

Parameters:
fieldName - The name of the field.
Returns:
A BeanValue instance.

isFieldNull

public boolean isFieldNull(String fieldName)
Return if the specified field is set but Null. This state is used to clear values when updating data represented by this bean instance.

Parameters:
fieldName - The name of the field.
Returns:
true if the specified field is set and the value is Null, false otherwise.

isFieldClear

public boolean isFieldClear(String fieldName)
Return if the specified field is not set in this instance.

Parameters:
fieldName - The name of the field.
Returns:
true if the field is not set in this instance, false if it is set.

setField

public void setField(String fieldName,
                     BeanValue value)
Set a field to the passed value.

Parameters:
fieldName - The name of the field
value - The value holder.

clearField

public void clearField(String fieldName)
Remove any existing value of the specified field from this instance.

Parameters:
fieldName - The name of the field.

setFieldNull

public void setFieldNull(String fieldName)
Set any existing value of the specified field to Null. If no existing value is found, create one and set it to Null.

Parameters:
fieldName - The name of the field.

fields

public Iterable<Map.Entry<String,BeanValue>> fields()
Return the fields (name-value pairs) set in this instance.

Returns:
A field Iterable (never null).

values

public Iterable<BeanValue> values()
Return the values (no names) of the data set in this instance.

Returns:
A BeanValue Iterable (never null).

getBeanValue

public BeanValue getBeanValue(String fieldName)
Get the value holder for the specified field's value. If an existing value is not set, create a new value holder and set it in this instance.

Parameters:
fieldName - The name of the field.
Returns:
The value holder.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

cloneBean

public static <B extends SentinelBean> B cloneBean(B bean)

toString

public String toString()
Return a String representation of this bean. Primarily useful for debugging.

Overrides:
toString in class Object