Package org.apache.openjpa.slice.jdbc
Class UniqueResultObjectProvider
- java.lang.Object
-
- org.apache.openjpa.slice.jdbc.UniqueResultObjectProvider
-
- All Implemented Interfaces:
ResultObjectProvider
,Closeable
public class UniqueResultObjectProvider extends java.lang.Object implements ResultObjectProvider
Aggregates individual single query results from different databases.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description UniqueResultObjectProvider(ResultObjectProvider[] rops, StoreQuery q, QueryExpressions[] exps)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
absolute(int pos)
Move to the given 0-based position.void
close()
Free the resources associated with this provider.java.lang.Object
getResultObject()
Instantiate the current result object.void
handleCheckedException(java.lang.Exception e)
Any checked exceptions that are thrown will be passed to this method.boolean
next()
Advance the input to the next position.void
open()
Open the result.void
reset()
Reset this provider.int
size()
Return the number of items in the input, orInteger.MAX_VALUE
if the size in unknown.boolean
supportsRandomAccess()
Return true if this provider supports random access.
-
-
-
Constructor Detail
-
UniqueResultObjectProvider
public UniqueResultObjectProvider(ResultObjectProvider[] rops, StoreQuery q, QueryExpressions[] exps)
-
-
Method Detail
-
absolute
public boolean absolute(int pos) throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Move to the given 0-based position. This method is only called for providers that support random access. Returntrue
if there is data at this position; otherwisefalse
. This may be invoked in place ofResultObjectProvider.next()
.- Specified by:
absolute
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Free the resources associated with this provider.- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
getResultObject
public java.lang.Object getResultObject() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Instantiate the current result object. This method will only be called afterResultObjectProvider.next()
orResultObjectProvider.absolute(int)
.- Specified by:
getResultObject
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
handleCheckedException
public void handleCheckedException(java.lang.Exception e)
Description copied from interface:ResultObjectProvider
Any checked exceptions that are thrown will be passed to this method. The provider should re-throw the exception as an appropriate unchecked exception.- Specified by:
handleCheckedException
in interfaceResultObjectProvider
-
next
public boolean next() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Advance the input to the next position. Returntrue
if there is more data; otherwisefalse
.- Specified by:
next
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
open
public void open() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Open the result. This will be called beforeResultObjectProvider.next()
,ResultObjectProvider.absolute(int)
, orResultObjectProvider.size()
.- Specified by:
open
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
reset
public void reset() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Reset this provider. This is an optional operation. If supported, it should move the position of the provider to before the first element. Non-random-access providers may be able to support this method by re-acquiring all resources as if the result were just opened.- Specified by:
reset
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
size
public int size() throws java.lang.Exception
Description copied from interface:ResultObjectProvider
Return the number of items in the input, orInteger.MAX_VALUE
if the size in unknown.- Specified by:
size
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
supportsRandomAccess
public boolean supportsRandomAccess()
Description copied from interface:ResultObjectProvider
Return true if this provider supports random access.- Specified by:
supportsRandomAccess
in interfaceResultObjectProvider
-
-