org.wso2.registry.jdbc.mediatypes.utils
Class SchemaFileProcessor

java.lang.Object
  extended by org.wso2.registry.jdbc.mediatypes.utils.SchemaFileProcessor

public class SchemaFileProcessor
extends java.lang.Object


Constructor Summary
SchemaFileProcessor(DefaultMediaTypeHandler defaultMediaTypeHandler)
           
 
Method Summary
 void calculateNewSchemaNames(org.apache.ws.commons.schema.XmlSchema xmlSchema, java.util.Map processedSchemaMap, java.util.Set visitedShemas, boolean isWsdlInlineSchema, boolean processInclues)
          calculate the new schema file names to save the schema.
 java.lang.String saveSchemaFileToRegistry(java.lang.String location, java.util.Map processedSchemaMap, java.lang.String registryBasePath, boolean processInclueds, Resource metadata)
           
 java.lang.String saveSchemaFileToRegistry(java.lang.String location, java.lang.String registryBasePath, boolean processInclueds, Resource metadata)
          saves the file to the reginstry after saving all its inclues and imports to the reginstry and updating the schema locations accordingly.
 void saveSchemaFileToRegistry(org.apache.ws.commons.schema.XmlSchema xmlSchema, java.util.Map processedSchemaMap, java.util.Map changeSchemaNames, java.util.Set visitedShemas, boolean isWsdlInlineSchema, java.lang.String registryBasePath, boolean processIncludes, Resource metadata)
          save the schemas to the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaFileProcessor

public SchemaFileProcessor(DefaultMediaTypeHandler defaultMediaTypeHandler)
Method Detail

saveSchemaFileToRegistry

public java.lang.String saveSchemaFileToRegistry(java.lang.String location,
                                                 java.lang.String registryBasePath,
                                                 boolean processInclueds,
                                                 Resource metadata)
                                          throws RegistryException
saves the file to the reginstry after saving all its inclues and imports to the reginstry and updating the schema locations accordingly.

Parameters:
location - - original schema location.
Throws:
java.io.FileNotFoundException
RegistryException

saveSchemaFileToRegistry

public java.lang.String saveSchemaFileToRegistry(java.lang.String location,
                                                 java.util.Map processedSchemaMap,
                                                 java.lang.String registryBasePath,
                                                 boolean processInclueds,
                                                 Resource metadata)
                                          throws RegistryException
Parameters:
location - - original schema location
processedSchemaMap - - this map contains schema source URI vs new schema locaitons.
Throws:
RegistryException

calculateNewSchemaNames

public void calculateNewSchemaNames(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                    java.util.Map processedSchemaMap,
                                    java.util.Set visitedShemas,
                                    boolean isWsdlInlineSchema,
                                    boolean processInclues)
calculate the new schema file names to save the schema. Here we can not save the schema file as it is since there can be recursive imports. So what we have to do is to first determine the schema names to be saved and then change the schema locations accordingly. In this method first we iterate through the imports and includes and find the names. have used the visitedSchemas variable to keep track of the visited schemas to avoid the recursion.

Parameters:
xmlSchema - - schema to change save into the registry
processedSchemaMap - - map to keep the source uri vs new schema location
visitedShemas - - already visited schemas source uris
isWsdlInlineSchema - - this variable is used to check whether the given schema is an inline schema of a wsdl. in that case we do not need to calculate a name for that

saveSchemaFileToRegistry

public void saveSchemaFileToRegistry(org.apache.ws.commons.schema.XmlSchema xmlSchema,
                                     java.util.Map processedSchemaMap,
                                     java.util.Map changeSchemaNames,
                                     java.util.Set visitedShemas,
                                     boolean isWsdlInlineSchema,
                                     java.lang.String registryBasePath,
                                     boolean processIncludes,
                                     Resource metadata)
                              throws RegistryException
save the schemas to the registry. used the calcualted names in the processedSchemaMap to change the schema locations.

Parameters:
xmlSchema - - xml scheam to save
processedSchemaMap - - already determined schema names
changeSchemaNames - - this contains the map between original schema names and the change uris. this is used to update the wsdl inline schema imports and inclueds when saving the wsdl file.
visitedShemas - - keep track of visited schemas to avoid recursion
isWsdlInlineSchema - - if called from a inline wsdl schema.
Throws:
RegistryException


Copyright © 2007 Apache Web Services Project. All Rights Reserved.