SmartFrog 3.10.000

org.smartfrog.sfcore.componentdescription
Class ComponentDescriptionImpl

java.lang.Object
  extended by org.smartfrog.sfcore.reference.ReferenceResolverHelperImpl
      extended by org.smartfrog.sfcore.componentdescription.ComponentDescriptionImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Copying, MessageKeys, PrettyPrinting, ComponentDescription, ReferenceResolver, ReferenceResolverHelper
Direct Known Subclasses:
SFComponentDescriptionImpl

public class ComponentDescriptionImpl
extends ReferenceResolverHelperImpl
implements java.io.Serializable, java.lang.Cloneable, ComponentDescription, MessageKeys, PrettyPrinting

Defines the context class used by Components. Context implementations need to respect the ordering and copying requirements imposed by Components.

See Also:
Serialized Form

Field Summary
 boolean eager
          Whether this description is eager or lazy.
 ComponentDescription parent
          Parent of this description.
 Prim primParent
          PrimParent of this description.
 Context sfContext
          Context of attributes (key value pairs).
 
Fields inherited from interface org.smartfrog.sfcore.common.MessageKeys
CANNOT_LINK_TO_PREDICATE, COMPONENT_TERMINATED, COPY_FAILED, COPY_SERIALIZE_FAILED, ERROR_NO_SECURITY_BUT_REQUIRED, ILLEGAL_BOOLEAN_PARAMETER, ILLEGAL_NUMERIC_PARAMETER, ILLEGAL_STRING_PARAMETER, ILLEGAL_VECTOR_PARAMETER, LIVENESS_SEND_FAILURE, LIVENESS_SEND_FAILURE_IN, MISSING_PARAMETER, MSG_CLASS_NOT_FOUND, MSG_CONNECT_ERR, MSG_CONT_OTHER_DEPLOY, MSG_DEPLOY_COMP_TERMINATED, MSG_DEPLOY_SUCCESS, MSG_DEPLOYWITH_PHASE_FAILED, MSG_DETACH_SUCCESS, MSG_DETACH_TERMINATE_SUCCESS, MSG_ERR_DEPLOY_FROM_URL, MSG_ERR_PARSE, MSG_ERR_RESOLVE_PHASE, MSG_ERR_SF_RUNNING, MSG_ERR_TERM, MSG_FAILED_INET_ADDRESS_LOOKUP, MSG_FAILED_TO_CONTACT_PARENT, MSG_FILE_NOT_FOUND, MSG_HOOK_ACTION_FAILED, MSG_ILLEGAL_ACCESS, MSG_ILLEGAL_CLASS_TYPE, MSG_ILLEGAL_CLASS_TYPE_EXPECTING_GOT, MSG_ILLEGAL_REFERENCE, MSG_INPUTSTREAM_NULL, MSG_INSTANTIATION_ERROR, MSG_INVALID_OBJECT_TYPE, MSG_INVOCATION_TARGET, MSG_LANG_NOT_FOUND, MSG_LIVENESS_START_FAILED, MSG_LOADING_URL, MSG_METHOD_NOT_FOUND, MSG_NON_REP_ATTRIB, MSG_NOT_COMPONENT_REFERENCE, MSG_NOT_FOUND_ATTRIBUTE, MSG_NOT_FOUND_REFERENCE, MSG_NOT_VALUE_REFERENCE, MSG_NULL_DEF_METHOD, MSG_NULL_URL, MSG_OBJECT_REGISTRATION_FAILED, MSG_PARENT_LOCATION_FAILED, MSG_PING_SUCCESS, MSG_RANDM_ERR, MSG_REMOTE_CONNECT_ERR, MSG_REPEATED_ATTRIBUTE, MSG_SF_DEAD, MSG_SF_READY, MSG_SF_TERMINATED, MSG_STACKTRACE_FOLLOWS, MSG_START_COMP_TERMINATED, MSG_TERMINATE_SUCCESS, MSG_UNHANDLED_EXCEPTION, MSG_UNKNOWN_HOST, MSG_UNRESOLVED_REFERENCE, MSG_UNRESOLVED_REFERENCE_IN, MSG_UPDATE_SUCCESS, MSG_URL_NOT_FOUND, MSG_URL_TO_PARSE_NOT_FOUND, MSG_WARNING_LIVENESS_ENABLED, MSG_WARNING_STACKTRACE_DISABLED, MSG_WARNING_STACKTRACE_ENABLED, ROOT_MUST_BE_COMPONENT, WARN_NO_SECURITY
 
