|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--osl.manager.ActorImpl
|
+--osl.manager.basic.StreamInputActorImpl
This class defines the implementation of an actor used to manage an input stream on behalf of external actors. We require an implementation (rather than an Actor) because if a security manager is running (i.e. startfoundry was specified with the -secure option), then user-written actors will not have direct access to several standard streams (e.g. System.out). Since instances of ActorImpl are privileged they may control such streams and provide their services to specific actors. The interface exported to external actors is defined by the StreamInputActor interface. In the current implementation, this actor will always use System.in as the encapsulated input stream.
osl.manager.basic.StreamInputActor, Serialized Form| Field Summary | |
protected WaitQueue |
mailQueue
The queue which holds incoming requests. |
protected ActorManager |
ourManager
The manager which manages this implementation. |
| Fields inherited from class osl.manager.ActorImpl |
actorClass,
classRef,
context,
extensionMethods,
nextID,
self |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY |
| Constructor Summary | |
StreamInputActorImpl()
|
|
| Method Summary | |
protected void |
actorDeliver(ActorMsgRequest msg)
This method is called by a manager to deliver a new message to the local actor. |
protected void |
actorInitialize(ActorManager ourMgr,
ActorName you,
ActorCreateRequest req)
This method is called by a manager to initialize an actor implementation after it is instantiated. |
protected void |
actorPostMigrateRebuild(ActorManager ourMgr)
This method is called by the new manager of an actor implementation just after migration has occurred. |
java.lang.Integer |
available()
Return the number of bytes that can be read from the internal input stream without blocking. |
void |
available(ActorName client,
java.lang.String method)
Determine the number of bytes that can be read from the internal input stream without blocking, and send the result to the specified caller. |
void |
close()
Close the internal input stream. |
protected ActorName |
implCreate(ActorCreateRequest req)
Request a new actor to be created. |
protected void |
implDestroy(java.lang.String reason)
Request to remove this actor from the system. |
protected java.lang.Object |
implInvokeService(ServiceName name,
java.lang.String meth,
java.lang.Object[] args)
Request a service invocation on the named node service. |
protected void |
implMigrate(ActorManagerName loc)
Request that this actor wishes to be migrated to a new location. |
protected java.lang.Object |
implSend(ActorMsgRequest msg)
Request a message to be sent. |
void |
mark(java.lang.Integer readlimit)
Mark the current position in the internal stream. |
java.lang.Boolean |
markSupported()
Test if the internal input stream supports the mark and reset methods. |
void |
markSupported(ActorName client,
java.lang.String method)
Test if the internal input stream supports the mark and reset methods. |
java.lang.Integer |
read()
Read the next byte of data from an input stream. |
void |
read(ActorName client,
java.lang.String method)
Read the next byte of data from an input stream and send it to a specified actor. |
void |
read(ActorName client,
java.lang.String method,
java.lang.Integer max)
Read an array of bytes from the input stream and send them to a specified actor. |
java.lang.Byte[] |
read(java.lang.Integer max)
Read an array of bytes from the input stream and return them to the caller. |
java.lang.Character[] |
readln()
Read a line of characters from the internal input stream. |
void |
readln(ActorName client,
java.lang.String method)
Read a line of characters from the internal input stream. |
void |
reset()
Reposition the internal stream to the position marked by a previous call to mark. |
void |
run()
The main run loop for this implementation. |
void |
skip(ActorName client,
java.lang.String method,
java.lang.Long n)
Skip over and discard n bytes of data from the input stream. |
java.lang.Long |
skip(java.lang.Long n)
Skip over and discard n bytes of data from the input stream. |
| Methods inherited from class osl.manager.ActorImpl |
buildAsynchException,
finalize,
formatAsynchException,
implExtension,
mgrActorCreate,
mgrActorFatalError,
mgrActorInvokeService,
mgrActorMigrate,
mgrActorSend,
registerExtension,
removeExtension,
setCreatingThread,
stampRequest |
| Methods inherited from class java.lang.Thread |
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
sleep,
sleep,
start,
stop,
stop,
suspend,
toString,
yield |
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected ActorManager ourManager
protected WaitQueue mailQueue
| Constructor Detail |
public StreamInputActorImpl()
| Method Detail |
protected void actorInitialize(ActorManager ourMgr,
ActorName you,
ActorCreateRequest req)
For this implementation, the manager reference and actor name are saved, but the actor create request is discarded since no internal actor is actually created.
ourMgr - The ActorManager which should be
used by this actor implementation to invoke actor services.you - The ActorName that should be used as
the name of the new actor.rtClass - The run-time Class of the
user-written actor that should be instantiated by this
implementation. This class will always be an extension of the
Actor class.initArgs - The array of arguments to pass to the
constructor of the user-defined actor when it is instantiated.ActorManager.implInitialize(osl.manager.ActorImpl, osl.manager.ActorName, osl.manager.ActorCreateRequest)protected void actorDeliver(ActorMsgRequest msg)
For this implementation, we deposit the new message in our mail queue so that it can be processed in the main run loop.
msg - The ActorMsgRequest structure to be
delivered. This structure must be maintained by the actor as it
is required if an exception is returned to the manager.protected void actorPostMigrateRebuild(ActorManager ourMgr)
This method should never be called for this implementation as StreamInputActorImpls will never migrate. If this method IS called for some reason then a runtime exception is thrown.
ourMgr - A reference to the new manager of the
implementation after migration has occurred.
protected java.lang.Object implSend(ActorMsgRequest msg)
throws RemoteCodeException
This method should never be called in this implementation since no internal actor is ever created.
msg - The ActorMsgRequest describing the
message to send.Actor.send(ActorName, String),
Actor.call(ActorName, String)
protected ActorName implCreate(ActorCreateRequest req)
throws java.lang.SecurityException,
RemoteCodeException
This method should never be called in this implementation since no internal actor is ever created.
req - The ActorCreateRequest describing the
new actor to create.Actor.create(String),
Actor.create(Class),
Actor.create(ActorManagerName, String),
Actor.create(ActorManagerName, Class)protected void implMigrate(ActorManagerName loc)
This method should never be called in this implementation since no internal actor is ever created.
loc - The ActorManagerName of the node to
migrate to.Actor.migrate(osl.manager.ActorManagerName),
Actor.cancelMigrate()
protected java.lang.Object implInvokeService(ServiceName name,
java.lang.String meth,
java.lang.Object[] args)
throws ServiceNotFoundException,
ServiceException
This method should never be called in this implementation since no internal actor is ever created.
name - The ServiceName describing the
service to invoke.args - The Object argument to pass to the
service invocation function.Actor.invokeService(osl.service.ServiceName, java.lang.String)protected void implDestroy(java.lang.String reason)
This method should never be called in this implementation since no internal actor is ever created.
reason - A String giving a "reason" for the
removal. This string should normally be appended to the log for
the actor before removing it from the system.Actor.destroy(java.lang.String)
public java.lang.Integer read()
throws java.io.IOException
public void read(ActorName client,
java.lang.String method)
throws java.io.IOException
public type method(Integer);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the data.method - The String name of the method in
client which will accept the data.StreamInputActor.read()
public java.lang.Byte[] read(java.lang.Integer max)
throws java.io.IOException
max - An Integer giving the maximum number
of bytes to read from the stream.
public void read(ActorName client,
java.lang.String method,
java.lang.Integer max)
throws java.io.IOException
public type method(Byte[]);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the data.method - The String name of the method in
client which will accept the data.max - An Integer giving the maximum number
of bytes to read from the stream.StreamInputActor.read(Integer)
public java.lang.Long skip(java.lang.Long n)
throws java.io.IOException
n - A Long giving the number of bytes to
be skipped.
public void skip(ActorName client,
java.lang.String method,
java.lang.Long n)
throws java.io.IOException
public type method(Long);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the number of bytes skipped.method - The String name of the method in
client which will accept the number of bytes skipped.n - A Long giving the number of bytes to
be skipped.StreamInputActor.skip(Long)
public java.lang.Integer available()
throws java.io.IOException
public void available(ActorName client,
java.lang.String method)
throws java.io.IOException
public type method(Integer);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the number of bytes available.method - The String name of the method in
client which will accept the number of bytes available.StreamInputActor.available()
public void close()
throws java.io.IOException
public void mark(java.lang.Integer readlimit)
readlimit - An Integer indicating the
maximum number of bytes that can be read before the mark position
becomes invalid.
public void reset()
throws java.io.IOException
public java.lang.Boolean markSupported()
public void markSupported(ActorName client,
java.lang.String method)
public type method(Boolean);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the markSupported statusmethod - The String name of the method in
client which will accept the markSupported
status.StreamInputActor.markSupported()
public java.lang.Character[] readln()
throws java.io.IOException
public void readln(ActorName client,
java.lang.String method)
throws java.io.IOException
public type method(Character);
where type may be any legal return type. Any error
resulting from the sending of the result
(e.g. NoSuchMethodException, RemoteCodeException, etc) is ignored
by the StreamInputActor (but it IS logged to the Actor
log file). Normally, this method is used by actors wishing to
perform asynchronous I/O. client - The ActorName of the actor which
should receive the line of characters.method - The String name of the method in
client which should recieve the line of characters.StreamInputActor.readln()public void run()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||