Java Doc for SynchronizedDataObject.java in  » J2EE » Expresso » com » jcorporate » expresso » core » dataobjects » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Expresso » com.jcorporate.expresso.core.dataobjects 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.core.dataobjects.SynchronizedDataObject

SynchronizedDataObject
public class SynchronizedDataObject implements DataObject(Code)
This class provides a threadsafe access to a dataobject. To be able to more safely share your dataobjects acrossed multiple threads, simple call.

Typical Usage:

 DataObject myobj = SynchronizedDataObject.newInstance(new MimeTypes(SecuredDBObject.SYSTEM_ACCOUNT));
 

//We now have a wrapped MimeTypes data object myobj.setField("MimeNumber",new Integer(1));

//Retrieves a set of cloned records. ArrayList records = myobj.searchAndRetrieveList();


author:
   Michael Rimov


Field Summary
 DataObjecttarget
    

Constructor Summary
 SynchronizedDataObject(DataObject _target)
    

Method Summary
public synchronized  voidadd()
     Adds the record to the defined data source.
public synchronized  voidcheckField(String fieldName, String fieldValue)
     Check that a given value is valid for a given field. This method is overriden by specific DBObjects to do their own field-level validations - they should also call super in order to do the standard stuff.
public synchronized  voidclear()
    
public synchronized  intcount()
     Just like find, but only retrieves the count, not the records themselves.
public synchronized  voiddelete()
     Deletes this defined record.
public synchronized  booleanequals(Object otherObject)
     Checks to see if two data objects are equal.
public synchronized  booleanfind()
    
public synchronized  Objectget(String fieldName)
     Retrieve the native object type for the given field name.
public synchronized  MapgetAllAttributes()
     Returns a Read Only Map containing all the current attributes set for this particular data object instance.
public synchronized  ObjectgetAttribute(String attributeName)
     Return an "attribute".
public synchronized  StringgetDataContext()
    
public synchronized  DataFieldgetDataField(String fieldName)
    
public synchronized  DataExecutorInterfacegetExecutor()
    
public synchronized  StringgetField(String fieldName)
    
public synchronized  IteratorgetFieldListIterator()
     Returna a list of all field names available to this class in order.
public synchronized  DataFieldMetaDatagetFieldMetaData(String fieldName)
     Retrieves the metadata for a particular field name
Parameters:
  fieldName - The name of the field to retrieve the metadata for.
public  PatterngetGlobalMask()
     Get the compiled regular expression for this base data object.
public  StringgetKey()
    
public synchronized  IteratorgetKeyFieldListIterator()
    
public synchronized  java.util.LocalegetLocale()
    
public synchronized  StringgetMappedDataContext()
     Returns the name of the physical database that we're talking with.
public synchronized  intgetMaxRecords()
     A DB Object can be told to only retrieve a certain number of records.
public synchronized  DataObjectMetaDatagetMetaData()
     Retrieve the database object's metadata.
public synchronized  intgetOffsetRecord()
     Gets the number of records that be skipped.
public synchronized  DataQueryInterfacegetQueryInterface()
    
public synchronized  StringgetStatus()
     Retrieve the status code of the dataobject.
public synchronized  java.util.ListgetValidValuesList(String fieldName)
     Retrieve a list of valid value object for this particular dbobject
Parameters:
  fieldName - name of the field to retrieve the list for.
public  inthashCode()
     Returns a hash code value for the object.
public  booleanisGlobalMasked()
    
public static synchronized  DataObjectnewInstance(DataObject wrappedObject)
     Call this to wrap your data object in a threadsafe wrapper.
Parameters:
  wrappedObject - the object to wrap.
public  ArrayListsearchAndRetrieveList(String sortOrder)
     Performs a datasource search so that the criteria set in the DataObject is used.

Note: This particular implementation, to be threadsafe, returns a new array instance, so it is particularly slow and memory intensive.

public  ArrayListsearchAndRetrieveList()
     Performs a datasource search so that the criteria set in the DataObject is used.
public synchronized  voidset(String fieldName, Object o)
    
public synchronized  voidsetAttribute(String attributeName, Object attributeValue)
     Set an attribute.
public synchronized  voidsetDataContext(String newContext)
     Sets the data context that this object is residing in.
public synchronized  voidsetFieldsWithDefaults()
    
public  voidsetGlobalMask(Pattern newMask)
     Set a regular expression "mask" for this base data object that specifies it's valid values.
public synchronized  voidsetLocale(java.util.Locale newLocale)
    
public synchronized  voidsetMaxRecords(int newMax)
     Specify a maximum number of records to be retrieved in any subsequent searchAndRetrieve() call.
public synchronized  voidsetOffsetRecord(int newOffset)
     Specifies the number of records that should be skipped over before any data from the ResultSet is retrieved in any subsequent searchAndRetrieve() call.
public synchronized  voidsetStatus(String statusValue)
     Sets the status of the object.
public synchronized  voidupdate()
    

Field Detail
target
DataObject target(Code)




