Author: hwright
Date: Tue Sep  7 22:00:57 2010
New Revision: 993544

URL: http://svn.apache.org/viewvc?rev=993544&view=rev
Log:
On the javahl-ra branch:
Implement the checkPath() RA method for JavaHL.

[ in subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/SVNRATests.java
  (testCheckPath): New.

* native/SVNReposAccess.h
  (checkPath): New.

* native/SVNReposAccess.cpp
  (checkPath): New.

* native/org_apache_subversion_javahl_SVNReposAccess.cpp
  (Java_org_apache_subversion_javahl_SVNReposAccess_checkPath): New.

* src/org/apache/subversion/javahl/ISVNReposAccess.java
  (checkPath): New.

* src/org/apache/subversion/javahl/SVNReposAccess.java
  (checkPath): New.

Modified:
    
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
    
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
    
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
    
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
    
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
    
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
 Tue Sep  7 22:00:57 2010
@@ -28,6 +28,8 @@
 #include "JNIUtil.h"
 #include "JNICriticalSection.h"
 #include "CreateJ.h"
+#include "EnumMapper.h"
+#include "Revision.h"
 
 #include "svn_ra.h"
 #include "svn_private_config.h"
@@ -90,3 +92,17 @@ SVNReposAccess::getLocks(const char *pat
 
   return CreateJ::LockMap(locks, requestPool.pool());
 }
+
+jobject
+SVNReposAccess::checkPath(const char *path, Revision &revision)
+{
+  SVN::Pool requestPool;
+  svn_node_kind_t kind;
+
+  SVN_JNI_ERR(svn_ra_check_path(m_ra_session, path,
+                                revision.revision()->value.number,
+                                &kind, requestPool.pool()),
+              NULL);
+
+  return EnumMapper::mapNodeKind(kind);
+}

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
 Tue Sep  7 22:00:57 2010
@@ -31,11 +31,14 @@
 #include "svn_ra.h"
 #include "SVNBase.h"
 
+class Revision;
+
 class SVNReposAccess : public SVNBase
 {
  public:
   svn_revnum_t getDatedRev(apr_time_t time);
   jobject getLocks(const char *path, svn_depth_t depth);
+  jobject checkPath(const char *path, Revision &revision);
 
   SVNReposAccess(const char *repos_url);
   virtual ~SVNReposAccess();

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
 Tue Sep  7 22:00:57 2010
@@ -28,6 +28,7 @@
 #include "JNIStackElement.h"
 #include "JNIStringHolder.h"
 #include "EnumMapper.h"
+#include "Revision.h"
 
 #include "svn_version.h"
 #include "svn_private_config.h"
@@ -111,3 +112,26 @@ Java_org_apache_subversion_javahl_SVNRep
 
   return ra->getLocks(path, EnumMapper::toDepth(jdepth));
 }
+
+JNIEXPORT jobject JNICALL
+Java_org_apache_subversion_javahl_SVNReposAccess_checkPath
+(JNIEnv *env, jobject jthis, jstring jpath, jobject jrevision)
+{
+  JNIEntry(SVNReposAccess, checkPath);
+  SVNReposAccess *ra = SVNReposAccess::getCppObject(jthis);
+  if (ra == NULL)
+    {
+      JNIUtil::throwError("bad C++ this");
+      return NULL;
+    }
+
+  JNIStringHolder path(jpath);
+  if (JNIUtil::isExceptionThrown())
+    return NULL;
+
+  Revision revision(jrevision);
+  if (JNIUtil::isExceptionThrown())
+    return NULL;
+
+  return ra->checkPath(path, revision);
+}

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
 Tue Sep  7 22:00:57 2010
@@ -52,4 +52,7 @@ public interface ISVNReposAccess
 
     public Map<String, Lock> getLocks(String path, Depth depth)
         throws SubversionException;
+
+    public NodeKind checkPath(String path, Revision revision)
+        throws SubversionException;
 }

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
 Tue Sep  7 22:00:57 2010
@@ -100,4 +100,7 @@ public class SVNReposAccess implements I
 
     public native Map<String, Lock> getLocks(String path, Depth depth)
         throws SubversionException;
+
+    public native NodeKind checkPath(String path, Revision revision)
+        throws SubversionException;
 }

Modified: 
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
URL: 
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java?rev=993544&r1=993543&r2=993544&view=diff
==============================================================================
--- 
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
 (original)
+++ 
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
 Tue Sep  7 22:00:57 2010
@@ -92,4 +92,17 @@ public class SVNRATests extends SVNTests
         assertNotNull(lock);
         assertEquals(lock.getOwner(), "jrandom");
     }
+
+    public void testCheckPath()
+        throws SubversionException, IOException
+    {
+        NodeKind kind = ra.checkPath("iota", Revision.getInstance(1));
+        assertEquals(NodeKind.file, kind);
+
+        kind = ra.checkPath("iota", Revision.getInstance(0));
+        assertEquals(NodeKind.none, kind);
+
+        kind = ra.checkPath("A", Revision.getInstance(1));
+        assertEquals(NodeKind.dir, kind);
+    }
 }


Reply via email to