SmartFrog 3.10.000

org.smartfrog.sfcore.languages.sf.predicates
Class Schema

java.lang.Object
  extended by org.smartfrog.sfcore.languages.sf.predicates.BasePredicate
      extended by org.smartfrog.sfcore.languages.sf.predicates.Schema
All Implemented Interfaces:
PhaseAction

public class Schema
extends BasePredicate
implements PhaseAction

Defines the basic schema implementation.


Field Summary
 
Fields inherited from class org.smartfrog.sfcore.languages.sf.predicates.BasePredicate
component, context, keepPredicates, phaseName, stack
 
Constructor Summary
Schema()
           
 
Method Summary
protected  void checkAttribute(java.lang.Object name, ComponentDescription predicate, ComponentDescription attributes, java.lang.String schemaDescription)
          Resolves the attributes for a specific schemadescription.
protected  void doPredicate()
          Applies predicates.
protected  java.lang.String getNameAndDescription(java.lang.Object name, java.lang.String description)
          Composes a string using name and description strings
protected  boolean isValidClass(java.lang.Object schemaClass, java.lang.Object foundClassToValidate)
          Checks an object class against a schema class(String) or classes (Vector of Strings)
protected  boolean isValidClass(java.lang.String schemaClass, java.lang.Object foundClassToValidate)
          Checks if an object class is valid when compared with a class string name
 
Methods inherited from class org.smartfrog.sfcore.languages.sf.predicates.BasePredicate
doit, forComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.smartfrog.sfcore.languages.sf.PhaseAction
doit, forComponent
 

Constructor Detail

Schema

public Schema()
Method Detail

checkAttribute

protected void checkAttribute(java.lang.Object name,
                              ComponentDescription predicate,
                              ComponentDescription attributes,
                              java.lang.String schemaDescription)
                       throws SmartFrogCompileResolutionException
Resolves the attributes for a specific schemadescription.

Parameters:
name - the name attribute
predicate - component description
attributes - attributes of component description
schemaDescription - schema description
Throws:
SmartFrogCompileResolutionException - failed to check the attributes

isValidClass

protected boolean isValidClass(java.lang.Object schemaClass,
                               java.lang.Object foundClassToValidate)
                        throws java.lang.ClassNotFoundException,
                               SmartFrogException
Checks an object class against a schema class(String) or classes (Vector of Strings)

Parameters:
schemaClass - class specified in the schema/predicate definition. It has to be a Vector of Strings or a String. The strings have to be the name of valid existing (codebase or classpath) classes
foundClassToValidate - object which class has to be validated against the predicate
Returns:
if the class found is complaint with schema or not.
Throws:
java.lang.ClassNotFoundException
SmartFrogException

isValidClass

protected boolean isValidClass(java.lang.String schemaClass,
                               java.lang.Object foundClassToValidate)
                        throws java.lang.ClassNotFoundException
Checks if an object class is valid when compared with a class string name

Parameters:
schemaClass - String name for the predicate class
foundClassToValidate - Object which class has to be validated
Returns:
true if object class is equal or descedant from schema class.
Throws:
java.lang.ClassNotFoundException

getNameAndDescription

protected java.lang.String getNameAndDescription(java.lang.Object name,
                                                 java.lang.String description)
Composes a string using name and description strings

Parameters:
name - for an attribute
description - for the attribute
Returns:
string 'name' or 'name(description)'

doPredicate

protected void doPredicate()
                    throws SmartFrogCompileResolutionException
Applies predicates.

Specified by:
doPredicate in class BasePredicate
Throws:
SmartFrogCompileResolutionException - if fail to apply predicates.

SmartFrog CORE 3.10.000

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