Package uk.ac.osswatch.simal.rdf

Examples of uk.ac.osswatch.simal.rdf.ISimalRepository


   * @return
   */
  protected com.hp.hpl.jena.rdf.model.Resource getJenaResource() {
    if (jenaResource == null) {
      try {
        ISimalRepository repo = SimalRepositoryFactory.getInstance();
        return ((JenaSimalRepository) repo).getJenaResource(getURI());
      } catch (SimalRepositoryException e) {
        logger
            .warn(
                "Unable to get hold of the repository, but we are already running, this should be impossible",
View Full Code Here


    }

    String response = "Could not handle request for " + req.getPathInfo();

    try {
      ISimalRepository repo = SimalRepositoryFactory.getInstance();
      if (!repo.isInitialised()) {
        repo.initialise();
      }
      HandlerFactory handlerFactory = new HandlerFactory(repo);
      IAPIHandler handler = handlerFactory.get(cmd);
      response = handler.execute();
    } catch (SimalAPIException e) {
View Full Code Here

    }

    String response = "Could not handle request for " + req.getPathInfo();

    try {
      ISimalRepository repo = SimalRepositoryFactory.getInstance();
      if (!repo.isInitialised()) {
        repo.initialise();
      }
      HandlerFactory handlerFactory = new HandlerFactory(repo);
      IAPIHandler handler = handlerFactory.get(cmd);
      response = handler.execute();
      if(cmd.isAddProject()) {
View Full Code Here

   * Import all the latest Doap documents.
* @throws SimalException
* @throws IOException
   */
  public void importLatestDOAP() throws SimalException, IOException
        ISimalRepository repo;
      int preProjectCount;
      repo = SimalRepositoryFactory.getInstance();
      preProjectCount = repo.getAllProjects().size();
     
      Document pings = getLatestPingsAsRDF();
     
          OutputFormat format = new OutputFormat(pings);
      StringWriter writer = new StringWriter();
      XMLSerializer serial = new XMLSerializer(writer, format);
      serial.serialize(pings);
      logger.info("Updated DOAP documents:\n");
      logger.info(writer.toString());
   
      File tmpFile = new File(System.getProperty("java.io.tmpdir")
          + File.separator + "PTSWExport.xml");
      FileWriter fw = null;
      try {
        fw = new FileWriter(tmpFile);
        fw.write(writer.toString());
      } catch (IOException e) {
        throw new SimalException(
            "Unable to write PTSW export file to temporary space");
      } finally {
        if (fw != null) {
          try {
            fw.close();
          } catch (IOException e) {
            logger.warn("Unable to close file", e);
          }
        }
      }
   
      repo.addProject(tmpFile.toURI().toURL(), tmpFile.toURI().toURL()
              .toExternalForm());
      int postProjectCount = repo.getAllProjects().size();
      logger.info("Imported " + (postProjectCount - preProjectCount)
            + " project records from PTSW");   
    }
View Full Code Here

   * Remove all data from the repository.
   *
   * @throws UserReportableException
   */
  private void removeAllData() throws UserReportableException {
    ISimalRepository repo;

    logger.warn("Removing all data from the repository.");
   
    try {
      repo = UserApplication.getRepository();
    } catch (SimalRepositoryException e) {
      throw new UserReportableException("Unable to get the count of projects",
          ToolsPage.class, e);
    }
    repo.removeAllData();
  }
View Full Code Here

    }
    repo.removeAllData();
  }

  private void importTestData() throws UserReportableException {
    ISimalRepository repo;

    logger.info("Importing the test data in the repository.");
   
    try {
      repo = UserApplication.getRepository();
View Full Code Here

      // Everything ok
    }
  }

  private JenaSimalRepository getJenaSimalRepository() {
    ISimalRepository repo = getRepository();
    if (!(repo instanceof JenaSimalRepository)) {
      fail("Configuration problem; testing Jena when repo is not of Jena type");
    }
    return (JenaSimalRepository) repo;
  }
View Full Code Here

        .isUniqueSimalID(id));
  }
 
  @Test
  public void testGetBackup() throws SimalRepositoryException {
    ISimalRepository repo = getRepository();
    StringWriter sw = new StringWriter();
    repo.writeBackup(sw);
    String backup = sw.toString();
    assertNotNull(backup);
  }
View Full Code Here

TOP

Related Classes of uk.ac.osswatch.simal.rdf.ISimalRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.