Constructor Summary
ComponentDescriptionImpl(ComponentDescription parent, Context cxt, boolean eager)
          Constucts ComponentDescriptionImpl with parent component and context.
 
Method Summary
static ComponentDescription addSystemProperties(java.lang.String startWith, ComponentDescription compDesc)
          Adds system properties to component description using parser.sfParsePrimitiveValue() for conversion using 'sf' language.
static ComponentDescription addSystemProperties(java.lang.String startWith, ComponentDescription compDesc, java.lang.String language)
          Adds system properties to component description using parser.sfParsePrimitiveValue() for conversion.
 java.lang.Object clone()
          Gets the clone of the ComponentDescription.
 java.lang.Object copy()
          Creates a deep copy of the compiled component.
static ComponentDescription getClassComponentDescription(java.lang.Object obj, boolean addSystemProperties, java.util.Vector newPhases)
          Gets configuration description for Obj class using "sf" language.
static ComponentDescription getClassComponentDescription(java.lang.Object obj, boolean addSystemProperties, java.util.Vector newPhases, java.lang.String languageExtension)
          Gets configuration description for Obj class using the right parser for language.
 boolean getEager()
          Gets the eager flag for description.
static void initLog(LogSF newlog)
          Special method to be used only by LogFactory to initialize log in ComponentDescription.
 Context setContext(Context cxt)
          Sets the context for this description.
 boolean setEager(boolean e)
          Sets eager flag for description.
 ComponentDescription setParent(ComponentDescription newparent)
          Sets parent for this component.
 Prim setPrimParent(Prim newparent)
          When a component description is held as an attribute in a Prim, the parent is no longer a ComponentDescription, but the Prim itself.
 java.lang.Object sfAddAttribute(java.lang.Object name, java.lang.Object value)
          Adds an attribute to this component description under given name.
 java.lang.Object sfAttributeKeyFor(java.lang.Object value)
          Returns the attribute key given a value.
 java.util.Iterator sfAttributes()
          Returns an ordered iterator over the attribute names in the context.
 Reference sfCompleteName()
          Returns the complete name for this component from the root of the application.
 Reference sfCompleteNameSafe()
          Returns the complete name for this ComponentDescription and does not throw any exception.
static ComponentDescription sfComponentDescription(java.lang.String url)
          Utility method that gets Component Description for URL after applying default parser phases
static ComponentDescription sfComponentDescription(java.lang.String url, java.lang.String language, java.util.Vector phases, Reference ref)
          Utility method that gets Component Description for URL after applying some parser phases
static ComponentDescription sfComponentDescription(java.lang.String url, java.lang.String language, java.util.Vector phases, Reference ref, java.lang.String codebase)
          Utility method that gets Component Description for URL after applying some parser phases
static ComponentDescription sfComponentDescription(java.lang.String url, java.util.Vector phases, Reference ref)
          Utility method that gets Component Description for URL after applying some parser phases
static ComponentDescription sfComponentDescriptionFromStr(java.io.InputStream description, java.lang.String language, java.util.Vector phases, Reference ref)
          Utility method that gets Component Description for a String after applying some parser phases
static ComponentDescription sfComponentDescriptionFromStr(java.io.InputStream description, java.lang.String language, java.util.Vector phases, Reference ref, java.lang.String codebase)
          Utility method that gets Component Description for a String after applying some parser phases
static ComponentDescription sfComponentDescriptionFromStr(java.lang.String description, java.lang.String language, java.util.Vector phases, Reference ref)
          Utility method that gets Component Description for a String after applying some parser phases
