/** * This is used to get the name of the element that owns the * nodes for the specified map. This can be used to determine * which element the node map belongs to. * * @return this returns the name of the owning element */ public String getName() { return source.getName(); }
/** * This is used to get the name of the element that owns the * nodes for the specified map. This can be used to determine * which element the node map belongs to. * * @return this returns the name of the owning element */ public String getName() { return source.getName(); }
/** * This is used to get the name of the element that owns the * nodes for the specified map. This can be used to determine * which element the node map belongs to. * * @return this returns the name of the owning element */ public String getName() { return source.getName(); }
@Override protected void readElement(InputNode input, ForeignKey foreignKey, XmlReadContext context) throws Exception { String element = input.getName(); if (REFERENCE_ELEMENT.equals(element)) { readReference(input, foreignKey, context); } }
@Override protected void readElement(InputNode input, Catalog catalog, XmlReadContext context) throws Exception { String element = input.getName(); if (SCHEMA_ELEMENT.equals(element)) { catalog.addSchema(context.read(input, Schema.class)); } }
@Override protected void readElement(InputNode input, T rowSet, XmlReadContext context) throws Exception { if (COLUMN_ELEMENT.equals(input.getName())) { rowSet.addColumn(context.read(input, Column.class)); } else if (CHUNK_ELEMENT.equals(input.getName())) { rowSet.addChunk(context.read(input, Chunk.class)); } }
@Override public Collect read(InputNode node) throws Exception { List<CollectorStep> collectorSteps = Lists.newArrayList(); InputNode inputNode; while ((inputNode = node.getNext()) != null) { Map<String, String> parameters = getParameters(inputNode); String name = StringUtils.defaultString(parameters.get("name"), inputNode.getName()); CollectorStep collectorStep = new CollectorStep(inputNode.getName(), name, parameters); collectorSteps.add(collectorStep); } ValidationUtils.validateSleep(collectorSteps); return new Collect(collectorSteps); }
@Override public Collect read(InputNode node) throws Exception { List<CollectorStep> collectorSteps = Lists.newArrayList(); InputNode inputNode; while ((inputNode = node.getNext()) != null) { Map<String, String> parameters = getParameters(inputNode); String name = StringUtils.defaultString(parameters.get("name"), inputNode.getName()); CollectorStep collectorStep = new CollectorStep(inputNode.getName(), name, parameters); collectorSteps.add(collectorStep); } ValidationUtils.validateSleep(collectorSteps); return new Collect(collectorSteps); }
@Override protected void readElement(InputNode input, QueryRowSet rowSet, XmlReadContext context) throws Exception { if (QUERY_ELEMENT.equals(input.getName())) { rowSet.setQuery(context.read(input, String.class)); } else { super.readElement(input, rowSet, context); } }
@Override protected void readElement(InputNode input, T jdbcType, XmlReadContext context) throws Exception { final String element = input.getName(); if (VALUE_ELEMENT.equals(element)) { jdbcType.addValue(context.read(input, String.class, EMPTY)); } else { super.readElement(input, jdbcType, context); } }
public static Element read(InputNode node) throws Exception { QName qname = new QName(node.getReference(), node.getName(), node.getPrefix()); org.w3c.dom.Element element = SardineUtil.createElement(qname); element.setTextContent(node.getValue()); return element; }
@Override protected void readElement(InputNode input, PrimaryKey primaryKey, XmlReadContext context) throws Exception { String element = input.getName(); Table table = getParent(context); if (COLUMN_ELEMENT.equals(element)) { primaryKey.addColumn( table.getColumn(context.readAttribute(input, NAME_ATTRIBUTE, String.class)), primaryKey.getColumns().size() ); } }
@Override protected void readElement(InputNode input, Index index, XmlReadContext context) throws Exception { Table table = getParent(context); String element = input.getName(); if (COLUMN_ELEMENT.equals(element)) { index.addColumn( table.getColumn(context.readAttribute(input, NAME_ATTRIBUTE, String.class)), index.getColumns().size() ); } }
@Override protected void readElement(InputNode input, Schema schema, XmlReadContext context) throws Exception { String element = input.getName(); if (TABLE_ELEMENT.equals(element)) { schema.addTable(context.read(input, Table.class)); } else if (SEQUENCE_ELEMENT.equals(element)) { schema.addSequence(context.read(input, Sequence.class)); } else if (USER_DEFINED_TYPE_ELEMENT.equals(element)) { schema.addUserDefinedType(context.read(input, UserDefinedType.class)); } }
protected Class<? extends T> lookupType(InputNode input, Class type) { Alias alias = new Alias(input.getReference(), input.getName(), get(input, getTypeAttribute())); return aliasTypeMap.get(alias); }
@Override protected void readElement(InputNode input, Check check, XmlReadContext context) throws Exception { String element = input.getName(); if (COLUMN_ELEMENT.equals(element)) { Table table = getParent(context); check.addColumn(table.getColumn(context.readAttribute(input, NAME_ATTRIBUTE, String.class))); } else if (TEXT_ELEMENT.equals(element)) { check.setText(context.read(input, String.class)); } }
@Override protected void readElement(InputNode input, DriverInfo driverInfo, XmlReadContext context) throws Exception { final String element = input.getName(); if (NAME_ELEMENT.equals(element)) { driverInfo.setName(context.read(input, String.class)); } else if (VERSION_ELEMENT.equals(element)) { driverInfo.setVersion(context.read(input, String.class)); } else if (MAJOR_VERSION_ELEMENT.equals(element)) { driverInfo.setMajorVersion(context.read(input, int.class)); } else if (MINOR_VERSION_ELEMENT.equals(element)) { driverInfo.setMinorVersion(context.read(input, int.class)); } }
@Override protected void readElement(InputNode input, Backup backup, XmlReadContext context) throws Exception { String element = input.getName(); if (DATABASE_ELEMENT.equals(element)) { backup.setDatabase(context.read(input, Database.class)); } else if (ROW_SET.equals(element)) { backup.addRowSet(context.read(input, RowSet.class)); } else if (DATABASE_INFO_ELEMENT.equals(element)) { // old format support Database database = new Database(); database.setDatabaseInfo(context.read(input, DatabaseInfo.class)); backup.setDatabase(database); } }
/** * The <code>validate</code> method is used to validate the XML * element provided using an associated class schema. The schema * is selected using the name of the XML element to acquire * the associated converter. Once the converter has been acquired * it is delegated to and validated against it. * * @param node this is the input XML element to be validated * * @return this returns true if the node validates */ public boolean validate(InputNode node) throws Exception { String name = node.getName(); String element = path.getElement(name); Label label = elements.get(element); Converter converter = label.getConverter(context); return converter.validate(node); }
@Override protected void readElement(InputNode input, Database database, XmlReadContext context) throws Exception { final String element = input.getName(); if (DRIVER_INFO_ELEMENT.equals(element)) { database.setDriverInfo(context.read(input, DriverInfo.class)); } else if (DATABASE_INFO_ELEMENT.equals(element)) { DatabaseInfo databaseInfo = context.read(input, DatabaseInfo.class); database.setDatabaseInfo(databaseInfo); database.setDialect(createDialectResolver().resolve(databaseInfo)); } else if (CONNECTION_SPEC_ELEMENT.equals(element)) { database.setConnectionSpec(context.read(input, ConnectionSpec.class)); } else if (CATALOG_ELEMENT.equals(element)) { database.addCatalog(context.read(input, Catalog.class)); } }