Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 74486 invoked from network); 27 Nov 2008 01:03:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Nov 2008 01:03:02 -0000 Received: (qmail 37129 invoked by uid 500); 27 Nov 2008 01:03:13 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 37097 invoked by uid 500); 27 Nov 2008 01:03:13 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 37088 invoked by uid 99); 27 Nov 2008 01:03:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Nov 2008 17:03:13 -0800 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, 27 Nov 2008 01:01:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D805F2388961; Wed, 26 Nov 2008 17:02:11 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r721054 - /directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java Date: Thu, 27 Nov 2008 01:02:11 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081127010211.D805F2388961@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Wed Nov 26 17:02:11 2008 New Revision: 721054 URL: http://svn.apache.org/viewvc?rev=721054&view=rev Log: Minor refactoring (generics, for loop, spaces, etc) Modified: directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java Modified: directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java URL: http://svn.apache.org/viewvc/directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java?rev=721054&r1=721053&r2=721054&view=diff ============================================================================== --- directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java (original) +++ directory/daemon/branches/daemon-mina2/bootstrappers/src/main/java/org/apache/directory/daemon/InstallationLayout.java Wed Nov 26 17:02:11 2008 @@ -63,13 +63,13 @@ private transient URL[] extensionJars = null; - public InstallationLayout(File baseDirectory) + public InstallationLayout( File baseDirectory ) { this.baseDirectory = baseDirectory; } - public InstallationLayout(String baseDirectoryPath) + public InstallationLayout( String baseDirectoryPath ) { this.baseDirectory = new File( baseDirectoryPath ); } @@ -95,9 +95,9 @@ public File getVarDirectory() { - String varDir = System.getProperty(VAR_DIR); + String varDir = System.getProperty( VAR_DIR ); - if ( varDir != null) + if ( varDir != null ) { return new File( varDir ); } @@ -108,7 +108,7 @@ public File getLogDirectory() { - String logDir = System.getProperty(LOG_DIR); + String logDir = System.getProperty( LOG_DIR ); if ( logDir != null) { @@ -121,9 +121,9 @@ public File getRunDirectory() { - String runDir = System.getProperty(RUN_DIR); + String runDir = System.getProperty( RUN_DIR ); - if ( runDir != null) + if ( runDir != null ) { return new File( runDir ); } @@ -257,16 +257,27 @@ if ( dirs == null ) { dirs = new File[] - { this.getBaseDirectory(), this.getBinDirectory(), this.getLibDirectory(), - this.getExtensionsDirectory(), this.getConfigurationDirectory(), this.getVarDirectory(), - this.getLogDirectory(), this.getPartitionsDirectory(), this.getRunDirectory() }; + { + getBaseDirectory(), + getBinDirectory(), + getLibDirectory(), + getExtensionsDirectory(), + getConfigurationDirectory(), + getVarDirectory(), + getLogDirectory(), + getPartitionsDirectory(), + getRunDirectory() + }; } if ( files == null ) { - // only these files are requred to be present + // only these files are required to be present files = new File[] - { this.getBootstrapper(), this.getBootstrapperConfigurationFile() }; + { + getBootstrapper(), + getBootstrapperConfigurationFile() + }; } } @@ -275,40 +286,40 @@ { init(); - for ( int ii = 0; ii < dirs.length; ii++ ) + for ( File dir:dirs ) { - if ( !dirs[ii].exists() ) + if ( !dir.exists() ) { - throw new IllegalStateException( dirs[ii] + " does not exist!" ); + throw new IllegalStateException( dir + " does not exist!" ); } - if ( dirs[ii].isFile() ) + if ( dir.isFile() ) { - throw new IllegalStateException( dirs[ii] + " is a file when it should be a directory." ); + throw new IllegalStateException( dir + " is a file when it should be a directory." ); } - if ( !dirs[ii].canWrite() ) + if ( !dir.canWrite() ) { - throw new IllegalStateException( dirs[ii] + " is write protected from the current user: " + throw new IllegalStateException( dir + " is write protected from the current user: " + System.getProperty( "user.name" ) ); } } - for ( int ii = 0; ii < files.length; ii++ ) + for ( File file:files ) { - if ( !files[ii].exists() ) + if ( !file.exists() ) { - throw new IllegalStateException( files[ii] + " does not exist!" ); + throw new IllegalStateException( file + " does not exist!" ); } - if ( files[ii].isDirectory() ) + if ( file.isDirectory() ) { - throw new IllegalStateException( files[ii] + " is a directory when it should be a file." ); + throw new IllegalStateException( file + " is a directory when it should be a file." ); } - if ( !dirs[ii].canRead() ) + if ( !file.canRead() ) { - throw new IllegalStateException( files[ii] + " is not readable by the current user: " + throw new IllegalStateException( file + " is not readable by the current user: " + System.getProperty( "user.name" ) ); } }