static ComponentDescription sfComponentDescriptionFromStr(java.lang.String description, java.lang.String language, java.util.Vector phases, Reference ref, java.lang.String codebase)
          Utility method that gets Component Description for a String after applying some parser phases
 boolean sfContainsAttribute(java.lang.Object attribute)
          Returns true if the context contains attribute.
 boolean sfContainsValue(java.lang.Object value)
          Returns true if the context contains value.
 Context sfContext()
          Gets the context for this description.
 ComponentDescription sfDiagnosticsReport()
          Creates diagnostics report
 LogSF sfLog()
          To log into sfCore logger.
 ComponentDescription sfParent()
          Gets the parent for this description.
 void sfParentageChanged()
          Parentage changed in component hierachy.
 Prim sfPrimParent()
          When a component description is held as an attribute in a Prim, the parent is no longer a ComponentDescription, but the Prim itself.
 java.lang.Object sfRemoveAttribute(java.lang.Object name)
          Removes an attribute from this component.
 java.lang.Object sfReplaceAttribute(java.lang.Object name, java.lang.Object value)
          Replace named attribute in component context.
 java.lang.Object sfResolve(Reference r)
          Resolve a given reference.
 java.lang.Object sfResolve(Reference r, int index)
          Resolves a refererence starting at given index.
 java.lang.Object sfResolveHere(java.lang.Object name)
          Find an attribute in this component context.
 java.lang.Object sfResolveHere(java.lang.Object name, boolean mandatory)
          Find an attribute in this context.
 java.lang.Object sfResolveParent()
          Resolves to the parent of this description.
 java.util.Iterator sfValues()
          Returns an ordered iterator over the values in the context.
protected  void tabPad(java.io.Writer ps, int amount)
          Internal method to pad out a writer.
 java.lang.String toString()
          Returns a string representation of the component.
 void visit(CDVisitor action, boolean topDown)
          Visit every node in the tree, applying an action to that node.
 void visit(CDVisitor action, boolean topDown, boolean includeLazy)
          Visit every node in the tree, applying an action to that node.
 void visit(CDVisitor action, boolean topDown, boolean includeLazy, java.util.Stack path)
          Visit every node in the tree from path downwards, applying an action to that node.
 void visit(CDVisitor action, boolean topDown, java.util.Stack path)
          Visit every node in the tree from path downwards, applying an action to that node.
 void writeOn(java.io.Writer ps)
          Writes this component description on a writer.
 void writeOn(java.io.Writer ps, int indent)
          Writes this component description on a writer.
 
Methods inherited from class org.smartfrog.sfcore.reference.ReferenceResolverHelperImpl
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.smartfrog.sfcore.reference.ReferenceResolverHelper
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser
 

Field Detail

sfContext

public Context sfContext
Context of attributes (key value pairs).


parent

public ComponentDescription parent
Parent of this description.


primParent

public Prim primParent
PrimParent of this description.


eager

public boolean eager
Whether this description is eager or lazy.

Constructor Detail

ComponentDescriptionImpl

public ComponentDescriptionImpl(ComponentDescription parent,
                                Context cxt,
                                boolean eager)
Constucts ComponentDescriptionImpl with parent component and context.

Parameters:
parent - parent component
cxt - context for description
eager - eager flag
Method Detail

sfCompleteNameSafe

public Reference sfCompleteNameSafe()
Returns the complete name for this ComponentDescription and does not throw any exception. If an exception is thrown it will return a new empty reference.

Specified by:
sfCompleteNameSafe in class ReferenceResolverHelperImpl
Returns:
reference of attribute names to this component or an empty reference

sfCompleteName

public Reference sfCompleteName()
Returns the complete name for this component from the root of the application.

Specified by:
sfCompleteName in interface ComponentDescription
Returns:
reference of attribute names to this component

sfParentageChanged

public void sfParentageChanged()
Parentage changed in component hierachy. Actions: sfCompleteName cache is cleaned


sfAddAttribute

public java.lang.Object sfAddAttribute(java.lang.Object name,
                                       java.lang.Object value)
                                throws SmartFrogRuntimeException
Adds an attribute to this component description under given name. If the attribute value is a component description, then its prim parent is set to this.

Specified by:
sfAddAttribute in interface ComponentDescription
Parameters:
name - name of attribute
value - value of attribute
Returns:
added attribute if non-existent or null otherwise
Throws:
SmartFrogRuntimeException - when name or value are null

sfRemoveAttribute

public java.lang.Object sfRemoveAttribute(java.lang.Object name)
                                   throws SmartFrogRuntimeException
Removes an attribute from this component.

