String generic = request.getGeneric();
String businessKey = request.getBusinessKey();
Vector nameVector = request.getNameVector();
CategoryBag categoryBag = request.getCategoryBag();
TModelBag tModelBag = request.getTModelBag();
FindQualifiers qualifiers = request.getFindQualifiers();
int maxRows = request.getMaxRows();
// first make sure we need to continue with this request. If
// no arguments were passed in then we'll simply return
// an empty ServiceList (aka "a zero match result set").
if (((nameVector == null) || (nameVector.size() == 0)) &&
((categoryBag == null) || (categoryBag.size() == 0)) &&
((tModelBag == null) || (tModelBag.size() == 0)))
{
ServiceList list = new ServiceList();
list.setServiceInfos(new ServiceInfos());
list.setGeneric(generic);
list.setOperator(Config.getOperator());
list.setTruncated(false);
return list;
}
// Validate CategoryBag and (if neccessary) add TModelKey for: uddiorg:general_keywords
if (categoryBag != null)
{
Vector keyedRefVector = categoryBag.getKeyedReferenceVector();
if (keyedRefVector != null)
{
int vectorSize = keyedRefVector.size();
if (vectorSize > 0)
{
for (int i=0; i<vectorSize; i++)
{
KeyedReference keyedRef = (KeyedReference)keyedRefVector.elementAt(i);
String key = keyedRef.getTModelKey();
// A null or zero-length tModelKey is treated as
// though the tModelKey for uddiorg:general_keywords
// had been specified.
//
if ((key == null) || (key.trim().length() == 0))
keyedRef.setTModelKey(TModel.GENERAL_KEYWORDS_TMODEL_KEY);
}
}
}
}
// 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 (nameVector != null)
{
// only allowed to specify a maximum of 5 names (implementation
// dependent). This value is configurable in jUDDI.
int maxNames = Config.getMaxNameElementsAllowed();
if ((nameVector != null) && (nameVector.size() > maxNames))
throw new TooManyOptionsException("max_names= "+maxNames);
// 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();
for (int i=0; i<nameVector.size(); i++)
{
String name = ((Name)nameVector.elementAt(i)).getValue();
if (name.length() > maxNameLength)
throw new NameTooLongException(name+" (max="+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);