//grab the underlying feature type
DataAccess<? extends FeatureType, ? extends Feature> dataAccess = getDataStore(info.getStore());
// sql view handling
VirtualTable vt = null;
String vtName = null;
if(dataAccess instanceof JDBCDataStore && info.getMetadata() != null &&
(info.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE) instanceof VirtualTable)) {
JDBCDataStore jstore = (JDBCDataStore) dataAccess;
vt = info.getMetadata().get(FeatureTypeInfo.JDBC_VIRTUAL_TABLE, VirtualTable.class);
if(!cacheable) {
// use a highly random name, we don't want to actually add the
// virtual table to the store as this feature type is not cacheable,
// it is "dirty" or un-saved. The renaming below will take care
// of making the user see the actual name
final String[] typeNames = jstore.getTypeNames();
do {
vtName = UUID.randomUUID().toString();
} while (Arrays.asList(typeNames).contains(vtName));
// try adding the vt and see if that works
jstore.addVirtualTable(new VirtualTable(vtName, vt));
ft = jstore.getSchema(vtName);
} else {
vtName = vt.getName();
jstore.addVirtualTable(vt);
ft = jstore.getSchema(vt.getName());
}
} else {
ft = dataAccess.getSchema(info.getQualifiedNativeName());
}