Author: hwright
Date: Thu Sep 2 21:45:15 2010
New Revision: 992125
URL: http://svn.apache.org/viewvc?rev=992125&view=rev
Log:
On the javahl-ra branch:
Add the plumbing to start wrapping the ra layer in JavaHL. This doesn't
actually *do* anything yet, but it does create the initial interface and
test classes.
[ in subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/RunTests.java
(suite): Add the new RA test suite.
* tests/org/apache/subversion/javahl/SVNRATests.java,
src/org/apache/subversion/javahl/ISVNReposAccess.java,
src/org/apache/subversion/javahl/SVNReposAccess.java,
native/SVNReposAccess.h,
native/SVNReposAccess.cpp,
native/org_apache_subversion_javahl_SVNReposAccess.cpp:
New.
Added:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
(with props)
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
(with props)
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
(with props)
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
(with props)
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
(with props)
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
(with props)
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,52 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file SVNReposAccess.cpp
+ * @brief Implementation of the class SVNReposAccess
+ */
+
+#include "SVNReposAccess.h"
+#include "JNIUtil.h"
+#include "svn_ra.h"
+#include "svn_private_config.h"
+
+SVNReposAccess::SVNReposAccess()
+{
+}
+
+SVNReposAccess::~SVNReposAccess()
+{
+}
+
+SVNReposAccess *SVNReposAccess::getCppObject(jobject jthis)
+{
+ static jfieldID fid = 0;
+ jlong cppAddr = SVNBase::findCppAddrForJObject(jthis, &fid,
+
JAVA_PACKAGE"/SVNReposAccess");
+ return (cppAddr == 0 ? NULL : reinterpret_cast<SVNReposAccess *>(cppAddr));
+}
+
+void SVNReposAccess::dispose()
+{
+ static jfieldID fid = 0;
+ SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNReposAccess");
+}
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,45 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ *
+ * @file SVNReposAccess.h
+ * @brief Interface of the class SVNReposAccess
+ */
+
+#ifndef SVNREPOSACCESS_H
+#define SVNREPOSACCESS_H
+
+#include <jni.h>
+#include "svn_ra.h"
+#include "SVNBase.h"
+
+class SVNReposAccess : public SVNBase
+{
+ public:
+ SVNReposAccess();
+ virtual ~SVNReposAccess();
+ void dispose();
+ static SVNReposAccess *getCppObject(jobject jthis);
+
+ private:
+};
+
+#endif // SVNREPOSACCESS_H
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
------------------------------------------------------------------------------
svn:eol-style = native
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,67 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ *
+ * Implementation of the native methods in the Java class SVNReposAccess
+ */
+
+#include "../include/org_apache_subversion_javahl_SVNReposAccess.h"
+#include "JNIUtil.h"
+#include "JNIStackElement.h"
+#include "svn_version.h"
+#include "svn_private_config.h"
+#include "version.h"
+#include <iostream>
+
+#include "SVNReposAccess.h"
+
+JNIEXPORT jlong JNICALL
+Java_org_apache_subversion_javahl_SVNReposAccess_ctNative
+(JNIEnv *env, jobject jthis)
+{
+ JNIEntry(SVNReposAccess, ctNative);
+ SVNReposAccess *obj = new SVNReposAccess;
+ return obj->getCppAddr();
+}
+
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNReposAccess_dispose
+(JNIEnv *env, jobject jthis)
+{
+ JNIEntry(SVNReposAccess, dispose);
+ SVNReposAccess *ra = SVNReposAccess::getCppObject(jthis);
+ if (ra == NULL)
+ {
+ JNIUtil::throwError(_("bad C++ this"));
+ return;
+ }
+ ra->dispose();
+}
+
+JNIEXPORT void JNICALL
+Java_org_apache_subversion_javahl_SVNReposAccess_finalize
+(JNIEnv *env, jobject jthis)
+{
+ JNIEntry(SVNReposAccess, finalize);
+ SVNReposAccess *ra = SVNReposAccess::getCppObject(jthis);
+ if (ra != NULL)
+ ra->finalize();
+}
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,42 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl;
+
+/**
+ * This interface is an interface to interact with a remote Subversion
+ * repository via the repository access method.
+ */
+public interface ISVNReposAccess
+{
+ /**
+ * release the native peer (should not depend on finalize)
+ */
+ void dispose();
+
+ /**
+ * @return Version information about the underlying native libraries.
+ * @since 1.0
+ */
+ public Version getVersion();
+}
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNReposAccess.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,97 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ */
+
+package org.apache.subversion.javahl;
+
+import java.net.URI;
+
+/**
+ * This class allows direct access to remote repositories through a
+ * lower-level API.
+ */
+public class SVNReposAccess implements ISVNReposAccess
+{
+ /**
+ * Load the required native library.
+ */
+ static
+ {
+ NativeResources.loadNativeLibrary();
+ }
+
+ /**
+ * Standard empty contructor, builds just the native peer.
+ */
+ public SVNReposAccess(URI reposURI)
+ {
+ cppAddr = ctNative();
+/*
+ // Ensure that Subversion's config file area and templates exist.
+ try
+ {
+ setConfigDirectory(null);
+ }
+ catch (ClientException suppressed)
+ {
+ // Not an exception-worthy problem, continue on.
+ }
+*/
+ }
+
+ /** Don't call this function! Public fucntion for backward compat reasons
+ */
+ public long getCppAddr()
+ {
+ return cppAddr;
+ }
+
+ /**
+ * Build the native peer
+ * @return the adress of the peer
+ */
+ private native long ctNative();
+
+ /**
+ * release the native peer (should not depend on finalize)
+ */
+ public native void dispose();
+
+ /**
+ * release the native peer (should use dispose instead)
+ */
+ public native void finalize();
+
+ /**
+ * slot for the adress of the native peer. The JNI code is the only user
+ * of this member
+ */
+ protected long cppAddr;
+
+ /**
+ * @since 1.0
+ */
+ public Version getVersion()
+ {
+ return NativeResources.getVersion();
+ }
+}
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNReposAccess.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java?rev=992125&r1=992124&r2=992125&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/RunTests.java
Thu Sep 2 21:45:15 2010
@@ -92,6 +92,7 @@ public class RunTests
{
// Add default test suites.
suite.addTestSuite(SVNAdminTests.class);
+ suite.addTestSuite(SVNRATests.class);
suite.addTestSuite(BasicTests.class);
}
else
Added:
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=992125&view=auto
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
(added)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
Thu Sep 2 21:45:15 2010
@@ -0,0 +1,67 @@
+/**
+ * @copyright
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ * @endcopyright
+ */
+package org.apache.subversion.javahl;
+
+import org.apache.subversion.javahl.callback.*;
+
+import java.net.URI;
+import java.io.IOException;
+
+/**
+ * This class is used for testing the SVNReposAccess class
+ *
+ * More methodes for testing are still needed
+ */
+public class SVNRATests extends SVNTests
+{
+ protected ISVNReposAccess ra;
+
+ protected OneTest thisTest;
+
+ public SVNRATests()
+ {
+ }
+
+ public SVNRATests(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ thisTest = new OneTest(false);
+ ra = new SVNReposAccess(new URI(thisTest.getUrl()));
+ }
+
+ /**
+ * Test the basic SVNAdmin.create functionality
+ * @throws SubversionException
+ */
+ public void testCreate()
+ throws SubversionException, IOException
+ {
+ assertTrue("repository exists", thisTest.getRepository().exists());
+ }
+}
Propchange:
subversion/branches/javahl-ra/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNRATests.java
------------------------------------------------------------------------------
svn:eol-style = native