Package org.openrdf.repository.manager.templates

Examples of org.openrdf.repository.manager.templates.ConfigTemplate


  private void createRepository(String templateName)
    throws IOException
  {
    try {
      ConfigTemplate configTemplate = manager.getConfigTemplateManager().getTemplate(templateName);
      if (configTemplate == null) {
        writeError("No template called " + templateName + " found");
        return;
      }

      List<ConfigProperty> properties = configTemplate.getProperties();

      if (!properties.isEmpty()) {
        writeln("Please specify values for the following variables:");
      }

      // prompt for repository ID
      write("Repository ID [" + templateName + "]: ");
      String repositoryID = in.readLine();
      if (repositoryID == null) {
        // EOF
        return;
      }
      else if (repositoryID.trim().length() < 1) {
        repositoryID = templateName;
      }

      // other properties
      for (ConfigProperty property : properties) {
        List<Literal> values = property.getPossibleLiterals();
        Literal defaultLiteral = property.getDefaultLiteral();

        write(property.getLabel());
        if (values.size() > 1) {
          write(" (");
          for (int i = 0; i < values.size(); i++) {
            if (i > 0) {
              write("|");
            }
            write(values.get(i).stringValue());
          }
          write(")");
        }
        if (defaultLiteral != null) {
          write(" [" + defaultLiteral.stringValue() + "]");
        }
        write(": ");

        String value = in.readLine();
        if (value == null) {
          // EOF
          return;
        }

        value = value.trim();
        if (value.length() > 0) {
          property.setValue(new LiteralImpl(value));
        }
      }

      Model repConfig = configTemplate.createConfig(properties);

      if (manager.hasRepositoryConfig(repositoryID)) {
        boolean proceed = askProceed(
            "WARNING: you are about to overwrite the configuration of an existing repository!", false);
View Full Code Here


   */
  private void createTestRepositories()
    throws StoreException, StoreConfigException
  {
    RepositoryManager manager = server.getRepositoryManager();
    ConfigTemplate memory = manager.getConfigTemplateManager().getTemplate("memory");
    manager.addRepositoryConfig(TEST_REPO_ID, memory.createConfig(null));
    ConfigTemplate memory_rdfs_dt = manager.getConfigTemplateManager().getTemplate("memory-rdfs");
    manager.addRepositoryConfig(TEST_INFERENCE_REPO_ID, memory_rdfs_dt.createConfig(null));
  }
View Full Code Here

  protected final Representation getRepresentation(RDFWriterFactory factory, MediaType mediaType)
    throws ResourceException
  {
    try {
      ConfigTemplate template = getRepositoryManager().getConfigTemplateManager().getTemplate(templateID);

      if (template == null) {
        throw new ResourceException(CLIENT_ERROR_NOT_FOUND, "No such template: " + templateID);
      }

      return new ModelRepresentation(template.getModel(), factory, mediaType);
    }
    catch (StoreConfigException e) {
      throw new ResourceException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.repository.manager.templates.ConfigTemplate

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.