Return-Path: Delivered-To: apmail-ws-scout-dev-archive@www.apache.org Received: (qmail 17933 invoked from network); 23 Jul 2009 22:48:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 22:48:50 -0000 Received: (qmail 37201 invoked by uid 500); 23 Jul 2009 22:49:55 -0000 Delivered-To: apmail-ws-scout-dev-archive@ws.apache.org Received: (qmail 37158 invoked by uid 500); 23 Jul 2009 22:49:55 -0000 Mailing-List: contact scout-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: scout-dev@ws.apache.org List-Id: Delivered-To: mailing list scout-dev@ws.apache.org Received: (qmail 37150 invoked by uid 500); 23 Jul 2009 22:49:55 -0000 Delivered-To: apmail-ws-scout-cvs@ws.apache.org Received: (qmail 37147 invoked by uid 99); 23 Jul 2009 22:49:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 22:49:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 22:49:51 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8F82A23888BD; Thu, 23 Jul 2009 22:49:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r797255 - /webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java Date: Thu, 23 Jul 2009 22:49:30 -0000 To: scout-cvs@ws.apache.org From: kstam@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090723224930.8F82A23888BD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kstam Date: Thu Jul 23 22:49:30 2009 New Revision: 797255 URL: http://svn.apache.org/viewvc?rev=797255&view=rev Log: SCOUT-80 NPE and updates some nearby code and reinstates a tck-required exception removed in SCOUT-43 Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java Modified: webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java URL: http://svn.apache.org/viewvc/webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java?rev=797255&r1=797254&r2=797255&view=diff ============================================================================== --- webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java (original) +++ webservices/scout/branches/v1.1/scout/src/main/java/org/apache/ws/scout/registry/BusinessQueryManagerImpl.java Thu Jul 23 22:49:30 2009 @@ -458,26 +458,20 @@ { //We are looking for one exact match, so getting upto 3 records is fine TModelList list = registry.findTModel(namePatterns, null, null, juddiFindQualifiers, 3); - TModelInfos infos = null; - TModelInfo[] tmarr = null; - if (list != null) infos = list.getTModelInfos(); - if (infos != null) - { - List tmodelInfoList = infos.getTModelInfo(); - tmarr = new TModelInfo[tmodelInfoList.size()]; - tmodelInfoList.toArray(tmarr); - } - - - if (tmarr != null && tmarr.length > 0) - { - /*if (tmarr.length > 1) - throw new InvalidRequestException("Multiple matches found:" + tmarr.length); -*/ - TModelInfo info = tmarr[0]; - scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); - scheme.setName(new InternationalStringImpl(info.getName().getValue())); - scheme.setKey(new KeyImpl(info.getTModelKey())); + if (list != null) { + TModelInfos infos = list.getTModelInfos(); + if (infos != null) { + List tmodelInfoList = infos.getTModelInfo(); + if (tmodelInfoList.size() > 1) { + throw new InvalidRequestException("Multiple matches found:" + tmodelInfoList.size()); + } + if (tmodelInfoList.size() ==1) { + TModelInfo info = tmodelInfoList.get(0); + scheme = new ClassificationSchemeImpl(registryService.getLifeCycleManagerImpl()); + scheme.setName(new InternationalStringImpl(info.getName().getValue())); + scheme.setKey(new KeyImpl(info.getTModelKey())); + } + } } } catch (RegistryException e) @@ -561,24 +555,16 @@ ScoutJaxrUddiHelper.getCategoryBagFromClassifications(classifications), ScoutJaxrUddiHelper.getIdentifierBagFromExternalIdentifiers(externalIdentifiers), juddiFindQualifiers, 10); - TModelInfos infos = null; - TModelInfo[] tmarr = null; - if (list != null) infos = list.getTModelInfos(); - if (infos != null) - { - List tmodelInfoList = infos.getTModelInfo(); - tmarr = new TModelInfo[tmodelInfoList.size()]; - tmodelInfoList.toArray(tmarr); - } - - for (int i = 0; tmarr != null && i < tmarr.length; i++) - { - TModelInfo info = tmarr[i]; - col.add(ScoutUddiJaxrHelper.getConcept(info, this.registryService.getBusinessLifeCycleManager())); + + if (list != null && list.getTModelInfos()!=null) { + List tmodelInfoList = list.getTModelInfos().getTModelInfo(); + if (tmodelInfoList!=null) { + for (TModelInfo info: tmodelInfoList) { + col.add(ScoutUddiJaxrHelper.getConcept(info, this.registryService.getBusinessLifeCycleManager())); + } + } } - - } catch (RegistryException e) - { + } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } @@ -694,23 +680,15 @@ if (serviceList != null) { ServiceInfos serviceInfos = serviceList.getServiceInfos(); - ServiceInfo[] serviceInfoArr = null; - - if(serviceInfos != null) - { - List serviceInfoList = serviceInfos.getServiceInfo(); - serviceInfoArr = new ServiceInfo[serviceInfoList.size()]; - serviceInfoList.toArray(serviceInfoArr); - } - LinkedHashSet col = new LinkedHashSet(); - - for (int i=0; serviceInfoArr != null && i < serviceInfoArr.length; i++) { - ServiceInfo si = (ServiceInfo) serviceInfoArr[i]; - Service srv = (Service) getRegistryObject(si.getServiceKey(), LifeCycleManager.SERVICE); - col.add(srv); + + if(serviceInfos != null && serviceInfos.getServiceInfo()!=null) { + for (ServiceInfo si : serviceInfos.getServiceInfo()) { + Service srv = (Service) getRegistryObject(si.getServiceKey(), LifeCycleManager.SERVICE); + col.add(srv); + } + } - blkRes.setCollection(col); } } @@ -779,21 +757,12 @@ else if (LifeCycleManager.SERVICE.equalsIgnoreCase(objectType)) { try { - - ServiceDetail sd = registry.getServiceDetail(id); - - if (sd != null) { - - List businessServiceList = sd.getBusinessService(); - BusinessService[] businessServiceArr = new BusinessService[businessServiceList.size()]; - businessServiceList.toArray(businessServiceArr); - - if (businessServiceArr != null && businessServiceArr.length != 0) { - Service service = getServiceFromBusinessService(businessServiceArr[0], lcm); - - return service; - } + if (sd != null && sd.getBusinessService()!=null) { + for (BusinessService businessService : sd.getBusinessService()) { + Service service = getServiceFromBusinessService(businessService, lcm); + return service; + } } } catch (RegistryException e) { @@ -868,10 +837,7 @@ //Convert into a vector of strings String[] keys = new String[objectKeys.size()]; int currLoc = 0; - Iterator iter = objectKeys.iterator(); - while(iter.hasNext()) - { - Key key = (Key)iter.next(); + for (Key key : objectKeys) { keys[currLoc] = key.getId(); currLoc++; } @@ -884,12 +850,10 @@ { TModelDetail tmodeldetail = registry.getTModelDetail(keys); List tmodelList = tmodeldetail.getTModel(); - TModel[] tmarray = new TModel[tmodelList.size()]; - tmodelList.toArray(tmarray); - - for (int i = 0; tmarray != null && i < tmarray.length; i++) + + for (TModel tModel: tmodelList) { - col.add(ScoutUddiJaxrHelper.getConcept(tmarray[i], lcm)); + col.add(ScoutUddiJaxrHelper.getConcept(tModel, lcm)); } } catch (RegistryException e) @@ -905,24 +869,17 @@ try { RegisteredInfo ri = registry.getRegisteredInfo(auth.getAuthInfo()); - BusinessInfos infos = null; - BusinessInfo[] biarr = null; - - if (ri != null) infos = ri.getBusinessInfos(); - if (infos != null) - { - List bizInfoList = infos.getBusinessInfo(); - biarr = new BusinessInfo[bizInfoList.size()]; - bizInfoList.toArray(biarr); - } - - for (int i = 0; i < biarr.length; i++) { - BusinessInfo info = biarr[i]; - BusinessDetail detail = registry.getBusinessDetail(info.getBusinessKey()); - - col.add(registryService.getLifeCycleManagerImpl().createOrganization(detail)); - } - } catch (RegistryException e) { + if (ri != null) { + BusinessInfos infos = ri.getBusinessInfos(); + if (infos != null) { + List bizInfoList = infos.getBusinessInfo(); + for (BusinessInfo businessInfo: bizInfoList) { + BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey()); + col.add(registryService.getLifeCycleManagerImpl().createOrganization(detail)); + } + } + } + } catch (RegistryException e) { throw new JAXRException(e.getLocalizedMessage()); } } @@ -931,11 +888,10 @@ try { TModelDetail tmodeldetail = registry.getTModelDetail(keys); List tmodelList = tmodeldetail.getTModel(); - TModel[] tmarr = new TModel[tmodelList.size()]; - - for (int i = 0; tmarr != null && i < tmarr.length; i++) + + for (TModel tmodel: tmodelList) { - col.add(ScoutUddiJaxrHelper.getConcept(tmarr[i], lcm)); + col.add(ScoutUddiJaxrHelper.getConcept(tmodel, lcm)); } } @@ -951,12 +907,10 @@ if (serviceDetail != null) { List bizServiceList = serviceDetail.getBusinessService(); - BusinessService[] bizServiceArr = new BusinessService[bizServiceList.size()]; - bizServiceList.toArray(bizServiceArr); - for (int i=0; bizServiceArr != null && i < bizServiceArr.length; i++) { + for (BusinessService businessService: bizServiceList) { - Service service = getServiceFromBusinessService(bizServiceArr[i], lcm); + Service service = getServiceFromBusinessService(businessService, lcm); col.add(service); } @@ -979,37 +933,21 @@ { if (LifeCycleManager.ORGANIZATION.equalsIgnoreCase(id)) { IRegistry registry = registryService.getRegistry(); - ConnectionImpl con = ((RegistryServiceImpl)getRegistryService()).getConnection(); AuthToken auth = this.getAuthToken(con,registry); - - BulkResponse br = null; LinkedHashSet orgs = null; - try { RegisteredInfo ri = registry.getRegisteredInfo(auth.getAuthInfo()); - BusinessInfos infos = null; - BusinessInfo[] biarr = null; - - if (ri != null) infos = ri.getBusinessInfos(); - if (infos != null) - { - List bizInfoList = infos.getBusinessInfo(); - biarr = new BusinessInfo[bizInfoList.size()]; - bizInfoList.toArray(biarr); - } - - if (biarr != null) { - orgs = new LinkedHashSet(); + if (ri != null && ri.getBusinessInfos()!=null) { + List bizInfoList = ri.getBusinessInfos().getBusinessInfo(); + orgs = new LinkedHashSet(); + for (BusinessInfo businessInfo : bizInfoList) { + BusinessDetail detail = registry.getBusinessDetail(businessInfo.getBusinessKey()); + orgs.add(registryService.getLifeCycleManagerImpl().createOrganization(detail)); + } } - for (int i = 0; i < biarr.length; i++) { - BusinessInfo info = biarr[i]; - BusinessDetail detail = registry.getBusinessDetail(info.getBusinessKey()); - - orgs.add(registryService.getLifeCycleManagerImpl().createOrganization(detail)); - } } catch (RegistryException re) { throw new JAXRException(re); } --------------------------------------------------------------------- To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org For additional commands, e-mail: scout-dev-help@ws.apache.org