summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rss/src
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-04-08 10:36:50 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-04-08 10:36:50 +0000
commit66612a985f5fcea7e86af85dd163942cac5db5db (patch)
treefe5f30c4f8d9040611ab5e4e6a0474fbd40e8259 /archiva-modules/archiva-web/archiva-rss/src
parent919466bbd25449259800c25a41f19a2e5a27bb70 (diff)
downloadarchiva-66612a985f5fcea7e86af85dd163942cac5db5db.tar.gz
archiva-66612a985f5fcea7e86af85dd163942cac5db5db.zip
[MRM-123]
-configure host and port of the links in the rss feeds git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645833 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rss/src')
-rw-r--r--archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java48
1 files changed, 41 insertions, 7 deletions
diff --git a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
index 7b556f07a..675731386 100644
--- a/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
+++ b/archiva-modules/archiva-web/archiva-rss/src/main/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessor.java
@@ -22,9 +22,11 @@ package org.apache.archiva.rss.processor;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.apache.archiva.rss.RssFeedEntry;
import org.apache.archiva.rss.RssFeedGenerator;
@@ -53,7 +55,17 @@ public class NewArtifactsRssFeedProcessor
private RssFeedGenerator generator;
private Logger log = LoggerFactory.getLogger( NewArtifactsRssFeedProcessor.class );
-
+
+ /**
+ * The hostname that will be used in the urls for the feed links.
+ */
+ private String host = "localhost";
+
+ /**
+ * The port that will be used in the urls for the feed links.
+ */
+ private String port = "8080";
+
/**
* Process the newly discovered artifacts in the repository. Generate feeds for new artifacts in the repository and
* new versions of artifact.
@@ -62,6 +74,16 @@ public class NewArtifactsRssFeedProcessor
{
log.debug( "Process new artifacts into rss feeds." );
+ if ( System.getProperty( "jetty.host" ) != null )
+ {
+ host = System.getProperty( "jetty.host" );
+ }
+
+ if ( System.getProperty( "jetty.port" ) != null )
+ {
+ port = System.getProperty( "jetty.port" );
+ }
+
processNewArtifactsInRepo( data );
processNewVersionsOfArtifact( data );
}
@@ -73,7 +95,7 @@ public class NewArtifactsRssFeedProcessor
RssFeedEntry entry =
new RssFeedEntry( NEW_ARTIFACTS_IN_REPO + "\'" + repoId + "\'" + " as of " +
- Calendar.getInstance().getTime(), "http://localhost:8080/archiva/rss/new_artifacts_" + repoId + ".xml" );
+ Calendar.getInstance().getTime(), getBaseUrl() + "/archiva/rss/new_artifacts_" + repoId + ".xml" );
String description = "These are the new artifacts found in repository " + "\'" + repoId + "\'" + ": \n";
for ( ArchivaArtifact artifact : data )
@@ -84,7 +106,7 @@ public class NewArtifactsRssFeedProcessor
entries.add( entry );
generateFeed( "new_artifacts_" + repoId + ".xml", NEW_ARTIFACTS_IN_REPO + "\'" + repoId + "\'",
- "http://localhost:8080/archiva/repository/rss/new_artifacts_" + repoId + ".xml",
+ getBaseUrl() + "/archiva/repository/rss/new_artifacts_" + repoId + ".xml",
"New artifacts found in repository " + "\'" + repoId + "\'" + " during repository scan.", entries );
}
@@ -108,7 +130,7 @@ public class NewArtifactsRssFeedProcessor
List<RssFeedEntry> entries = new ArrayList<RssFeedEntry>();
RssFeedEntry entry =
new RssFeedEntry( NEW_VERSIONS_OF_ARTIFACT + "\'" + key + "\'" + " as of " +
- Calendar.getInstance().getTime(), "http://localhost:8080/archiva/rss/new_versions_" + key + ".xml" );
+ Calendar.getInstance().getTime(), getBaseUrl() + "/archiva/rss/new_versions_" + key + ".xml" );
String description =
"These are the new versions of artifact " + "\'" + key + "\'" + " in the repository: \n" +
@@ -116,9 +138,9 @@ public class NewArtifactsRssFeedProcessor
entry.setDescription( description );
entries.add( entry );
-
+
generateFeed( "new_versions_" + key + ".xml", NEW_VERSIONS_OF_ARTIFACT + "\'" + key + "\'",
- "http://localhost:8080/archiva/rss/new_versions_" + key + ".xml",
+ getBaseUrl() + "/archiva/rss/new_versions_" + key + ".xml",
"New versions of artifact " + "\'" + key + "\' found in repository " + "\'" + repoId + "\'" +
" during repository scan.", entries );
}
@@ -173,5 +195,17 @@ public class NewArtifactsRssFeedProcessor
{
this.generator = generator;
}
-
+
+ private String getBaseUrl()
+ {
+ String baseUrl = "http://" + host;
+
+ if( port != null && !"".equals( port ) )
+ {
+ baseUrl = baseUrl + ":" + port;
+ }
+
+ return baseUrl;
+ }
+
}