@SuppressWarnings("unchecked") protected void importSchema(Schema schema) { for (Iterator it = schema.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Entry) it.next(); Name key = (Name) entry.getKey(); Object value = entry.getValue(); if (typeRegistry.containsKey(key)) { LOGGER.finer( "Ignoring " + key + " as it already exists. type " + value.getClass().getName()); } else { LOGGER.finer("Importing " + key + " of type " + value.getClass().getName()); if (value instanceof AttributeType) { AttributeType type = (AttributeType) value; register(type, false); } else if (value instanceof AttributeDescriptor) { AttributeDescriptor descriptor = (AttributeDescriptor) value; register(descriptor); } } } LOGGER.fine("Schema " + schema.getURI() + " imported successfully"); }
for (Entry<Name, AttributeType> entry : profile.entrySet()) { AttributeType type = entry.getValue(); if (type.getBinding().isAssignableFrom(binding)) {
AttributeType findType(Class binding) { for (Schema schema : typeMappingProfiles) { for (Map.Entry<Name, AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { return at; } } for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { return at; } } } return null; } }
@SuppressWarnings("unchecked") private void importSchema(Schema schema) { for (Iterator it = schema.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry) it.next(); Name key = (Name) entry.getKey(); Object value = entry.getValue(); if (typeRegistry.containsKey(key)) { LOGGER.finer("Ignoring " + key + " as it already exists. type " + value.getClass().getName()); } else { LOGGER.finer("Importing " + key + " of type " + value.getClass().getName()); if (value instanceof AttributeType) { AttributeType type = (AttributeType) value; register(type, false); } else if (value instanceof AttributeDescriptor) { AttributeDescriptor descriptor = (AttributeDescriptor) value; register(descriptor); } } } LOGGER.fine("Schema " + schema.getURI() + " imported successfully"); }
@SuppressWarnings("unchecked") protected void importSchema(Schema schema) { for (Iterator it = schema.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Entry) it.next(); Name key = (Name) entry.getKey(); Object value = entry.getValue(); if (typeRegistry.containsKey(key)) { LOGGER.finer( "Ignoring " + key + " as it already exists. type " + value.getClass().getName()); } else { LOGGER.finer("Importing " + key + " of type " + value.getClass().getName()); if (value instanceof AttributeType) { AttributeType type = (AttributeType) value; register(type, false); } else if (value instanceof AttributeDescriptor) { AttributeDescriptor descriptor = (AttributeDescriptor) value; register(descriptor); } } } LOGGER.fine("Schema " + schema.getURI() + " imported successfully"); }
AttributeType findType(Class binding) { for (Schema schema : typeMappingProfiles) { for (Map.Entry<Name,AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { return at; } } for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { return at; } } } return null; } }
Name findTypeName(Class binding) { for (Iterator p = profiles.iterator(); p.hasNext(); ) { Object profile = p.next(); Name name = null; if (profile instanceof TypeMappingProfile) { name = ((TypeMappingProfile) profile).name(binding); } else if (profile instanceof Schema) { Schema schema = (Schema) profile; for (Map.Entry<Name, AttributeType> e : schema.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(binding)) { name = at.getName(); break; } } if (name == null) { for (AttributeType at : schema.values()) { if (binding.isAssignableFrom(at.getBinding())) { name = at.getName(); break; } } } } if (name != null) { return name; } } return null; }
protected Name lookupTypeName(List<Schema> profiles, Parameter arg) { // hack, look up for geometry mae if ("geometry".equals(arg.getName())) { return new NameImpl(org.geotools.gml3.v3_2.GML.AbstractGeometryType); } // default Class clazz = arg.getType(); if (clazz == null || clazz == Object.class) { return new NameImpl(XS.STRING); } // TODO: this is stolen from FeaturTypeSchemaBuilder, factor out into utility class for (Schema profile : profiles) { for (Map.Entry<Name, AttributeType> e : profile.entrySet()) { AttributeType at = e.getValue(); if (at.getBinding() != null && at.getBinding().equals(clazz)) { return at.getName(); } } for (AttributeType at : profile.values()) { if (clazz.isAssignableFrom(at.getBinding())) { return at.getName(); } } } return new NameImpl(XS.STRING); } }