Constructor Detail
SynchronizedDataObject
SynchronizedDataObject(DataObject _target)(Code)




Method Detail
add
public synchronized void add() throws DBException(Code)
Adds the record to the defined data source.



checkField
public synchronized void checkField(String fieldName, String fieldValue) throws DBException(Code)
Check that a given value is valid for a given field. This method is overriden by specific DBObjects to do their own field-level validations - they should also call super in order to do the standard stuff. Every field is automatically checked by this method before the database is updated.
Parameters:
  fieldName - Name of the field to verify
Parameters:
  fieldValue - Value of the field to be evaluated
throws:
  DBException - If the value is not valid



clear
public synchronized void clear() throws DBException(Code)
Clears all currently loaded fields



count
public synchronized int count() throws DBException(Code)
Just like find, but only retrieves the count, not the records themselves. integer Count of the records matching the criteria
throws:
  DBException - If the search could not be completed



delete
public synchronized void delete() throws DBException(Code)
Deletes this defined record.



equals
public synchronized boolean equals(Object otherObject)(Code)
Checks to see if two data objects are equal. This is extremely important in conflict resolution.
Parameters:
  otherObject - the other object to compare to. true if the two objects are considered equal



find
public synchronized boolean find() throws DBException(Code)
Finds a single record based upon the criteria specified by the DataTransferObject boolean true if a record was found, and the criteria parameteris filled with the first data object found.
throws:
  DBException - upon error performing the search



get
public synchronized Object get(String fieldName) throws DataException(Code)
Retrieve the native object type for the given field name.
Parameters:
  fieldName - the name of the field to retrieve Object or null if the field was null
throws:
  DataException - upon error
throws:
  IllegalArgumentException - if fieldname is invalid



getAllAttributes
public synchronized Map getAllAttributes()(Code)
Returns a Read Only Map containing all the current attributes set for this particular data object instance. Read Only java.util.Map



getAttribute
public synchronized Object getAttribute(String attributeName)(Code)
Return an "attribute". Attributes are temporary (e.g. not stored in the DBMS) values associated with this particular DB object instance.
Parameters:
  attributeName - The attribute name to check the object associated with this attribute



getDataContext
public synchronized String getDataContext()(Code)
Returns the name of the currently set DataContext java.lang.String



getDataField
public synchronized DataField getDataField(String fieldName) throws DBException(Code)
Returns the object embedded within the field keyed by the fieldName parameter
Parameters:
  fieldName - The name of the field to get The object if it isn't null for the data value or null.
throws:
  DBException - upon error



getExecutor
public synchronized DataExecutorInterface getExecutor()(Code)
Use this function to acquire the Executor interface that is associated with this data object DataExecutorInterface or null if no Executor has been associatedwith this object



getField
public synchronized String getField(String fieldName) throws DBException(Code)
Retrieve the field value as a String
Parameters:
  fieldName - the name of the field to retrieve Object or null if the field was null
throws:
  DBException - upon error
throws:
  IllegalArgumentException - if fieldname is invalid



getFieldListIterator
public synchronized Iterator getFieldListIterator()(Code)
Returna a list of all field names available to this class in order. java.util.Iterator



getFieldMetaData
public synchronized DataFieldMetaData getFieldMetaData(String fieldName)(Code)
Retrieves the metadata for a particular field name
Parameters:
  fieldName - The name of the field to retrieve the metadata for. <\u0441ode>DataFieldMetaData the metadata associated with thisfield.
throws:
  IllegalArgumentException - if the fieldName does not exist.



getGlobalMask
public Pattern getGlobalMask()(Code)
Get the compiled regular expression for this base data object. the precompiled regular expression mask



getKey
public String getKey()(Code)
Every class that can stay in the system cache must define a way to get a unique key The cache key for this item.



getKeyFieldListIterator
public synchronized Iterator getKeyFieldListIterator() throws DBException(Code)
Retrieve iterator of all keys java.util.Itaerator Each iteration will return the name ofthe next key in the list.
throws:
  DBException - upon error



getLocale
public synchronized java.util.Locale getLocale()(Code)
Retrieve the DBObject's current locale java.util.Locale



getMappedDataContext
public synchronized String getMappedDataContext()(Code)
Returns the name of the physical database that we're talking with. This is opposed to getDataContext() which returns the security context as well. getMappedDataContext() is strictly used to get at the low level database connection. java.lang.String... the context we've mapped to.



getMaxRecords
public synchronized int getMaxRecords()(Code)
A DB Object can be told to only retrieve a certain number of records. If a "max records" value has been specified, this method provides access to it. The maximum number of records that should be retrieved, or zeroif no max has been set



getMetaData
public synchronized DataObjectMetaData getMetaData()(Code)
Retrieve the database object's metadata. Metadata is a description of the database object, so it contains static information such as as description, field names, field types. Etc.

For implementers of this interface: It is best to store the metadata somewhere rather than recreating it each and every time. For low-memory requirements, a WeakHashMap is recommended

a built DataObjectMetaData for this database object



