Author: jacopoc
Date: Fri Feb 26 06:42:05 2010 New Revision: 916586 URL: http://svn.apache.org/viewvc?rev=916586&view=rev Log: Fixed formatting, no functional change. Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=916586&r1=916585&r2=916586&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Fri Feb 26 06:42:05 2010 @@ -96,108 +96,105 @@ } private Map<String, ModelService> getModelServices() { + UtilTimer utilTimer = new UtilTimer(); + Document document; + if (this.isFromURL) { + // utilTimer.timerString("Before getDocument in file " + readerURL); + document = getDocument(readerURL); - UtilTimer utilTimer = new UtilTimer(); - - Document document; + if (document == null) { + return null; + } + } else { + // utilTimer.timerString("Before getDocument in " + handler); + try { + document = handler.getDocument(); + } catch (GenericConfigException e) { + Debug.logError(e, "Error getting XML document from resource", module); + return null; + } + } - if (this.isFromURL) { - // utilTimer.timerString("Before getDocument in file " + readerURL); - document = getDocument(readerURL); + Map<String, ModelService> modelServices = FastMap.newInstance(); + if (this.isFromURL) {// utilTimer.timerString("Before getDocumentElement in file " + readerURL); + } else {// utilTimer.timerString("Before getDocumentElement in " + handler); + } - if (document == null) { - return null; - } - } else { - // utilTimer.timerString("Before getDocument in " + handler); - try { - document = handler.getDocument(); - } catch (GenericConfigException e) { - Debug.logError(e, "Error getting XML document from resource", module); - return null; - } - } + Element docElement = document.getDocumentElement(); + if (docElement == null) { + return null; + } - Map<String, ModelService> modelServices = FastMap.newInstance(); - if (this.isFromURL) {// utilTimer.timerString("Before getDocumentElement in file " + readerURL); - } else {// utilTimer.timerString("Before getDocumentElement in " + handler); - } + docElement.normalize(); - Element docElement = document.getDocumentElement(); - if (docElement == null) { - return null; - } + String resourceLocation = handler.getLocation(); + try { + resourceLocation = handler.getURL().toExternalForm(); + } catch (GenericConfigException e) { + Debug.logError(e, "Could not get resource URL", module); + } - docElement.normalize(); + int i = 0; + Node curChild = docElement.getFirstChild(); + if (curChild != null) { + if (this.isFromURL) { + utilTimer.timerString("Before start of service loop in file " + readerURL); + } else { + utilTimer.timerString("Before start of service loop in " + handler); + } - String resourceLocation = handler.getLocation(); - try { - resourceLocation = handler.getURL().toExternalForm(); - } catch (GenericConfigException e) { - Debug.logError(e, "Could not get resource URL", module); + do { + if (curChild.getNodeType() == Node.ELEMENT_NODE && "service".equals(curChild.getNodeName())) { + i++; + Element curServiceElement = (Element) curChild; + String serviceName = UtilXml.checkEmpty(curServiceElement.getAttribute("name")); + + // check to see if service with same name has already been read + if (modelServices.containsKey(serviceName)) { + Debug.logWarning("WARNING: Service " + serviceName + " is defined more than once, " + + "most recent will over-write previous definition(s)", module); } - int i = 0; - Node curChild = docElement.getFirstChild(); - if (curChild != null) { - if (this.isFromURL) { - utilTimer.timerString("Before start of service loop in file " + readerURL); - } else { - utilTimer.timerString("Before start of service loop in " + handler); - } + // utilTimer.timerString(" After serviceName -- " + i + " --"); + ModelService service = createModelService(curServiceElement, resourceLocation); - do { - if (curChild.getNodeType() == Node.ELEMENT_NODE && "service".equals(curChild.getNodeName())) { - i++; - Element curServiceElement = (Element) curChild; - String serviceName = UtilXml.checkEmpty(curServiceElement.getAttribute("name")); - - // check to see if service with same name has already been read - if (modelServices.containsKey(serviceName)) { - Debug.logWarning("WARNING: Service " + serviceName + " is defined more than once, " + - "most recent will over-write previous definition(s)", module); - } - - // utilTimer.timerString(" After serviceName -- " + i + " --"); - ModelService service = createModelService(curServiceElement, resourceLocation); - - // utilTimer.timerString(" After createModelService -- " + i + " --"); - if (service != null) { - modelServices.put(serviceName, service); - // utilTimer.timerString(" After modelServices.put -- " + i + " --"); - /* - int reqIn = service.getParameterNames(ModelService.IN_PARAM, false).size(); - int optIn = service.getParameterNames(ModelService.IN_PARAM, true).size() - reqIn; - int reqOut = service.getParameterNames(ModelService.OUT_PARAM, false).size(); - int optOut = service.getParameterNames(ModelService.OUT_PARAM, true).size() - reqOut; - - if (Debug.verboseOn()) { - String msg = "-- getModelService: # " + i + " Loaded service: " + serviceName + - " (IN) " + reqIn + "/" + optIn + " (OUT) " + reqOut + "/" + optOut; - - Debug.logVerbose(msg, module); - } - */ - } else { - Debug.logWarning( - "-- -- SERVICE ERROR:getModelService: Could not create service for serviceName: " + - serviceName, module); - } + // utilTimer.timerString(" After createModelService -- " + i + " --"); + if (service != null) { + modelServices.put(serviceName, service); + // utilTimer.timerString(" After modelServices.put -- " + i + " --"); + /* + int reqIn = service.getParameterNames(ModelService.IN_PARAM, false).size(); + int optIn = service.getParameterNames(ModelService.IN_PARAM, true).size() - reqIn; + int reqOut = service.getParameterNames(ModelService.OUT_PARAM, false).size(); + int optOut = service.getParameterNames(ModelService.OUT_PARAM, true).size() - reqOut; + + if (Debug.verboseOn()) { + String msg = "-- getModelService: # " + i + " Loaded service: " + serviceName + + " (IN) " + reqIn + "/" + optIn + " (OUT) " + reqOut + "/" + optOut; - } - } while ((curChild = curChild.getNextSibling()) != null); - } else { - Debug.logWarning("No child nodes found.", module); - } - if (this.isFromURL) { - utilTimer.timerString("Finished file " + readerURL + " - Total Services: " + i + " FINISHED"); - Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + readerURL, module); - } else { - utilTimer.timerString("Finished document in " + handler + " - Total Services: " + i + " FINISHED"); - if (Debug.importantOn()) { - Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + resourceLocation, module); + Debug.logVerbose(msg, module); } + */ + } else { + Debug.logWarning( + "-- -- SERVICE ERROR:getModelService: Could not create service for serviceName: " + + serviceName, module); } + + } + } while ((curChild = curChild.getNextSibling()) != null); + } else { + Debug.logWarning("No child nodes found.", module); + } + if (this.isFromURL) { + utilTimer.timerString("Finished file " + readerURL + " - Total Services: " + i + " FINISHED"); + Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + readerURL, module); + } else { + utilTimer.timerString("Finished document in " + handler + " - Total Services: " + i + " FINISHED"); + if (Debug.importantOn()) { + Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + resourceLocation, module); + } + } return modelServices; } |
Free forum by Nabble | Edit this page |