Specified by:
sfRemoveAttribute in interface ComponentDescription
Parameters:
name - of attribute to be removed
Returns:
removed attribute value if successfull or null if not. If the attribute value removed is a component description, then its parent is removed as well.
Throws:
SmartFrogRuntimeException - when name is null

sfReplaceAttribute

public java.lang.Object sfReplaceAttribute(java.lang.Object name,
                                           java.lang.Object value)
                                    throws SmartFrogRuntimeException
Replace named attribute in component context. If attribute is not present it is added to the context. If the attribute value added is a component description, then its parent is set to this and/or if the one removed is a component description then its parent is reset.

Specified by:
sfReplaceAttribute in interface ComponentDescription
Parameters:
name - of attribute to replace
value - value to add or replace
Returns:
the old value if present, null otherwise
Throws:
SmartFrogRuntimeException - when name or value are null

sfAttributeKeyFor

public java.lang.Object sfAttributeKeyFor(java.lang.Object value)
Returns the attribute key given a value.

Specified by:
sfAttributeKeyFor in interface ComponentDescription
Parameters:
value - value to look up key for
Returns:
key for attribute value or null if none

sfContainsValue

public boolean sfContainsValue(java.lang.Object value)
Returns true if the context contains value.

Specified by:
sfContainsValue in interface ComponentDescription
Parameters:
value - object to check
Returns:
true if context contains value, false otherwise

sfContainsAttribute

public boolean sfContainsAttribute(java.lang.Object attribute)
Returns true if the context contains attribute.

Specified by:
sfContainsAttribute in interface ComponentDescription
Parameters:
attribute - to check
Returns:
true if context contains key, false otherwise

sfAttributes

public java.util.Iterator sfAttributes()
Returns an ordered iterator over the attribute names in the context. The remove operation of this Iterator won't affect the contents of ConponentDescription

Specified by:
sfAttributes in interface ComponentDescription
Returns:
iterator

sfValues

public java.util.Iterator sfValues()
Returns an ordered iterator over the values in the context. The remove operation of this Iterator won't affect the contents of the ComponentDescription

Specified by:
sfValues in interface ComponentDescription
Returns:
iterator

sfContext

public Context sfContext()
Gets the context for this description.

Specified by:
sfContext in interface ComponentDescription
Returns:
context
See Also:
setContext(org.smartfrog.sfcore.common.Context)

setContext

public Context setContext(Context cxt)
Sets the context for this description.

Specified by:
setContext in interface ComponentDescription
Parameters:
cxt - new context
Returns:
old context
See Also:
sfContext

sfParent

public ComponentDescription sfParent()
Gets the parent for this description.

Specified by:
sfParent in interface ComponentDescription
Returns:
component parent description
See Also:
setParent(org.smartfrog.sfcore.componentdescription.ComponentDescription)

setParent

public ComponentDescription setParent(ComponentDescription newparent)
Sets parent for this component.

Specified by:
setParent in interface ComponentDescription
Parameters:
newparent - new parent component
Returns:
old parent for description
See Also:
sfParent()

sfPrimParent

public Prim sfPrimParent()
When a component description is held as an attribute in a Prim, the parent is no longer a ComponentDescription, but the Prim itself. This is so that attribute resolution works through the component description in to the Prim hierarchy. For typenig reasons, the PrimParent has to be handled specially and not through the normal interface (due to RemoteExceptions in the interface). Gets the parent for this description.

Specified by:
sfPrimParent in interface ComponentDescription
Returns:
component parent description
See Also:
setPrimParent(Prim)

setPrimParent

public Prim setPrimParent(Prim newparent)
When a component description is held as an attribute in a Prim, the parent is no longer a ComponentDescription, but the Prim itself. This is so that attribute resolution works through the component description in to the Prim hierarchy. For typenig reasons, the PrimParent has to be handled specially and not through the normal interface (due to RemoteExceptions in the interface). Sets parent for this component.

Specified by:
setPrimParent in interface ComponentDescription
Parameters:
newparent - new parent component
Returns:
old parent for description
See Also:
sfPrimParent()

getEager

public boolean getEager()
Gets the eager flag for description.

Specified by:
getEager in interface ComponentDescription
Returns:
true if description eager, false if lazy
See Also:
setEager(boolean)

setEager

public boolean setEager(boolean e)
Sets eager flag for description.

