From fc03f60797d85a3d935eeb1bd619cbffb7e4ab4a Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Tue, 31 Jan 2006 03:44:13 +0000 Subject: [PATCH] copyright and reformat git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@373689 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/proxy/DefaultProxyManager.java | 43 +++++++++++++------ .../repository/proxy/ProxyException.java | 16 +++++++ .../maven/repository/proxy/ProxyManager.java | 19 +++++++- .../configuration/ProxyConfiguration.java | 31 ++++++++++--- .../repository/proxy/files/Checksum.java | 16 +++++++ .../files/DefaultRepositoryFileManager.java | 18 +++++++- .../proxy/repository/ProxyRepository.java | 18 +++++++- 7 files changed, 139 insertions(+), 22 deletions(-) diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java index b1a6e637c..4fe07d8a9 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java @@ -1,12 +1,28 @@ package org.apache.maven.repository.proxy; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.manager.ChecksumFailedException; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.repository.proxy.configuration.ProxyConfiguration; -import org.apache.maven.repository.proxy.files.DefaultRepositoryFileManager; import org.apache.maven.repository.proxy.files.Checksum; +import org.apache.maven.repository.proxy.files.DefaultRepositoryFileManager; import org.apache.maven.repository.proxy.repository.ProxyRepository; import org.apache.maven.wagon.ConnectionException; import org.apache.maven.wagon.ResourceDoesNotExistException; @@ -91,11 +107,11 @@ public class DefaultProxyManager } } } - catch( TransferFailedException e ) + catch ( TransferFailedException e ) { throw new ProxyException( e.getMessage(), e ); } - catch( ResourceDoesNotExistException e) + catch ( ResourceDoesNotExistException e ) { throw new ProxyException( e.getMessage(), e ); } @@ -129,7 +145,7 @@ public class DefaultProxyManager ArtifactRepository cache = config.getRepositoryCache(); File target = new File( cache.getBasedir(), path ); - for( Iterator repositories = config.getRepositories().iterator(); repositories.hasNext(); ) + for ( Iterator repositories = config.getRepositories().iterator(); repositories.hasNext(); ) { ProxyRepository repository = (ProxyRepository) repositories.next(); @@ -151,8 +167,8 @@ public class DefaultProxyManager } catch ( NoSuchAlgorithmException e ) { - System.out.println( "Skipping checksum validation for unsupported algorithm: " - + repository.getChecksum() ); + System.out.println( + "Skipping checksum validation for unsupported algorithm: " + repository.getChecksum() ); } if ( connectToRepository( wagon, repository ) ) @@ -163,7 +179,7 @@ public class DefaultProxyManager int tries = 0; boolean success = false; - while( !success ) + while ( !success ) { tries++; @@ -191,8 +207,7 @@ public class DefaultProxyManager } catch ( TransferFailedException e ) { - System.out.println( "Skipping repository " + repository.getUrl() + - ": " + e.getMessage() ); + System.out.println( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() ); } catch ( ResourceDoesNotExistException e ) { @@ -200,8 +215,7 @@ public class DefaultProxyManager } catch ( AuthorizationException e ) { - System.out.println( "Skipping repository " + repository.getUrl() + - ": " + e.getMessage() ); + System.out.println( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() ); } catch ( UnsupportedProtocolException e ) { @@ -234,7 +248,7 @@ public class DefaultProxyManager } private boolean doChecksumCheck( ChecksumObserver listener, ProxyRepository repository, String path, Wagon wagon ) - //throws ChecksumFailedException + //throws ChecksumFailedException { boolean success = false; @@ -297,7 +311,10 @@ public class DefaultProxyManager if ( expectedChecksum.equals( actualChecksum ) ) { File checksumFile = new File( destination + checksumFileExtension ); - if ( checksumFile.exists() ) checksumFile.delete(); + if ( checksumFile.exists() ) + { + checksumFile.delete(); + } FileUtils.copyFile( tempChecksumFile, checksumFile ); } else diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyException.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyException.java index 92ac871c4..cd6ecc323 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyException.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyException.java @@ -1,5 +1,21 @@ package org.apache.maven.repository.proxy; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @author Edwin Punzalan */ diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java index 3c582aa4c..c3b1d6ca1 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java @@ -1,12 +1,28 @@ package org.apache.maven.repository.proxy; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.Artifact; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; +import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.io.File; /** * @author Edwin Punzalan @@ -15,6 +31,7 @@ public interface ProxyManager { File getArtifactFile( Artifact artifact ) throws TransferFailedException, ResourceDoesNotExistException, IOException; + InputStream getArtifactAsStream( Artifact artifact ) throws TransferFailedException, ResourceDoesNotExistException, IOException; } diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java index 990e15480..be0555088 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java @@ -1,30 +1,49 @@ package org.apache.maven.repository.proxy.configuration; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.repository.proxy.repository.ProxyRepository; import java.util.ArrayList; -import java.util.List; import java.util.Collections; +import java.util.List; /** - * @plexus.component role="org.apache.maven.repository.proxy.configuration.ProxyConfiguration" - * * @author Edwin Punzalan + * @plexus.component role="org.apache.maven.repository.proxy.configuration.ProxyConfiguration" */ public class ProxyConfiguration { public static final String ROLE = ProxyConfiguration.class.getName(); - /** @plexus.requirement */ + /** + * @plexus.requirement + */ private ArtifactRepositoryFactory artifactRepositoryFactory; private boolean browsable; + private ArtifactRepository repoCache; + private ArrayList repositories = new ArrayList(); public void setBrowsable( boolean browsable ) @@ -49,7 +68,7 @@ public class ProxyConfiguration standardPolicy, standardPolicy ); } - public ArtifactRepository getRepositoryCache( ) + public ArtifactRepository getRepositoryCache() { return repoCache; } diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/Checksum.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/Checksum.java index 458848899..1b2314f8f 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/Checksum.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/Checksum.java @@ -1,5 +1,21 @@ package org.apache.maven.repository.proxy.files; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /** * @author Edwin Punzalan */ diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/DefaultRepositoryFileManager.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/DefaultRepositoryFileManager.java index f3317735c..2289286ba 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/DefaultRepositoryFileManager.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/files/DefaultRepositoryFileManager.java @@ -1,5 +1,21 @@ package org.apache.maven.repository.proxy.files; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -67,7 +83,7 @@ public class DefaultRepositoryFileManager List reversedPath = new ArrayList(); StringTokenizer tokenizer = new StringTokenizer( path, "/" ); - while( tokenizer.hasMoreTokens() ) + while ( tokenizer.hasMoreTokens() ) { reversedPath.add( 0, tokenizer.nextToken() ); } diff --git a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java index d0e833952..fcea3456c 100644 --- a/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java +++ b/maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java @@ -1,9 +1,25 @@ package org.apache.maven.repository.proxy.repository; +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import org.apache.maven.artifact.repository.DefaultArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.wagon.observers.ChecksumObserver; import org.apache.maven.repository.proxy.files.Checksum; +import org.apache.maven.wagon.observers.ChecksumObserver; import java.security.NoSuchAlgorithmException; -- 2.39.5