===================================================================== Found a 40 line (237 tokens) duplication in the following files: Starting at line 941 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java Starting at line 1035 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java ServiceInfo serviceInfo; BusinessService bs; YPProxy proxy; }; final State state = new State(); state.proxy = proxy; // step1 is below // step2 catches the ServiceDetail and invokes the loop state.step2 = new CallbackDelegate(callback) { public void invoke(Object result) { ServiceDetail sd = (ServiceDetail) result; state.e = sd.getBusinessServiceVector().elements(); state.step3.invoke(null); }}; // step 3 starts the loop. state.step3 = new CallbackDelegate(callback) { public void invoke(Object result) { if (result != null) { Collection sbs = (Collection) result; state.serviceInfo.setServiceBindings(sbs); serviceInfos.add(state.serviceInfo); } if (state.e.hasMoreElements()) { state.bs = (BusinessService) state.e.nextElement(); state.serviceInfo = new ServiceInfo(); state.serviceInfo.setServiceId(state.bs.getServiceKey()); state.serviceInfo.setServiceName(state.bs.getDefaultNameString()); getServiceClassifications(state.bs.getCategoryBag(), state.step4, state.proxy); } else { super.invoke(serviceInfos); }}}; // step 4 adds the SCs state.step4 = new CallbackDelegate(callback) { public void invoke(Object result) { state.serviceInfo.setServiceClassifications((Collection) result); ===================================================================== Found a 24 line (154 tokens) duplication in the following files: Starting at line 339 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/SDCommunityBasedRegistrationPlugin.java Starting at line 395 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/SDCommunityBasedRegistrationPlugin.java protected void removeRegisteredRole(final AvailabilityChangeMessage availabilityChange) { Set scaSet = scaHash.entrySet(); for (Iterator scaIterator = scaSet.iterator(); scaIterator.hasNext();) { Map.Entry entry = (Map.Entry) scaIterator.next(); final SCAInfo scaInfo = (SCAInfo) entry.getValue(); if (scaInfo.getIsRegistered() || scaInfo.getPendingRegistration()) { // Delete role Collection serviceClassifications = new ArrayList(1); ServiceClassification sca = new ServiceClassificationImpl(availabilityChange.getRole().toString(), availabilityChange.getRole().toString(), UDDIConstants.MILITARY_SERVICE_SCHEME); serviceClassifications.add(sca); RegistrationService.Callback cb = new RegistrationService.Callback() { public void invoke(Object o) { if (log.isDebugEnabled()) { log.debug(getAgentIdentifier() + ===================================================================== Found a 27 line (137 tokens) duplication in the following files: Starting at line 724 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/MatchmakerStubPlugin.java Starting at line 814 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/MatchmakerStubPlugin.java myRegistryQueryService.findServiceAndBinding((String) r.currentYPContext, r.rq, new RegistryQueryService.CallbackWithContext() { public void invoke(Object result) { r.services = (Collection) result; if (myLoggingService.isDebugEnabled()) { myLoggingService.debug(getAgentIdentifier() + " results = " + result + " for " + r.currentYPContext); } flush(); } public void handle(Exception e) { r.exception = e; if (myLoggingService.isDebugEnabled()) { myLoggingService.debug(getAgentIdentifier() + " failed during query of " + r.queryRequest + " context = " + r.currentYPContext, e); } flush(); } public void setNextContext(Object context){ if (myLoggingService.isDebugEnabled()) { myLoggingService.debug(getAgentIdentifier() + ===================================================================== Found a 22 line (124 tokens) duplication in the following files: Starting at line 485 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java Starting at line 564 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java createCategoryBag(rq.getBusinessClassifications(), state.step2, state.proxy); } else { state.step2.invoke(null); } }}; // step2: consume category bag, do FQ and providernames, launch findBusiness state.step2 = new CallbackDelegate(callback) { public void invoke(Object result) { state.bag = (CategoryBag) result; if (rq.getFindQualifiers() != null) { state.fq = new FindQualifiers(); // BUG: original version just took the first one for (Iterator it = rq.getFindQualifiers().iterator(); it.hasNext(); ) { String qualifier = (String) it.next(); state.fq.getFindQualifierVector().add(new FindQualifier(qualifier)); } } if (rq.getProviderName() != null) { ===================================================================== Found a 28 line (112 tokens) duplication in the following files: Starting at line 768 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/SDRegistrationPluginBase.java Starting at line 455 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/plugin/SimpleSDRegistrationPlugin.java private class RetryAlarm implements Alarm { private long expiresAt; private boolean expired = false; public RetryAlarm (long expirationTime) { expiresAt = expirationTime; } public long getExpirationTime() { return expiresAt; } public synchronized void expire() { if (!expired) { expired = true; getBlackboardService().signalClientActivity(); } } public boolean hasExpired() { return expired; } public synchronized boolean cancel() { boolean was = expired; expired=true; return was; } public String toString() { return ""; } } ===================================================================== Found a 22 line (110 tokens) duplication in the following files: Starting at line 555 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java Starting at line 632 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java } final State state = new State(); state.proxy = proxy; // step1 create category bag state.step1 = new CallbackDelegate(callback) { public void invoke(Object result) { if (rq.getBusinessClassifications() != null) { createCategoryBag(rq.getBusinessClassifications(), state.step2, state.proxy); } else { state.step2.invoke(null); } }}; // step2: consume category bag, do FQ and providernames, launch findBusiness state.step2 = new CallbackDelegate(callback) { public void invoke(Object result) { state.bag = (CategoryBag) result; if (rq.getFindQualifiers() != null) { ===================================================================== Found a 32 line (105 tokens) duplication in the following files: Starting at line 45 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/description/BusinessClassificationImpl.java Starting at line 39 of /usr/local/dashboard/working/servicediscovery/src/org/cougaar/servicediscovery/description/ServiceClassificationImpl.java public ServiceClassificationImpl(String code, String name, String scheme){ this.code = code; this.name = name; this.scheme = scheme; } public String getClassificationName() { return name; } public String getClassificationCode() { return code; } public String getClassificationSchemeName() { return scheme; } public void setClassificationName(String name) { this.name = name; } public void setClassificationCode(String code) { this.code = code; } public void setClassificationSchemeName(String scheme) { this.scheme = scheme; } public String toString() { String ret = "ServiceClassification(scheme: " + this.getClassificationSchemeName() + " name: " +