|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.dsp.das.HelperContextCache
public final class HelperContextCache
ALDSP maintains a global cache of SDO HelperContexts. This cache is keyed by a String "name", which is one of two things:
DataAccessServiceFactory.newDataAccessService(Context, String,
String)
or DataAccessServiceFactory.prepareExpression(Context, String,
String)
.
DataAccessServiceFactory.newDataAccessService(Context,
String)
.
One of the most important things contained in an SDO HelperContext
is the XSDHelper, which contains all XML schemas known to the
HelperContext. When the mediator APIs construct DataObjects, these
DataObjects will be untyped unless the XSDHelper knows the schema
for the data returned from the ALDSP server. In general, untyped
DataObjects perform more slowly; they also will not behave
correctly when enabled for change-logging (see SDOUtil.enableChanges(commonj.sdo.DataObject)
),
and so cannot be passed to update procedure on the ALDSP server.
Therefore, it is important to ensure that the schemas are loaded whenever possible. There are several ways to accomplish this:
DataAccessServiceFactory.newDataAccessService(Context, String,
String, boolean)
(for the EJB transport) or DataAccessServiceFactory.newDataAccessService(Context, String,
boolean)
(for the WS transport), and manage the HelperContext
yourself using the methods on this class.
However, for ad-hoc queries (see PreparedExpression
), the mediator cannot know which
schemas are necessary, nor is it always the case that the
appropriate schemas for DataObjects returned from ad-hoc queries
exist on the ALDSP server. Therefore it is up to the user to ensure
that the schemas are loaded into the HelperContext prior to
executing any ad-hoc queries. You may use any of methods (1) - (4)
to accomplish this, depending on your query and where the schemas
are located.
Constructor Summary | |
---|---|
HelperContextCache()
|
Method Summary | |
---|---|
static boolean |
flush(java.lang.String name)
Flush the SDO HelperContext associated with a particular dataspace or WSDL URL. |
static commonj.sdo.helper.HelperContext |
get(java.lang.String name)
Obtain the SDO HelperContext associated with a particular dataspace or WSDL URL. |
static boolean |
loadSchemasForDataspace(javax.naming.Context context,
java.lang.String dataspace,
java.lang.String dsname)
Populates the HelperContext for a given dataspace name with schemas by downloading them from the ALDSP server. |
static boolean |
loadSchemasForWsdl(java.lang.String wsdl_url)
Populates the HelperContext for a given WSDL URL with all schemas from the WSDL. |
static boolean |
setClassLoader(java.lang.String name,
java.lang.ClassLoader classloader)
Assign a ClassLoader to be used when creating HelperContexts for a given dataspace name or WSDL URL via get(String) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HelperContextCache()
Method Detail |
---|
public static commonj.sdo.helper.HelperContext get(java.lang.String name)
name
- Either a dataspace name, or a WSDL URL.
public static boolean flush(java.lang.String name)
get(String)
must be discarded by the client. It is the
client's responsibility to manage obtaining a correct
HelperContext at any point in time.
name
- Either a dataspace name, or a WSDL URL.
public static boolean setClassLoader(java.lang.String name, java.lang.ClassLoader classloader)
get(String)
. If you do not call this,
ClassLoader.getSystemClassLoader() will be used. IMPORTANT
NOTE: Calling this method will implicitly call flush(String)
if the current ClassLoader for the named
dataspace/WSDL is not the same as the specified ClassLoader,
because it is not possible to change the ClassLoader associated
with an already-existing HelperContext. You will need to call
get(String)
again after changing the ClassLoader to
obtain the new HelperContext after calling this method.
name
- Either a dataspace name, or a WSDL URL.classloader
- The ClassLoader to use when looking up
compiled schemas. May be null to reset default behaviour for
this name.
flush(String)
was called because the
ClassLoader was changed.public static boolean loadSchemasForDataspace(javax.naming.Context context, java.lang.String dataspace, java.lang.String dsname) throws DASException
This method will attempt not to repeat downloads; if it is
called twice with the same arguments without an intervening
call to flush(String)
, the second invocation will
return with no effect. In particular, passing a null
dsname a second time for a particular dataspace will never
result in any schemas being downloaded, even if new schemas
have been added to the dataspace in the meantime.
context
- Context to use when connecting to ALDSP server
(same as that passed to DataAccessServiceFactory.newDataAccessService(Context, String,
String)
).dataspace
- the dataspace name.dsname
- the data service name (an "ld:" URI). All schemas
describing XML types referred to by any input parameter or
return type of any operations on the named data service will be
downloaded. If the data service name is null, schemas will be
downloaded for ALL data services in the dataspace. Warning -
This could be a large number of schemas and hence be quite
slow!
DASException
public static boolean loadSchemasForWsdl(java.lang.String wsdl_url) throws DASException
flush(String)
has not been
called in the meantime), this method will return with no
effect.
wsdl_url
- URL of the WSDL.
DASException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |