summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-plexus-bridge/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-08-16 13:51:25 +0000
committerOlivier Lamy <olamy@apache.org>2011-08-16 13:51:25 +0000
commitb39ba2f6c511c85032a2f62f559edf0393a6ca05 (patch)
treedfbb4a32fb41c1249d72841ae6ee6d1d33242d99 /archiva-modules/archiva-base/archiva-plexus-bridge/src
parentc7607a63e569a4bbe271fdcf8744d5ba909652a5 (diff)
downloadarchiva-b39ba2f6c511c85032a2f62f559edf0393a6ca05.tar.gz
archiva-b39ba2f6c511c85032a2f62f559edf0393a6ca05.zip
add an other hack when using tomcat maven plugin and issue with TCCL not URLClassLoader with sisu
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1158273 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-plexus-bridge/src')
-rw-r--r--archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/DigesterUtils.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/DigesterUtils.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/DigesterUtils.java
new file mode 100644
index 000000000..a8a72d417
--- /dev/null
+++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/DigesterUtils.java
@@ -0,0 +1,74 @@
+package org.apache.archiva.common.plexusbridge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.digest.Digester;
+import org.codehaus.plexus.digest.Md5Digester;
+import org.codehaus.plexus.digest.Sha1Digester;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Service( "digesterUtils" )
+public class DigesterUtils
+{
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ private List<? extends Digester> allDigesters;
+
+ @Inject
+ public DigesterUtils( PlexusSisuBridge plexusSisuBridge )
+ throws PlexusSisuBridgeException
+ {
+ this.allDigesters = plexusSisuBridge.lookupList( Digester.class );
+
+ if ( allDigesters == null || allDigesters.isEmpty() )
+ {
+ // olamy when the TCL is not a URLClassLoader lookupList fail !
+ // when using tomcat maven plugin so adding a simple hack
+ log.warn( "using lookList from sisu plexus failed so build plexus Digesters manually" );
+
+ allDigesters = Arrays.asList( new Sha1Digester(), new Md5Digester() );
+
+ }
+
+ log.debug( "allIndexCreators {}", allDigesters );
+
+ }
+
+ public List<? extends Digester> getAllDigesters()
+ {
+ return allDigesters;
+ }
+
+ public void setAllDigesters( List<? extends Digester> allDigesters )
+ {
+ this.allDigesters = allDigesters;
+ }
+}