}
}
break;
}
} else {
StoredProcedure proc = (StoredProcedure)command;
if (StringUtil.startsWithIgnoreCase(proc.getProcedureCallableName(), CoreConstants.SYSTEM_ADMIN_MODEL)) {
final SystemAdminProcs sysProc = SystemAdminProcs.valueOf(proc.getProcedureCallableName().substring(CoreConstants.SYSTEM_ADMIN_MODEL.length() + 1).toUpperCase());
switch (sysProc) {
case SETPROPERTY:
try {
String uuid = (String)((Constant)proc.getParameter(2).getExpression()).getValue();
String key = (String)((Constant)proc.getParameter(3).getExpression()).getValue();
Clob value = (Clob)((Constant)proc.getParameter(4).getExpression()).getValue();
String strVal = null;
String result = null;
if (value != null) {
if (value.length() > MAX_VALUE_LENGTH) {
throw new TeiidProcessingException(QueryPlugin.Util.getString("DataTierManagerImpl.max_value_length", MAX_VALUE_LENGTH)); //$NON-NLS-1$
}
strVal = ObjectConverterUtil.convertToString(value.getCharacterStream());
}
AbstractMetadataRecord target = getByUuid(metadata, uuid);
if (target == null) {
throw new TeiidProcessingException(QueryPlugin.Util.getString("DataTierManagerImpl.unknown_uuid", uuid)); //$NON-NLS-1$
}
if (this.metadataRepository != null) {
this.metadataRepository.setProperty(vdbName, vdbVersion, target, key, strVal);
}
result = target.setProperty(key, strVal);
if (eventDistributor != null) {
eventDistributor.setProperty(vdbName, vdbVersion, uuid, key, strVal);
}
if (result == null) {
rows.add(Arrays.asList((Clob)null));
} else {
rows.add(Arrays.asList(new ClobType(new SerialClob(result.toCharArray()))));
}
return new CollectionTupleSource(rows.iterator());
} catch (SQLException e) {
throw new TeiidProcessingException(e);
} catch (IOException e) {
throw new TeiidProcessingException(e);
}
}
Table table = indexMetadata.getGroupID((String)((Constant)proc.getParameter(1).getExpression()).getValue());
switch (sysProc) {
case SETCOLUMNSTATS:
String columnName = (String)((Constant)proc.getParameter(2).getExpression()).getValue();
Column c = null;
for (Column col : table.getColumns()) {
if (col.getName().equalsIgnoreCase(columnName)) {
c = col;
break;
}
}
if (c == null) {
throw new TeiidProcessingException(columnName + TransformationMetadata.NOT_EXISTS_MESSAGE);
}
Integer distinctVals = (Integer)((Constant)proc.getParameter(3).getExpression()).getValue();
Integer nullVals = (Integer)((Constant)proc.getParameter(4).getExpression()).getValue();
String max = (String) ((Constant)proc.getParameter(5).getExpression()).getValue();
String min = (String) ((Constant)proc.getParameter(6).getExpression()).getValue();
ColumnStats columnStats = new ColumnStats();
columnStats.setDistinctValues(distinctVals);
columnStats.setNullValues(nullVals);
columnStats.setMaximumValue(max);
columnStats.setMinimumValue(min);
if (this.metadataRepository != null) {
this.metadataRepository.setColumnStats(vdbName, vdbVersion, c, columnStats);
}
c.setColumnStats(columnStats);
if (eventDistributor != null) {
eventDistributor.setColumnStats(vdbName, vdbVersion, table.getParent().getName(), table.getName(), columnName, columnStats);
}
break;
case SETTABLESTATS:
Constant val = (Constant)proc.getParameter(2).getExpression();
int cardinality = (Integer)val.getValue();
TableStats tableStats = new TableStats();
tableStats.setCardinality(cardinality);
if (this.metadataRepository != null) {
this.metadataRepository.setTableStats(vdbName, vdbVersion, table, tableStats);
}
table.setCardinality(cardinality);
if (eventDistributor != null) {
eventDistributor.setTableStats(vdbName, vdbVersion, table.getParent().getName(), table.getName(), tableStats);
}
break;
}
table.setLastModified(System.currentTimeMillis());
return new CollectionTupleSource(rows.iterator());
}
final SystemProcs sysTable = SystemProcs.valueOf(proc.getProcedureCallableName().substring(CoreConstants.SYSTEM_MODEL.length() + 1).toUpperCase());
switch (sysTable) {
case GETXMLSCHEMAS:
try {
Object groupID = indexMetadata.getGroupID((String)((Constant)proc.getParameter(1).getExpression()).getValue());
List<SQLXMLImpl> schemas = indexMetadata.getXMLSchemas(groupID);
for (SQLXMLImpl schema : schemas) {
rows.add(Arrays.asList(new XMLType(schema)));
}
} catch (QueryMetadataException e) {