getOffsetRecord
public synchronized int getOffsetRecord()(Code)
Gets the number of records that be skipped. The offset records. A DB Object can be told to skip a certain number of records, before reading records from the ResultSet.

author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001 The maximum number of records that should beskipped over before reading the data records.
See Also:   SynchronizedDataObject.setOffsetRecord(int)




getQueryInterface
public synchronized DataQueryInterface getQueryInterface()(Code)
Use this function to acquire the DataQueryInterface that is associated with this data object DataQueryInterface or null if no QueryInterface has beenassociated with this object



getStatus
public synchronized String getStatus()(Code)
Retrieve the status code of the dataobject. java.lang.String



getValidValuesList
public synchronized java.util.List getValidValuesList(String fieldName) throws DBException(Code)
Retrieve a list of valid value object for this particular dbobject
Parameters:
  fieldName - name of the field to retrieve the list for. java.util.List of valid values
throws:
  DBException - upon error



hashCode
public int hashCode()(Code)
Returns a hash code value for the object. a hash code value for this object.



isGlobalMasked
public boolean isGlobalMasked()(Code)
Return boolean if the data object has a mask set True if the data object mask is set, else false if it is not



newInstance
public static synchronized DataObject newInstance(DataObject wrappedObject)(Code)
Call this to wrap your data object in a threadsafe wrapper.
Parameters:
  wrappedObject - the object to wrap. a DataObject who's implementation is threadsafe.



searchAndRetrieveList
public ArrayList searchAndRetrieveList(String sortOrder) throws DBException(Code)
Performs a datasource search so that the criteria set in the DataObject is used.

Note: This particular implementation, to be threadsafe, returns a new array instance, so it is particularly slow and memory intensive. However, for the scope of the class, it is at least threadsafe.


Parameters:
  sortOrder - A pipe delimited string specifying the field(s) to be sorted upon.May be a single field without any pipes. java.util.List of objects. May be an empty list if noobjects were found.
throws:
  DBException - upon error performing the search



searchAndRetrieveList
public ArrayList searchAndRetrieveList() throws DBException(Code)
Performs a datasource search so that the criteria set in the DataObject is used. There is no specified sort order for this version of the method

Note: This particular implementation, to be threadsafe, returns a new array instance, so it is particularly slow and memory intensive. However, for the scope of the class, it is at least threadsafe.

java.util.List of objects. May be an empty list if noobjects were found.
throws:
  DBException - upon error performing the search



set
public synchronized void set(String fieldName, Object o) throws DataException(Code)
Directly sets the field value without getting the datafield object
Parameters:
  fieldName - the name of the field to set
Parameters:
  o - the object value to set it to.



setAttribute
public synchronized void setAttribute(String attributeName, Object attributeValue)(Code)
Set an attribute. Attributes are temporary (e.g. not stored in the DBMS) values associated with this particular DB object instance.
Parameters:
  attributeName - The name of the attribute being defined
Parameters:
  attributeValue - The object to store under this attribute name



setDataContext
public synchronized void setDataContext(String newContext)(Code)
Sets the data context that this object is residing in. This is identical to the pre-Expresso 5.0 setDBName()
Parameters:
  newContext - the new name of the data context.
throws:
  IllegalArgumentException - if the DataContext does not exist



setFieldsWithDefaults
public synchronized void setFieldsWithDefaults() throws DataException(Code)

throws:
  DataException - upon setField error.



setGlobalMask
public void setGlobalMask(Pattern newMask)(Code)
Set a regular expression "mask" for this base data object that specifies it's valid values. The mask should already be compiled by the regular expression compiler
Parameters:
  newMask - The compiled regular expression mask



setLocale
public synchronized void setLocale(java.util.Locale newLocale)(Code)
Sets the DataObject's locale
Parameters:
  newLocale - the New locale object



setMaxRecords
public synchronized void setMaxRecords(int newMax) throws DBException(Code)
Specify a maximum number of records to be retrieved in any subsequent searchAndRetrieve() call. Records will be retrieved (in the specified sort order) until the specified maximum is reached, then the remainder of the result set is discarded. Specifying zero indicates that all records are to be retrieved.
Parameters:
  newMax - The maximum number of records to retrieve.
throws:
  DBException - If the max number is less than 0



setOffsetRecord
public synchronized void setOffsetRecord(int newOffset) throws DBException(Code)
Specifies the number of records that should be skipped over before any data from the ResultSet is retrieved in any subsequent searchAndRetrieve() call. Records will be skipped over (in the specified sort order) until the record counts is equal to or greater than the offset record. Specifying zero indicates that no records should be skipped over and the ResultSet immediately from the start.
Parameters:
  newOffset - The maximum number of records to retrieve.
throws:
  DBException - If the max number is less than 0

author Peter Pilgrim




setStatus
public synchronized void setStatus(String statusValue)(Code)
Sets the status of the object.
Parameters:
  statusValue -



update
public synchronized void update() throws DBException(Code)
Updates the record to the defined datasource



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.