|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eodistribution.EODistributionContext
EODistributionContext objects perform the server-side related work behind Java Client applications and take care of encoding and decoding enterprise objects and other data. While WOJavaClientComponent objects embed Java Client into WebObjects and configure the client-side parameters, distribution contexts take care of actually generating the responses to client- side requests. EODistributionContext objects track the state of the server side object graph and communicate changes to the client, thus keeping the client and server object graphs in sync.
The delegate of a distribution context plays an important role in Java Client since it can validate remote method invocations originating from client objects and can implement various security mechanisms. See the EODistributionContext.Delegate interface description for more details on security.
If no delegate is implemented and set, the default security mechanisms are as follows: All clients can access all class descriptions (entities) and they can access all objects of those class descriptions, but only the properties explicitly marked as client-side class properties. But be careful: If the client-side class properties are not set explicitly, they default to the server-side class properties. Thus if you just use an EOModel which is not explicitly prepared for Java Client, the client has access to the complete database.
But without a delegate implementation, clients are not allowed to remotely invoke any methods outside the enterprise objects they fetch -- except methods that begin with the prefix "clientSideRequest". Remote methods that have a name starting with "clientSideRequest" and are invoked on the distribution context itsself, on a remote method receiver registered with the distribution context or the invocation target's session (the most common case) bypass the delegate security mechanisms and are considered safe to be invoked by any client. The standard remote method invocations to run Java Client applications do not allow the delegate to intersect, but they offer more specialized delegate methods to control security.
To support arbitrary remote method invocations, for example to communicate directly
with the session object to handle special authentication needs, clients can invoke
remote methods on a target relative to the so-called invocationTarget
of
the distribution context, which by default is the WOJavaClientComponent. These remote
methods can use a key path which is evaluated relative to the invocationTarget
(the WOJavaClientComponent). By using a key path "session" for example, you reach the
session of the WOJavaClientComponent.
But sometimes methods invoked by the client are not implemented on the session, but on
other objects. To support an easy configuration of those methods, clients can also
pass null
as the key path of a remote method invocation target, in which
case the distribution context goes through the list of objects registered with the
addRemoteMethodReceiver
method and invokes the method on the first
registered receiver responding to the method to be invoked. Usually these remote
method receivers are registered with the help of the
RemoteMethodReceiverNeededNotification
notification. Typically you
register the WOApplication or another global object to receiver this notification
from all distribution contexts and then, when received, add a list of remote
method receivers to the distribution context.
EODistributionContext.Delegate
Inner Class Summary | |
static interface |
EODistributionContext.Delegate
This interface defines the methods that can be implemented by the delegate of EODistributionContexts -- mostly to control security. |
Field Summary | |
static String |
DistributionContextInstantiatedNotification
The name of the notification sent when a distribution context is instantiated. |
static String |
RemoteMethodReceiverNeededNotification
The name of the notification sent when a distribution context needs the list of remote method receivers. |
Constructor Summary | |
EODistributionContext(WOSession session)
Creates a new distribution context for the session session ,
using the session's defaultEditingContext as the editing context
which controls the server side representation of the enterprise object graph
fetched by the client. |
|
EODistributionContext(WOSession session,
EOEditingContext editingContext)
Creates a new distribution context for the session session ,
using editingContext as the editing context which controls
the server-side representation of the enterprise object graph fetched
by the client. |
Method Summary | |
void |
addRemoteMethodReceiver(Object target)
Adds an object to the array of remote method receivers. |
Object |
delegate()
Returns the delegate of the distribution context. |
void |
dispose()
Prepares the receiver so it is disposed when Java performs garbage collection. |
static NSArray |
distributionContextsForSession(WOSession session)
Returns a array of distribution contexts for a session. |
EOEditingContext |
editingContext()
Returns the editing context used by the distribution context. |
Object |
invocationTarget()
Returns the invocation target for remote method invocations which use a key path. |
NSArray |
remoteMethodReceivers()
Returns the array of remote method receivers. |
NSData |
responseToClientMessage(NSData message)
Invoked to generate a response to a remote method invocation of the client appliction. |
WOSession |
session()
Returns the session for the distribution context. |
void |
setDelegate(Object delegate)
Sets the delegate of the distribution context. |
void |
setInvocationTarget(Object invocationTarget)
Sets the invocation target for remote method invocations which use a key path. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String DistributionContextInstantiatedNotification
public static final String RemoteMethodReceiverNeededNotification
addRemoteMethodReceiver
. The new distribution context
is the sender of the notification.Constructor Detail |
public EODistributionContext(WOSession session, EOEditingContext editingContext)
session
,
using editingContext
as the editing context which controls
the server-side representation of the enterprise object graph fetched
by the client.session
- the session to use with the distribution contexteditingContext
- the editing context to use with the distribution contextpublic EODistributionContext(WOSession session)
session
,
using the session's defaultEditingContext
as the editing context
which controls the server side representation of the enterprise object graph
fetched by the client.session
- the session to use with the distribution contextMethod Detail |
public void addRemoteMethodReceiver(Object target)
null
invocation target key path.target
- the remote method receiverRemoteMethodReceiverNeededNotification
,
remoteMethodReceivers()
public Object delegate()
EODistributionContext.Delegate
,
setDelegate(Object)
public void dispose()
dispose
in interface NSDisposable
public static NSArray distributionContextsForSession(WOSession session)
session
- the session to look the distribution contexts up forpublic EOEditingContext editingContext()
public Object invocationTarget()
setInvocationTarget(Object)
,
remoteMethodReceivers()
public NSArray remoteMethodReceivers()
RemoteMethodReceiverNeededNotification
,
addRemoteMethodReceiver(Object)
public NSData responseToClientMessage(NSData message)
message
- the remote method invocation data in a private formatpublic WOSession session()
public void setDelegate(Object delegate)
delegate
- the delegate objectEODistributionContext.Delegate
,
delegate()
public void setInvocationTarget(Object invocationTarget)
invocationTarget
- the invocation targetinvocationTarget()
,
remoteMethodReceivers()
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |