+++ /dev/null
-<?xml version="1.0"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-web</artifactId>
- <version>1.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>archiva-webdav</artifactId>
- <name>Archiva Web :: WebDAV</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-layer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-proxy</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-security</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-webdav</artifactId>
- </dependency>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-struts2-integration</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-keys-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-rbac-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.redback</groupId>
- <artifactId>redback-users-memory</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-slf4j-logging</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- <scope>test</scope>
- <exclusions>
- <!-- This triggers httpunit to use it instead, but it doesn't work -->
- <exclusion>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- </exclusion>
- <exclusion>
- <groupId>nekohtml</groupId>
- <artifactId>xercesMinimal</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.jackrabbit.webdav.DavLocatorFactory;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.util.Text;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
-
-/**
- */
-public class ArchivaDavLocatorFactory
- implements DavLocatorFactory
-{
- public DavResourceLocator createResourceLocator( String prefix, String href )
- {
- // build prefix string and remove all prefixes from the given href.
- StringBuilder b = new StringBuilder();
- if ( prefix != null && prefix.length() > 0 )
- {
- b.append( prefix );
- if ( !prefix.endsWith( "/" ) )
- {
- b.append( '/' );
- }
- if ( href.startsWith( prefix ) )
- {
- href = href.substring( prefix.length() );
- }
- }
-
- // special treatment for root item, that has no name but '/' path.
- if ( href == null || "".equals( href ) )
- {
- href = "/";
- }
-
- final String repository = RepositoryPathUtil.getRepositoryName( href );
- return new ArchivaDavResourceLocator( b.toString(), Text.unescape( href ), repository, this );
- }
-
- public DavResourceLocator createResourceLocator( String prefix, String workspacePath, String resourcePath )
- {
- return createResourceLocator( prefix, workspacePath, resourcePath, true );
- }
-
- public DavResourceLocator createResourceLocator( String prefix, String workspacePath, String path,
- boolean isResourcePath )
- {
- final String repository = RepositoryPathUtil.getRepositoryName( path );
- return new ArchivaDavResourceLocator( prefix, path, repository, this );
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavResourceIterator;
-import org.apache.jackrabbit.webdav.DavResourceIteratorImpl;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.DavSession;
-import org.apache.jackrabbit.webdav.MultiStatusResponse;
-import org.apache.jackrabbit.webdav.io.InputContext;
-import org.apache.jackrabbit.webdav.io.OutputContext;
-import org.apache.jackrabbit.webdav.lock.ActiveLock;
-import org.apache.jackrabbit.webdav.lock.LockInfo;
-import org.apache.jackrabbit.webdav.lock.LockManager;
-import org.apache.jackrabbit.webdav.lock.Scope;
-import org.apache.jackrabbit.webdav.lock.Type;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.webdav.property.ResourceType;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.repository.audit.AuditEvent;
-import org.apache.maven.archiva.repository.audit.AuditListener;
-import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
-import org.apache.maven.archiva.security.ArchivaXworkUser;
-import org.apache.maven.archiva.webdav.util.IndexWriter;
-import org.apache.maven.archiva.webdav.util.MimeTypes;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormatter;
-import org.joda.time.format.ISODateTimeFormat;
-
-import com.opensymphony.xwork2.ActionContext;
-
-/**
- */
-public class ArchivaDavResource
- implements DavResource
-{
- public static final String HIDDEN_PATH_PREFIX = ".";
-
- private final ArchivaDavResourceLocator locator;
-
- private final DavResourceFactory factory;
-
- private final File localResource;
-
- private final String logicalResource;
-
- private DavPropertySet properties = null;
-
- private LockManager lockManager;
-
- private final DavSession session;
-
- private String remoteAddr;
-
- private final ManagedRepositoryConfiguration repository;
-
- private final RepositoryContentConsumers consumers;
-
- private final MimeTypes mimeTypes;
-
- private List<AuditListener> auditListeners;
-
- private ArchivaXworkUser archivaXworkUser;
-
- public static final String COMPLIANCE_CLASS = "1, 2";
-
- public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
- DavSession session, ArchivaDavResourceLocator locator, DavResourceFactory factory,
- MimeTypes mimeTypes, List<AuditListener> auditListeners,
- RepositoryContentConsumers consumers, ArchivaXworkUser archivaXworkUser )
- {
- this.localResource = new File( localResource );
- this.logicalResource = logicalResource;
- this.locator = locator;
- this.factory = factory;
- this.session = session;
- this.archivaXworkUser = archivaXworkUser;
-
- // TODO: push into locator as well as moving any references out of the resource factory
- this.repository = repository;
-
- // TODO: these should be pushed into the repository layer, along with the physical file operations in this class
- this.mimeTypes = mimeTypes;
- this.consumers = consumers;
- this.auditListeners = auditListeners;
- }
-
- public ArchivaDavResource( String localResource, String logicalResource, ManagedRepositoryConfiguration repository,
- String remoteAddr, DavSession session, ArchivaDavResourceLocator locator,
- DavResourceFactory factory, MimeTypes mimeTypes, List<AuditListener> auditListeners,
- RepositoryContentConsumers consumers, ArchivaXworkUser archivaXworkUser )
- {
- this( localResource, logicalResource, repository, session, locator, factory, mimeTypes, auditListeners,
- consumers, archivaXworkUser );
-
- this.remoteAddr = remoteAddr;
- }
-
- public String getComplianceClass()
- {
- return COMPLIANCE_CLASS;
- }
-
- public String getSupportedMethods()
- {
- return METHODS;
- }
-
- public boolean exists()
- {
- return localResource.exists();
- }
-
- public boolean isCollection()
- {
- return localResource.isDirectory();
- }
-
- public String getDisplayName()
- {
- String resPath = getResourcePath();
- return ( resPath != null ) ? Text.getName( resPath ) : resPath;
- }
-
- public DavResourceLocator getLocator()
- {
- return locator;
- }
-
- public File getLocalResource()
- {
- return localResource;
- }
-
- public String getResourcePath()
- {
- return locator.getResourcePath();
- }
-
- public String getHref()
- {
- return locator.getHref( isCollection() );
- }
-
- public long getModificationTime()
- {
- return localResource.lastModified();
- }
-
- public void spool( OutputContext outputContext )
- throws IOException
- {
- if ( !isCollection())
- {
- outputContext.setContentLength( localResource.length() );
- outputContext.setContentType( mimeTypes.getMimeType( localResource.getName() ) );
- }
-
- if ( !isCollection() && outputContext.hasStream() )
- {
- FileInputStream is = null;
- try
- {
- // Write content to stream
- is = new FileInputStream( localResource );
- IOUtils.copy( is, outputContext.getOutputStream() );
- }
- finally
- {
- IOUtils.closeQuietly( is );
- }
- }
- else if (outputContext.hasStream())
- {
- IndexWriter writer = new IndexWriter( this, localResource, logicalResource );
- writer.write( outputContext );
- }
- }
-
- public DavPropertyName[] getPropertyNames()
- {
- return getProperties().getPropertyNames();
- }
-
- public DavProperty getProperty( DavPropertyName name )
- {
- return getProperties().get( name );
- }
-
- public DavPropertySet getProperties()
- {
- return initProperties();
- }
-
- public void setProperty( DavProperty property )
- throws DavException
- {
- }
-
- public void removeProperty( DavPropertyName propertyName )
- throws DavException
- {
- }
-
- public MultiStatusResponse alterProperties( DavPropertySet setProperties, DavPropertyNameSet removePropertyNames )
- throws DavException
- {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public MultiStatusResponse alterProperties( List changeList )
- throws DavException
- {
- return null;
- }
-
- public DavResource getCollection()
- {
- DavResource parent = null;
- if ( getResourcePath() != null && !getResourcePath().equals( "/" ) )
- {
- String parentPath = Text.getRelativeParent( getResourcePath(), 1 );
- if ( parentPath.equals( "" ) )
- {
- parentPath = "/";
- }
- DavResourceLocator parentloc = locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
- try
- {
- parent = factory.createResource( parentloc, session );
- }
- catch ( DavException e )
- {
- // should not occur
- }
- }
- return parent;
- }
-
- public void addMember( DavResource resource, InputContext inputContext )
- throws DavException
- {
- File localFile = new File( localResource, resource.getDisplayName() );
- boolean exists = localFile.exists();
-
- if ( isCollection() && inputContext.hasStream() ) // New File
- {
- FileOutputStream stream = null;
- try
- {
- stream = new FileOutputStream( localFile );
- IOUtils.copy( inputContext.getInputStream(), stream );
- }
- catch ( IOException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
- }
- finally
- {
- IOUtils.closeQuietly( stream );
- }
-
- if ( inputContext.getContentLength() != localFile.length() )
- {
- FileUtils.deleteQuietly( localFile );
-
- throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Content Header length was " +
- inputContext.getContentLength() + " but was " + localFile.length() );
- }
-
- // Just-in-time update of the index and database by executing the consumers for this artifact
- consumers.executeConsumers( repository, localFile );
-
- triggerAuditEvent( resource, exists ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE );
- }
- else if ( !inputContext.hasStream() && isCollection() ) // New directory
- {
- localFile.mkdir();
-
- triggerAuditEvent( resource, AuditEvent.CREATE_DIR );
- }
- else
- {
- throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Could not write member " +
- resource.getResourcePath() + " at " + getResourcePath() );
- }
- }
-
- public DavResourceIterator getMembers()
- {
- List<DavResource> list = new ArrayList<DavResource>();
- if ( exists() && isCollection() )
- {
- for ( String item : localResource.list() )
- {
- try
- {
- if ( !item.startsWith( HIDDEN_PATH_PREFIX ) )
- {
- String path = locator.getResourcePath() + '/' + item;
- DavResourceLocator resourceLocator =
- locator.getFactory().createResourceLocator( locator.getPrefix(), path );
- DavResource resource = factory.createResource( resourceLocator, session );
- if ( resource != null )
- {
- list.add( resource );
- }
- }
- }
- catch ( DavException e )
- {
- // Should not occur
- }
- }
- }
- return new DavResourceIteratorImpl( list );
- }
-
- public void removeMember( DavResource member )
- throws DavException
- {
- File resource = checkDavResourceIsArchivaDavResource( member ).getLocalResource();
-
- if ( resource.exists() )
- {
- try
- {
- if ( resource.isDirectory() )
- {
- FileUtils.deleteDirectory( resource );
-
- triggerAuditEvent( member, AuditEvent.REMOVE_DIR );
- }
- else
- {
- if ( !resource.delete() )
- {
- throw new IOException( "Could not remove file" );
- }
-
- triggerAuditEvent( member, AuditEvent.REMOVE_FILE );
- }
- }
- catch ( IOException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
- }
- }
- else
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND );
- }
- }
-
- private void triggerAuditEvent( DavResource member, String event ) throws DavException
- {
- String path = logicalResource + "/" + member.getDisplayName();
-
- triggerAuditEvent( checkDavResourceIsArchivaDavResource( member ).remoteAddr, locator.getRepositoryId(), path,
- event );
- }
-
- public void move( DavResource destination )
- throws DavException
- {
- if ( !exists() )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource to copy does not exist." );
- }
-
- try
- {
- ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( destination );
- if ( isCollection() )
- {
- FileUtils.moveDirectory( getLocalResource(), resource.getLocalResource() );
-
- triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_DIRECTORY );
- }
- else
- {
- FileUtils.moveFile( getLocalResource(), resource.getLocalResource() );
-
- triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.MOVE_FILE );
- }
- }
- catch ( IOException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
- }
- }
-
- public void copy( DavResource destination, boolean shallow )
- throws DavException
- {
- if ( !exists() )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource to copy does not exist." );
- }
-
- if ( shallow && isCollection() )
- {
- throw new DavException( DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow copy for collection" );
- }
-
- try
- {
- ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( destination );
- if ( isCollection() )
- {
- FileUtils.copyDirectory( getLocalResource(), resource.getLocalResource() );
-
- triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_DIRECTORY );
- }
- else
- {
- FileUtils.copyFile( getLocalResource(), resource.getLocalResource() );
-
- triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
- }
- }
- catch ( IOException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
- }
- }
-
- public boolean isLockable( Type type, Scope scope )
- {
- return Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope);
- }
-
- public boolean hasLock( Type type, Scope scope )
- {
- return getLock(type, scope) != null;
- }
-
- public ActiveLock getLock( Type type, Scope scope )
- {
- ActiveLock lock = null;
- if (exists() && Type.WRITE.equals(type) && Scope.EXCLUSIVE.equals(scope))
- {
- lock = lockManager.getLock(type, scope, this);
- }
- return lock;
- }
-
- public ActiveLock[] getLocks()
- {
- ActiveLock writeLock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- return (writeLock != null) ? new ActiveLock[]{writeLock} : new ActiveLock[0];
- }
-
- public ActiveLock lock( LockInfo lockInfo )
- throws DavException
- {
- ActiveLock lock = null;
- if (isLockable(lockInfo.getType(), lockInfo.getScope()))
- {
- lock = lockManager.createLock(lockInfo, this);
- }
- else
- {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "Unsupported lock type or scope.");
- }
- return lock;
- }
-
- public ActiveLock refreshLock( LockInfo lockInfo, String lockToken )
- throws DavException
- {
- if (!exists()) {
- throw new DavException(DavServletResponse.SC_NOT_FOUND);
- }
- ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope());
- if (lock == null) {
- throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No lock with the given type/scope present on resource " + getResourcePath());
- }
-
- lock = lockManager.refreshLock(lockInfo, lockToken, this);
-
- return lock;
- }
-
- public void unlock( String lockToken )
- throws DavException
- {
- ActiveLock lock = getLock(Type.WRITE, Scope.EXCLUSIVE);
- if (lock == null)
- {
- throw new DavException(HttpServletResponse.SC_PRECONDITION_FAILED);
- }
- else if (lock.isLockedByToken(lockToken))
- {
- lockManager.releaseLock(lockToken, this);
- }
- else
- {
- throw new DavException(DavServletResponse.SC_LOCKED);
- }
- }
-
- public void addLockManager( LockManager lockManager )
- {
- this.lockManager = lockManager;
- }
-
- public DavResourceFactory getFactory()
- {
- return factory;
- }
-
- public DavSession getSession()
- {
- return session;
- }
-
- /**
- * Fill the set of properties
- */
- protected DavPropertySet initProperties()
- {
- if ( !exists() )
- {
- properties = new DavPropertySet();
- }
-
- if ( properties != null )
- {
- return properties;
- }
-
- DavPropertySet properties = new DavPropertySet();
-
- // set (or reset) fundamental properties
- if ( getDisplayName() != null )
- {
- properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
- }
- if ( isCollection() )
- {
- properties.add( new ResourceType( ResourceType.COLLECTION ) );
- // Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) );
- }
- else
- {
- properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) );
-
- // Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
- }
-
- // Need to get the ISO8601 date for properties
- DateTime dt = new DateTime( localResource.lastModified() );
- DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
- String modifiedDate = fmt.print( dt );
-
- properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
-
- properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );
-
- properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, localResource.length() ) );
-
- this.properties = properties;
-
- return properties;
- }
-
- private ArchivaDavResource checkDavResourceIsArchivaDavResource( DavResource resource )
- throws DavException
- {
- if ( !( resource instanceof ArchivaDavResource ) )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "DavResource is not instance of ArchivaDavResource" );
- }
- return (ArchivaDavResource) resource;
- }
-
- private void triggerAuditEvent( String remoteIP, String repositoryId, String resource, String action )
- {
- String activePrincipal = archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
- AuditEvent event = new AuditEvent( repositoryId, activePrincipal, resource, action );
- event.setRemoteIP( remoteIP );
-
- for ( AuditListener listener : auditListeners )
- {
- listener.auditEvent( event );
- }
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavServletRequest;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.DavSession;
-import org.apache.jackrabbit.webdav.lock.LockManager;
-import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
-import org.apache.maven.archiva.common.utils.PathUtil;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
-import org.apache.maven.archiva.model.ArtifactReference;
-import org.apache.maven.archiva.model.VersionedReference;
-import org.apache.maven.archiva.policies.ProxyDownloadException;
-import org.apache.maven.archiva.proxy.RepositoryProxyConnectors;
-import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.apache.maven.archiva.repository.RepositoryContentFactory;
-import org.apache.maven.archiva.repository.RepositoryException;
-import org.apache.maven.archiva.repository.RepositoryNotFoundException;
-import org.apache.maven.archiva.repository.audit.AuditEvent;
-import org.apache.maven.archiva.repository.audit.AuditListener;
-import org.apache.maven.archiva.repository.audit.Auditable;
-import org.apache.maven.archiva.repository.content.RepositoryRequest;
-import org.apache.maven.archiva.repository.layout.LayoutException;
-import org.apache.maven.archiva.repository.metadata.MetadataTools;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataMerge;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
-import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
-import org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers;
-import org.apache.maven.archiva.security.ArchivaXworkUser;
-import org.apache.maven.archiva.security.ServletAuthenticator;
-import org.apache.maven.archiva.webdav.util.MimeTypes;
-import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
-import org.apache.maven.archiva.webdav.util.WebdavMethodUtil;
-import org.apache.maven.model.DistributionManagement;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Relocation;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.digest.ChecksumFile;
-import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.digest.DigesterException;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.authorization.UnauthorizedException;
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystemConstants;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.opensymphony.xwork2.ActionContext;
-
-/**
- * @plexus.component role="org.apache.maven.archiva.webdav.ArchivaDavResourceFactory"
- */
-public class ArchivaDavResourceFactory
- implements DavResourceFactory, Auditable
-{
- private static final String PROXIED_SUFFIX = " (proxied)";
-
- private static final String HTTP_PUT_METHOD = "PUT";
-
- private Logger log = LoggerFactory.getLogger( ArchivaDavResourceFactory.class );
-
- /**
- * @plexus.requirement role="org.apache.maven.archiva.repository.audit.AuditListener"
- */
- private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
-
- /**
- * @plexus.requirement
- */
- private RepositoryContentFactory repositoryFactory;
-
- /**
- * @plexus.requirement
- */
- private RepositoryRequest repositoryRequest;
-
- /**
- * @plexus.requirement role-hint="default"
- */
- private RepositoryProxyConnectors connectors;
-
- /**
- * @plexus.requirement
- */
- private MetadataTools metadataTools;
-
- /**
- * @plexus.requirement
- */
- private MimeTypes mimeTypes;
-
- /**
- * @plexus.requirement
- */
- private ArchivaConfiguration archivaConfiguration;
-
- /**
- * @plexus.requirement
- */
- private ServletAuthenticator servletAuth;
-
- /**
- * @plexus.requirement role-hint="basic"
- */
- private HttpAuthenticator httpAuth;
-
- /**
- * Lock Manager - use simple implementation from JackRabbit
- */
- private final LockManager lockManager = new SimpleLockManager();
-
- /**
- * @plexus.requirement
- */
- private RepositoryContentConsumers consumers;
-
- /**
- * @plexus.requirement
- */
- private ChecksumFile checksum;
-
- /**
- * @plexus.requirement role-hint="sha1"
- */
- private Digester digestSha1;
-
- /**
- * @plexus.requirement role-hint="md5";
- */
- private Digester digestMd5;
-
- /**
- * @plexus.requirement
- */
- private ArchivaXworkUser archivaXworkUser;
-
- public DavResource createResource( final DavResourceLocator locator, final DavServletRequest request,
- final DavServletResponse response )
- throws DavException
- {
- checkLocatorIsInstanceOfRepositoryLocator( locator );
- ArchivaDavResourceLocator archivaLocator = (ArchivaDavResourceLocator) locator;
-
- RepositoryGroupConfiguration repoGroupConfig =
- archivaConfiguration.getConfiguration().getRepositoryGroupsAsMap().get( archivaLocator.getRepositoryId() );
- List<String> repositories = new ArrayList<String>();
-
- boolean isGet = WebdavMethodUtil.isReadMethod( request.getMethod() );
- boolean isPut = WebdavMethodUtil.isWriteMethod( request.getMethod() );
-
- if ( repoGroupConfig != null )
- {
- if( WebdavMethodUtil.isWriteMethod( request.getMethod() ) )
- {
- throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED,
- "Write method not allowed for repository groups." );
- }
- repositories.addAll( repoGroupConfig.getRepositories() );
-
- // handle browse requests for virtual repos
- if ( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ).endsWith( "/" ) )
- {
- return getResource( request, repositories, archivaLocator );
- }
- }
- else
- {
- repositories.add( archivaLocator.getRepositoryId() );
- }
-
- //MRM-419 - Windows Webdav support. Should not 404 if there is no content.
- if (StringUtils.isEmpty(archivaLocator.getRepositoryId()))
- {
- throw new DavException(HttpServletResponse.SC_NO_CONTENT);
- }
-
- List<DavResource> availableResources = new ArrayList<DavResource>();
- List<String> resourcesInAbsolutePath = new ArrayList<String>();
- DavException e = null;
-
- for ( String repositoryId : repositories )
- {
- ManagedRepositoryContent managedRepository = null;
-
- try
- {
- managedRepository = getManagedRepository( repositoryId );
- }
- catch ( DavException de )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Invalid managed repository <" +
- repositoryId + ">" );
- }
-
- DavResource resource = null;
-
- if ( !locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
- {
- if ( managedRepository != null )
- {
- try
- {
- if( isAuthorized( request, repositoryId ) )
- {
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) );
-
- if ( isGet )
- {
- resource = doGet( managedRepository, request, archivaLocator, logicalResource );
- }
-
- if ( isPut )
- {
- resource = doPut( managedRepository, request, archivaLocator, logicalResource );
- }
- }
- }
- catch ( DavException de )
- {
- e = de;
- continue;
- }
-
- if( resource == null )
- {
- e = new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource does not exist" );
- }
- else
- {
- availableResources.add( resource );
-
- String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
- resourcesInAbsolutePath.add( managedRepository.getRepoRoot() + logicalResource );
- }
- }
- else
- {
- e = new DavException( HttpServletResponse.SC_NOT_FOUND, "Repository does not exist" );
- }
- }
- }
-
- if ( availableResources.isEmpty() )
- {
- throw e;
- }
-
- String requestedResource = request.getRequestURI();
-
- // MRM-872 : merge all available metadata
- // merge metadata only when requested via the repo group
- if ( ( repositoryRequest.isMetadata( requestedResource ) || ( requestedResource.endsWith( "metadata.xml.sha1" ) || requestedResource.endsWith( "metadata.xml.md5" ) ) ) &&
- repoGroupConfig != null )
- {
- // this should only be at the project level not version level!
- if( isProjectReference( requestedResource ) )
- {
- String artifactId = StringUtils.substringBeforeLast( requestedResource.replace( '\\', '/' ), "/" );
- artifactId = StringUtils.substringAfterLast( artifactId, "/" );
-
- ArchivaDavResource res = ( ArchivaDavResource ) availableResources.get( 0 );
- String filePath = StringUtils.substringBeforeLast( res.getLocalResource().getAbsolutePath().replace( '\\', '/' ), "/" );
- filePath = filePath + "/maven-metadata-" + repoGroupConfig.getId() + ".xml";
-
- // for MRM-872 handle checksums of the merged metadata files
- if( repositoryRequest.isSupportFile( requestedResource ) )
- {
- File metadataChecksum = new File( filePath + "."
- + StringUtils.substringAfterLast( requestedResource, "." ) );
- if( metadataChecksum.exists() )
- {
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) );
-
- ArchivaDavResource metadataChecksumResource =
- new ArchivaDavResource( metadataChecksum.getAbsolutePath(), logicalResource.getPath(), null,
- request.getRemoteAddr(), request.getDavSession(), archivaLocator, this,
- mimeTypes, auditListeners, consumers, archivaXworkUser );
- availableResources.add( 0, metadataChecksumResource );
- }
- }
- else
- { // merge the metadata of all repos under group
- ArchivaRepositoryMetadata mergedMetadata = new ArchivaRepositoryMetadata();
- for ( String resourceAbsPath : resourcesInAbsolutePath )
- {
- try
- {
- File metadataFile = new File( resourceAbsPath );
- ArchivaRepositoryMetadata repoMetadata = RepositoryMetadataReader.read( metadataFile );
- mergedMetadata = RepositoryMetadataMerge.merge( mergedMetadata, repoMetadata );
- }
- catch ( RepositoryMetadataException r )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while reading metadata file." );
- }
- }
-
- try
- {
- File resourceFile = writeMergedMetadataToFile( mergedMetadata, filePath );
-
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) );
-
- ArchivaDavResource metadataResource =
- new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(), null,
- request.getRemoteAddr(), request.getDavSession(), archivaLocator, this,
- mimeTypes, auditListeners, consumers, archivaXworkUser );
- availableResources.add( 0, metadataResource );
- }
- catch ( RepositoryMetadataException r )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while writing metadata file." );
- }
- catch ( IOException ie )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while generating checksum files." );
- }
- catch ( DigesterException de )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while generating checksum files." );
- }
- }
- }
- }
-
- DavResource resource = availableResources.get( 0 );
- setHeaders(response, locator, resource );
-
- // compatibility with MRM-440 to ensure browsing the repository works ok
- if ( resource.isCollection() && !request.getRequestURI().endsWith("/" ) )
- {
- throw new BrowserRedirectException( resource.getHref() );
- }
- resource.addLockManager(lockManager);
- return resource;
- }
-
- public DavResource createResource( final DavResourceLocator locator, final DavSession davSession )
- throws DavException
- {
- checkLocatorIsInstanceOfRepositoryLocator( locator );
- ArchivaDavResourceLocator archivaLocator = (ArchivaDavResourceLocator) locator;
-
- DavResource resource = null;
- if ( !locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
- {
- ManagedRepositoryContent managedRepository = getManagedRepository( archivaLocator.getRepositoryId() );
- String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource );
- resource =
- new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource,
- managedRepository.getRepository(), davSession, archivaLocator, this, mimeTypes,
- auditListeners, consumers, archivaXworkUser );
- }
- resource.addLockManager(lockManager);
- return resource;
- }
-
- private DavResource doGet( ManagedRepositoryContent managedRepository, DavServletRequest request,
- ArchivaDavResourceLocator locator, LogicalResource logicalResource )
- throws DavException
- {
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
-
- //MRM-893, dont send back a file when user intentionally wants a directory
- if ( locator.getHref( false ).endsWith( "/" ) )
- {
- if ( ! resourceFile.isDirectory() )
- {
- //force a resource not found
- return null;
- }
- }
-
- ArchivaDavResource resource =
- new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
- managedRepository.getRepository(), request.getRemoteAddr(),
- request.getDavSession(), locator, this, mimeTypes, auditListeners, consumers, archivaXworkUser );
-
- if ( !resource.isCollection() )
- {
- boolean previouslyExisted = resourceFile.exists();
-
- // At this point the incoming request can either be in default or
- // legacy layout format.
-// boolean fromProxy = fetchContentFromProxies( managedRepository, request, logicalResource );
-
- boolean fromProxy = true;
- try
- {
- // Perform an adjustment of the resource to the managed
- // repository expected path.
- String localResourcePath =
- repositoryRequest.toNativePath( logicalResource.getPath(), managedRepository );
- resourceFile = new File( managedRepository.getRepoRoot(), localResourcePath );
- }
- catch ( LayoutException e )
- {
- if ( previouslyExisted )
- {
- return resource;
- }
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
- }
-
- // Attempt to fetch the resource from any defined proxy.
- if ( fromProxy )
- {
- String repositoryId = locator.getRepositoryId();
- String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE ) + PROXIED_SUFFIX;
- triggerAuditEvent( request.getRemoteAddr(), repositoryId, logicalResource.getPath(), event );
- }
-
- if ( !resourceFile.exists() )
- {
- resource = null;
- }
- else
- {
- resource =
- new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
- managedRepository.getRepository(), request.getRemoteAddr(),
- request.getDavSession(), locator, this, mimeTypes, auditListeners,
- consumers, archivaXworkUser );
- }
- }
- return resource;
- }
-
- private DavResource doPut( ManagedRepositoryContent managedRepository, DavServletRequest request,
- ArchivaDavResourceLocator locator, LogicalResource logicalResource )
- throws DavException
- {
- /*
- * Create parent directories that don't exist when writing a file This actually makes this implementation not
- * compliant to the WebDAV RFC - but we have enough knowledge about how the collection is being used to do this
- * reasonably and some versions of Maven's WebDAV don't correctly create the collections themselves.
- */
-
- File rootDirectory = new File( managedRepository.getRepoRoot() );
- File destDir = new File( rootDirectory, logicalResource.getPath() ).getParentFile();
-
- if ( request.getMethod().equals(HTTP_PUT_METHOD) && !destDir.exists() )
- {
- destDir.mkdirs();
- String relPath = PathUtil.getRelative( rootDirectory.getAbsolutePath(), destDir );
- triggerAuditEvent( request.getRemoteAddr(), logicalResource.getPath(), relPath, AuditEvent.CREATE_DIR );
- }
-
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
-
- return new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
- managedRepository.getRepository(), request.getRemoteAddr(),
- request.getDavSession(), locator, this, mimeTypes, auditListeners, consumers, archivaXworkUser );
- }
-
- private boolean fetchContentFromProxies( ManagedRepositoryContent managedRepository, DavServletRequest request,
- LogicalResource resource )
- throws DavException
- {
- if ( repositoryRequest.isSupportFile( resource.getPath() ) )
- {
- File proxiedFile = connectors.fetchFromProxies( managedRepository, resource.getPath() );
-
- return ( proxiedFile != null );
- }
-
- // Is it a Metadata resource?
- if ( repositoryRequest.isDefault( resource.getPath() ) && repositoryRequest.isMetadata( resource.getPath() ) )
- {
- return connectors.fetchMetatadaFromProxies(managedRepository, resource.getPath()) != null;
- }
-
- // Not any of the above? Then it's gotta be an artifact reference.
- try
- {
- // Get the artifact reference in a layout neutral way.
- ArtifactReference artifact = repositoryRequest.toArtifactReference( resource.getPath() );
-
- if ( artifact != null )
- {
- applyServerSideRelocation( managedRepository, artifact );
-
- File proxiedFile = connectors.fetchFromProxies( managedRepository, artifact );
-
- resource.setPath( managedRepository.toPath( artifact ) );
-
- return ( proxiedFile != null );
- }
- }
- catch ( LayoutException e )
- {
- /* eat it */
- }
- catch ( ProxyDownloadException e )
- {
- log.error( e.getMessage(), e );
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Unable to fetch artifact resource." );
- }
- return false;
- }
-
- /**
- * A relocation capable client will request the POM prior to the artifact, and will then read meta-data and do
- * client side relocation. A simplier client (like maven 1) will only request the artifact and not use the
- * metadatas.
- * <p>
- * For such clients, archiva does server-side relocation by reading itself the <relocation> element in
- * metadatas and serving the expected artifact.
- */
- protected void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference artifact )
- throws ProxyDownloadException
- {
- if ( "pom".equals( artifact.getType() ) )
- {
- return;
- }
-
- // Build the artifact POM reference
- ArtifactReference pomReference = new ArtifactReference();
- pomReference.setGroupId( artifact.getGroupId() );
- pomReference.setArtifactId( artifact.getArtifactId() );
- pomReference.setVersion( artifact.getVersion() );
- pomReference.setType( "pom" );
-
- // Get the artifact POM from proxied repositories if needed
- connectors.fetchFromProxies( managedRepository, pomReference );
-
- // Open and read the POM from the managed repo
- File pom = managedRepository.toFile( pomReference );
-
- if ( !pom.exists() )
- {
- return;
- }
-
- try
- {
- // MavenXpp3Reader leaves the file open, so we need to close it ourselves.
- FileReader reader = new FileReader( pom );
- Model model = null;
- try
- {
- model = new MavenXpp3Reader().read( reader );
- }
- finally
- {
- if (reader != null)
- {
- reader.close();
- }
- }
-
- DistributionManagement dist = model.getDistributionManagement();
- if ( dist != null )
- {
- Relocation relocation = dist.getRelocation();
- if ( relocation != null )
- {
- // artifact is relocated : update the repositoryPath
- if ( relocation.getGroupId() != null )
- {
- artifact.setGroupId( relocation.getGroupId() );
- }
- if ( relocation.getArtifactId() != null )
- {
- artifact.setArtifactId( relocation.getArtifactId() );
- }
- if ( relocation.getVersion() != null )
- {
- artifact.setVersion( relocation.getVersion() );
- }
- }
- }
- }
- catch ( FileNotFoundException e )
- {
- // Artifact has no POM in repo : ignore
- }
- catch ( IOException e )
- {
- // Unable to read POM : ignore.
- }
- catch ( XmlPullParserException e )
- {
- // Invalid POM : ignore
- }
- }
-
- // TODO: remove?
- private void triggerAuditEvent( String remoteIP, String repositoryId, String resource, String action )
- {
- String activePrincipal = archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
- AuditEvent event = new AuditEvent( repositoryId, activePrincipal, resource, action );
- event.setRemoteIP( remoteIP );
-
- for ( AuditListener listener : auditListeners )
- {
- listener.auditEvent( event );
- }
- }
-
- public void addAuditListener( AuditListener listener )
- {
- this.auditListeners.add( listener );
- }
-
- public void clearAuditListeners()
- {
- this.auditListeners.clear();
- }
-
- public void removeAuditListener( AuditListener listener )
- {
- this.auditListeners.remove( listener );
- }
-
- private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource )
- {
- // [MRM-503] - Metadata file need Pragma:no-cache response
- // header.
- if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) )
- {
- response.addHeader( "Pragma", "no-cache" );
- response.addHeader( "Cache-Control", "no-cache" );
- }
-
- //We need to specify this so connecting wagons can work correctly
- response.addDateHeader("last-modified", resource.getModificationTime());
-
- // TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
- }
-
- private ManagedRepositoryContent getManagedRepository( String respositoryId )
- throws DavException
- {
- if ( respositoryId != null )
- {
- try
- {
- return repositoryFactory.getManagedRepositoryContent( respositoryId );
- }
- catch ( RepositoryNotFoundException e )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
- }
- catch ( RepositoryException e )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
- }
- }
- return null;
- }
-
- private void checkLocatorIsInstanceOfRepositoryLocator( DavResourceLocator locator )
- throws DavException
- {
- if ( !( locator instanceof RepositoryLocator ) )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Locator does not implement RepositoryLocator" );
- }
- }
-
- class LogicalResource
- {
- private String path;
-
- public LogicalResource( String path )
- {
- this.path = path;
- }
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath( String path )
- {
- this.path = path;
- }
- }
-
- protected boolean isAuthorized( DavServletRequest request, String repositoryId )
- throws DavException
- {
- try
- {
- AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
- SecuritySession securitySession = httpAuth.getSecuritySession( request.getSession( true ) );
-
- return servletAuth.isAuthenticated( request, result ) &&
- servletAuth.isAuthorized( request, securitySession, repositoryId,
- WebdavMethodUtil.isWriteMethod( request.getMethod() ) );
- }
- catch ( AuthenticationException e )
- {
- boolean isPut = WebdavMethodUtil.isWriteMethod( request.getMethod() );
-
- // safety check for MRM-911
- String guest = archivaXworkUser.getGuest();
- try
- {
- if( servletAuth.isAuthorized( guest,
- ( ( ArchivaDavResourceLocator ) request.getRequestLocator() ).getRepositoryId(), isPut ) )
- {
- return true;
- }
- }
- catch ( UnauthorizedException ae )
- {
- throw new UnauthorizedDavException( repositoryId,
- "You are not authenticated and authorized to access any repository." );
- }
-
- throw new UnauthorizedDavException( repositoryId, "You are not authenticated" );
- }
- catch ( MustChangePasswordException e )
- {
- throw new UnauthorizedDavException( repositoryId, "You must change your password." );
- }
- catch ( AccountLockedException e )
- {
- throw new UnauthorizedDavException( repositoryId, "User account is locked." );
- }
- catch ( AuthorizationException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Fatal Authorization Subsystem Error." );
- }
- catch ( UnauthorizedException e )
- {
- throw new UnauthorizedDavException( repositoryId, e.getMessage() );
- }
- }
-
- private DavResource getResource( DavServletRequest request, List<String> repositories, ArchivaDavResourceLocator locator )
- throws DavException
- {
- List<File> mergedRepositoryContents = new ArrayList<File>();
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) );
-
- // flow:
- // if the current user logged in has permission to any of the repositories, allow user to
- // browse the repo group but displaying only the repositories which the user has permission to access.
- // otherwise, prompt for authentication.
-
- // put the current session in the session map which will be passed to ArchivaXworkUser
- Map<String, Object> sessionMap = new HashMap<String, Object>();
- if( request.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ) != null )
- {
- sessionMap.put( SecuritySystemConstants.SECURITY_SESSION_KEY,
- request.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ) );
- }
-
- String activePrincipal = archivaXworkUser.getActivePrincipal( sessionMap );
- boolean allow = isAllowedToContinue( request, repositories, activePrincipal );
-
- if( allow )
- {
- boolean isPut = WebdavMethodUtil.isWriteMethod( request.getMethod() );
-
- for( String repository : repositories )
- {
- // for prompted authentication
- if( httpAuth.getSecuritySession( request.getSession( true ) ) != null )
- {
- try
- {
- if( isAuthorized( request, repository ) )
- {
- getResource( locator, mergedRepositoryContents, logicalResource, repository );
- }
- }
- catch ( DavException e )
- {
- continue;
- }
- }
- else
- {
- // for the current user logged in
- try
- {
- if( servletAuth.isAuthorized( activePrincipal, repository, isPut ) )
- {
- getResource( locator, mergedRepositoryContents, logicalResource, repository );
- }
- }
- catch ( UnauthorizedException e )
- {
- continue;
- }
- }
- }
- }
- else
- {
- throw new UnauthorizedDavException( locator.getRepositoryId(), "User not authorized." );
- }
-
- ArchivaVirtualDavResource resource =
- new ArchivaVirtualDavResource( mergedRepositoryContents, logicalResource.getPath(), mimeTypes, locator, this );
-
- // compatibility with MRM-440 to ensure browsing the repository group works ok
- if ( resource.isCollection() && !request.getRequestURI().endsWith("/" ) )
- {
- throw new BrowserRedirectException( resource.getHref() );
- }
-
- return resource;
- }
-
- private void getResource( ArchivaDavResourceLocator locator, List<File> mergedRepositoryContents,
- LogicalResource logicalResource, String repository )
- throws DavException
- {
- ManagedRepositoryContent managedRepository = null;
-
- try
- {
- managedRepository = getManagedRepository( repository );
- }
- catch ( DavException de )
- {
- throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Invalid managed repository <" +
- repository + ">" );
- }
-
- if ( !locator.getResourcePath().startsWith( ArchivaVirtualDavResource.HIDDEN_PATH_PREFIX ) )
- {
- if( managedRepository != null )
- {
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
- if( resourceFile.exists() )
- {
- mergedRepositoryContents.add( resourceFile );
- }
- }
- }
- }
-
- /**
- * Check if the current user is authorized to access any of the repos
- *
- * @param request
- * @param repositories
- * @param activePrincipal
- * @return
- */
- private boolean isAllowedToContinue( DavServletRequest request, List<String> repositories, String activePrincipal )
- {
- boolean allow = false;
-
-
- // if securitySession != null, it means that the user was prompted for authentication
- if( httpAuth.getSecuritySession( request.getSession() ) != null )
- {
- for( String repository : repositories )
- {
- try
- {
- if( isAuthorized( request, repository ) )
- {
- allow = true;
- break;
- }
- }
- catch( DavException e )
- {
- continue;
- }
- }
- }
- else
- {
- boolean isPut = WebdavMethodUtil.isWriteMethod( request.getMethod() );
- for( String repository : repositories )
- {
- try
- {
- if( servletAuth.isAuthorized( activePrincipal, repository, isPut ) )
- {
- allow = true;
- break;
- }
- }
- catch ( UnauthorizedException e )
- {
- continue;
- }
- }
- }
-
- return allow;
- }
-
- private File writeMergedMetadataToFile( ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
- throws RepositoryMetadataException, DigesterException, IOException
- {
- File outputFile = new File( outputFilename );
- if( outputFile.exists() )
- {
- FileUtils.deleteQuietly( outputFile );
- }
-
- outputFile.getParentFile().mkdirs();
- RepositoryMetadataWriter.write( mergedMetadata, outputFile );
-
- createChecksumFile( outputFilename, digestSha1 );
- createChecksumFile( outputFilename, digestMd5 );
-
- return outputFile;
- }
-
- private void createChecksumFile( String path, Digester digester )
- throws DigesterException, IOException
- {
- File checksumFile = new File( path + digester.getFilenameExtension() );
- if ( !checksumFile.exists() )
- {
- FileUtils.deleteQuietly( checksumFile );
- checksum.createChecksum( new File( path ), digester );
- }
- else if ( !checksumFile.isFile() )
- {
- log.error( "Checksum file is not a file." );
- }
- }
-
- private boolean isProjectReference( String requestedResource )
- {
- try
- {
- VersionedReference versionRef = metadataTools.toVersionedReference( requestedResource );
- return false;
- }
- catch ( RepositoryMetadataException re )
- {
- return true;
- }
- }
-
- public void setServletAuth( ServletAuthenticator servletAuth )
- {
- this.servletAuth = servletAuth;
- }
-
- public void setHttpAuth( HttpAuthenticator httpAuth )
- {
- this.httpAuth = httpAuth;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavLocatorFactory;
-import org.apache.jackrabbit.util.Text;
-
-/**
- */
-public class ArchivaDavResourceLocator
- implements DavResourceLocator, RepositoryLocator
-{
- private final String prefix;
-
- private final String resourcePath;
-
- private final String href;
-
- private final String repositoryId;
-
- private final DavLocatorFactory davLocatorFactory;
-
- public ArchivaDavResourceLocator( String prefix, String resourcePath, String repositoryId,
- DavLocatorFactory davLocatorFactory )
- {
- this.prefix = prefix;
- this.repositoryId = repositoryId;
- this.davLocatorFactory = davLocatorFactory;
-
- String path = resourcePath;
-
- if (!resourcePath.startsWith("/"))
- {
- path = "/" + resourcePath;
- }
-
- String escapedPath = Text.escapePath( resourcePath );
- String hrefPrefix = prefix;
-
- // Ensure no extra slashes when href is joined
- if ( hrefPrefix.endsWith( "/" ) && escapedPath.startsWith( "/" ) )
- {
- hrefPrefix = hrefPrefix.substring( 0, hrefPrefix.length() - 1 );
- }
-
- href = hrefPrefix + escapedPath;
-
- //Remove trailing slashes otherwise Text.getRelativeParent fails
- if (resourcePath.endsWith("/") && resourcePath.length() > 1)
- {
- path = resourcePath.substring( 0, resourcePath.length() - 1 );
- }
-
- this.resourcePath = path;
- }
-
- public String getRepositoryId()
- {
- return repositoryId;
- }
-
- public String getPrefix()
- {
- return prefix;
- }
-
- public String getResourcePath()
- {
- return resourcePath;
- }
-
- public String getWorkspacePath()
- {
- return "";
- }
-
- public String getWorkspaceName()
- {
- return "";
- }
-
- public boolean isSameWorkspace( DavResourceLocator locator )
- {
- return isSameWorkspace( locator.getWorkspaceName() );
- }
-
- public boolean isSameWorkspace( String workspaceName )
- {
- return getWorkspaceName().equals( workspaceName );
- }
-
- public String getHref( boolean isCollection )
- {
- // avoid doubled trailing '/' for the root item
- String suffix = ( isCollection && !isRootLocation() && !href.endsWith("/") ) ? "/" : "";
- return href + suffix;
- }
-
- public boolean isRootLocation()
- {
- return "/".equals( resourcePath );
- }
-
- public DavLocatorFactory getFactory()
- {
- return davLocatorFactory;
- }
-
- public String getRepositoryPath()
- {
- return getResourcePath();
- }
-
- /**
- * Computes the hash code from the href, which is built using the final fields prefix and resourcePath.
- *
- * @return the hash code
- */
- public int hashCode()
- {
- return href.hashCode();
- }
-
- /**
- * Equality of path is achieved if the specified object is a <code>DavResourceLocator</code> object with the same
- * hash code.
- *
- * @param obj the object to compare to
- * @return <code>true</code> if the 2 objects are equal; <code>false</code> otherwise
- */
- public boolean equals( Object obj )
- {
- if ( obj instanceof DavResourceLocator )
- {
- DavResourceLocator other = (DavResourceLocator) obj;
- return hashCode() == other.hashCode();
- }
- return false;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 java.util.HashSet;
-import org.apache.jackrabbit.webdav.DavSession;
-
-public class ArchivaDavSession implements DavSession
-{
- private final HashSet lockTokens = new HashSet();
-
- public void addLockToken(String token)
- {
- lockTokens.add(token);
- }
-
- public String[] getLockTokens()
- {
- return (String[]) lockTokens.toArray(new String[lockTokens.size()]);
- }
-
- public void removeLockToken(String token)
- {
- lockTokens.remove(token);
- }
-
- public void removeReference(Object reference)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- public void addReference(Object reference)
- {
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavServletRequest;
-import org.apache.jackrabbit.webdav.DavSessionProvider;
-import org.apache.jackrabbit.webdav.WebdavRequest;
-import org.apache.maven.archiva.security.ArchivaXworkUser;
-import org.apache.maven.archiva.security.ServletAuthenticator;
-import org.apache.maven.archiva.webdav.util.RepositoryPathUtil;
-import org.apache.maven.archiva.webdav.util.WebdavMethodUtil;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authorization.UnauthorizedException;
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- */
-public class ArchivaDavSessionProvider
- implements DavSessionProvider
-{
- private Logger log = LoggerFactory.getLogger( ArchivaDavSessionProvider.class );
-
- private ServletAuthenticator servletAuth;
-
- private HttpAuthenticator httpAuth;
-
- private ArchivaXworkUser archivaXworkUser;
-
- public ArchivaDavSessionProvider( ServletAuthenticator servletAuth, HttpAuthenticator httpAuth, ArchivaXworkUser archivaXworkUser )
- {
- this.servletAuth = servletAuth;
- this.httpAuth = httpAuth;
- this.archivaXworkUser = archivaXworkUser;
- }
-
- public boolean attachSession( WebdavRequest request )
- throws DavException
- {
- final String repositoryId = RepositoryPathUtil.getRepositoryName( removeContextPath( request ) );
-
- try
- {
- AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
-
- //Create a dav session
- request.setDavSession(new ArchivaDavSession());
-
- return servletAuth.isAuthenticated( request, result );
- }
- catch ( AuthenticationException e )
- {
- boolean isPut = WebdavMethodUtil.isWriteMethod( request.getMethod() );
-
- // safety check for MRM-911
- String guest = archivaXworkUser.getGuest();
- try
- {
- if( servletAuth.isAuthorized( guest,
- ( ( ArchivaDavResourceLocator ) request.getRequestLocator() ).getRepositoryId(), isPut ) )
- {
- request.setDavSession(new ArchivaDavSession());
- return true;
- }
- }
- catch ( UnauthorizedException ae )
- {
- throw new UnauthorizedDavException( repositoryId,
- "You are not authenticated and authorized to access any repository." );
- }
-
- throw new UnauthorizedDavException( repositoryId, "You are not authenticated." );
- }
- catch ( MustChangePasswordException e )
- {
- throw new UnauthorizedDavException( repositoryId, "You must change your password." );
- }
- catch ( AccountLockedException e )
- {
- throw new UnauthorizedDavException( repositoryId, "User account is locked." );
- }
- }
-
- public void releaseSession( WebdavRequest request )
- {
- request.setDavSession(null);
- }
-
- private String removeContextPath( final DavServletRequest request )
- {
- String path = request.getRequestURI();
- String ctx = request.getContextPath();
- if ( path.startsWith( ctx ) )
- {
- path = path.substring( ctx.length() );
- }
- return path;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.jackrabbit.util.Text;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavResourceIterator;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-import org.apache.jackrabbit.webdav.DavSession;
-import org.apache.jackrabbit.webdav.MultiStatusResponse;
-import org.apache.jackrabbit.webdav.io.InputContext;
-import org.apache.jackrabbit.webdav.io.OutputContext;
-import org.apache.jackrabbit.webdav.lock.ActiveLock;
-import org.apache.jackrabbit.webdav.lock.LockInfo;
-import org.apache.jackrabbit.webdav.lock.LockManager;
-import org.apache.jackrabbit.webdav.lock.Scope;
-import org.apache.jackrabbit.webdav.lock.Type;
-import org.apache.jackrabbit.webdav.property.DavProperty;
-import org.apache.jackrabbit.webdav.property.DavPropertyName;
-import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
-import org.apache.jackrabbit.webdav.property.DavPropertySet;
-import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
-import org.apache.jackrabbit.webdav.property.ResourceType;
-import org.apache.maven.archiva.webdav.util.IndexWriter;
-import org.apache.maven.archiva.webdav.util.MimeTypes;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormatter;
-import org.joda.time.format.ISODateTimeFormat;
-
-/**
- * DavResource for virtual repositories
- *
- */
-public class ArchivaVirtualDavResource
- implements DavResource
-{
- public static final String HIDDEN_PATH_PREFIX = ".";
-
- private static final String COMPLIANCE_CLASS = "1";
-
- private MimeTypes mimeTypes;
-
- private ArchivaDavResourceLocator locator;
-
- private DavResourceFactory factory;
-
- private String logicalResource;
-
- private DavPropertySet properties;
-
- private boolean propsInitialized = false;
-
- private static final String METHODS = "OPTIONS, GET, HEAD, POST, TRACE, PROPFIND, PROPPATCH, MKCOL";
-
- private final List<File> localResources;
-
- public ArchivaVirtualDavResource( List<File> localResources, String logicalResource, MimeTypes mimeTypes,
- ArchivaDavResourceLocator locator, DavResourceFactory factory )
- {
- this.localResources = localResources;
- this.logicalResource = logicalResource;
- this.mimeTypes = mimeTypes;
- this.locator = locator;
- this.factory = factory;
- this.properties = new DavPropertySet();
- }
-
- public void spool( OutputContext outputContext )
- throws IOException
- {
- if (outputContext.hasStream())
- {
- Collections.sort( localResources );
- List<File> localResourceFiles = new ArrayList<File>();
-
- for ( File resourceFile : localResources )
- {
- if ( resourceFile.exists() )
- {
- localResourceFiles.add( resourceFile );
- }
- }
-
- IndexWriter writer = new IndexWriter( this, localResourceFiles, logicalResource );
- writer.write( outputContext );
- }
- }
-
- public void addLockManager( LockManager arg0 )
- {
-
- }
-
- public void addMember( DavResource arg0, InputContext arg1 )
- throws DavException
- {
-
- }
-
- public MultiStatusResponse alterProperties( List arg0 )
- throws DavException
- {
- return null;
- }
-
- public MultiStatusResponse alterProperties( DavPropertySet arg0, DavPropertyNameSet arg1 )
- throws DavException
- {
- return null;
- }
-
- public void copy( DavResource arg0, boolean arg1 )
- throws DavException
- {
-
- }
-
- public boolean exists()
- {
- // localResources are already filtered (all files in the list are already existing)
- return true;
- }
-
- public ActiveLock getLock( Type arg0, Scope arg1 )
- {
- return null;
- }
-
- public ActiveLock[] getLocks()
- {
- return null;
- }
-
- public DavResourceIterator getMembers()
- {
- return null;
- }
-
- public String getSupportedMethods()
- {
- return METHODS;
- }
-
- public long getModificationTime()
- {
- return 0;
- }
-
- public boolean hasLock( Type arg0, Scope arg1 )
- {
- return false;
- }
-
- public boolean isCollection()
- {
- return true;
- }
-
- public boolean isLockable( Type arg0, Scope arg1 )
- {
- return false;
- }
-
- public ActiveLock lock( LockInfo arg0 )
- throws DavException
- {
- return null;
- }
-
- public void move( DavResource arg0 )
- throws DavException
- {
-
- }
-
- public ActiveLock refreshLock( LockInfo arg0, String arg1 )
- throws DavException
- {
- return null;
- }
-
- public void removeMember( DavResource arg0 )
- throws DavException
- {
-
- }
-
- public void unlock( String arg0 )
- throws DavException
- {
-
- }
-
- public String getComplianceClass()
- {
- return COMPLIANCE_CLASS;
- }
-
- public DavResourceLocator getLocator()
- {
- return locator;
- }
-
- public String getResourcePath()
- {
- return locator.getResourcePath();
- }
-
- public String getHref()
- {
- return locator.getHref( isCollection() );
- }
-
- public DavResourceFactory getFactory()
- {
- return factory;
- }
-
- public String getDisplayName()
- {
- String resPath = getResourcePath();
-
- return ( resPath != null ) ? Text.getName( resPath ) : resPath;
- }
-
- public DavSession getSession()
- {
- return null;
- }
-
- public DavPropertyName[] getPropertyNames()
- {
- return getProperties().getPropertyNames();
- }
-
- public DavProperty getProperty( DavPropertyName name )
- {
- initProperties();
- return properties.get( name );
- }
-
- public DavPropertySet getProperties()
- {
- initProperties();
- return properties;
- }
-
- public void setProperty( DavProperty property )
- throws DavException
- {
- }
-
- public void removeProperty( DavPropertyName propertyName )
- throws DavException
- {
- }
-
- public DavResource getCollection()
- {
- DavResource parent = null;
- if ( getResourcePath() != null && !getResourcePath().equals( "/" ) )
- {
- String parentPath = Text.getRelativeParent( getResourcePath(), 1 );
- if ( parentPath.equals( "" ) )
- {
- parentPath = "/";
- }
- DavResourceLocator parentloc = locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
- try
- {
- // go back to ArchivaDavResourceFactory!
- parent = factory.createResource( parentloc, null );
- }
- catch ( DavException e )
- {
- // should not occur
- }
- }
- return parent;
- }
-
- /**
- * Fill the set of properties
- */
- protected void initProperties()
- {
- if ( !exists() || propsInitialized )
- {
- return;
- }
-
- // set (or reset) fundamental properties
- if ( getDisplayName() != null )
- {
- properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
- }
- if ( isCollection() )
- {
- properties.add( new ResourceType( ResourceType.COLLECTION ) );
- // Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) );
- }
- else
- {
- properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) );
-
- // Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
- }
-
- // Need to get the ISO8601 date for properties
- DateTime dt = new DateTime( 0 );
- DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
- String modifiedDate = fmt.print( dt );
-
- properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
-
- properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );
-
- properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, 0 ) );
-
- propsInitialized = true;
- }
-
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.jackrabbit.webdav.DavException;
-
-import javax.servlet.http.HttpServletResponse;
-
-/**
- */
-public class BrowserRedirectException extends DavException
-{
- final String location;
-
- public BrowserRedirectException(String location)
- {
- super(HttpServletResponse.SC_MOVED_PERMANENTLY);
- this.location = location;
- }
-
- public String getLocation()
- {
- return location;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-/**
- */
-public class LogicalResource
-{
- private String path;
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath(String path)
- {
- this.path = path;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-/**
- */
-public interface RepositoryLocator
-{
- String getRepositoryId();
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavLocatorFactory;
-import org.apache.jackrabbit.webdav.DavMethods;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.DavResourceFactory;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-import org.apache.jackrabbit.webdav.DavSessionProvider;
-import org.apache.jackrabbit.webdav.WebdavRequest;
-import org.apache.jackrabbit.webdav.WebdavRequestImpl;
-import org.apache.jackrabbit.webdav.WebdavResponse;
-import org.apache.jackrabbit.webdav.WebdavResponseImpl;
-import org.apache.jackrabbit.webdav.server.AbstractWebdavServlet;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ConfigurationEvent;
-import org.apache.maven.archiva.configuration.ConfigurationListener;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.security.ArchivaXworkUser;
-import org.apache.maven.archiva.security.ServletAuthenticator;
-import org.codehaus.plexus.spring.PlexusToSpringUtils;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-/**
- * RepositoryServlet
- *
- * @version $Id$
- */
-public class RepositoryServlet
- extends AbstractWebdavServlet
- implements ConfigurationListener
-{
- private Logger log = LoggerFactory.getLogger( RepositoryServlet.class );
-
- private ArchivaConfiguration configuration;
-
- private Map<String, ManagedRepositoryConfiguration> repositoryMap;
-
- private DavLocatorFactory locatorFactory;
-
- private DavResourceFactory resourceFactory;
-
- private DavSessionProvider sessionProvider;
-
- private final Object reloadLock = new Object();
-
- public void init( javax.servlet.ServletConfig servletConfig )
- throws ServletException
- {
- super.init( servletConfig );
- initServers( servletConfig );
- }
-
- /**
- * Service the given request. This method has been overridden and copy/pasted to allow better exception handling and
- * to support different realms
- *
- * @param request
- * @param response
- * @throws ServletException
- * @throws java.io.IOException
- */
- @Override
- protected void service( HttpServletRequest request, HttpServletResponse response )
- throws ServletException, IOException
- {
- WebdavRequest webdavRequest = new WebdavRequestImpl( request, getLocatorFactory() );
- // DeltaV requires 'Cache-Control' header for all methods except 'VERSION-CONTROL' and 'REPORT'.
- int methodCode = DavMethods.getMethodCode( request.getMethod() );
- boolean noCache =
- DavMethods.isDeltaVMethod( webdavRequest ) &&
- !( DavMethods.DAV_VERSION_CONTROL == methodCode || DavMethods.DAV_REPORT == methodCode );
- WebdavResponse webdavResponse = new WebdavResponseImpl( response, noCache );
- DavResource resource = null;
-
- try
- {
- // make sure there is a authenticated user
- if ( !getDavSessionProvider().attachSession( webdavRequest ) )
- {
- return;
- }
-
- // check matching if=header for lock-token relevant operations
- resource =
- getResourceFactory().createResource( webdavRequest.getRequestLocator(), webdavRequest, webdavResponse );
-
- if ( !isPreconditionValid( webdavRequest, resource ) )
- {
- webdavResponse.sendError( DavServletResponse.SC_PRECONDITION_FAILED );
- return;
- }
- if ( !execute( webdavRequest, webdavResponse, methodCode, resource ) )
- {
- super.service( request, response );
- }
-
- }
- catch ( UnauthorizedDavException e )
- {
- webdavResponse.setHeader( "WWW-Authenticate", getAuthenticateHeaderValue( e.getRepositoryName() ) );
- webdavResponse.sendError( e.getErrorCode(), e.getStatusPhrase() );
- }
- catch ( BrowserRedirectException e )
- {
- response.sendRedirect( e.getLocation() );
- }
- catch ( DavException e )
- {
- if ( e.getErrorCode() == HttpServletResponse.SC_UNAUTHORIZED )
- {
- final String msg = "Should throw " + UnauthorizedDavException.class.getName();
- log.error( msg );
- webdavResponse.sendError( e.getErrorCode(), msg );
- }
- else if ( e.getCause() != null )
- {
- webdavResponse.sendError( e.getErrorCode(), e.getCause().getMessage() );
- }
- else
- {
- webdavResponse.sendError( e.getErrorCode(), e.getMessage() );
- }
- }
- finally
- {
- getDavSessionProvider().releaseSession( webdavRequest );
- }
- }
-
- public synchronized void initServers( ServletConfig servletConfig )
- {
- WebApplicationContext wac =
- WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );
-
- configuration =
- (ArchivaConfiguration) wac.getBean( PlexusToSpringUtils.buildSpringId( ArchivaConfiguration.class.getName() ) );
- configuration.addListener( this );
-
- repositoryMap = configuration.getConfiguration().getManagedRepositoriesAsMap();
-
- for ( ManagedRepositoryConfiguration repo : repositoryMap.values() )
- {
- File repoDir = new File( repo.getLocation() );
-
- if ( !repoDir.exists() )
- {
- if ( !repoDir.mkdirs() )
- {
- // Skip invalid directories.
- log( "Unable to create missing directory for " + repo.getLocation() );
- continue;
- }
- }
- }
-
- resourceFactory =
- (DavResourceFactory) wac.getBean( PlexusToSpringUtils.buildSpringId( ArchivaDavResourceFactory.class ) );
- locatorFactory = new ArchivaDavLocatorFactory();
-
- ServletAuthenticator servletAuth =
- (ServletAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( ServletAuthenticator.class.getName() ) );
- HttpAuthenticator httpAuth =
- (HttpAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE, "basic" ) );
-
- ArchivaXworkUser archivaXworkUser =
- (ArchivaXworkUser) wac.getBean( PlexusToSpringUtils.buildSpringId( ArchivaXworkUser.class.getName() ) );
- sessionProvider = new ArchivaDavSessionProvider( servletAuth, httpAuth, archivaXworkUser );
- }
-
- public void configurationEvent( ConfigurationEvent event )
- {
- if ( event.getType() == ConfigurationEvent.SAVED )
- {
- initRepositories();
- }
- }
-
- private void initRepositories()
- {
- synchronized ( repositoryMap )
- {
- repositoryMap.clear();
- repositoryMap.putAll( configuration.getConfiguration().getManagedRepositoriesAsMap() );
- }
-
- synchronized ( reloadLock )
- {
- initServers( getServletConfig() );
- }
- }
-
- public synchronized ManagedRepositoryConfiguration getRepository( String prefix )
- {
- if ( repositoryMap.isEmpty() )
- {
- repositoryMap.putAll( configuration.getConfiguration().getManagedRepositoriesAsMap() );
- }
- return repositoryMap.get( prefix );
- }
-
- ArchivaConfiguration getConfiguration()
- {
- return configuration;
- }
-
- protected boolean isPreconditionValid( final WebdavRequest request, final DavResource davResource )
- {
- // check for read or write access to the resource when resource-based permission is implemented
-
- return true;
- }
-
- public DavSessionProvider getDavSessionProvider()
- {
- return sessionProvider;
- }
-
- public void setDavSessionProvider( final DavSessionProvider davSessionProvider )
- {
- this.sessionProvider = davSessionProvider;
- }
-
- public DavLocatorFactory getLocatorFactory()
- {
- return locatorFactory;
- }
-
- public void setLocatorFactory( final DavLocatorFactory davLocatorFactory )
- {
- locatorFactory = davLocatorFactory;
- }
-
- public DavResourceFactory getResourceFactory()
- {
- return resourceFactory;
- }
-
- public void setResourceFactory( final DavResourceFactory davResourceFactory )
- {
- resourceFactory = davResourceFactory;
- }
-
- public String getAuthenticateHeaderValue()
- {
- throw new UnsupportedOperationException();
- }
-
- public String getAuthenticateHeaderValue( String repository )
- {
- return "Basic realm=\"Repository Archiva Managed " + repository + " Repository\"";
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.jackrabbit.webdav.DavException;
-
-import javax.servlet.http.HttpServletResponse;
-
-/**
- */
-public class UnauthorizedDavException extends DavException
-{
- final private String repositoryName;
-
- public UnauthorizedDavException(String repositoryName, String message)
- {
- super(HttpServletResponse.SC_UNAUTHORIZED, message);
- this.repositoryName = repositoryName;
- }
-
- public String getRepositoryName()
- {
- return repositoryName;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.lang.StringUtils;
-import org.apache.jackrabbit.webdav.DavResource;
-import org.apache.jackrabbit.webdav.io.OutputContext;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.io.PrintWriter;
-import java.io.File;
-
-/**
- */
-public class IndexWriter
-{
- private final DavResource resource;
-
- private final String logicalResource;
-
- private final List<File> localResources;
-
- private final boolean isVirtual;
-
- public IndexWriter(DavResource resource, File localResource, String logicalResource)
- {
- this.resource = resource;
- this.localResources = new ArrayList<File>();
- this.localResources.add( localResource );
- this.logicalResource = logicalResource;
- this.isVirtual = false;
- }
-
- public IndexWriter( DavResource resource, List<File> localResources, String logicalResource )
- {
- this.resource = resource;
- this.logicalResource = logicalResource;
- this.localResources = localResources;
- this.isVirtual = true;
- }
-
- public void write(OutputContext outputContext)
- {
- outputContext.setModificationTime(new Date().getTime());
- outputContext.setContentType("text/html");
- outputContext.setETag("");
- if (outputContext.hasStream())
- {
- PrintWriter writer = new PrintWriter(outputContext.getOutputStream());
- writeDocumentStart(writer);
- writeHyperlinks(writer);
- writeDocumentEnd(writer);
- writer.flush();
- writer.close();
- }
- }
-
- private void writeDocumentStart(PrintWriter writer)
- {
- writer.println("<html>");
- writer.println("<head>");
- writer.println("<title>Collection: " + logicalResource + "</title>");
- writer.println("</head>");
- writer.println("<body>");
- writer.println("<h3>Collection: " + logicalResource + "</h3>");
-
- //Check if not root
- if (!"/".equals(logicalResource))
- {
- File file = new File(logicalResource);
- String parentName = file.getParent().equals("") ? "/" : file.getParent();
-
- //convert to unix path in case archiva is hosted on windows
- parentName = StringUtils.replace(parentName, "\\", "/" );
-
- writer.println("<ul>");
- writer.println("<li><a href=\"../\">" + parentName + "</a> <i><small>(Parent)</small></i></li>");
- writer.println("</ul>");
- }
-
- writer.println("<ul>");
- }
-
- private void writeDocumentEnd(PrintWriter writer)
- {
- writer.println("</ul>");
- writer.println("</body>");
- writer.println("</html>");
- }
-
- private void writeHyperlinks(PrintWriter writer)
- {
- if( !isVirtual )
- {
- for( File localResource : localResources )
- {
- List<File> files = new ArrayList<File>( Arrays.asList( localResource.listFiles() ) );
- Collections.sort( files );
-
- for ( File file : files )
- {
- writeHyperlink( writer, file.getName(), file.isDirectory() );
- }
- }
- }
- else
- {
- // virtual repository - filter unique directories
- Map<String, File> uniqueChildFiles = new HashMap<String, File>();
- List<String> sortedList = new ArrayList<String>();
- for( File resource : localResources )
- {
- List<File> files = new ArrayList<File>( Arrays.asList( resource.listFiles() ) );
-
- for ( File file : files )
- {
- if( uniqueChildFiles.get( file.getName() ) == null )
- {
- uniqueChildFiles.put( file.getName(), file );
- sortedList.add( file.getName() );
- }
- }
- }
-
- Collections.sort( sortedList );
- for ( String fileName : sortedList )
- {
- writeHyperlink( writer, fileName, ( (File) uniqueChildFiles.get( fileName ) ).isDirectory());
- }
- }
- }
-
- private void writeHyperlink(PrintWriter writer, String resourceName, boolean directory )
- {
- if (directory)
- {
- writer.println("<li><a href=\"" + resourceName + "/\">" + resourceName + "</a></li>");
- }
- else
- {
- writer.println("<li><a href=\"" + resourceName + "\">" + resourceName + "</a></li>");
- }
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-/**
- * MimeTypes
- *
- * @version $Id: MimeTypes.java 7010 2007-10-25 23:35:02Z joakime $
- *
- * @plexus.component role="org.apache.maven.archiva.webdav.util.MimeTypes"
- */
-public class MimeTypes
- extends AbstractLogEnabled
- implements Initializable
-{
- private static final String DEFAULT_MIME_TYPE = "application/octet-stream";
-
- private String resource = "org/apache/maven/archiva/webdav/util/mime.types";
-
- private Map mimeMap = new HashMap();
-
- /**
- * Get the Mime Type for the provided filename.
- *
- * @param filename the filename to obtain the mime type for.
- * @return a mime type String, or null if filename is null, has no extension, or no mime type is associated with it.
- */
- public String getMimeType( String filename )
- {
- String value = null;
- if ( !StringUtils.isEmpty( filename ) )
- {
- int index = filename.lastIndexOf( '.' );
-
- if ( index >= 0 )
- {
- value = (String) mimeMap.get( filename.substring( index + 1 ).toLowerCase() );
- }
- }
-
-
- if (value == null)
- {
- value = DEFAULT_MIME_TYPE;
- }
-
- return value;
-
- }
-
- public void initialize()
- throws InitializationException
- {
- load( resource );
- }
-
- public void load( File file )
- {
- if ( !file.exists() || !file.isFile() || !file.canRead() )
- {
- getLogger().error( "Unable to load mime types from file " + file.getAbsolutePath() + " : not a readable file." );
- return;
- }
-
- FileInputStream fis = null;
-
- try
- {
- fis = new FileInputStream( file );
- }
- catch ( FileNotFoundException e )
- {
- getLogger().error( "Unable to load mime types from file " + file.getAbsolutePath() + " : " + e.getMessage(), e );
- }
- finally
- {
- IOUtils.closeQuietly( fis );
- }
- }
-
- public void load( String resourceName )
- {
- ClassLoader cloader = this.getClass().getClassLoader();
-
- /* Load up the mime types table */
- URL mimeURL = cloader.getResource( resourceName );
-
- if ( mimeURL == null )
- {
- throw new IllegalStateException( "Unable to find resource " + resourceName );
- }
-
- InputStream mimeStream = null;
-
- try
- {
- mimeStream = mimeURL.openStream();
- load( mimeStream );
- }
- catch ( IOException e )
- {
- getLogger().error( "Unable to load mime map " + resourceName + " : " + e.getMessage(), e );
- }
- finally
- {
- IOUtils.closeQuietly( mimeStream );
- }
- }
-
- public void load( InputStream mimeStream )
- {
- mimeMap.clear();
-
- InputStreamReader reader = null;
- BufferedReader buf = null;
-
- try
- {
- reader = new InputStreamReader( mimeStream );
- buf = new BufferedReader( reader );
- String line = null;
-
- while ( ( line = buf.readLine() ) != null )
- {
- line = line.trim();
-
- if ( line.length() == 0 )
- {
- // empty line. skip it
- continue;
- }
-
- if ( line.startsWith( "#" ) )
- {
- // Comment. skip it
- continue;
- }
-
- StringTokenizer tokenizer = new StringTokenizer( line );
- if ( tokenizer.countTokens() > 1 )
- {
- String type = tokenizer.nextToken();
- while ( tokenizer.hasMoreTokens() )
- {
- String extension = tokenizer.nextToken().toLowerCase();
- this.mimeMap.put( extension, type );
- }
- }
- }
- }
- catch ( IOException e )
- {
- getLogger().error( "Unable to read mime types from input stream : " + e.getMessage(), e );
- }
- finally
- {
- IOUtils.closeQuietly( buf );
- IOUtils.closeQuietly( reader );
- }
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.lang.StringUtils;
-import org.apache.commons.lang.ArrayUtils;
-
-/**
- */
-public class RepositoryPathUtil
-{
- public static String getLogicalResource(final String href)
- {
- String logicalResource = null;
- String requestPathInfo = StringUtils.defaultString( href );
-
- //remove prefix ie /repository/blah becomes /blah
- requestPathInfo = removePrefix(requestPathInfo);
-
- // Remove prefixing slash as the repository id doesn't contain it;
- if ( requestPathInfo.startsWith( "/" ) )
- {
- requestPathInfo = requestPathInfo.substring( 1 );
- }
-
- int slash = requestPathInfo.indexOf( '/' );
- if ( slash > 0 )
- {
- logicalResource = requestPathInfo.substring( slash );
-
- if (logicalResource.endsWith( "/.." ) )
- {
- logicalResource += "/";
- }
-
- if ( logicalResource != null && logicalResource.startsWith( "//" ) )
- {
- logicalResource = logicalResource.substring( 1 );
- }
-
- if ( logicalResource == null )
- {
- logicalResource = "/";
- }
- }
- else
- {
- logicalResource = "/";
- }
- return logicalResource;
- }
-
- public static String getRepositoryName(final String href)
- {
- String requestPathInfo = StringUtils.defaultString( href );
-
- //remove prefix ie /repository/blah becomes /blah
- requestPathInfo = removePrefix(requestPathInfo);
-
- // Remove prefixing slash as the repository id doesn't contain it;
- if ( requestPathInfo.startsWith( "/" ) )
- {
- requestPathInfo = requestPathInfo.substring( 1 );
- }
-
- // Find first element, if slash exists.
- int slash = requestPathInfo.indexOf( '/' );
- if ( slash > 0 )
- {
- // Filtered: "central/org/apache/maven/" -> "central"
- return requestPathInfo.substring( 0, slash );
- }
- return requestPathInfo;
- }
-
- private static String removePrefix(final String href)
- {
- String[] parts = StringUtils.split(href, '/');
- parts = (String[]) ArrayUtils.subarray(parts, 1, parts.length);
- if (parts == null || parts.length == 0)
- {
- return "/";
- }
-
- String joinedString = StringUtils.join(parts, '/');
- if( href.endsWith( "/" ) )
- {
- joinedString = joinedString + "/";
- }
-
- return joinedString;
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * WebdavMethodUtil
- *
- * @version $Id: WebdavMethodUtil.java 5412 2007-01-13 01:18:47Z joakime $
- */
-public class WebdavMethodUtil
-{
- private static final List READ_METHODS;
-
- static
- {
- READ_METHODS = new ArrayList();
- READ_METHODS.add( "HEAD" );
- READ_METHODS.add( "GET" );
- READ_METHODS.add( "PROPFIND" );
- READ_METHODS.add( "OPTIONS" );
- READ_METHODS.add( "REPORT" );
- }
-
- public static boolean isReadMethod( String method )
- {
- if ( StringUtils.isBlank( method ) )
- {
- return false;
- }
-
- return READ_METHODS.contains( method.toUpperCase() );
- }
-
- public static boolean isWriteMethod( String method )
- {
- if ( StringUtils.isBlank( method ) )
- {
- return false;
- }
-
- return !READ_METHODS.contains( method.toUpperCase() );
- }
-}
+++ /dev/null
-# This file controls what Internet media types are sent to the client for
-# given file extension(s). Sending the correct media type to the client
-# is important so they know how to handle the content of the file.
-# Extra types can either be added here or by using an AddType directive
-# in your config files. For more information about Internet media types,
-# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
-# registry is at <http://www.iana.org/assignments/media-types/>.
-
-# MIME type Extensions
-
-application/andrew-inset ez
-application/atom+xml atom
-application/java-archive jar
-application/mac-binhex40 hqx
-application/mac-compactpro cpt
-application/mathml+xml mathml
-application/msword doc
-application/octet-stream bin dms lha lzh exe class so dll dmg
-application/oda oda
-application/ogg ogg
-application/pdf pdf
-application/pgp-encrypted pgp
-application/postscript ai eps ps
-application/rdf+xml rdf
-application/smil smi smil
-application/srgs gram
-application/srgs+xml grxml
-application/vnd.mif mif
-application/vnd.mozilla.xul+xml xul
-application/vnd.ms-excel xls
-application/vnd.ms-powerpoint ppt
-application/vnd.rn-realmedia rm
-application/vnd.wap.wbxml wbxml
-application/vnd.wap.wmlc wmlc
-application/vnd.wap.wmlscriptc wmlsc
-application/voicexml+xml vxml
-application/x-bcpio bcpio
-application/x-cdlink vcd
-application/x-chess-pgn pgn
-application/x-cpio cpio
-application/x-csh csh
-application/x-director dcr dir dxr
-application/x-dvi dvi
-application/x-futuresplash spl
-application/x-gtar gtar
-application/x-hdf hdf
-application/x-java-jnlp-file jnlp
-application/x-javascript js
-application/x-koan skp skd skt skm
-application/x-latex latex
-application/x-netcdf nc cdf
-application/x-sh sh
-application/x-shar shar
-application/x-shockwave-flash swf
-application/x-stuffit sit
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-tcl tcl
-application/x-tex tex
-application/x-texinfo texinfo texi
-application/x-troff t tr roff
-application/x-troff-man man
-application/x-troff-me me
-application/x-troff-ms ms
-application/x-ustar ustar
-application/x-wais-source src
-application/xhtml+xml xhtml xht
-application/xml xml xsl pom
-application/xml-dtd dtd
-application/xslt+xml xslt
-application/zip zip
-audio/basic au snd
-audio/midi mid midi kar
-audio/mpeg mpga mp2 mp3
-audio/x-aiff aif aiff aifc
-audio/x-mpegurl m3u
-audio/x-pn-realaudio ram ra
-audio/x-wav wav
-chemical/x-pdb pdb
-chemical/x-xyz xyz
-image/bmp bmp
-image/cgm cgm
-image/gif gif
-image/ief ief
-image/jp2 jp2
-image/jpeg jpeg jpg jpe
-image/pict pict pic pct
-image/png png
-image/svg+xml svg
-image/tiff tiff tif
-image/vnd.djvu djvu djv
-image/vnd.wap.wbmp wbmp
-image/x-cmu-raster ras
-image/x-icon ico
-image/x-macpaint pntg pnt mac
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-quicktime qtif qti
-image/x-rgb rgb
-image/x-xbitmap xbm
-image/x-xpixmap xpm
-image/x-xwindowdump xwd
-model/iges igs iges
-model/mesh msh mesh silo
-model/vrml wrl vrml
-text/calendar ics ifb
-text/css css
-text/html html htm
-text/plain asc txt sha1 md5
-text/richtext rtx
-text/rtf rtf
-text/sgml sgml sgm
-text/tab-separated-values tsv
-text/vnd.wap.wml wml
-text/vnd.wap.wmlscript wmls
-text/x-setext etx
-video/mp4 mp4
-video/mpeg mpeg mpg mpe
-video/quicktime qt mov
-video/vnd.mpegurl mxu m4u
-video/x-dv dv dif
-video/x-msvideo avi
-video/x-sgi-movie movie
-x-conference/x-cooltalk ice
+++ /dev/null
-package org.apache.maven.archiva.webdav.httpunit;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 com.meterware.httpunit.HeaderOnlyWebRequest;
-import java.net.URL;
-
-/**
- * MkColMethodWebRequest
- * See RFC-2518 Section 8.3
- */
-public class MkColMethodWebRequest extends HeaderOnlyWebRequest
-{
- public MkColMethodWebRequest( String urlString )
- {
- super(urlString);
- }
-
- @Override
- public String getMethod() {
- return "MKCOL";
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.codehaus.plexus.spring.PlexusInSpringTestCase;
-
-/**
- * MimeTypesTest
- *
- * @version $Id: MimeTypesTest.java 6556 2007-06-20 20:44:46Z joakime $
- */
-public class MimeTypesTest extends PlexusInSpringTestCase
-{
- public void testGetMimeType() throws Exception
- {
- MimeTypes mime = (MimeTypes) lookup( MimeTypes.class );
- assertNotNull( "MimeTypes should not be null.", mime );
-
- assertEquals( "application/pdf", mime.getMimeType( "big-book.pdf" ) );
- assertEquals( "application/octet-stream", mime.getMimeType( "BookMaker.class" ) );
- assertEquals( "application/vnd.ms-powerpoint", mime.getMimeType( "TypeSetting.ppt" ) );
- assertEquals( "application/java-archive", mime.getMimeType( "BookViewer.jar" ) );
- }
-}
+++ /dev/null
-package org.apache.maven.archiva.webdav.util;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 junit.framework.TestCase;
-
-/**
- */
-public class RepositoryPathUtilTest extends TestCase
-{
- public void testGetRepositoryId()
- {
- String href = "/path/to/my/resource";
- assertEquals("to", RepositoryPathUtil.getRepositoryName(href));
-
- href = "path/to/my/resource";
- assertEquals("to", RepositoryPathUtil.getRepositoryName(href));
-
- href = "mypath";
- assertEquals("/", RepositoryPathUtil.getLogicalResource(href));
- }
-
- public void testGetLogicalPath()
- {
- String href = "/repository/internal/org/apache/maven/someartifact.jar";
- assertEquals("/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource(href));
-
- href = "repository/internal/org/apache/maven/someartifact.jar";
- assertEquals("/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource(href));
-
- href = "repository/internal/org/apache/maven/";
- assertEquals( "/org/apache/maven/", RepositoryPathUtil.getLogicalResource( href ) );
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<component-set>
- <components>
- <!-- Components that are common for all test cases -->
- <component>
- <role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
- <implementation>org.apache.maven.archiva.webdav.util.MimeTypes</implementation>
- <description>MimeTypes</description>
- <configuration>
- <resource>archiva-mime-types.txt</resource>
- </configuration>
- </component>
- </components>
-</component-set>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>Apache Archiva</display-name>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <context-param>
- <param-name>contextClass</param-name>
- <param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>
- </context-param>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- classpath*:/META-INF/plexus/components.xml
- classpath*:/META-INF/spring-context.xml
- target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml
- </param-value>
- </context-param>
-
-</web-app>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>Apache Archiva</display-name>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <context-param>
- <param-name>contextClass</param-name>
- <param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>
- </context-param>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- classpath*:/META-INF/plexus/components.xml
- classpath*:/META-INF/spring-context.xml
- target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletTest.xml
- </param-value>
- </context-param>
-
-</web-app>
+++ /dev/null
-# This file controls what Internet media types are sent to the client for
-# given file extension(s). Sending the correct media type to the client
-# is important so they know how to handle the content of the file.
-# Extra types can either be added here or by using an AddType directive
-# in your config files. For more information about Internet media types,
-# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
-# registry is at <http://www.iana.org/assignments/media-types/>.
-
-# MIME type Extensions
-
-application/andrew-inset ez
-application/atom+xml atom
-application/java-archive jar
-application/mac-binhex40 hqx
-application/mac-compactpro cpt
-application/mathml+xml mathml
-application/msword doc
-application/octet-stream bin dms lha lzh exe class so dll dmg
-application/oda oda
-application/ogg ogg
-application/pdf pdf
-application/pgp-encrypted pgp
-application/postscript ai eps ps
-application/rdf+xml rdf
-application/smil smi smil
-application/srgs gram
-application/srgs+xml grxml
-application/vnd.mif mif
-application/vnd.mozilla.xul+xml xul
-application/vnd.ms-excel xls
-application/vnd.ms-powerpoint ppt
-application/vnd.rn-realmedia rm
-application/vnd.wap.wbxml wbxml
-application/vnd.wap.wmlc wmlc
-application/vnd.wap.wmlscriptc wmlsc
-application/voicexml+xml vxml
-application/x-bcpio bcpio
-application/x-cdlink vcd
-application/x-chess-pgn pgn
-application/x-cpio cpio
-application/x-csh csh
-application/x-director dcr dir dxr
-application/x-dvi dvi
-application/x-futuresplash spl
-application/x-gtar gtar
-application/x-hdf hdf
-application/x-java-jnlp-file jnlp
-application/x-javascript js
-application/x-koan skp skd skt skm
-application/x-latex latex
-application/x-netcdf nc cdf
-application/x-sh sh
-application/x-shar shar
-application/x-shockwave-flash swf
-application/x-stuffit sit
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-tcl tcl
-application/x-tex tex
-application/x-texinfo texinfo texi
-application/x-troff t tr roff
-application/x-troff-man man
-application/x-troff-me me
-application/x-troff-ms ms
-application/x-ustar ustar
-application/x-wais-source src
-application/xhtml+xml xhtml xht
-application/xml xml xsl pom
-application/xml-dtd dtd
-application/xslt+xml xslt
-application/zip zip
-audio/basic au snd
-audio/midi mid midi kar
-audio/mpeg mpga mp2 mp3
-audio/x-aiff aif aiff aifc
-audio/x-mpegurl m3u
-audio/x-pn-realaudio ram ra
-audio/x-wav wav
-chemical/x-pdb pdb
-chemical/x-xyz xyz
-image/bmp bmp
-image/cgm cgm
-image/gif gif
-image/ief ief
-image/jp2 jp2
-image/jpeg jpeg jpg jpe
-image/pict pict pic pct
-image/png png
-image/svg+xml svg
-image/tiff tiff tif
-image/vnd.djvu djvu djv
-image/vnd.wap.wbmp wbmp
-image/x-cmu-raster ras
-image/x-icon ico
-image/x-macpaint pntg pnt mac
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-quicktime qtif qti
-image/x-rgb rgb
-image/x-xbitmap xbm
-image/x-xpixmap xpm
-image/x-xwindowdump xwd
-model/iges igs iges
-model/mesh msh mesh silo
-model/vrml wrl vrml
-text/calendar ics ifb
-text/css css
-text/html html htm
-text/plain asc txt sha1 md5
-text/richtext rtx
-text/rtf rtf
-text/sgml sgml sgm
-text/tab-separated-values tsv
-text/vnd.wap.wml wml
-text/vnd.wap.wmlscript wmls
-text/x-setext etx
-video/mp4 mp4
-video/mpeg mpeg mpg mpe
-video/quicktime qt mov
-video/vnd.mpegurl mxu m4u
-video/x-dv dv dif
-video/x-msvideo avi
-video/x-sgi-movie movie
-x-conference/x-cooltalk ice
+++ /dev/null
-artifact.jar
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%5p|%t|%5r|%-30c{1} - %m%n"/>
- </layout>
- </appender>
-
- <!-- Help identify bugs during testing -->
- <logger name="org.apache.maven.archiva">
- <level value="info"/>
- </logger>
-
- <logger name="net.sf.ehcache">
- <level value="warn"/>
- </logger>
-
- <logger name="org.codehaus.plexus.security">
- <level value="info"/>
- </logger>
-
- <logger name="org.springframework">
- <level value="error"/>
- </logger>
-
- <logger name="org.codehaus.plexus.spring">
- <level value="error"/>
- </logger>
-
- <logger name="JPOX">
- <level value="warn"/>
- </logger>
-
- <logger name="JPOX.MetaData">
- <level value="error"/>
- </logger>
-
- <logger name="JPOX.RDBMS.SQL">
- <level value="error"/>
- </logger>
-
- <logger name="SQL">
- <level value="error"/>
- </logger>
-
- <root>
- <priority value ="info" />
- <appender-ref ref="console" />
- </root>
-
-</log4j:configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
- <!--
- | Logger manager
- -->
- <component>
- <role>org.codehaus.plexus.logging.LoggerManager</role>
- <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
- <lifecycle-handler>basic</lifecycle-handler>
- </component>
-
- <!--
- | Configuration
- -->
- <component>
- <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
- <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
- <field-name>prePolicies</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
- <field-name>postPolicies</field-name>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
- <configuration>
- <properties>
- <system/>
- <xml fileName="${appserver.base}/conf/archiva.xml"
- config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
- </properties>
- </configuration>
- </component>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>default</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>proxied</role-hint>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.cache.Cache</role>
- <role-hint>url-failures-cache</role-hint>
- <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
- <description>URL Failure Cache</description>
- <configuration>
- <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
- <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
- <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
- <eternal>false</eternal>
- <max-elements-in-memory>1000</max-elements-in-memory>
- <memory-eviction-policy>LRU</memory-eviction-policy>
- <name>url-failures-cache</name>
- <overflow-to-disk>false</overflow-to-disk>
- <!-- 45 minutes = 2700 seconds -->
- <time-to-idle-seconds>2700</time-to-idle-seconds>
- <!-- 30 minutes = 1800 seconds -->
- <time-to-live-seconds>1800</time-to-live-seconds>
- </configuration>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.system.DefaultSecuritySystem</implementation>
- </component>
-
- <component>
- <role>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</role>
- <implementation>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</implementation>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
- <field-name>archivaConfiguration</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
- <field-name>repositoryFactory</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.content.RepositoryRequest</role>
- <field-name>repositoryRequest</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.proxy.RepositoryProxyConnectors</role>
- <field-name>connectors</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
- <field-name>metadataTools</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.security.ServletAuthenticator</role>
- <field-name>servletAuth</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
- <field-name>mimeTypes</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.xwork.filter.authentication.HttpAuthenticator</role>
- <role-hint>basic</role-hint>
- <field-name>httpAuth</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
- <role-hint>default</role-hint>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.ChecksumFile</role>
- <field-name>checksum</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.Digester</role>
- <role-hint>sha1</role-hint>
- <field-name>digestSha1</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.Digester</role>
- <role-hint>md5</role-hint>
- <field-name>digestMd5</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.security.ArchivaXworkUser</role>
- <field-name>archivaXworkUser</field-name>
- </requirement>
- </requirements>
- </component>
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
- <!--
- | Logger manager
- -->
- <component>
- <role>org.codehaus.plexus.logging.LoggerManager</role>
- <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
- <lifecycle-handler>basic</lifecycle-handler>
- </component>
-
- <!--
- | Configuration
- -->
- <component>
- <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
- <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
- <field-name>prePolicies</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
- <field-name>postPolicies</field-name>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>org.codehaus.plexus.registry.Registry</role>
- <role-hint>configured</role-hint>
- <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
- <configuration>
- <properties>
- <system/>
- <xml fileName="${appserver.base}/conf/archiva.xml"
- config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
- </properties>
- </configuration>
- </component>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>default</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>proxied</role-hint>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.cache.Cache</role>
- <role-hint>url-failures-cache</role-hint>
- <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
- <description>URL Failure Cache</description>
- <configuration>
- <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
- <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
- <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
- <eternal>false</eternal>
- <max-elements-in-memory>1000</max-elements-in-memory>
- <memory-eviction-policy>LRU</memory-eviction-policy>
- <name>url-failures-cache</name>
- <overflow-to-disk>false</overflow-to-disk>
- <!-- 45 minutes = 2700 seconds -->
- <time-to-idle-seconds>2700</time-to-idle-seconds>
- <!-- 30 minutes = 1800 seconds -->
- <time-to-live-seconds>1800</time-to-live-seconds>
- </configuration>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
- <role-hint>default</role-hint>
- <implementation>org.apache.maven.archiva.webdav.BypassSecuritySystem</implementation>
- </component>
-
- <component>
- <role>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</role>
- <implementation>org.apache.maven.archiva.webdav.UnauthenticatedDavResourceFactory</implementation>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
- <field-name>archivaConfiguration</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
- <field-name>repositoryFactory</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.content.RepositoryRequest</role>
- <field-name>repositoryRequest</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.proxy.RepositoryProxyConnectors</role>
- <field-name>connectors</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
- <field-name>metadataTools</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.security.ServletAuthenticator</role>
- <field-name>servletAuth</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
- <field-name>mimeTypes</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.struts2.filter.authentication.HttpAuthenticator</role>
- <role-hint>basic</role-hint>
- <field-name>httpAuth</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
- <role-hint>default</role-hint>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.ChecksumFile</role>
- <field-name>checksum</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.Digester</role>
- <role-hint>sha1</role-hint>
- <field-name>digestSha1</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.digest.Digester</role>
- <role-hint>md5</role-hint>
- <field-name>digestMd5</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.security.ArchivaXworkUser</role>
- <field-name>archivaXworkUser</field-name>
- </requirement>
- </requirements>
- </component>
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<configuration>
-
- <version>2</version>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
-</configuration>
+++ /dev/null
-<?xml version="1.0" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>simple</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>simple</role-hint>
- </requirement>
- </requirements>
- </component>
-
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>simple</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>simple</role-hint>
- </requirement>
- </requirements>
- </component>
-
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>simple</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>simple</role-hint>
- </requirement>
- </requirements>
- </component>
-
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" ?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<plexus>
- <components>
-
- <component>
- <role>org.apache.maven.archiva.webdav.DavServerManager</role>
- <role-hint>simple</role-hint>
- <implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
- <description>DefaultDavServerManager</description>
- <requirements>
- <requirement>
- <role>org.apache.maven.archiva.webdav.DavServerComponent</role>
- <role-hint>simple</role-hint>
- </requirement>
- </requirements>
- </component>
-
- </components>
-</plexus>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<configuration>
-
- <version>2</version>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
-</configuration>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>Apache Archiva</display-name>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <context-param>
- <param-name>contextClass</param-name>
- <param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>
- </context-param>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>
- classpath*:/META-INF/plexus/components.xml
- </param-value>
- </context-param>
-
-</web-app>
<module>archiva-applet</module>
<module>archiva-security</module>
<module>archiva-webapp</module>
- <module>archiva-webdav</module>
<module>archiva-rss</module>
<module>archiva-xmlrpc</module>
<module>archiva-repository-servlet</module>
</modules>
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
</dependencies>
<dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-webdav</artifactId>
- <version>1.5.0</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>