import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.facets.AuditEvent;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.*;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.repository.ManagedRepositoryContent;
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
default-lazy-init="true">
<context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.repository.maven.content,org.apache.archiva.metadata.maven"/>
+ <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.repository.maven.content,org.apache.archiva.maven.metadata"/>
<bean name="commons-configuration" class="org.apache.archiva.components.registry.commons.CommonsConfigurationRegistry">
<property name="initialConfiguration">
import org.apache.archiva.indexer.IndexUpdateFailedException;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
import org.apache.archiva.proxy.ProxyRegistry;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryException;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryException;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.EditableRepository;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.repository.content.BaseRepositoryContentLayout;
import org.apache.archiva.repository.content.ContentAccessException;
import org.apache.archiva.repository.content.BaseDataItemTypes;
import org.apache.archiva.repository.content.ContentItem;
import org.apache.archiva.repository.content.DataItem;
-import org.apache.archiva.repository.content.ItemNotFoundException;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Namespace;
import org.apache.archiva.repository.content.Project;
--- /dev/null
+package org.apache.archiva.maven.proxy;
+/*
+ * 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.maven.wagon.events.TransferEvent;
+import org.apache.maven.wagon.events.TransferListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M1
+ */
+public class DebugTransferListener
+ implements TransferListener
+{
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Override
+ public void transferInitiated( TransferEvent transferEvent )
+ {
+ log.debug( "transferInitiated for resource {} on repository url {}", transferEvent.getResource().getName(),
+ transferEvent.getWagon().getRepository().getUrl() );
+ }
+
+ @Override
+ public void transferStarted( TransferEvent transferEvent )
+ {
+ log.debug( "transferStarted for resource {} on repository url {}", transferEvent.getResource().getName(),
+ transferEvent.getWagon().getRepository().getUrl() );
+ }
+
+ @Override
+ public void transferProgress( TransferEvent transferEvent, byte[] bytes, int i )
+ {
+ log.debug( "transferProgress for resource {} on repository url {}", transferEvent.getResource().getName(),
+ transferEvent.getWagon().getRepository().getUrl() );
+ }
+
+ @Override
+ public void transferCompleted( TransferEvent transferEvent )
+ {
+ log.debug( "transferCompleted for resource {} on repository url {}", transferEvent.getResource().getName(),
+ transferEvent.getWagon().getRepository().getUrl() );
+ }
+
+ @Override
+ public void transferError( TransferEvent transferEvent )
+ {
+ log.debug( "transferError for resource {} on repository url {}", transferEvent.getResource().getName(),
+ transferEvent.getWagon().getRepository().getUrl(), transferEvent.getException() );
+ }
+
+ @Override
+ public void debug( String s )
+ {
+ log.debug( "wagon debug {}", s );
+ }
+}
--- /dev/null
+package org.apache.archiva.maven.proxy;
+
+/*
+ * 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.lang3.StringUtils;
+import org.apache.maven.wagon.Wagon;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M1
+ */
+@Service ("wagonFactory")
+public class DefaultWagonFactory
+ implements WagonFactory
+{
+
+ private ApplicationContext applicationContext;
+
+ private Logger logger = LoggerFactory.getLogger( getClass() );
+
+ private DebugTransferListener debugTransferListener = new DebugTransferListener();
+
+ @Inject
+ public DefaultWagonFactory( ApplicationContext applicationContext )
+ {
+ this.applicationContext = applicationContext;
+ }
+
+ @Override
+ public Wagon getWagon( WagonFactoryRequest wagonFactoryRequest )
+ throws WagonFactoryException
+ {
+ try
+ {
+ String protocol = StringUtils.startsWith( wagonFactoryRequest.getProtocol(), "wagon#" )
+ ? wagonFactoryRequest.getProtocol()
+ : "wagon#" + wagonFactoryRequest.getProtocol();
+
+ // if it's a ntlm proxy we have to lookup the wagon light which support thats
+ // wagon http client doesn't support that
+ if ( wagonFactoryRequest.getNetworkProxy() != null && wagonFactoryRequest.getNetworkProxy().isUseNtlm() )
+ {
+ protocol = protocol + "-ntlm";
+ }
+
+ Wagon wagon = applicationContext.getBean( protocol, Wagon.class );
+ wagon.addTransferListener( debugTransferListener );
+ configureUserAgent( wagon, wagonFactoryRequest );
+ return wagon;
+ }
+ catch ( BeansException e )
+ {
+ throw new WagonFactoryException( e.getMessage(), e );
+ }
+ }
+
+ protected void configureUserAgent( Wagon wagon, WagonFactoryRequest wagonFactoryRequest )
+ {
+ try
+ {
+ Class<? extends Wagon> clazz = wagon.getClass();
+ Method getHttpHeaders = clazz.getMethod( "getHttpHeaders" );
+
+ Properties headers = (Properties) getHttpHeaders.invoke( wagon );
+ if ( headers == null )
+ {
+ headers = new Properties();
+ }
+
+ headers.put( "User-Agent", wagonFactoryRequest.getUserAgent() );
+
+ if ( !wagonFactoryRequest.getHeaders().isEmpty() )
+ {
+ for ( Map.Entry<String, String> entry : wagonFactoryRequest.getHeaders().entrySet() )
+ {
+ headers.put( entry.getKey(), entry.getValue() );
+ }
+ }
+
+ Method setHttpHeaders = clazz.getMethod( "setHttpHeaders", new Class[]{ Properties.class } );
+ setHttpHeaders.invoke( wagon, headers );
+
+ logger.debug( "http headers set to: {}", headers );
+ }
+ catch ( Exception e )
+ {
+ logger.warn( "fail to configure User-Agent: {}", e.getMessage(), e );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.maven.proxy;
+
+/*
+ * 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.maven.wagon.Wagon;
+
+/**
+ * Create a Wagon instance for the given protocol.
+ */
+public interface WagonFactory
+{
+ /**
+ * Create a new Wagon instance for the given protocol.
+ *
+ * @param wagonFactoryRequest
+ *
+ * @return the Wagon instance
+ */
+ Wagon getWagon( WagonFactoryRequest wagonFactoryRequest )
+ throws WagonFactoryException;
+}
--- /dev/null
+package org.apache.archiva.maven.proxy;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M1
+ */
+public class WagonFactoryException
+ extends Exception
+{
+ public WagonFactoryException( String message, Throwable e )
+ {
+ super( message, e );
+ }
+}
--- /dev/null
+package org.apache.archiva.maven.proxy;
+/*
+ * 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.archiva.proxy.model.NetworkProxy;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M4
+ */
+public class WagonFactoryRequest
+{
+
+ public static final String USER_AGENT_SYSTEM_PROPERTY = "archiva.userAgent";
+
+ private static String DEFAULT_USER_AGENT = "Java-Archiva";
+
+ /**
+ * the protocol to find the Wagon for, which must be prefixed with <code>wagon#</code>, for example
+ * <code>wagon#http</code>. <b>to have a wagon supporting ntlm add -ntlm</b>
+ */
+ private String protocol;
+
+ private Map<String, String> headers = new HashMap<>();
+
+ private String userAgent = DEFAULT_USER_AGENT;
+
+ static {
+ if ( StringUtils.isNotBlank( System.getProperty( USER_AGENT_SYSTEM_PROPERTY))) {
+ DEFAULT_USER_AGENT=System.getProperty(USER_AGENT_SYSTEM_PROPERTY);
+ }
+ }
+
+ private NetworkProxy networkProxy;
+
+ public WagonFactoryRequest()
+ {
+ // no op
+ }
+
+ public WagonFactoryRequest( String protocol, Map<String, String> headers )
+ {
+ this.protocol = protocol;
+ this.headers = headers;
+ }
+
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ public void setProtocol( String protocol )
+ {
+ this.protocol = protocol;
+ }
+
+ public WagonFactoryRequest protocol( String protocol )
+ {
+ this.protocol = protocol;
+ return this;
+ }
+
+ public Map<String, String> getHeaders()
+ {
+ if ( this.headers == null )
+ {
+ this.headers = new HashMap<>();
+ }
+ return headers;
+ }
+
+ public void setHeaders( Map<String, String> headers )
+ {
+ this.headers = headers;
+ }
+
+ public WagonFactoryRequest headers( Map<String, String> headers )
+ {
+ this.headers = headers;
+ return this;
+ }
+
+ public String getUserAgent()
+ {
+ return userAgent;
+ }
+
+ public void setUserAgent( String userAgent )
+ {
+ this.userAgent = userAgent;
+ }
+
+ public WagonFactoryRequest userAgent( String userAgent )
+ {
+ this.userAgent = userAgent;
+ return this;
+ }
+
+ public NetworkProxy getNetworkProxy()
+ {
+ return networkProxy;
+ }
+
+ public void setNetworkProxy( NetworkProxy networkProxy )
+ {
+ this.networkProxy = networkProxy;
+ }
+
+ public WagonFactoryRequest networkProxy( NetworkProxy networkProxy )
+ {
+ this.networkProxy = networkProxy;
+ return this;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof WagonFactoryRequest ) )
+ {
+ return false;
+ }
+
+ WagonFactoryRequest that = (WagonFactoryRequest) o;
+
+ if ( protocol != null ? !protocol.equals( that.protocol ) : that.protocol != null )
+ {
+ return false;
+ }
+ if ( userAgent != null ? !userAgent.equals( that.userAgent ) : that.userAgent != null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = protocol != null ? protocol.hashCode() : 0;
+ result = 31 * result + ( userAgent != null ? userAgent.hashCode() : 0 );
+ return result;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "WagonFactoryRequest{" +
+ "protocol='" + protocol + '\'' +
+ ", headers=" + headers +
+ ", userAgent='" + userAgent + '\'' +
+ ", networkProxy=" + networkProxy +
+ '}';
+ }
+}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-/*
- * 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.maven.wagon.events.TransferEvent;
-import org.apache.maven.wagon.events.TransferListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M1
- */
-public class DebugTransferListener
- implements TransferListener
-{
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- @Override
- public void transferInitiated( TransferEvent transferEvent )
- {
- log.debug( "transferInitiated for resource {} on repository url {}", transferEvent.getResource().getName(),
- transferEvent.getWagon().getRepository().getUrl() );
- }
-
- @Override
- public void transferStarted( TransferEvent transferEvent )
- {
- log.debug( "transferStarted for resource {} on repository url {}", transferEvent.getResource().getName(),
- transferEvent.getWagon().getRepository().getUrl() );
- }
-
- @Override
- public void transferProgress( TransferEvent transferEvent, byte[] bytes, int i )
- {
- log.debug( "transferProgress for resource {} on repository url {}", transferEvent.getResource().getName(),
- transferEvent.getWagon().getRepository().getUrl() );
- }
-
- @Override
- public void transferCompleted( TransferEvent transferEvent )
- {
- log.debug( "transferCompleted for resource {} on repository url {}", transferEvent.getResource().getName(),
- transferEvent.getWagon().getRepository().getUrl() );
- }
-
- @Override
- public void transferError( TransferEvent transferEvent )
- {
- log.debug( "transferError for resource {} on repository url {}", transferEvent.getResource().getName(),
- transferEvent.getWagon().getRepository().getUrl(), transferEvent.getException() );
- }
-
- @Override
- public void debug( String s )
- {
- log.debug( "wagon debug {}", s );
- }
-}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-
-/*
- * 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.lang3.StringUtils;
-import org.apache.maven.wagon.Wagon;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M1
- */
-@Service ("wagonFactory")
-public class DefaultWagonFactory
- implements WagonFactory
-{
-
- private ApplicationContext applicationContext;
-
- private Logger logger = LoggerFactory.getLogger( getClass() );
-
- private DebugTransferListener debugTransferListener = new DebugTransferListener();
-
- @Inject
- public DefaultWagonFactory( ApplicationContext applicationContext )
- {
- this.applicationContext = applicationContext;
- }
-
- @Override
- public Wagon getWagon( WagonFactoryRequest wagonFactoryRequest )
- throws WagonFactoryException
- {
- try
- {
- String protocol = StringUtils.startsWith( wagonFactoryRequest.getProtocol(), "wagon#" )
- ? wagonFactoryRequest.getProtocol()
- : "wagon#" + wagonFactoryRequest.getProtocol();
-
- // if it's a ntlm proxy we have to lookup the wagon light which support thats
- // wagon http client doesn't support that
- if ( wagonFactoryRequest.getNetworkProxy() != null && wagonFactoryRequest.getNetworkProxy().isUseNtlm() )
- {
- protocol = protocol + "-ntlm";
- }
-
- Wagon wagon = applicationContext.getBean( protocol, Wagon.class );
- wagon.addTransferListener( debugTransferListener );
- configureUserAgent( wagon, wagonFactoryRequest );
- return wagon;
- }
- catch ( BeansException e )
- {
- throw new WagonFactoryException( e.getMessage(), e );
- }
- }
-
- protected void configureUserAgent( Wagon wagon, WagonFactoryRequest wagonFactoryRequest )
- {
- try
- {
- Class<? extends Wagon> clazz = wagon.getClass();
- Method getHttpHeaders = clazz.getMethod( "getHttpHeaders" );
-
- Properties headers = (Properties) getHttpHeaders.invoke( wagon );
- if ( headers == null )
- {
- headers = new Properties();
- }
-
- headers.put( "User-Agent", wagonFactoryRequest.getUserAgent() );
-
- if ( !wagonFactoryRequest.getHeaders().isEmpty() )
- {
- for ( Map.Entry<String, String> entry : wagonFactoryRequest.getHeaders().entrySet() )
- {
- headers.put( entry.getKey(), entry.getValue() );
- }
- }
-
- Method setHttpHeaders = clazz.getMethod( "setHttpHeaders", new Class[]{ Properties.class } );
- setHttpHeaders.invoke( wagon, headers );
-
- logger.debug( "http headers set to: {}", headers );
- }
- catch ( Exception e )
- {
- logger.warn( "fail to configure User-Agent: {}", e.getMessage(), e );
- }
- }
-}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-
-/*
- * 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.maven.wagon.Wagon;
-
-/**
- * Create a Wagon instance for the given protocol.
- */
-public interface WagonFactory
-{
- /**
- * Create a new Wagon instance for the given protocol.
- *
- * @param wagonFactoryRequest
- *
- * @return the Wagon instance
- */
- Wagon getWagon( WagonFactoryRequest wagonFactoryRequest )
- throws WagonFactoryException;
-}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-
-/*
- * 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.
- */
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M1
- */
-public class WagonFactoryException
- extends Exception
-{
- public WagonFactoryException( String message, Throwable e )
- {
- super( message, e );
- }
-}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-/*
- * 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.archiva.proxy.model.NetworkProxy;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M4
- */
-public class WagonFactoryRequest
-{
-
- public static final String USER_AGENT_SYSTEM_PROPERTY = "archiva.userAgent";
-
- private static String DEFAULT_USER_AGENT = "Java-Archiva";
-
- /**
- * the protocol to find the Wagon for, which must be prefixed with <code>wagon#</code>, for example
- * <code>wagon#http</code>. <b>to have a wagon supporting ntlm add -ntlm</b>
- */
- private String protocol;
-
- private Map<String, String> headers = new HashMap<>();
-
- private String userAgent = DEFAULT_USER_AGENT;
-
- static {
- if ( StringUtils.isNotBlank( System.getProperty( USER_AGENT_SYSTEM_PROPERTY))) {
- DEFAULT_USER_AGENT=System.getProperty(USER_AGENT_SYSTEM_PROPERTY);
- }
- }
-
- private NetworkProxy networkProxy;
-
- public WagonFactoryRequest()
- {
- // no op
- }
-
- public WagonFactoryRequest( String protocol, Map<String, String> headers )
- {
- this.protocol = protocol;
- this.headers = headers;
- }
-
- public String getProtocol()
- {
- return protocol;
- }
-
- public void setProtocol( String protocol )
- {
- this.protocol = protocol;
- }
-
- public WagonFactoryRequest protocol( String protocol )
- {
- this.protocol = protocol;
- return this;
- }
-
- public Map<String, String> getHeaders()
- {
- if ( this.headers == null )
- {
- this.headers = new HashMap<>();
- }
- return headers;
- }
-
- public void setHeaders( Map<String, String> headers )
- {
- this.headers = headers;
- }
-
- public WagonFactoryRequest headers( Map<String, String> headers )
- {
- this.headers = headers;
- return this;
- }
-
- public String getUserAgent()
- {
- return userAgent;
- }
-
- public void setUserAgent( String userAgent )
- {
- this.userAgent = userAgent;
- }
-
- public WagonFactoryRequest userAgent( String userAgent )
- {
- this.userAgent = userAgent;
- return this;
- }
-
- public NetworkProxy getNetworkProxy()
- {
- return networkProxy;
- }
-
- public void setNetworkProxy( NetworkProxy networkProxy )
- {
- this.networkProxy = networkProxy;
- }
-
- public WagonFactoryRequest networkProxy( NetworkProxy networkProxy )
- {
- this.networkProxy = networkProxy;
- return this;
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( !( o instanceof WagonFactoryRequest ) )
- {
- return false;
- }
-
- WagonFactoryRequest that = (WagonFactoryRequest) o;
-
- if ( protocol != null ? !protocol.equals( that.protocol ) : that.protocol != null )
- {
- return false;
- }
- if ( userAgent != null ? !userAgent.equals( that.userAgent ) : that.userAgent != null )
- {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int result = protocol != null ? protocol.hashCode() : 0;
- result = 31 * result + ( userAgent != null ? userAgent.hashCode() : 0 );
- return result;
- }
-
- @Override
- public String toString()
- {
- return "WagonFactoryRequest{" +
- "protocol='" + protocol + '\'' +
- ", headers=" + headers +
- ", userAgent='" + userAgent + '\'' +
- ", networkProxy=" + networkProxy +
- '}';
- }
-}
default-lazy-init="true">
<context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.proxy.maven"/>
+ <context:component-scan base-package="org.apache.archiva.maven.proxy"/>
</beans>
\ No newline at end of file
import org.apache.archiva.indexer.IndexUpdateFailedException;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
import org.apache.archiva.proxy.ProxyRegistry;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryException;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryException;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.EditableRepository;
import org.apache.archiva.repository.ManagedRepository;
--- /dev/null
+package org.apache.archiva.maven.metadata;
+/*
+ * 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.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.archiva.model.Plugin;
+import org.apache.archiva.model.SnapshotVersion;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.metadata.MetadataReader;
+import org.apache.archiva.repository.metadata.RepositoryMetadataException;
+import org.apache.archiva.repository.storage.StorageAsset;
+import org.apache.archiva.xml.XMLException;
+import org.apache.archiva.xml.XMLReader;
+import org.apache.archiva.xml.XmlUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.time.Instant;
+import java.util.Date;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M3
+ */
+@Service("metadataReader#maven")
+public class MavenMetadataReader implements MetadataReader
+{
+ public static final String MAVEN_METADATA = "maven-metadata.xml";
+
+
+ /*
+ <?xml version="1.0" encoding="UTF-8"?>
+ <metadata modelVersion="1.1.0">
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva</artifactId>
+ <version>1.4-M3-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20120310.230917</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ <lastUpdated>20120310230917</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <extension>pom</extension>
+ <value>1.4-M3-20120310.230917-2</value>
+ <updated>20120310230917</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+ </metadata>
+ */
+
+ private static final Logger log = LoggerFactory.getLogger( MavenMetadataReader.class );
+
+
+ /**
+ * Read and return the {@link org.apache.archiva.model.ArchivaRepositoryMetadata} object from the provided xml file.
+ *
+ * @param metadataFile the maven-metadata.xml file to read.
+ * @return the archiva repository metadata object that represents the provided file contents.
+ * @throws RepositoryMetadataException if the file cannot be read
+ */
+ public ArchivaRepositoryMetadata read( StorageAsset metadataFile )
+ throws RepositoryMetadataException {
+
+ XMLReader xml;
+ try
+ {
+ xml = new XMLReader( "metadata", metadataFile );
+ }
+ catch ( XMLException e )
+ {
+ throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
+ }
+ return read( xml, metadataFile.getModificationTime(), metadataFile.getSize() );
+
+ }
+
+ public ArchivaRepositoryMetadata read( Path metadataFile )
+ throws RepositoryMetadataException {
+
+ XMLReader xml;
+ try
+ {
+ xml = new XMLReader( "metadata", metadataFile );
+ }
+ catch ( XMLException e )
+ {
+ log.error( "XML error while reading metadata file {}: {}", metadataFile, e.getMessage(), e );
+ throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
+ }
+ try
+ {
+ return read( xml, Files.getLastModifiedTime( metadataFile ).toInstant(), Files.size( metadataFile ) );
+ }
+ catch ( IOException e )
+ {
+ log.error( "IO Error while reading metadata file {}: {}", metadataFile, e.getMessage(), e );
+ throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
+ }
+
+ }
+
+ private ArchivaRepositoryMetadata read( XMLReader xml, Instant modTime, long fileSize) throws RepositoryMetadataException
+ {
+ // invoke this to remove namespaces, see MRM-1136
+ xml.removeNamespaces();
+
+ ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
+
+ try
+ {
+ metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
+ metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
+ metadata.setVersion( xml.getElementText( "//metadata/version" ) );
+ metadata.setFileLastModified( Date.from(modTime) );
+ metadata.setFileSize( fileSize );
+ metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
+ metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
+ metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
+ metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );
+
+ Element snapshotElem = xml.getElement( "//metadata/versioning/snapshot" );
+ if ( snapshotElem != null )
+ {
+ SnapshotVersion snapshot = new SnapshotVersion( );
+ snapshot.setTimestamp( XmlUtil.getChildText( snapshotElem, "timestamp" ) );
+ String buildNumber = XmlUtil.getChildText( snapshotElem, "buildNumber" );
+ if ( NumberUtils.isCreatable( buildNumber ) )
+ {
+ snapshot.setBuildNumber( NumberUtils.toInt( buildNumber ) );
+ }
+ metadata.setSnapshotVersion( snapshot );
+ }
+
+ for ( Node node : xml.getElementList( "//metadata/plugins/plugin" ) )
+ {
+ if ( node instanceof Element )
+ {
+ Element plugin = (Element) node;
+ Plugin p = new Plugin( );
+ String prefix = plugin.getElementsByTagName( "prefix" ).item( 0 ).getTextContent( ).trim( );
+ p.setPrefix( prefix );
+ String artifactId = plugin.getElementsByTagName( "artifactId" ).item( 0 ).getTextContent( ).trim( );
+ p.setArtifactId( artifactId );
+ String name = plugin.getElementsByTagName( "name" ).item( 0 ).getTextContent( ).trim( );
+ p.setName( name );
+ metadata.addPlugin( p );
+ }
+ }
+ } catch ( XMLException e) {
+ throw new RepositoryMetadataException( "XML Error while reading metadata file : " + e.getMessage( ), e );
+ }
+ return metadata;
+ }
+
+ @Override
+ public boolean isValidMetadataPath( String path )
+ {
+ if ( StringUtils.isNotEmpty( path ) ) {
+ return path.endsWith( MAVEN_METADATA );
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isValidForType( RepositoryType repositoryType )
+ {
+ return RepositoryType.MAVEN.equals( repositoryType );
+ }
+}
--- /dev/null
+package org.apache.archiva.maven.metadata.model;
+
+/*
+ * 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.archiva.metadata.model.MetadataFacet;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class MavenArtifactFacet
+ implements MetadataFacet
+{
+ private String classifier;
+
+ private String type;
+
+ private String timestamp;
+
+ private int buildNumber;
+
+ public static final String FACET_ID = "org.apache.archiva.metadata.repository.storage.maven2.artifact";
+
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ public void setClassifier( String classifier )
+ {
+ this.classifier = classifier;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ public String getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp( String timestamp )
+ {
+ this.timestamp = timestamp;
+ }
+
+ public int getBuildNumber()
+ {
+ return buildNumber;
+ }
+
+ public void setBuildNumber( int buildNumber )
+ {
+ this.buildNumber = buildNumber;
+ }
+
+ @Override
+ public String getFacetId()
+ {
+ return FACET_ID;
+ }
+
+ @Override
+ public String getName()
+ {
+ // TODO: not needed, perhaps artifact/version metadata facet should be separate interface?
+ return null;
+ }
+
+ @Override
+ public Map<String, String> toProperties()
+ {
+ Map<String, String> properties = new HashMap<>();
+ properties.put( "type", type );
+ if ( classifier != null )
+ {
+ properties.put( "classifier", classifier );
+ }
+ if ( timestamp != null )
+ {
+ properties.put( "timestamp", timestamp );
+ }
+ if ( buildNumber > 0 )
+ {
+ properties.put( "buildNumber", Integer.toString( buildNumber ) );
+ }
+ return properties;
+ }
+
+ @Override
+ public void fromProperties( Map<String, String> properties )
+ {
+ type = properties.get( "type" );
+ classifier = properties.get( "classifier" );
+ timestamp = properties.get( "timestamp" );
+ String buildNumber = properties.get( "buildNumber" );
+ if ( buildNumber != null )
+ {
+ this.buildNumber = Integer.parseInt( buildNumber );
+ }
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof MavenArtifactFacet ) )
+ {
+ return false;
+ }
+
+ MavenArtifactFacet that = (MavenArtifactFacet) o;
+
+ return StringUtils.equals( that.getClassifier(), this.classifier );
+ }
+
+}
+++ /dev/null
-package org.apache.archiva.metadata.maven;
-/*
- * 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.archiva.model.ArchivaRepositoryMetadata;
-import org.apache.archiva.model.Plugin;
-import org.apache.archiva.model.SnapshotVersion;
-import org.apache.archiva.repository.RepositoryType;
-import org.apache.archiva.repository.metadata.MetadataReader;
-import org.apache.archiva.repository.metadata.RepositoryMetadataException;
-import org.apache.archiva.repository.storage.StorageAsset;
-import org.apache.archiva.xml.XMLException;
-import org.apache.archiva.xml.XMLReader;
-import org.apache.archiva.xml.XmlUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.math.NumberUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.time.Instant;
-import java.util.Date;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M3
- */
-@Service("metadataReader#maven")
-public class MavenMetadataReader implements MetadataReader
-{
- public static final String MAVEN_METADATA = "maven-metadata.xml";
-
-
- /*
- <?xml version="1.0" encoding="UTF-8"?>
- <metadata modelVersion="1.1.0">
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva</artifactId>
- <version>1.4-M3-SNAPSHOT</version>
- <versioning>
- <snapshot>
- <timestamp>20120310.230917</timestamp>
- <buildNumber>2</buildNumber>
- </snapshot>
- <lastUpdated>20120310230917</lastUpdated>
- <snapshotVersions>
- <snapshotVersion>
- <extension>pom</extension>
- <value>1.4-M3-20120310.230917-2</value>
- <updated>20120310230917</updated>
- </snapshotVersion>
- </snapshotVersions>
- </versioning>
- </metadata>
- */
-
- private static final Logger log = LoggerFactory.getLogger( MavenMetadataReader.class );
-
-
- /**
- * Read and return the {@link org.apache.archiva.model.ArchivaRepositoryMetadata} object from the provided xml file.
- *
- * @param metadataFile the maven-metadata.xml file to read.
- * @return the archiva repository metadata object that represents the provided file contents.
- * @throws RepositoryMetadataException if the file cannot be read
- */
- public ArchivaRepositoryMetadata read( StorageAsset metadataFile )
- throws RepositoryMetadataException {
-
- XMLReader xml;
- try
- {
- xml = new XMLReader( "metadata", metadataFile );
- }
- catch ( XMLException e )
- {
- throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
- }
- return read( xml, metadataFile.getModificationTime(), metadataFile.getSize() );
-
- }
-
- public ArchivaRepositoryMetadata read( Path metadataFile )
- throws RepositoryMetadataException {
-
- XMLReader xml;
- try
- {
- xml = new XMLReader( "metadata", metadataFile );
- }
- catch ( XMLException e )
- {
- log.error( "XML error while reading metadata file {}: {}", metadataFile, e.getMessage(), e );
- throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
- }
- try
- {
- return read( xml, Files.getLastModifiedTime( metadataFile ).toInstant(), Files.size( metadataFile ) );
- }
- catch ( IOException e )
- {
- log.error( "IO Error while reading metadata file {}: {}", metadataFile, e.getMessage(), e );
- throw new RepositoryMetadataException( "Could not open XML metadata file " + metadataFile, e );
- }
-
- }
-
- private ArchivaRepositoryMetadata read( XMLReader xml, Instant modTime, long fileSize) throws RepositoryMetadataException
- {
- // invoke this to remove namespaces, see MRM-1136
- xml.removeNamespaces();
-
- ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
-
- try
- {
- metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
- metadata.setArtifactId( xml.getElementText( "//metadata/artifactId" ) );
- metadata.setVersion( xml.getElementText( "//metadata/version" ) );
- metadata.setFileLastModified( Date.from(modTime) );
- metadata.setFileSize( fileSize );
- metadata.setLastUpdated( xml.getElementText( "//metadata/versioning/lastUpdated" ) );
- metadata.setLatestVersion( xml.getElementText( "//metadata/versioning/latest" ) );
- metadata.setReleasedVersion( xml.getElementText( "//metadata/versioning/release" ) );
- metadata.setAvailableVersions( xml.getElementListText( "//metadata/versioning/versions/version" ) );
-
- Element snapshotElem = xml.getElement( "//metadata/versioning/snapshot" );
- if ( snapshotElem != null )
- {
- SnapshotVersion snapshot = new SnapshotVersion( );
- snapshot.setTimestamp( XmlUtil.getChildText( snapshotElem, "timestamp" ) );
- String buildNumber = XmlUtil.getChildText( snapshotElem, "buildNumber" );
- if ( NumberUtils.isCreatable( buildNumber ) )
- {
- snapshot.setBuildNumber( NumberUtils.toInt( buildNumber ) );
- }
- metadata.setSnapshotVersion( snapshot );
- }
-
- for ( Node node : xml.getElementList( "//metadata/plugins/plugin" ) )
- {
- if ( node instanceof Element )
- {
- Element plugin = (Element) node;
- Plugin p = new Plugin( );
- String prefix = plugin.getElementsByTagName( "prefix" ).item( 0 ).getTextContent( ).trim( );
- p.setPrefix( prefix );
- String artifactId = plugin.getElementsByTagName( "artifactId" ).item( 0 ).getTextContent( ).trim( );
- p.setArtifactId( artifactId );
- String name = plugin.getElementsByTagName( "name" ).item( 0 ).getTextContent( ).trim( );
- p.setName( name );
- metadata.addPlugin( p );
- }
- }
- } catch ( XMLException e) {
- throw new RepositoryMetadataException( "XML Error while reading metadata file : " + e.getMessage( ), e );
- }
- return metadata;
- }
-
- @Override
- public boolean isValidMetadataPath( String path )
- {
- if ( StringUtils.isNotEmpty( path ) ) {
- return path.endsWith( MAVEN_METADATA );
- } else {
- return false;
- }
- }
-
- @Override
- public boolean isValidForType( RepositoryType repositoryType )
- {
- return RepositoryType.MAVEN.equals( repositoryType );
- }
-}
+++ /dev/null
-package org.apache.archiva.metadata.maven.model;
-
-/*
- * 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.archiva.metadata.model.MetadataFacet;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class MavenArtifactFacet
- implements MetadataFacet
-{
- private String classifier;
-
- private String type;
-
- private String timestamp;
-
- private int buildNumber;
-
- public static final String FACET_ID = "org.apache.archiva.metadata.repository.storage.maven2.artifact";
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public void setClassifier( String classifier )
- {
- this.classifier = classifier;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public String getTimestamp()
- {
- return timestamp;
- }
-
- public void setTimestamp( String timestamp )
- {
- this.timestamp = timestamp;
- }
-
- public int getBuildNumber()
- {
- return buildNumber;
- }
-
- public void setBuildNumber( int buildNumber )
- {
- this.buildNumber = buildNumber;
- }
-
- @Override
- public String getFacetId()
- {
- return FACET_ID;
- }
-
- @Override
- public String getName()
- {
- // TODO: not needed, perhaps artifact/version metadata facet should be separate interface?
- return null;
- }
-
- @Override
- public Map<String, String> toProperties()
- {
- Map<String, String> properties = new HashMap<>();
- properties.put( "type", type );
- if ( classifier != null )
- {
- properties.put( "classifier", classifier );
- }
- if ( timestamp != null )
- {
- properties.put( "timestamp", timestamp );
- }
- if ( buildNumber > 0 )
- {
- properties.put( "buildNumber", Integer.toString( buildNumber ) );
- }
- return properties;
- }
-
- @Override
- public void fromProperties( Map<String, String> properties )
- {
- type = properties.get( "type" );
- classifier = properties.get( "classifier" );
- timestamp = properties.get( "timestamp" );
- String buildNumber = properties.get( "buildNumber" );
- if ( buildNumber != null )
- {
- this.buildNumber = Integer.parseInt( buildNumber );
- }
- }
-
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
- if ( !( o instanceof MavenArtifactFacet ) )
- {
- return false;
- }
-
- MavenArtifactFacet that = (MavenArtifactFacet) o;
-
- return StringUtils.equals( that.getClassifier(), this.classifier );
- }
-
-}
default-lazy-init="true">
<context:annotation-config/>
- <context:component-scan base-package="org.apache.archiva.metadata.maven"/>
+ <context:component-scan base-package="org.apache.archiva.maven.metadata"/>
</beans>
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.maven.proxy;
+
+/*
+ * 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.archiva.proxy.DefaultRepositoryProxyHandler;
+import org.apache.archiva.proxy.NotFoundException;
+import org.apache.archiva.proxy.NotModifiedException;
+import org.apache.archiva.proxy.ProxyException;
+import org.apache.archiva.proxy.model.NetworkProxy;
+import org.apache.archiva.proxy.model.ProxyConnector;
+import org.apache.archiva.proxy.model.RepositoryProxyHandler;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.base.PasswordCredentials;
+import org.apache.archiva.repository.storage.StorageAsset;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.WagonException;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.apache.maven.wagon.repository.Repository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * DefaultRepositoryProxyHandler
+ * TODO exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than
+ * your average brown onion
+ */
+@Service( "repositoryProxyHandler#maven" )
+public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler {
+
+ private static final Logger log = LoggerFactory.getLogger( MavenRepositoryProxyHandler.class );
+
+ private static final List<RepositoryType> REPOSITORY_TYPES = new ArrayList<>();
+
+ static {
+ REPOSITORY_TYPES.add(RepositoryType.MAVEN);
+ }
+
+ @Inject
+ private WagonFactory wagonFactory;
+
+ private ConcurrentMap<String, ProxyInfo> networkProxyMap = new ConcurrentHashMap<>();
+
+ @Override
+ public void initialize() {
+ super.initialize();
+ }
+
+ private void updateWagonProxyInfo(Map<String, NetworkProxy> proxyList) {
+ this.networkProxyMap.clear();
+ for (Map.Entry<String, NetworkProxy> proxyEntry : proxyList.entrySet()) {
+ String key = proxyEntry.getKey();
+ NetworkProxy networkProxyDef = proxyEntry.getValue();
+
+ ProxyInfo proxy = new ProxyInfo();
+
+ proxy.setType(networkProxyDef.getProtocol());
+ proxy.setHost(networkProxyDef.getHost());
+ proxy.setPort(networkProxyDef.getPort());
+ proxy.setUserName(networkProxyDef.getUsername());
+ proxy.setPassword(new String(networkProxyDef.getPassword()));
+
+ this.networkProxyMap.put(key, proxy);
+ }
+ }
+
+ @Override
+ public void setNetworkProxies(Map<String, NetworkProxy> networkProxies ) {
+ super.setNetworkProxies( networkProxies );
+ updateWagonProxyInfo( networkProxies );
+ }
+
+ /**
+ * @param connector
+ * @param remoteRepository
+ * @param tmpResource
+ * @param checksumFiles
+ * @param url
+ * @param remotePath
+ * @param resource
+ * @param workingDirectory
+ * @param repository
+ * @throws ProxyException
+ * @throws NotModifiedException
+ */
+ @Override
+ protected void transferResources( ProxyConnector connector, RemoteRepository remoteRepository,
+ StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource,
+ Path workingDirectory, ManagedRepository repository )
+ throws ProxyException, NotModifiedException {
+ Wagon wagon = null;
+ try {
+ URI repoUrl = remoteRepository.getLocation( );
+ String protocol = repoUrl.getScheme( );
+ NetworkProxy networkProxy = null;
+ String proxyId = connector.getProxyId();
+ if (StringUtils.isNotBlank(proxyId)) {
+
+ networkProxy = getNetworkProxy(proxyId);
+ }
+ WagonFactoryRequest wagonFactoryRequest = new WagonFactoryRequest("wagon#" + protocol,
+ remoteRepository.getExtraHeaders());
+ if (networkProxy == null) {
+
+ log.warn("No network proxy with id {} found for connector {}->{}", proxyId,
+ connector.getSourceRepository().getId(), connector.getTargetRepository().getId());
+ } else {
+ wagonFactoryRequest = wagonFactoryRequest.networkProxy(networkProxy);
+ }
+ wagon = wagonFactory.getWagon(wagonFactoryRequest);
+ if (wagon == null) {
+ throw new ProxyException("Unsupported target repository protocol: " + protocol);
+ }
+
+ boolean connected = connectToRepository(connector, wagon, remoteRepository);
+ if (connected) {
+ transferArtifact(wagon, remoteRepository, remotePath, resource.getFilePath(),
+ tmpResource);
+
+ // TODO: these should be used to validate the download based on the policies, not always downloaded
+ // to
+ // save on connections since md5 is rarely used
+ for ( StorageAsset checksumFile : checksumFiles )
+ {
+ String ext = "." + StringUtils.substringAfterLast( checksumFile.getName( ), "." );
+ transferChecksum( wagon, remoteRepository, remotePath, resource.getFilePath( ), ext,
+ checksumFile.getFilePath( ) );
+ }
+ }
+ }
+ catch (NotModifiedException e) {
+ // Do not cache url here.
+ throw e;
+ }
+ catch ( ProxyException e) {
+ urlFailureCache.cacheFailure(url);
+ throw e;
+ }
+ catch (WagonFactoryException e) {
+ throw new ProxyException(e.getMessage(), e);
+ } finally {
+ if (wagon != null) {
+ try {
+ wagon.disconnect();
+ } catch (ConnectionException e) {
+ log.warn("Unable to disconnect wagon.", e);
+ }
+ }
+ }
+ }
+
+ protected void transferArtifact( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
+ Path resource,
+ StorageAsset destFile )
+ throws ProxyException {
+ transferSimpleFile(wagon, remoteRepository, remotePath, resource, destFile.getFilePath());
+ }
+
+ /**
+ * <p>
+ * Quietly transfer the checksum file from the remote repository to the local file.
+ * </p>
+ *
+ * @param wagon the wagon instance (should already be connected) to use.
+ * @param remoteRepository the remote repository to transfer from.
+ * @param remotePath the remote path to the resource to get.
+ * @param resource the local file that should contain the downloaded contents
+ * @param ext the type of checksum to transfer (example: ".md5" or ".sha1")
+ * @throws ProxyException if copying the downloaded file into place did not succeed.
+ */
+ protected void transferChecksum( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
+ Path resource, String ext,
+ Path destFile )
+ throws ProxyException {
+ String url = remoteRepository.getLocation().toString() + remotePath + ext;
+
+ // Transfer checksum does not use the policy.
+ if (urlFailureCache.hasFailedBefore(url)) {
+ return;
+ }
+
+ try {
+ transferSimpleFile(wagon, remoteRepository, remotePath + ext, resource, destFile);
+ log.debug("Checksum {} Downloaded: {} to move to {}", url, destFile, resource);
+ } catch (NotFoundException e) {
+ urlFailureCache.cacheFailure(url);
+ log.debug("Transfer failed, checksum not found: {}", url);
+ // Consume it, do not pass this on.
+ } catch (NotModifiedException e) {
+ log.debug("Transfer skipped, checksum not modified: {}", url);
+ // Consume it, do not pass this on.
+ } catch (ProxyException e) {
+ urlFailureCache.cacheFailure(url);
+ log.warn("Transfer failed on checksum: {} : {}", url, e.getMessage(), e);
+ // Critical issue, pass it on.
+ throw e;
+ }
+ }
+
+ /**
+ * Perform the transfer of the remote file to the local file specified.
+ *
+ * @param wagon the wagon instance to use.
+ * @param remoteRepository the remote repository to use
+ * @param remotePath the remote path to attempt to get
+ * @param origFile the local file to save to
+ * @throws ProxyException if there was a problem moving the downloaded file into place.
+ */
+ protected void transferSimpleFile( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
+ Path origFile, Path destFile )
+ throws ProxyException {
+ assert (remotePath != null);
+
+ // Transfer the file.
+ try {
+
+
+ if (!Files.exists(origFile)) {
+ log.debug("Retrieving {} from {}", remotePath, remoteRepository.getId());
+ wagon.get(addParameters(remotePath, remoteRepository), destFile.toFile());
+
+ // You wouldn't get here on failure, a WagonException would have been thrown.
+ log.debug("Downloaded successfully.");
+ } else {
+ boolean success;
+ log.debug("Retrieving {} from {} if updated", remotePath, remoteRepository.getId());
+ try {
+ success = wagon.getIfNewer(addParameters(remotePath, remoteRepository), destFile.toFile(),
+ Files.getLastModifiedTime(origFile).toMillis());
+ } catch (IOException e) {
+ throw new ProxyException("Failed to the modification time of " + origFile.toAbsolutePath());
+ }
+ if (!success) {
+ throw new NotModifiedException(
+ "Not downloaded, as local file is newer than remote side: " + origFile.toAbsolutePath());
+ }
+
+ if (Files.exists(destFile)) {
+ log.debug("Downloaded successfully.");
+ }
+ }
+ } catch (ResourceDoesNotExistException e) {
+ throw new NotFoundException(
+ "Resource [" + remoteRepository.getLocation() + "/" + remotePath + "] does not exist: " + e.getMessage(),
+ e);
+ } catch (WagonException e) {
+ // TODO: shouldn't have to drill into the cause, but TransferFailedException is often not descriptive enough
+
+ String msg =
+ "Download failure on resource [" + remoteRepository.getLocation() + "/" + remotePath + "]:" + e.getMessage();
+ if (e.getCause() != null) {
+ msg += " (cause: " + e.getCause() + ")";
+ }
+ throw new ProxyException(msg, e);
+ }
+ }
+
+ /**
+ * Using wagon, connect to the remote repository.
+ *
+ * @param connector the connector configuration to utilize (for obtaining network proxy configuration from)
+ * @param wagon the wagon instance to establish the connection on.
+ * @param remoteRepository the remote repository to connect to.
+ * @return true if the connection was successful. false if not connected.
+ */
+ protected boolean connectToRepository(ProxyConnector connector, Wagon wagon,
+ RemoteRepository remoteRepository) {
+ final ProxyInfo networkProxy =
+ connector.getProxyId() == null ? null : this.networkProxyMap.get(connector.getProxyId());
+
+ if (log.isDebugEnabled()) {
+ if (networkProxy != null) {
+ // TODO: move to proxyInfo.toString()
+ String msg = "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort()
+ + " to connect to remote repository " + remoteRepository.getLocation();
+ if (networkProxy.getNonProxyHosts() != null) {
+ msg += "; excluding hosts: " + networkProxy.getNonProxyHosts();
+ }
+ if (StringUtils.isNotBlank(networkProxy.getUserName())) {
+ msg += "; as user: " + networkProxy.getUserName();
+ }
+ log.debug(msg);
+ }
+ }
+
+ AuthenticationInfo authInfo = null;
+ String username = "";
+ String password = "";
+ RepositoryCredentials repCred = remoteRepository.getLoginCredentials();
+ if (repCred != null && repCred instanceof PasswordCredentials ) {
+ PasswordCredentials pwdCred = (PasswordCredentials) repCred;
+ username = pwdCred.getUsername();
+ password = pwdCred.getPassword() == null ? "" : new String(pwdCred.getPassword());
+ }
+
+ if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
+ log.debug("Using username {} to connect to remote repository {}", username, remoteRepository.getLocation());
+ authInfo = new AuthenticationInfo();
+ authInfo.setUserName(username);
+ authInfo.setPassword(password);
+ }
+
+ // Convert seconds to milliseconds
+
+ long timeoutInMilliseconds = remoteRepository.getTimeout().toMillis();
+
+ // Set timeout read and connect
+ // FIXME olamy having 2 config values
+ wagon.setReadTimeout((int) timeoutInMilliseconds);
+ wagon.setTimeout((int) timeoutInMilliseconds);
+
+ try {
+ Repository wagonRepository =
+ new Repository(remoteRepository.getId(), remoteRepository.getLocation().toString());
+ wagon.connect(wagonRepository, authInfo, networkProxy);
+ return true;
+ } catch (ConnectionException | AuthenticationException e) {
+ log.warn("Could not connect to {}: {}", remoteRepository.getId(), e.getMessage());
+ return false;
+ }
+
+ }
+
+
+ public WagonFactory getWagonFactory() {
+ return wagonFactory;
+ }
+
+ public void setWagonFactory(WagonFactory wagonFactory) {
+ this.wagonFactory = wagonFactory;
+ }
+
+ @Override
+ public List<RepositoryType> supports() {
+ return REPOSITORY_TYPES;
+ }
+
+ @Override
+ public void addNetworkproxy( String id, NetworkProxy networkProxy )
+ {
+
+ }
+
+ @Override
+ public <T extends RepositoryProxyHandler> T getHandler( Class<T> clazz ) throws IllegalArgumentException
+ {
+ if (clazz.isAssignableFrom( this.getClass() )) {
+ return (T)this;
+ } else {
+ throw new IllegalArgumentException( "This Proxy Handler is no subclass of " + clazz );
+ }
+ }
+}
+++ /dev/null
-package org.apache.archiva.proxy.maven;
-
-/*
- * 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.archiva.proxy.DefaultRepositoryProxyHandler;
-import org.apache.archiva.proxy.NotFoundException;
-import org.apache.archiva.proxy.NotModifiedException;
-import org.apache.archiva.proxy.ProxyException;
-import org.apache.archiva.proxy.model.NetworkProxy;
-import org.apache.archiva.proxy.model.ProxyConnector;
-import org.apache.archiva.proxy.model.RepositoryProxyHandler;
-import org.apache.archiva.repository.ManagedRepository;
-import org.apache.archiva.repository.RemoteRepository;
-import org.apache.archiva.repository.RepositoryCredentials;
-import org.apache.archiva.repository.RepositoryType;
-import org.apache.archiva.repository.base.PasswordCredentials;
-import org.apache.archiva.repository.storage.StorageAsset;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.maven.wagon.ConnectionException;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.WagonException;
-import org.apache.maven.wagon.authentication.AuthenticationException;
-import org.apache.maven.wagon.authentication.AuthenticationInfo;
-import org.apache.maven.wagon.proxy.ProxyInfo;
-import org.apache.maven.wagon.repository.Repository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * DefaultRepositoryProxyHandler
- * TODO exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than
- * your average brown onion
- */
-@Service( "repositoryProxyHandler#maven" )
-public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler {
-
- private static final Logger log = LoggerFactory.getLogger( MavenRepositoryProxyHandler.class );
-
- private static final List<RepositoryType> REPOSITORY_TYPES = new ArrayList<>();
-
- static {
- REPOSITORY_TYPES.add(RepositoryType.MAVEN);
- }
-
- @Inject
- private WagonFactory wagonFactory;
-
- private ConcurrentMap<String, ProxyInfo> networkProxyMap = new ConcurrentHashMap<>();
-
- @Override
- public void initialize() {
- super.initialize();
- }
-
- private void updateWagonProxyInfo(Map<String, NetworkProxy> proxyList) {
- this.networkProxyMap.clear();
- for (Map.Entry<String, NetworkProxy> proxyEntry : proxyList.entrySet()) {
- String key = proxyEntry.getKey();
- NetworkProxy networkProxyDef = proxyEntry.getValue();
-
- ProxyInfo proxy = new ProxyInfo();
-
- proxy.setType(networkProxyDef.getProtocol());
- proxy.setHost(networkProxyDef.getHost());
- proxy.setPort(networkProxyDef.getPort());
- proxy.setUserName(networkProxyDef.getUsername());
- proxy.setPassword(new String(networkProxyDef.getPassword()));
-
- this.networkProxyMap.put(key, proxy);
- }
- }
-
- @Override
- public void setNetworkProxies(Map<String, NetworkProxy> networkProxies ) {
- super.setNetworkProxies( networkProxies );
- updateWagonProxyInfo( networkProxies );
- }
-
- /**
- * @param connector
- * @param remoteRepository
- * @param tmpResource
- * @param checksumFiles
- * @param url
- * @param remotePath
- * @param resource
- * @param workingDirectory
- * @param repository
- * @throws ProxyException
- * @throws NotModifiedException
- */
- @Override
- protected void transferResources( ProxyConnector connector, RemoteRepository remoteRepository,
- StorageAsset tmpResource, StorageAsset[] checksumFiles, String url, String remotePath, StorageAsset resource,
- Path workingDirectory, ManagedRepository repository )
- throws ProxyException, NotModifiedException {
- Wagon wagon = null;
- try {
- URI repoUrl = remoteRepository.getLocation( );
- String protocol = repoUrl.getScheme( );
- NetworkProxy networkProxy = null;
- String proxyId = connector.getProxyId();
- if (StringUtils.isNotBlank(proxyId)) {
-
- networkProxy = getNetworkProxy(proxyId);
- }
- WagonFactoryRequest wagonFactoryRequest = new WagonFactoryRequest("wagon#" + protocol,
- remoteRepository.getExtraHeaders());
- if (networkProxy == null) {
-
- log.warn("No network proxy with id {} found for connector {}->{}", proxyId,
- connector.getSourceRepository().getId(), connector.getTargetRepository().getId());
- } else {
- wagonFactoryRequest = wagonFactoryRequest.networkProxy(networkProxy);
- }
- wagon = wagonFactory.getWagon(wagonFactoryRequest);
- if (wagon == null) {
- throw new ProxyException("Unsupported target repository protocol: " + protocol);
- }
-
- boolean connected = connectToRepository(connector, wagon, remoteRepository);
- if (connected) {
- transferArtifact(wagon, remoteRepository, remotePath, resource.getFilePath(),
- tmpResource);
-
- // TODO: these should be used to validate the download based on the policies, not always downloaded
- // to
- // save on connections since md5 is rarely used
- for ( StorageAsset checksumFile : checksumFiles )
- {
- String ext = "." + StringUtils.substringAfterLast( checksumFile.getName( ), "." );
- transferChecksum( wagon, remoteRepository, remotePath, resource.getFilePath( ), ext,
- checksumFile.getFilePath( ) );
- }
- }
- }
- catch (NotModifiedException e) {
- // Do not cache url here.
- throw e;
- }
- catch ( ProxyException e) {
- urlFailureCache.cacheFailure(url);
- throw e;
- }
- catch (WagonFactoryException e) {
- throw new ProxyException(e.getMessage(), e);
- } finally {
- if (wagon != null) {
- try {
- wagon.disconnect();
- } catch (ConnectionException e) {
- log.warn("Unable to disconnect wagon.", e);
- }
- }
- }
- }
-
- protected void transferArtifact( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
- Path resource,
- StorageAsset destFile )
- throws ProxyException {
- transferSimpleFile(wagon, remoteRepository, remotePath, resource, destFile.getFilePath());
- }
-
- /**
- * <p>
- * Quietly transfer the checksum file from the remote repository to the local file.
- * </p>
- *
- * @param wagon the wagon instance (should already be connected) to use.
- * @param remoteRepository the remote repository to transfer from.
- * @param remotePath the remote path to the resource to get.
- * @param resource the local file that should contain the downloaded contents
- * @param ext the type of checksum to transfer (example: ".md5" or ".sha1")
- * @throws ProxyException if copying the downloaded file into place did not succeed.
- */
- protected void transferChecksum( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
- Path resource, String ext,
- Path destFile )
- throws ProxyException {
- String url = remoteRepository.getLocation().toString() + remotePath + ext;
-
- // Transfer checksum does not use the policy.
- if (urlFailureCache.hasFailedBefore(url)) {
- return;
- }
-
- try {
- transferSimpleFile(wagon, remoteRepository, remotePath + ext, resource, destFile);
- log.debug("Checksum {} Downloaded: {} to move to {}", url, destFile, resource);
- } catch (NotFoundException e) {
- urlFailureCache.cacheFailure(url);
- log.debug("Transfer failed, checksum not found: {}", url);
- // Consume it, do not pass this on.
- } catch (NotModifiedException e) {
- log.debug("Transfer skipped, checksum not modified: {}", url);
- // Consume it, do not pass this on.
- } catch (ProxyException e) {
- urlFailureCache.cacheFailure(url);
- log.warn("Transfer failed on checksum: {} : {}", url, e.getMessage(), e);
- // Critical issue, pass it on.
- throw e;
- }
- }
-
- /**
- * Perform the transfer of the remote file to the local file specified.
- *
- * @param wagon the wagon instance to use.
- * @param remoteRepository the remote repository to use
- * @param remotePath the remote path to attempt to get
- * @param origFile the local file to save to
- * @throws ProxyException if there was a problem moving the downloaded file into place.
- */
- protected void transferSimpleFile( Wagon wagon, RemoteRepository remoteRepository, String remotePath,
- Path origFile, Path destFile )
- throws ProxyException {
- assert (remotePath != null);
-
- // Transfer the file.
- try {
-
-
- if (!Files.exists(origFile)) {
- log.debug("Retrieving {} from {}", remotePath, remoteRepository.getId());
- wagon.get(addParameters(remotePath, remoteRepository), destFile.toFile());
-
- // You wouldn't get here on failure, a WagonException would have been thrown.
- log.debug("Downloaded successfully.");
- } else {
- boolean success;
- log.debug("Retrieving {} from {} if updated", remotePath, remoteRepository.getId());
- try {
- success = wagon.getIfNewer(addParameters(remotePath, remoteRepository), destFile.toFile(),
- Files.getLastModifiedTime(origFile).toMillis());
- } catch (IOException e) {
- throw new ProxyException("Failed to the modification time of " + origFile.toAbsolutePath());
- }
- if (!success) {
- throw new NotModifiedException(
- "Not downloaded, as local file is newer than remote side: " + origFile.toAbsolutePath());
- }
-
- if (Files.exists(destFile)) {
- log.debug("Downloaded successfully.");
- }
- }
- } catch (ResourceDoesNotExistException e) {
- throw new NotFoundException(
- "Resource [" + remoteRepository.getLocation() + "/" + remotePath + "] does not exist: " + e.getMessage(),
- e);
- } catch (WagonException e) {
- // TODO: shouldn't have to drill into the cause, but TransferFailedException is often not descriptive enough
-
- String msg =
- "Download failure on resource [" + remoteRepository.getLocation() + "/" + remotePath + "]:" + e.getMessage();
- if (e.getCause() != null) {
- msg += " (cause: " + e.getCause() + ")";
- }
- throw new ProxyException(msg, e);
- }
- }
-
- /**
- * Using wagon, connect to the remote repository.
- *
- * @param connector the connector configuration to utilize (for obtaining network proxy configuration from)
- * @param wagon the wagon instance to establish the connection on.
- * @param remoteRepository the remote repository to connect to.
- * @return true if the connection was successful. false if not connected.
- */
- protected boolean connectToRepository(ProxyConnector connector, Wagon wagon,
- RemoteRepository remoteRepository) {
- final ProxyInfo networkProxy =
- connector.getProxyId() == null ? null : this.networkProxyMap.get(connector.getProxyId());
-
- if (log.isDebugEnabled()) {
- if (networkProxy != null) {
- // TODO: move to proxyInfo.toString()
- String msg = "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort()
- + " to connect to remote repository " + remoteRepository.getLocation();
- if (networkProxy.getNonProxyHosts() != null) {
- msg += "; excluding hosts: " + networkProxy.getNonProxyHosts();
- }
- if (StringUtils.isNotBlank(networkProxy.getUserName())) {
- msg += "; as user: " + networkProxy.getUserName();
- }
- log.debug(msg);
- }
- }
-
- AuthenticationInfo authInfo = null;
- String username = "";
- String password = "";
- RepositoryCredentials repCred = remoteRepository.getLoginCredentials();
- if (repCred != null && repCred instanceof PasswordCredentials ) {
- PasswordCredentials pwdCred = (PasswordCredentials) repCred;
- username = pwdCred.getUsername();
- password = pwdCred.getPassword() == null ? "" : new String(pwdCred.getPassword());
- }
-
- if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
- log.debug("Using username {} to connect to remote repository {}", username, remoteRepository.getLocation());
- authInfo = new AuthenticationInfo();
- authInfo.setUserName(username);
- authInfo.setPassword(password);
- }
-
- // Convert seconds to milliseconds
-
- long timeoutInMilliseconds = remoteRepository.getTimeout().toMillis();
-
- // Set timeout read and connect
- // FIXME olamy having 2 config values
- wagon.setReadTimeout((int) timeoutInMilliseconds);
- wagon.setTimeout((int) timeoutInMilliseconds);
-
- try {
- Repository wagonRepository =
- new Repository(remoteRepository.getId(), remoteRepository.getLocation().toString());
- wagon.connect(wagonRepository, authInfo, networkProxy);
- return true;
- } catch (ConnectionException | AuthenticationException e) {
- log.warn("Could not connect to {}: {}", remoteRepository.getId(), e.getMessage());
- return false;
- }
-
- }
-
-
- public WagonFactory getWagonFactory() {
- return wagonFactory;
- }
-
- public void setWagonFactory(WagonFactory wagonFactory) {
- this.wagonFactory = wagonFactory;
- }
-
- @Override
- public List<RepositoryType> supports() {
- return REPOSITORY_TYPES;
- }
-
- @Override
- public void addNetworkproxy( String id, NetworkProxy networkProxy )
- {
-
- }
-
- @Override
- public <T extends RepositoryProxyHandler> T getHandler( Class<T> clazz ) throws IllegalArgumentException
- {
- if (clazz.isAssignableFrom( this.getClass() )) {
- return (T)this;
- } else {
- throw new IllegalArgumentException( "This Proxy Handler is no subclass of " + clazz );
- }
- }
-}
*/
import junit.framework.TestCase;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.maven.wagon.Wagon;
import org.junit.Test;
throws Exception
{
- Wagon first = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) );
+ Wagon first = factory.getWagon( new WagonFactoryRequest().protocol( "wagon#file" ) );
- Wagon second = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) );
+ Wagon second = factory.getWagon( new WagonFactoryRequest().protocol( "wagon#file" ) );
// ensure we support only protocol name too
Wagon third = factory.getWagon( new WagonFactoryRequest().protocol( "file" ) );
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.repository.content.BaseRepositoryContentLayout;
import org.apache.archiva.repository.content.ContentAccessException;
<bean name="repositoryContentProvider#mocked" class="org.apache.archiva.repository.mock.RepositoryContentProviderMock" />
- <bean name="repositoryProxyHandler#test" class="org.apache.archiva.proxy.maven.MavenRepositoryProxyHandler">
+ <bean name="repositoryProxyHandler#test" class="org.apache.archiva.maven.proxy.MavenRepositoryProxyHandler">
<property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
<property name="metadataTools" ref="metadataTools#mocked"/>
</bean>
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ItemDeleteStatus;
import org.apache.archiva.repository.ManagedRepository;
*/
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.maven2.model.TreeEntry;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.filter.Filter;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
*/
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.common.Try;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.filter.Filter;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.proxy.ProxyRegistry;
-import org.apache.archiva.proxy.maven.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactory;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.proxy.model.ProxyConnector;
import org.apache.archiva.proxy.model.RepositoryProxyHandler;
* under the License.
*/
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.facets.AbstractMetadataFacetFactory;
import org.springframework.stereotype.Service;
*/
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.SnapshotVersion;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryException;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryException;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RemoteRepository;
* under the License.
*/
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.repository.maven.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.FileType;
import org.apache.archiva.configuration.FileTypes;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ManagedRepository;
*/
import org.apache.archiva.common.filelock.DefaultFileLockManager;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.archiva.repository.storage.StorageAsset;
*/
import junit.framework.TestCase;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
import org.apache.archiva.metadata.model.MailingList;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
-import org.apache.archiva.proxy.maven.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactory;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
import org.junit.Before;
import org.apache.archiva.filter.AllFilter;
import org.apache.archiva.filter.ExcludesFilter;
import org.apache.archiva.filter.Filter;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.Dependency;
import org.apache.archiva.metadata.model.License;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException;
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.base.RepositoryHandlerDependencies;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
*/
import junit.framework.TestCase;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.Plugin;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.indexer.IndexUpdateFailedException;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
import org.apache.archiva.proxy.ProxyRegistry;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryException;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryException;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.EditableRepository;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.configuration.ConfigurationEvent;
import org.apache.archiva.configuration.ConfigurationListener;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
-import org.apache.archiva.proxy.maven.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactory;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.features.RemoteIndexFeature;
import org.apache.commons.lang3.StringUtils;
* under the License.
*/
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.base.PasswordCredentials;
import org.apache.archiva.repository.RemoteRepository;
* under the License.
*/
-import org.apache.archiva.proxy.maven.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactory;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.maven.index.packer.IndexPacker;
import org.apache.archiva.indexer.IndexCreationFailedException;
import org.apache.archiva.indexer.IndexUpdateFailedException;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryException;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryException;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.repository.EditableRepository;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.proxy.ProxyRegistry;
-import org.apache.archiva.proxy.maven.WagonFactory;
-import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.maven.proxy.WagonFactory;
+import org.apache.archiva.maven.proxy.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.metadata.audit.RepositoryListener;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.repository.content.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.content.LayoutException;
* under the License.
*/
-import org.apache.archiva.proxy.maven.MavenRepositoryProxyHandler;
+import org.apache.archiva.maven.proxy.MavenRepositoryProxyHandler;
import org.apache.archiva.proxy.model.ProxyFetchResult;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.RepositoryGroupConfiguration;
-import org.apache.archiva.metadata.maven.MavenMetadataReader;
+import org.apache.archiva.maven.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
*/
import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.metadata.QueryParameter;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.CiManagement;
import org.apache.archiva.metadata.model.Dependency;
import junit.framework.TestCase;
import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
+import org.apache.archiva.maven.metadata.model.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;