Specified by:
setEager in interface ComponentDescription
Parameters:
e - new eager flag
Returns:
old eager flag
See Also:
getEager()

sfResolveHere

public java.lang.Object sfResolveHere(java.lang.Object name)
                               throws SmartFrogResolutionException
Find an attribute in this component context.

Specified by:
sfResolveHere in interface ReferenceResolver
Parameters:
name - attribute key to resolve
Returns:
Object Reference
Throws:
SmartFrogResolutionException - failed to find attribute

sfResolveHere

public java.lang.Object sfResolveHere(java.lang.Object name,
                                      boolean mandatory)
                               throws SmartFrogResolutionException
Find an attribute in this context.

Specified by:
sfResolveHere in interface ReferenceResolver
Specified by:
sfResolveHere in interface ReferenceResolverHelper
Parameters:
name - attribute key to resolve
mandatory - boolean that indicates if this attribute must be present in the description. If it is mandatory and not found it throws a SmartFrogResolutionException
Returns:
Object value for attribute
Throws:
SmartFrogResolutionException - failed to find attribute

sfResolveParent

public java.lang.Object sfResolveParent()
Resolves to the parent of this description.

Specified by:
sfResolveParent in interface ReferenceResolver
Returns:
parent or null if no parent

sfResolve

public java.lang.Object sfResolve(Reference r)
                           throws SmartFrogResolutionException
Resolve a given reference. Forwards to indexed resolve with index 0.

Specified by:
sfResolve in interface ReferenceResolver
Specified by:
sfResolve in class ReferenceResolverHelperImpl
Parameters:
r - reference to resolve
Returns:
resolved reference
Throws:
SmartFrogResolutionException - occurred while resolving

sfResolve

public java.lang.Object sfResolve(Reference r,
                                  int index)
                           throws SmartFrogResolutionException
Resolves a refererence starting at given index.

Specified by:
sfResolve in interface ReferenceResolver
Specified by:
sfResolve in class ReferenceResolverHelperImpl
Parameters:
r - reference to resolve
index - index in reference to start to resolve
Returns:
Object refernce
Throws:
SmartFrogResolutionException - failure while resolving reference

copy

public java.lang.Object copy()
Creates a deep copy of the compiled component. Parent, eager flag are the same in the copy. Resolvers are blanked in the copy to avoid resolution confusion. Resolution data object reference is copied if it implements the Copying interface, otherwise the pointer is shared with the copy. Note: Use "copy", not clone, to deploy more than one component using the same ComponentDescription

Specified by:
copy in interface Copying
Returns:
copy of component

clone

public java.lang.Object clone()
Gets the clone of the ComponentDescription. Note: Use "copy" to deploy more than one component using the same ComponentDescription

Specified by:
clone in interface Copying
Overrides:
clone in class java.lang.Object
Returns:
cloned object

toString

public java.lang.String toString()
Returns a string representation of the component. This will give a description of the component which is parseable, and deployable again... Unless someone removed attributes which are essential to startup that is. Large description trees should be written out using writeOn since memory for large strings runs out quick!

Specified by:
toString in interface ComponentDescription
Overrides:
toString in class java.lang.Object
Returns:
string representation of component

writeOn

public void writeOn(java.io.Writer ps)
             throws java.io.IOException
Writes this component description on a writer. Used by toString. Should be used instead of toString to write large descriptions to file, since memory can become a problem given the LONG strings created

Specified by:
writeOn in interface PrettyPrinting
Specified by:
writeOn in interface ComponentDescription
Parameters:
ps - writer to write on
Throws:
java.io.IOException - failure while writing

writeOn

public void writeOn(java.io.Writer ps,
                    int indent)
             throws java.io.IOException
Writes this component description on a writer. Used by toString. Should be used instead of toString to write large descriptions to file, since memory can become a problem given the LONG strings created

Specified by:
writeOn in interface PrettyPrinting
Parameters:
ps - writer to write on
indent - the indent to use for printing offset
Throws:
java.io.IOException - failure while writing

tabPad

protected void tabPad(java.io.Writer ps,
                      int amount)
               throws java.io.IOException
Internal method to pad out a writer.

Parameters:
ps - writer to tab to
amount - amount to tab
Throws:
java.io.IOException - failure while writing

visit

public void visit(CDVisitor action,
                  boolean topDown)
           throws java.lang.Exception
Visit every node in the tree, applying an action to that node. The nodes may be visited top-down or bottom-up

Specified by:
visit in interface ComponentDescription
Parameters:
action - the action to apply
topDown - true if top-down, false if bottom-up
Throws:
java.lang.Exception - error during applying an action

visit

public void visit(CDVisitor action,
                  boolean topDown,
                  boolean includeLazy)
           throws java.lang.Exception
Visit every node in the tree, applying an action to that node. The nodes may be visited top-down or bottom-up

Specified by:
visit in interface ComponentDescription
Parameters:
action - the action to apply
topDown - true if top-down, false if bottom-up
includeLazy - whether to visit into sub-nodes tagged LAZY
Throws:
java.lang.Exception - error during applying an action

visit

public void visit(CDVisitor action,
                  boolean topDown,
                  java.util.Stack path)
           throws java.lang.Exception
Visit every node in the tree from path downwards, applying an action to that node. The nodes may be visited top-down or bottom-up

Specified by:
visit in interface ComponentDescription
Parameters:
action - the action to apply
topDown - true if top-down, false if bottom-up
path - the path through the CD hierarchy taken to get here
Throws:
java.lang.Exception - error during applying an action

visit

public void visit(CDVisitor action,
                  boolean topDown,
                  boolean includeLazy,
                  java.util.Stack path)
           throws java.lang.Exception
Visit every node in the tree from path downwards, applying an action to that node. The nodes may be visited top-down or bottom-up

Specified by:
visit in interface ComponentDescription
Parameters:
action - the action to apply
topDown - true if top-down, false if bottom-up
includeLazy - whether to visit into sub-nodes tagged LAZY
path - the path through the CD hierarchy taken to get here
Throws:
java.lang.Exception - error during applying an action

sfComponentDescription

public static ComponentDescription sfComponentDescription(java.lang.String url)
                                                   throws SmartFrogException
Utility method that gets Component Description for URL after applying default parser phases

Parameters:
url - URL to convert to ComponentDescription
Returns:
process compound description default phases Resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescription

public static ComponentDescription sfComponentDescription(java.lang.String url,
                                                          java.util.Vector phases,
                                                          Reference ref)
                                                   throws SmartFrogException
Utility method that gets Component Description for URL after applying some parser phases

Parameters:
url - to convert to ComponentDescription. The url is used to select the parser selecting any ending after the last '.'
phases - parser phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in Description.
Returns:
process compound description 'phases' Resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescription

public static ComponentDescription sfComponentDescription(java.lang.String url,
                                                          java.lang.String language,
                                                          java.util.Vector phases,
                                                          Reference ref)
                                                   throws SmartFrogException
Utility method that gets Component Description for URL after applying some parser phases

Parameters:
url - URL to convert to ComponentDescription
language - language to select appropriate parser
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescription

public static ComponentDescription sfComponentDescription(java.lang.String url,
                                                          java.lang.String language,
                                                          java.util.Vector phases,
                                                          Reference ref,
                                                          java.lang.String codebase)
                                                   throws SmartFrogException
Utility method that gets Component Description for URL after applying some parser phases

Parameters:
url - URL to convert to ComponentDescription
language - language to select appropriate parser
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
codebase - suggested codebase for the classloader
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescriptionFromStr

public static ComponentDescription sfComponentDescriptionFromStr(java.io.InputStream description,
                                                                 java.lang.String language,
                                                                 java.util.Vector phases,
                                                                 Reference ref)
                                                          throws SmartFrogException
Utility method that gets Component Description for a String after applying some parser phases

Parameters:
description - to parse into ComponentDescription
language - to select appropriate parser ('sf')
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescriptionFromStr

public static ComponentDescription sfComponentDescriptionFromStr(java.io.InputStream description,
                                                                 java.lang.String language,
                                                                 java.util.Vector phases,
                                                                 Reference ref,
                                                                 java.lang.String codebase)
                                                          throws SmartFrogException
Utility method that gets Component Description for a String after applying some parser phases

Parameters:
description - to parse into ComponentDescription
language - to select appropriate parser ('sf')
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
codebase - suggested codebase for the classloader
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescriptionFromStr

