com.j_spaces.core.client.view
Class View

java.lang.Object
  extended by com.j_spaces.core.client.SQLQuery
      extended by com.j_spaces.core.client.ContinousQuery
          extended by com.j_spaces.core.client.view.View
All Implemented Interfaces:
Query, Serializable, Entry

public class View
extends ContinousQuery

TODO add Javadoc

Since:
5.2
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.j_spaces.core.client.SQLQuery
CALL, COUNT_PREFIX, DELETE_PREFIX, GROUP, ORDER, SELECT_PREFIX
 
Constructor Summary
View()
          Empty constructor.
View(Entry entry, String sqlQuery)
          Constructor for setting the entry as a template to query with the sql query expression.
View(Object object, String sqlQuery)
          Constructor for setting the object as a template to query with the sql query expression.
View(String className, String sqlQuery)
          Constructor for setting the className of the entry to query with the sql query expression.
 
Method Summary
 
Methods inherited from class com.j_spaces.core.client.SQLQuery
getClassName, getEntry, getObject, getQuery, hasWhereClause, isExternalEntry, isNullExpression, isStoredProcedure, setClassName, setExternalEntry, setQuery, setTemplate, setTemplate, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

View

public View()
Empty constructor.


View

public View(String className,
            String sqlQuery)
Constructor for setting the className of the entry to query with the sql query expression.

Parameters:
className - - Entry class name to be queried.
sqlQuery - - The SQL Query expression (contents of the WHERE part).

Usage example:

 SQLQuery query = new SQLQuery(MyEntry.class.getName(), "m_integer > 50");
 Entry result[] = space.readMultiple(query, null, Integer.MAX_VALUE);
 System.out.println("Found " + result.length + " Entries");
 for (int i = 0; i < result.length; i++) {
     System.out.println(i + " " + (MyEntry) result[i]);
 }
 

Note that a single read/take operation will return only the first match, if any.

View

public View(Object object,
            String sqlQuery)
Constructor for setting the object as a template to query with the sql query expression. The constructor behaves in a similar manner to the former, but incase of an ExternalEntry its class name is extracted implicitly.

Parameters:
object - - The POJO to query by
sqlQuery - - The SQL Query expression (contents of the WHERE part).

Usage Example:

 //let MyEntry extend ExternalEntry
 SQLQuery query = new SQLQuery(MyEntry(), "m_integer > 50");
 MyEntry result = (MyEntry)space.read(query, null, JavaSpace.NO_WAIT);
 if (result!=null)
     // if there are more then one, it will return the first entry found
     System.out.println("Found entry: " + result.toString());
 else
     System.out.println("None of the entries match the specified query: "+query);
 
See Also:
SQLQuery.SQLQuery(String className, String sqlQuery)

View

public View(Entry entry,
            String sqlQuery)
Constructor for setting the entry as a template to query with the sql query expression. The constructor behaves in a similar manner to the former, but incase of an ExternalEntry its class name is extracted implicitly.

Parameters:
entry - - The entry to query by
sqlQuery - - The SQL Query expression (contents of the WHERE part).

Usage Example:

 //let MyEntry extend ExternalEntry
 SQLQuery query = new SQLQuery(MyEntry(), "m_integer > 50");
 MyEntry result = (MyEntry)space.read(query, null, JavaSpace.NO_WAIT);
 if (result!=null)
     // if there are more then one, it will return the first entry found
     System.out.println("Found entry: " + result.toString());
 else
     System.out.println("None of the entries match the specified query: "+query);
 
See Also:
SQLQuery.SQLQuery(String className, String sqlQuery)