Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 85835 invoked from network); 23 Jan 2010 15:46:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jan 2010 15:46:49 -0000 Received: (qmail 56329 invoked by uid 500); 23 Jan 2010 15:46:48 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 56161 invoked by uid 500); 23 Jan 2010 15:46:48 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 56152 invoked by uid 500); 23 Jan 2010 15:46:48 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 56149 invoked by uid 99); 23 Jan 2010 15:46:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Jan 2010 15:46:48 +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; Sat, 23 Jan 2010 15:46:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 799E523889D2; Sat, 23 Jan 2010 15:46:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r902427 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java Date: Sat, 23 Jan 2010 15:46:17 -0000 To: axis2-cvs@ws.apache.org From: veithen@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100123154617.799E523889D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: veithen Date: Sat Jan 23 15:46:17 2010 New Revision: 902427 URL: http://svn.apache.org/viewvc?rev=902427&view=rev Log: Usage of generic collections and Java 5 style loops in JAXWSDeployer. Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java?rev=902427&r1=902426&r2=902427&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java (original) +++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java Sat Jan 23 15:46:17 2010 @@ -88,11 +88,11 @@ URL repository = axisConfig.getRepository(); if (!file.isDirectory() || repository == null) return; - ArrayList classList = getClassesInWebInfDirectory(file); + ArrayList classList = getClassesInWebInfDirectory(file); ClassLoader threadClassLoader = null; try { threadClassLoader = Thread.currentThread().getContextClassLoader(); - ArrayList urls = new ArrayList(); + ArrayList urls = new ArrayList(); urls.add(repository); String webLocation = DeploymentEngine.getWebLocationString(); if (webLocation != null) { @@ -117,10 +117,10 @@ } } - protected ArrayList getClassesInWebInfDirectory(File file) { + protected ArrayList getClassesInWebInfDirectory(File file) { String filePath = file.getAbsolutePath(); Collection files = FileUtils.listFiles(file, new String[]{"class"}, true); - ArrayList classList = new ArrayList(); + ArrayList classList = new ArrayList(); for (Iterator iterator = files.iterator(); iterator.hasNext();) { File f = (File) iterator.next(); String fPath = f.getAbsolutePath(); @@ -141,7 +141,7 @@ URL location = deploymentFileData.getFile().toURL(); if (isJar(deploymentFileData.getFile())) { log.info("Deploying artifact : " + deploymentFileData.getAbsolutePath()); - ArrayList urls = new ArrayList(); + ArrayList urls = new ArrayList(); urls.add(deploymentFileData.getFile().toURL()); urls.add(axisConfig.getRepository()); String webLocation = DeploymentEngine.getWebLocationString(); @@ -157,7 +157,7 @@ axisConfig.isChildFirstClassLoading()); Thread.currentThread().setContextClassLoader(classLoader); - ArrayList classList = getListOfClasses(deploymentFileData); + ArrayList classList = getListOfClasses(deploymentFileData); AxisServiceGroup serviceGroup = deployClasses(groupName, location, classLoader, classList); if(serviceGroup == null) { @@ -179,23 +179,22 @@ } } - protected AxisServiceGroup deployClasses(String groupName, URL location, ClassLoader classLoader, List classList) + protected AxisServiceGroup deployClasses(String groupName, URL location, ClassLoader classLoader, List classList) throws ClassNotFoundException, InstantiationException, IllegalAccessException, AxisFault { - ArrayList axisServiceList = new ArrayList(); + ArrayList axisServiceList = new ArrayList(); // Get the hierarchical path of the service String serviceHierarchy = Utils.getServiceHierarchy(location.getPath(), this.directory); - for (int i = 0, size = classList.size(); i < size; i++) { - String className = (String) classList.get(i); - Class pojoClass; + for (String className : classList) { + Class pojoClass; try { pojoClass = Loader.loadClass(classLoader, className); } catch (Exception e){ continue; } - WebService wsAnnotation = (WebService) pojoClass.getAnnotation(WebService.class); + WebService wsAnnotation = pojoClass.getAnnotation(WebService.class); WebServiceProvider wspAnnotation = null; if (wsAnnotation == null) { - wspAnnotation = (WebServiceProvider) pojoClass.getAnnotation(WebServiceProvider.class); + wspAnnotation = pojoClass.getAnnotation(WebServiceProvider.class); } // Create an Axis Service only if the class is not an interface and it has either @@ -222,8 +221,7 @@ //creating service group by considering the hierarchical path also AxisServiceGroup serviceGroup = new AxisServiceGroup(); serviceGroup.setServiceGroupName(serviceHierarchy + groupName); - for (int i = 0; i < size; i++) { - AxisService axisService = (AxisService) axisServiceList.get(i); + for (AxisService axisService : axisServiceList) { axisService.setName(serviceHierarchy + axisService.getName()); serviceGroup.addService(axisService); } @@ -232,15 +230,15 @@ return serviceGroup; } - protected ArrayList getListOfClasses(DeploymentFileData deploymentFileData) throws IOException { - ArrayList classList; + protected ArrayList getListOfClasses(DeploymentFileData deploymentFileData) throws IOException { + ArrayList classList; FileInputStream fin = null; ZipInputStream zin = null; try { fin = new FileInputStream(deploymentFileData.getAbsolutePath()); zin = new ZipInputStream(fin); ZipEntry entry; - classList = new ArrayList(); + classList = new ArrayList(); while ((entry = zin.getNextEntry()) != null) { String name = entry.getName(); if (name.endsWith(".class")) { @@ -280,7 +278,7 @@ InstantiationException, IllegalAccessException, AxisFault { - Class pojoClass = Loader.loadClass(classLoader, className); + Class pojoClass = Loader.loadClass(classLoader, className); AxisService axisService; try { axisService = DescriptionFactory.createAxisService(pojoClass, configCtx); @@ -289,9 +287,9 @@ return null; } if (axisService != null) { - Iterator operations = axisService.getOperations(); + Iterator operations = axisService.getOperations(); while (operations.hasNext()) { - AxisOperation axisOperation = (AxisOperation) operations.next(); + AxisOperation axisOperation = operations.next(); if (axisOperation.getMessageReceiver() == null) { axisOperation.setMessageReceiver(new JAXWSMessageReceiver()); } @@ -362,10 +360,10 @@ configCtx.setProperty(org.apache.axis2.jaxws.Constants.ENDPOINT_CONTEXT_MAP, map); } - Iterator iterator = serviceGroup.getServices(); + Iterator iterator = serviceGroup.getServices(); while (iterator.hasNext()) { - AxisService axisService = (AxisService) iterator.next(); + AxisService axisService = iterator.next(); Parameter param = axisService.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER); EndpointDescription ed = (EndpointDescription) param.getValue();