public static ComponentDescription sfComponentDescriptionFromStr(java.lang.String description,
                                                                 java.lang.String language,
                                                                 java.util.Vector phases,
                                                                 Reference ref)
                                                          throws SmartFrogException
Utility method that gets Component Description for a String after applying some parser phases

Parameters:
description - to parse into ComponentDescription
language - to select appropriate parser ('sf')
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

sfComponentDescriptionFromStr

public static ComponentDescription sfComponentDescriptionFromStr(java.lang.String description,
                                                                 java.lang.String language,
                                                                 java.util.Vector phases,
                                                                 Reference ref,
                                                                 java.lang.String codebase)
                                                          throws SmartFrogException
Utility method that gets Component Description for a String after applying some parser phases

Parameters:
description - to parse into ComponentDescription
language - to select appropriate parser ('sf')
phases - phases to apply. If the vector is null, then all the default phases are applied
ref - reference to resolve in ComponentDescription. If ref is null the whole result ComponentDescription is returned.
codebase - suggested codebase for the classloader
Returns:
process the selected ComponentDescription after compound description 'phases' are resolved
Throws:
SmartFrogException - In case of SmartFrog system error

addSystemProperties

public static ComponentDescription addSystemProperties(java.lang.String startWith,
                                                       ComponentDescription compDesc)
Adds system properties to component description using parser.sfParsePrimitiveValue() for conversion using 'sf' language. Uses startWith parameter as filter.

Parameters:
startWith - system property label (ex. org.smartfrog)
compDesc - configuration description where to add system properties.
Returns:
this configuration description with system properties added.

addSystemProperties

public static ComponentDescription addSystemProperties(java.lang.String startWith,
                                                       ComponentDescription compDesc,
                                                       java.lang.String language)
Adds system properties to component description using parser.sfParsePrimitiveValue() for conversion. Uses startWith parameter as filter.

Parameters:
startWith - system property label (ex. org.smartfrog)
compDesc - configuration description where to add system properties.
language - language extension to use.
Returns:
this configuration description with system properties added.

getClassComponentDescription

public static ComponentDescription getClassComponentDescription(java.lang.Object obj,
                                                                boolean addSystemProperties,
                                                                java.util.Vector newPhases)
                                                         throws SmartFrogException
Gets configuration description for Obj class using "sf" language. The short class name will be used to locate its Reference. Name of the description file will be in lower case. System properties that start with same package name as obj are added to ComponentDescription if addSystemProperties is true. Note: If obj is java.lang.string, then the string is used as the class name. Useful for static classes

Parameters:
obj - which class Component description has to be read (or java.lang.String)
addSystemProperties - to select if to add system properties
newPhases - parser phases to apply to component description languageExtension provide extenstion for the language used (ex. sf by default) Takes default when vector is null. Default: type, link, function, predicate.
Returns:
Component Description
Throws:
SmartFrogException - In case of SmartFrog system error

getClassComponentDescription

public static ComponentDescription getClassComponentDescription(java.lang.Object obj,
                                                                boolean addSystemProperties,
                                                                java.util.Vector newPhases,
                                                                java.lang.String languageExtension)
                                                         throws SmartFrogException
Gets configuration description for Obj class using the right parser for language. The short class name will be used to locate its Reference. Name of the description file will be in lower case. System properties that start with same package name as obj are added to ComponentDescription if addSystemProperties is true. Note: If obj is java.lang.string, then the string is used as the class name. Useful for static classes

Parameters:
obj - which class Component description has to be read (or java.lang.String)
addSystemProperties - to select if to add system properties
newPhases - parser phases to apply to component description
languageExtension - provide extenstion for the language used (ex. sf by default) Takes default when vector is null. Default: type, link, function, predicate.
Returns:
Component Description
Throws:
SmartFrogException - In case of SmartFrog system error

initLog

public static void initLog(LogSF newlog)
Special method to be used only by LogFactory to initialize log in ComponentDescription. This is because LogImpl uses ComponentDescription to initialize itself.

Parameters:
newlog - new log

sfLog

public LogSF sfLog()
To log into sfCore logger. This method should be used to log Core messages

Specified by:
sfLog in interface ComponentDescription
Returns:
Logger implementing LogSF and Log

sfDiagnosticsReport

public ComponentDescription sfDiagnosticsReport()
Creates diagnostics report

Returns:
Component description

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP