org.jibx.schema.codegen.custom
Class SchemasetCustom

java.lang.Object
  extended by org.jibx.schema.codegen.custom.CustomBase
      extended by org.jibx.schema.codegen.custom.NestingCustomBase
          extended by org.jibx.schema.codegen.custom.SchemaRootBase
              extended by org.jibx.schema.codegen.custom.SchemasetCustom
All Implemented Interfaces:
TypeReplacer

public class SchemasetCustom
extends SchemaRootBase

Customization information for a set of schemas.

Author:
Dennis M. Sosnoski

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
SchemaRootBase.ClassDecoratorUnmarshaller, SchemaRootBase.ExtensionUnmarshaller, SchemaRootBase.NameConverterUnmarshaller
 
Field Summary
private  java.lang.String[] m_names
          Schema name patterns.
private  java.lang.String[] m_namespaces
          Schema namespace patterns.
private  java.util.Map m_schemaMap
          Map from schema file name to customization.
static StringArray s_allowedAttributes
          Enumeration of allowed attribute names
private static org.apache.log4j.Logger s_logger
          Logger for class.
 
Fields inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
ENUM_JAVA5, ENUM_SIMPLE, REPEAT_ARRAY, REPEAT_LIST, REPEAT_TYPED, s_enumValues, s_repeatValues
 
Fields inherited from class org.jibx.schema.codegen.custom.NestingCustomBase
ANY_DISCARD, ANY_DOM, ANY_MAPPED, s_anyValues, s_selectionValues, SELECTION_CHECKEDBOTH, SELECTION_CHECKEDSET, SELECTION_OVERRIDEBOTH, SELECTION_OVERRIDESET, SELECTION_UNCHECKED
 
Constructor Summary
SchemasetCustom(SchemaCustom child)
          Constructor with single schema customization as content.
SchemasetCustom(SchemasetCustom parent)
          Normal constructor.
 
Method Summary
 void checkSchemas(ValidationContext vctx)
          Recursively check that each schema customization has been matched to a schema.
private static SchemasetCustom factory(IUnmarshallingContext ictx)
          Factory used during unmarshalling.
 SchemaCustom forceCustomization(java.lang.String name, SchemaElement schema, ValidationContext vctx)
          Get schema customization information, creating it if it doesn't already exist.
 SchemaCustom getCustomization(java.lang.String name)
          Get existing schema customization information.
 java.lang.String[] getNames()
          Get schema name match patterns.
 boolean isInSet(java.lang.String name, SchemaElement schema)
          Check if a schema is included in this set.
static boolean isPatternMatch(java.lang.String name, java.lang.String pattern)
          Checks if a name matches a pattern.
private  void preSet(IUnmarshallingContext uctx)
          Make sure all attributes are defined.
 boolean validate(ValidationContext vctx)
          Validate and finalize customization information.
 
Methods inherited from class org.jibx.schema.codegen.custom.SchemaRootBase
getClassDecorators, getEnumText, getEnumType, getLineWidth, getNameConverter, getPackage, getRepeatText, getRepeatType, getRootParent, isDeleteAnnotations, isGenerateAll, isJavaDocDocumentation, isNullCollectionAllowed, isPreferInline, isSchemaFragmentDocumentation, isStructureOptional, isUseInner, setEnumType, setRepeatType
 
Methods inherited from class org.jibx.schema.codegen.custom.NestingCustomBase
getActiveFacetsMask, getAnyHandling, getAnyType, getChildren, getChoiceHandling, getChoiceType, getReplacement, getSubstitutions, getUnionHandling, getUnionType, isChoiceExposed, isUnionExposed, setAnyType, setChoiceType, setEnforcedFacets, setIgnoredFacets, setReplacement, setSubstitutions, setUnionType
 
Methods inherited from class org.jibx.schema.codegen.custom.CustomBase
getContainingObject, getParent, getSchemaRoot, setParent, validateAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_logger

private static final org.apache.log4j.Logger s_logger
Logger for class.


s_allowedAttributes

public static final StringArray s_allowedAttributes
Enumeration of allowed attribute names


m_names

private java.lang.String[] m_names
Schema name patterns.


m_namespaces

private java.lang.String[] m_namespaces
Schema namespace patterns.


m_schemaMap

private final java.util.Map m_schemaMap
Map from schema file name to customization.

Constructor Detail

SchemasetCustom

public SchemasetCustom(SchemasetCustom parent)
Normal constructor.

Parameters:
parent -

SchemasetCustom

public SchemasetCustom(SchemaCustom child)
Constructor with single schema customization as content.

Parameters:
child -
Method Detail

getNames

public java.lang.String[] getNames()
Get schema name match patterns.

Returns:
names (null if not set)

preSet

private void preSet(IUnmarshallingContext uctx)
Make sure all attributes are defined.

Parameters:
uctx - unmarshalling context

isInSet

public boolean isInSet(java.lang.String name,
                       SchemaElement schema)
Check if a schema is included in this set.

Parameters:
name - schema file name
schema - actual schema
Returns:
true if in set, false if not

getCustomization

public SchemaCustom getCustomization(java.lang.String name)
Get existing schema customization information.

Parameters:
name - schema file name
Returns:
customization

forceCustomization

public SchemaCustom forceCustomization(java.lang.String name,
                                       SchemaElement schema,
                                       ValidationContext vctx)
Get schema customization information, creating it if it doesn't already exist.

Parameters:
name - schema file name
schema - actual schema
vctx - validation context for reporting errors
Returns:
customization

factory

private static SchemasetCustom factory(IUnmarshallingContext ictx)
Factory used during unmarshalling.

Parameters:
ictx -
Returns:
instance

isPatternMatch

public static boolean isPatternMatch(java.lang.String name,
                                     java.lang.String pattern)
Checks if a name matches a pattern. This method accepts one or more '*' wildcard characters in the pattern, calling itself recursively in order to handle multiple wildcards.

Parameters:
name -
pattern - match pattern
Returns:
true if pattern matched, false if not

checkSchemas

public void checkSchemas(ValidationContext vctx)
Recursively check that each schema customization has been matched to a schema. A warning is generated for any customization without a matching schema.

Parameters:
vctx -

validate

public boolean validate(ValidationContext vctx)
Validate and finalize customization information. This override of the base class implementation also invokes the same method on any nested schemasets in order to make sure that the type substitution map and active facets mask will be available for use by nested schemas.

Overrides:
validate in class NestingCustomBase
Parameters:
vctx - validation context
Returns:
true if valid, false if not


Project Web Site