SmartFrog 3.10.000

Class DefaultIncludeHandler

  extended by org.smartfrog.sfcore.languages.sf.DefaultIncludeHandler
All Implemented Interfaces:

public class DefaultIncludeHandler
extends java.lang.Object
implements IncludeHandler

This is the default include handler for the SmartFrog parser. This simply creates a new parser and returns an AttributeList. The include name is located using SFSystem.stringToURl which will try to use the name as a URL, or make a file URL to locate it. Otherwise the classloader's getResourceAsStream is used to locate the include. Subclasses can override this to do more sophisticated include storage. The format of an AttributeList as returned by DefaultParser is a vector of Object[] with element 0 the name of the attribute and element 1 the value.

Constructor Summary
DefaultIncludeHandler(java.lang.String baseCodebase)
Method Summary
protected  java.lang.String actualCodebase(java.lang.String codebase)
          build a concatenated codebase from the base codebase and the codebase passed as a parameter
protected openInclude(java.lang.String include, java.lang.String codebase)
          Locate the include and returns an input stream on it.
 java.util.Vector parseInclude(java.lang.String include, java.lang.String codebase)
          Parses given include.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DefaultIncludeHandler()


public DefaultIncludeHandler(java.lang.String baseCodebase)

baseCodebase - the codebase for this include handler to which will be appended the codebase passed in the parseIncldue method.
Method Detail


public java.util.Vector parseInclude(java.lang.String include,
                                     java.lang.String codebase)
                              throws java.lang.Exception
Parses given include. This implementation constructs a new DefaultParser on the result of openInclude and uses the AttributeList methods to construct the vector of attributes

Specified by:
parseInclude in interface IncludeHandler
include - include file to parse
codebase - an optional codebase where the include may be found. If null, use the default codebase
vector of attribute name X value pairs
java.lang.Exception - error while locating or parsing include


protected openInclude(java.lang.String include,
                                          java.lang.String codebase)
                                   throws java.lang.Exception
Locate the include and returns an input stream on it. This uses SFSystem.stringToURL to check whether include is a URL or a file. On failure it tries to use standard getResourceAsStream to get the inlude of the classpath. Subclasses can override to provide additional means of locating includes.

include - include to locate
codebase - an optional codebase where hte include may be found. If null, use the default code base
input stream on located include
java.lang.Exception - failed to locate or open include


protected java.lang.String actualCodebase(java.lang.String codebase)
build a concatenated codebase from the base codebase and the codebase passed as a parameter

codebase - the codeebase to concatenate to the base. May be null.

SmartFrog CORE 3.10.000

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