Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Implemented the DydraRepository#isWritable() method.

  • Loading branch information...
commit 0b9f88c5d4b1fd0b0ddd47fe7e6c1a4c92da02eb 1 parent d8589a5
Arto Bendiken authored
15  src/com/dydra/sesame/DydraRepository.java
@@ -8,15 +8,15 @@
8 8
 import org.openrdf.repository.RepositoryConnection;
9 9
 import org.openrdf.repository.RepositoryException;
10 10
 import org.openrdf.repository.http.HTTPRepository;
  11
+import org.openrdf.repository.manager.SystemRepository;
11 12
 
12 13
 public class DydraRepository extends HTTPRepository implements Repository {
  14
+  protected final String id;
  15
+
13 16
   public DydraRepository(@NotNull final String serverURL,
14 17
                          @NotNull final String repositoryID) {
15 18
     super(serverURL, repositoryID);
16  
-  }
17  
-
18  
-  public DydraRepository(@NotNull final String repositoryURL) {
19  
-    super(repositoryURL);
  19
+    this.id = repositoryID;
20 20
   }
21 21
 
22 22
   @Override @NotNull
@@ -24,4 +24,11 @@ public RepositoryConnection getConnection()
24 24
       throws RepositoryException {
25 25
     return super.getConnection(); // TODO
26 26
   }
  27
+
  28
+  @Override
  29
+  public boolean isWritable()
  30
+      throws RepositoryException {
  31
+    // All repositories except for the SYSTEM repository are writable:
  32
+    return !SystemRepository.ID.equals(this.id);
  33
+  }
27 34
 }
7  test/com/dydra/sesame/DydraRepositoryTest.java
@@ -32,7 +32,7 @@ public void setUp() throws RepositoryException {
32 32
     this.serverURL      = properties.getProperty("com.dydra.sesame.url",
33 33
       "http://api.dydra.com/sesame2") + "/" + this.accountName + "/";
34 34
     this.repositoryURL  = this.serverURL + "repositories/" + this.repositoryName;
35  
-    this.repository     = new DydraRepository(this.repositoryURL);
  35
+    this.repository     = new DydraRepository(this.serverURL, this.repositoryName);
36 36
     this.repository.initialize();
37 37
   }
38 38
 
@@ -46,4 +46,9 @@ public void testGetConnection() throws RepositoryException {
46 46
     final RepositoryConnection connection = repository.getConnection();
47 47
     assertNotNull(connection);
48 48
   }
  49
+
  50
+  @Test
  51
+  public void testIsWritable() throws RepositoryException {
  52
+    assertTrue(repository.isWritable());
  53
+  }
49 54
 }

0 notes on commit 0b9f88c

Please sign in to comment.
Something went wrong with that request. Please try again.