|
SmartFrog 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.smartfrog.sfcore.utils.ComponentHelper
public class ComponentHelper
Contains methods for helping components; a factoring out of common functionality. Component helpers must be bound to Prim classes before use. created 18-May-2004 11:26:15
| Constructor Summary | |
|---|---|
ComponentHelper(Prim owner)
construct a component helper and bind to a prim class |
|
| Method Summary | |
|---|---|
Reference |
completeNameOrNull()
Returns the complete name for any component from the root of the application and does not throw any exception. |
Reference |
completeNameSafe()
Returns the complete name for any component from the root of the application and does not throw any exception. |
static Reference |
completeNameSafe(Prim owner)
Returns the complete name for any component from the root of the application and does not throw any exception. |
static Prim |
findAncestorImplementing(Prim node,
java.lang.String interfaceName,
int depth)
find an ancestor of a given type |
Prim |
findAncestorImplementing(java.lang.String interfaceName,
int depth)
find an ancestor of the owner that implements this class. |
java.lang.String |
getCodebase()
get the codebase of a component |
Log |
getLogger()
get the relevant logger for this component. |
Prim |
getOwner()
return the prim that this helper is bound to |
static boolean |
implementsInterface(java.lang.Class clazz,
java.lang.String interfaceName)
recursive search for interface inheritance |
java.io.InputStream |
loadResource(java.lang.String resourcename)
load a resource using the classpath of the component at question. |
java.lang.String |
loadResourceToString(java.lang.String resourcename,
java.nio.charset.Charset encoding)
Load a resource into a string |
void |
logIgnoredException(java.lang.Throwable thrown)
ignore an exception by logging it at the fine level. |
void |
sfSelfDetachAndOrTerminate(java.lang.String terminationType,
java.lang.String terminationMessage,
Reference refId,
java.lang.Throwable thrown)
s Method that can be invoked in any PrimImpl to trigger the detach and/or termination of a component according to the values of the boolean attributes 'sfShouldDetach', 'sfShouldTerminate' and 'sfShouldTerminateQuietly' Example: new ComponentHelper(this).sfSelfDetachAndOrTerminate("normal","Copy ",this.sfCompleteNameSafe(),null); |
void |
targetForTermination()
mark this task for termination by spawning a separate thread to do it. |
void |
targetForTermination(TerminationRecord record,
boolean detach,
boolean quietly)
mark this task for termination by spawning a separate thread to do it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ComponentHelper(Prim owner)
owner - the owner to which this helper should be bound| Method Detail |
|---|
public Prim getOwner()
public Log getLogger()
public void logIgnoredException(java.lang.Throwable thrown)
thrown - exception to be loggedpublic Reference completeNameOrNull()
public Reference completeNameSafe()
public static Reference completeNameSafe(Prim owner)
owner - component whose completename is to be returned
public void sfSelfDetachAndOrTerminate(java.lang.String terminationType,
java.lang.String terminationMessage,
Reference refId,
java.lang.Throwable thrown)
terminationType - - termination type, system recognized types are "normal", "abnormal" and "externalReferenceDead".terminationMessage - - description of terminationrefId - Reference - id of terminating componentthrown - Thrown fault
public void targetForTermination(TerminationRecord record,
boolean detach,
boolean quietly)
Prim.sfTerminate(org.smartfrog.sfcore.prim.TerminationRecord) and Prim.sfStart() are synchronized,
the thread blocks until sfStart has finished.
record - record to terminate withdetach - detach first?quietly - terminate quietly?public void targetForTermination()
Prim.sfTerminate(org.smartfrog.sfcore.prim.TerminationRecord) and Prim.sfStart() are synchronized,
the thread blocks until sfStart has finished.
Note that we detach before terminating; this stops our timely end propagating.
public java.io.InputStream loadResource(java.lang.String resourcename)
throws SmartFrogException,
java.rmi.RemoteException
resourcename - name of resource on the classpath
SmartFrogException - if the resource is not on the classpath
java.rmi.RemoteException - in case of Remote/network error
public java.lang.String loadResourceToString(java.lang.String resourcename,
java.nio.charset.Charset encoding)
throws SmartFrogException,
java.rmi.RemoteException
resourcename - name of resource on the classpathencoding - encoding to be used
SmartFrogException - if the resource is not on the classpath
java.rmi.RemoteException - in case of Remote/network error
public java.lang.String getCodebase()
throws SmartFrogResolutionException,
java.rmi.RemoteException
SmartFrogResolutionException - if failed to resolve
java.rmi.RemoteException - in case of Remote/network error
public static Prim findAncestorImplementing(Prim node,
java.lang.String interfaceName,
int depth)
throws java.rmi.RemoteException
node - node to look forinterfaceName - full name of interface to look fordepth - 0 means dont look upwards, -1 means indefinite.
java.rmi.RemoteException - in case of Remote/network error
public Prim findAncestorImplementing(java.lang.String interfaceName,
int depth)
throws java.rmi.RemoteException
interfaceName - full name of interface to look fordepth - 0 means dont look upwards, -1 means indefinite.
java.rmi.RemoteException - in case of Remote/network error
public static boolean implementsInterface(java.lang.Class clazz,
java.lang.String interfaceName)
clazz - Class nameinterfaceName - full name of interface to look for
|
SmartFrog CORE 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||