geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r507680 - in /geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository: AbstractRepository.java Maven1Repository.java Maven2Repository.java
Date Wed, 14 Feb 2007 20:26:07 GMT
Author: djencks
Date: Wed Feb 14 12:26:06 2007
New Revision: 507680

URL: http://svn.apache.org/viewvc?view=rev&rev=507680
Log:
GERONIMO-2814 add flag to Repository so it can resolve against base or server location

Modified:
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/AbstractRepository.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven1Repository.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven2Repository.java

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/AbstractRepository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/AbstractRepository.java?view=diff&rev=507680&r1=507679&r2=507680
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/AbstractRepository.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/AbstractRepository.java
Wed Feb 14 12:26:06 2007
@@ -59,8 +59,8 @@
     protected final File rootFile;
     private final Map typeHandlers = new HashMap();
 
-    public AbstractRepository(URI root, ServerInfo serverInfo) {
-        this(resolveRoot(root, serverInfo));
+    public AbstractRepository(URI root, ServerInfo serverInfo, boolean resolveToServer) {
+        this(resolveRoot(root, serverInfo, resolveToServer));
     }
 
     public AbstractRepository(File rootFile) {
@@ -76,7 +76,7 @@
         typeHandlers.put("car", new UnpackArtifactTypeHandler());
     }
 
-    private static File resolveRoot(URI root, ServerInfo serverInfo) {
+    private static File resolveRoot(URI root, ServerInfo serverInfo, boolean resolveToServer)
{
         if (root == null) throw new NullPointerException("root is null");
 
         if (!root.toString().endsWith("/")) {
@@ -89,7 +89,7 @@
 
         URI resolvedUri;
         if (serverInfo != null) {
-            resolvedUri = serverInfo.resolve(root);
+            resolvedUri = resolveToServer ? serverInfo.resolveServer(root) : serverInfo.resolve(root);
         } else {
             resolvedUri = root;
         }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven1Repository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven1Repository.java?view=diff&rev=507680&r1=507679&r2=507680
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven1Repository.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven1Repository.java
Wed Feb 14 12:26:06 2007
@@ -38,8 +38,8 @@
  * @version $Rev$ $Date$
  */
 public class Maven1Repository extends AbstractRepository implements WritableListableRepository
{
-    public Maven1Repository(URI root, ServerInfo serverInfo) {
-        super(root, serverInfo);
+    public Maven1Repository(URI root, ServerInfo serverInfo, boolean resolveToServer) {
+        super(root, serverInfo, resolveToServer);
     }
 
     public Maven1Repository(File rootFile) {
@@ -166,10 +166,12 @@
         infoFactory.addAttribute("root", URI.class, true);
 
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
+        
+        infoFactory.addAttribute("resolveToServer", Boolean.TYPE, true);
 
         infoFactory.addInterface(Maven1Repository.class);
 
-        infoFactory.setConstructor(new String[]{"root", "ServerInfo"});
+        infoFactory.setConstructor(new String[]{"root", "ServerInfo", "resolveToServer"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven2Repository.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven2Repository.java?view=diff&rev=507680&r1=507679&r2=507680
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven2Repository.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/repository/Maven2Repository.java
Wed Feb 14 12:26:06 2007
@@ -24,6 +24,8 @@
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -34,8 +36,12 @@
  * @version $Rev$ $Date$
  */
 public class Maven2Repository extends AbstractRepository implements WritableListableRepository
{
-    public Maven2Repository(URI root, ServerInfo serverInfo) {
-        super(root, serverInfo);
+    private static final Log log = LogFactory.getLog(Maven2Repository.class);
+    public Maven2Repository(URI root, ServerInfo serverInfo, boolean resolveToServer) {
+        super(root, serverInfo, resolveToServer);
+        log.debug("Maven2Repository(root = " + root + ", resolveToServer = "
+                + resolveToServer + ") rootFile = "
+                + rootFile.getAbsolutePath());
     }
 
     public Maven2Repository(File rootFile) {
@@ -204,8 +210,9 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Maven2Repository.class,
"Repository");
         infoFactory.addAttribute("root", URI.class, true);
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
+        infoFactory.addAttribute("resolveToServer", Boolean.TYPE, true);
         infoFactory.addInterface(Maven2Repository.class);
-        infoFactory.setConstructor(new String[]{"root", "ServerInfo"});
+        infoFactory.setConstructor(new String[]{"root", "ServerInfo", "resolveToServer"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
 



Mime
View raw message