list.setTruncated(false);
return list;
}
// aquire a jUDDI datastore instance
DataStore dataStore = DataStoreFactory.getDataStore();
try
{
dataStore.beginTrans();
// validate the 'name' parameters as much as possible up-front before
// calling into the data layer for relational validation.
if (name != null)
{
// names can not exceed the maximum character length specified by the
// UDDI specification (v2.0 specifies a max character length of 255). This
// value is configurable in jUDDI.
int maxNameLength = Config.getMaxNameLengthAllowed();
if (name.length() > maxNameLength)
throw new NameTooLongException(name+" (max_name="+maxNameLength+")");
}
// validate the 'qualifiers' parameter as much as possible up-front before
// calling into the data layer for relational validation.
if (qualifiers != null)
{
Vector qVector = qualifiers.getFindQualifierVector();
if ((qVector!=null) && (qVector.size() > 0))
{
for (int i=0; i<qVector.size(); i++)
{
FindQualifier qualifier = (FindQualifier)qVector.elementAt(i);
String qValue = qualifier.getValue();
if ((!qValue.equals(FindQualifier.EXACT_NAME_MATCH)) &&
(!qValue.equals(FindQualifier.CASE_SENSITIVE_MATCH)) &&
(!qValue.equals(FindQualifier.OR_ALL_KEYS)) &&
(!qValue.equals(FindQualifier.OR_LIKE_KEYS)) &&
(!qValue.equals(FindQualifier.AND_ALL_KEYS)) &&
(!qValue.equals(FindQualifier.SORT_BY_NAME_ASC)) &&
(!qValue.equals(FindQualifier.SORT_BY_NAME_DESC)) &&
(!qValue.equals(FindQualifier.SORT_BY_DATE_ASC)) &&
(!qValue.equals(FindQualifier.SORT_BY_DATE_DESC)) &&
(!qValue.equals(FindQualifier.SERVICE_SUBSET)) &&
(!qValue.equals(FindQualifier.COMBINE_CATEGORY_BAGS)))
throw new UnsupportedException("find_qualifier="+qValue);
}
}
}
Vector infoVector = null;
boolean truncatedResults = false;
// perform the search for matching technical models (return only keys in requested order)
Vector keyVector = dataStore.findTModel(name,categoryBag,identifierBag,qualifiers);
if ((keyVector != null) && (keyVector.size() > 0))
{
// if a maxRows value has been specified and it's less than
// the number of rows we are about to return then only return
// maxRows specified.
int rowCount = keyVector.size();
if ((maxRows > 0) && (maxRows < rowCount))
{
rowCount = maxRows;
truncatedResults = true;
}
// iterate through the technical model keys fetching
// each associated TModelInfo in sequence.
infoVector = new Vector(rowCount);
for (int i=0; i<rowCount; i++)
infoVector.addElement(dataStore.fetchTModelInfo((String)keyVector.elementAt(i)));
}
dataStore.commit();
// create a new TModelInfos instance and stuff
// the new Vector of TModelInfos into it.
TModelInfos infos = new TModelInfos();
infos.setTModelInfoVector(infoVector);
// create a new TModelList instance and
// stuff the new tModelInfoVector into it.
TModelList list = new TModelList();
list.setGeneric(generic);
list.setTModelInfos(infos);
list.setOperator(Config.getOperator());
list.setTruncated(truncatedResults);
return list;
}
catch(NameTooLongException ntlex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.info(ntlex.getMessage());
throw (RegistryException)ntlex;
}
catch(UnsupportedException suppex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.info(suppex.getMessage());
throw (RegistryException)suppex;
}
catch(RegistryException regex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.error(regex);
throw (RegistryException)regex;
}
catch(Exception ex)
{
try { dataStore.rollback(); } catch(Exception e) { }
log.error(ex);
throw new RegistryException(ex);
}
finally
{
if (dataStore != null)
dataStore.release();
}
}