本文整理汇总了Java中com.thaiopensource.util.PropertyMapBuilder类的典型用法代码示例。如果您正苦于以下问题:Java PropertyMapBuilder类的具体用法?Java PropertyMapBuilder怎么用?Java PropertyMapBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyMapBuilder类属于com.thaiopensource.util包,在下文中一共展示了PropertyMapBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SchemaReceiverImpl
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
public SchemaReceiverImpl(PropertyMap properties) {
Name attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
attributesSchema = (attributeOwner != null);
PropertyMapBuilder builder = new PropertyMapBuilder(properties);
if (ValidatorImpl.OWNER_NAME.equals(attributeOwner)) {
attributeSchemaProperties = properties;
builder.put(WrapProperty.ATTRIBUTE_OWNER, null);
this.properties = builder.toPropertyMap();
}
else {
if (attributeOwner == null)
this.properties = properties;
else {
builder.put(WrapProperty.ATTRIBUTE_OWNER, null);
this.properties = builder.toPropertyMap();
}
builder.put(WrapProperty.ATTRIBUTE_OWNER, ValidatorImpl.OWNER_NAME);
attributeSchemaProperties = builder.toPropertyMap();
}
this.autoSchemaLanguage = new AutoSchemaReader(properties.get(SchemaReceiverFactory.PROPERTY));
}
示例2: parseValidate
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
/**
* Parse a validate action.
* @param attributes The validate element attributes.
* @throws SAXException
*/
private void parseValidate(Attributes attributes) throws SAXException {
// get the resolved URI pointing to the schema.
md.schemaUriRef = getSchema(attributes);
md.schemaUriBase = xmlBaseHandler.getBaseUri();
// get the schema type
md.schemaType = getSchemaType(attributes);
// if no schemaType attribute, use the default schema type.
if (md.schemaType == null)
md.schemaType = defaultSchemaType;
if (SchemaReceiverImpl.LEGACY_RNC_MEDIA_TYPE.equals(md.schemaType))
warning("legacy_rnc_media_type", locator);
// if we matched on elements create a mode usage.
if (md.actions != null)
md.modeUsage = getModeUsage(attributes);
else
md.modeUsage = null;
// prepare to receive validate options.
md.options = new PropertyMapBuilder();
md.mustSupportOptions.clear();
}
示例3: createValidator
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
protected ContentHandler createValidator() {
String rnc;
if (xtm_version == XTMVersion.XTM_1_0)
rnc = XTM_1_RNC;
else if (xtm_version == XTMVersion.XTM_2_0 ||
xtm_version == XTMVersion.XTM_2_1)
rnc = XTM_2_RNC;
else
throw new OntopiaRuntimeException("Unknown XTM version: " + xtm_version);
InputSource src = new InputSource(XTMValidatingContentHandler.class.getResourceAsStream(rnc));
try {
SchemaFactory factory = new SchemaFactory();
factory.setXMLReaderCreator(new Jaxp11XMLReaderCreator());
factory.setErrorHandler(new DraconianErrorHandler());
factory.setDatatypeLibraryFactory(new DatatypeLibraryLoader());
Schema schema = factory.createSchema(src);
PropertyMapBuilder pmb = new PropertyMapBuilder();
pmb.put(ValidateProperty.ERROR_HANDLER, new DraconianErrorHandler());
return schema.createValidator(pmb.toPropertyMap()).getContentHandler();
} catch (Exception e) {
throw new OntopiaRuntimeException("INTERNAL ERROR: " + e, e);
}
}
示例4: addValidator
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
public void addValidator(XMLValidator xv)
{
PropertyMapBuilder propertyMapBuilder = new PropertyMapBuilder();
propertyMapBuilder.put(ValidateProperty.ERROR_HANDLER, this);
Validator validator = xv.schema.createValidator(propertyMapBuilder.toPropertyMap());
ContentHandler contentHandler = validator.getContentHandler();
if (contentHandler != null)
{
validatorContentHandlers.add(contentHandler);
}
DTDHandler dtdHandler = validator.getDTDHandler();
if (dtdHandler != null)
{
validatorDTDHandlers.add(dtdHandler);
}
}
示例5: createSchematronDriver
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
/**
* Sets up the schematron reader with all the necessary parameters. Calls
* initSchematronReader() to do further setup of the validation driver.
*
* @param phase
* The string phase name (contained in schematron file)
* @return The ValidationDriver to use in validating the XML document
*/
ValidationDriver createSchematronDriver(String phase) {
SchemaReaderLoader loader = new SchemaReaderLoader();
SchemaReader schReader = loader.createSchemaReader(SCHEMATRON_NS_URI);
this.configPropBuilder = new PropertyMapBuilder();
SchematronProperty.DIAGNOSE.add(this.configPropBuilder);
if (this.outputLogger == null) {
this.outputLogger = new PrintWriter(System.out);
}
if (null != phase && !phase.isEmpty()) {
this.configPropBuilder.put(SchematronProperty.PHASE, phase);
}
ErrorHandler eh = new ErrorHandlerImpl("Schematron", outputLogger);
this.configPropBuilder.put(ValidateProperty.ERROR_HANDLER, eh);
ValidationDriver validator = new ValidationDriver(
this.configPropBuilder.toPropertyMap(), schReader);
return validator;
}
示例6: process
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
public void process(Exchange exchange) throws Exception {
Jaxp11XMLReaderCreator xmlCreator = new Jaxp11XMLReaderCreator();
DefaultValidationErrorHandler errorHandler = new DefaultValidationErrorHandler();
PropertyMapBuilder mapBuilder = new PropertyMapBuilder();
mapBuilder.put(ValidateProperty.XML_READER_CREATOR, xmlCreator);
mapBuilder.put(ValidateProperty.ERROR_HANDLER, errorHandler);
PropertyMap propertyMap = mapBuilder.toPropertyMap();
Validator validator = getSchema().createValidator(propertyMap);
Message in = exchange.getIn();
SAXSource saxSource = in.getBody(SAXSource.class);
if (saxSource == null) {
Source source = exchange.getIn().getMandatoryBody(Source.class);
saxSource = ExchangeHelper.convertToMandatoryType(exchange, SAXSource.class, source);
}
InputSource bodyInput = saxSource.getInputSource();
// now lets parse the body using the validator
XMLReader reader = xmlCreator.createXMLReader();
reader.setContentHandler(validator.getContentHandler());
reader.setDTDHandler(validator.getDTDHandler());
reader.setErrorHandler(errorHandler);
reader.parse(bodyInput);
errorHandler.handleErrors(exchange, schema);
}
示例7: parseValidate
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
private void parseValidate(Attributes attributes) throws SAXException {
schemaUri = getSchema(attributes);
schemaUriBase = xmlBaseHandler.getBaseUri();
schemaType = getSchemaType(attributes);
if (schemaType == null)
schemaType = defaultSchemaType;
if (actions != null)
modeUsage = getModeUsage(attributes);
else
modeUsage = null;
options = new PropertyMapBuilder();
mustSupportOptions.clear();
}
示例8: SchemaReceiverImpl
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
public SchemaReceiverImpl(PropertyMap properties) {
this.attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
PropertyMapBuilder builder = new PropertyMapBuilder();
for (int i = 0; i < subSchemaProperties.length; i++) {
Object value = properties.get(subSchemaProperties[i]);
if (value != null)
builder.put(subSchemaProperties[i], value);
}
this.properties = builder.toPropertyMap();
this.autoSchemaReader = new AutoSchemaReader(properties.get(SchemaReceiverFactory.PROPERTY));
}
示例9: createChildSchema
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
Schema createChildSchema(SAXSource source, String schemaType, PropertyMap options, boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException {
SchemaReader reader = isRnc(schemaType) ? CompactSchemaReader.getInstance() : autoSchemaReader;
PropertyMapBuilder builder = new PropertyMapBuilder(properties);
if (isAttributesSchema)
builder.put(WrapProperty.ATTRIBUTE_OWNER, ValidatorImpl.OWNER_NAME);
builder.add(options);
return reader.createSchema(source, builder.toPropertyMap());
}
示例10: SchemaReceiverImpl
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
/**
* Creates a schema receiver for NVDL schemas.
*
* @param properties Properties.
*/
public SchemaReceiverImpl(PropertyMap properties) {
this.attributeOwner = properties.get(WrapProperty.ATTRIBUTE_OWNER);
PropertyMapBuilder builder = new PropertyMapBuilder();
for (int i = 0; i < subSchemaProperties.length; i++) {
Object value = properties.get(subSchemaProperties[i]);
if (value != null)
builder.put(subSchemaProperties[i], value);
}
this.properties = builder.toPropertyMap();
this.autoSchemaReader = new AutoSchemaReader(properties.get(SchemaReceiverFactory.PROPERTY));
}
示例11: instanceProperties
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
private PropertyMap instanceProperties() {
PropertyMapBuilder builder = new PropertyMapBuilder();
builder.put(ValidateProperty.ERROR_HANDLER, errorHandler);
return builder.toPropertyMap();
}
示例12: installHandlers
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
public SchemaFuture installHandlers(XMLReader xr) {
PropertyMapBuilder builder = new PropertyMapBuilder(properties);
if (attributeOwner != null)
builder.put(WrapProperty.ATTRIBUTE_OWNER, attributeOwner);
return new SchemaImpl(builder.toPropertyMap()).installHandlers(xr, this);
}
示例13: filterProperties
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
static public PropertyMap filterProperties(PropertyMap properties, PropertyId<?>[] supportedPropertyIds) {
PropertyMapBuilder builder = new PropertyMapBuilder();
for (int i = 0; i < supportedPropertyIds.length; i++)
copy(builder, supportedPropertyIds[i], properties);
return builder.toPropertyMap();
}
示例14: copy
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
static private <T> void copy(PropertyMapBuilder builder, PropertyId<T> pid, PropertyMap properties) {
T value = properties.get(pid);
if (value != null)
builder.put(pid, value);
}
示例15: createChildSchema
import com.thaiopensource.util.PropertyMapBuilder; //导入依赖的package包/类
/**
* Creates a child schema. This schema is referred in a validate action.
*
* @param source the SAXSource for the schema.
* @param schemaType the schema type.
* @param options options specified for this schema in the NVDL script.
* @param isAttributesSchema flag indicating if the schema should be modified
* to check attributes only.
* @return
* @throws IOException In case of IO problems.
* @throws IncorrectSchemaException In case of invalid schema.
* @throws SAXException In case if XML problems while creating the schema.
*/
Schema createChildSchema(SAXSource source, String schemaType, PropertyMap options, boolean isAttributesSchema) throws IOException, IncorrectSchemaException, SAXException {
SchemaReader reader = isRnc(schemaType) ? CompactSchemaReader.getInstance() : autoSchemaReader;
PropertyMapBuilder builder = new PropertyMapBuilder(properties);
if (isAttributesSchema)
builder.put(WrapProperty.ATTRIBUTE_OWNER, ValidatorImpl.OWNER_NAME);
builder.add(options);
return reader.createSchema(source, builder.toPropertyMap());
}