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;
}
}
}
- catch( TransferFailedException e )
+ catch ( TransferFailedException e )
{
throw new ProxyException( e.getMessage(), e );
}
- catch( ResourceDoesNotExistException e)
+ catch ( ResourceDoesNotExistException e )
{
throw new ProxyException( e.getMessage(), e );
}
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();
}
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 ) )
int tries = 0;
boolean success = false;
- while( !success )
+ while ( !success )
{
tries++;
}
catch ( TransferFailedException e )
{
- System.out.println( "Skipping repository " + repository.getUrl() +
- ": " + e.getMessage() );
+ System.out.println( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() );
}
catch ( ResourceDoesNotExistException e )
{
}
catch ( AuthorizationException e )
{
- System.out.println( "Skipping repository " + repository.getUrl() +
- ": " + e.getMessage() );
+ System.out.println( "Skipping repository " + repository.getUrl() + ": " + e.getMessage() );
}
catch ( UnsupportedProtocolException e )
{
}
private boolean doChecksumCheck( ChecksumObserver listener, ProxyRepository repository, String path, Wagon wagon )
- //throws ChecksumFailedException
+ //throws ChecksumFailedException
{
boolean success = false;
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
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
*/
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
{
File getArtifactFile( Artifact artifact )
throws TransferFailedException, ResourceDoesNotExistException, IOException;
+
InputStream getArtifactAsStream( Artifact artifact )
throws TransferFailedException, ResourceDoesNotExistException, IOException;
}
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 )
standardPolicy, standardPolicy );
}
- public ArtifactRepository getRepositoryCache( )
+ public ArtifactRepository getRepositoryCache()
{
return repoCache;
}
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
*/
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;
List reversedPath = new ArrayList();
StringTokenizer tokenizer = new StringTokenizer( path, "/" );
- while( tokenizer.hasMoreTokens() )
+ while ( tokenizer.hasMoreTokens() )
{
reversedPath.add( 0, tokenizer.nextToken() );
}
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;