Examples of PlainLiteralImpl


Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

    Lock writeLock = systemGraph.getLock().writeLock();
    writeLock.lock();
    try {
      systemGraph.add(new TripleImpl(role, RDF.type, PERMISSION.Role));
      systemGraph.add(new TripleImpl(role, DC.title,
          new PlainLiteralImpl(title)));
    } finally {
      writeLock.unlock();
    }
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> triples = systemGraph.filter(null, DC.title,
          new PlainLiteralImpl(title));
      NonLiteral role = null;
      while (triples.hasNext()) {
        role = triples.next().getSubject();
        if (systemGraph.filter(role, RDF.type, PERMISSION.Role).hasNext()) {
          return role;
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

   * @return permission node
   */
  private NonLiteral getPermissionOfAJavaPermEntry(
      String permissionString) {
    LockableMGraph systemGraph = getSystemGraph();
    PlainLiteral javaPermEntry = new PlainLiteralImpl(permissionString);
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> javaPermTriples = systemGraph.filter(null,
          PERMISSION.javaPermissionEntry, javaPermEntry);
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

    Lock writeLock = systemGraph.getLock().writeLock();
    writeLock.lock();
    try {
      systemGraph.add(new TripleImpl(user, RDF.type, FOAF.Agent));
      systemGraph.add(new TripleImpl(user, PLATFORM.userName,
          new PlainLiteralImpl(name)));
      if (email != null) {
        systemGraph.add(new TripleImpl(user, FOAF.mbox,
            new UriRef("mailto:" + email)));
      }
      if (password != null) {
        try {
          String pswSha1 = bytes2HexString(MessageDigest.getInstance("SHA1").digest(password.getBytes("UTF-8")));
          systemGraph.add(new TripleImpl(user, PERMISSION.passwordSha1, new PlainLiteralImpl(pswSha1)));
        } catch (UnsupportedEncodingException ex) {
          throw new RuntimeException(ex);
        } catch (NoSuchAlgorithmException ex) {
          throw new RuntimeException(ex);
        }
      }
      if (pathPrefix != null && pathPrefix.trim().length() != 0) {
        systemGraph.add(new TripleImpl(user, OSGI.agent_path_prefix,
            new PlainLiteralImpl(pathPrefix)));
      }
      if (!assignedRoles.isEmpty()) {
        addRolesToUser(assignedRoles, user);
      }     
    } finally {
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

      }

      if (password != null) {
        try {
          String pswSha1 = bytes2HexString(MessageDigest.getInstance("SHA1").digest(password.getBytes("UTF-8")));
          updateProperty(userGraphNode, PERMISSION.passwordSha1, new PlainLiteralImpl(pswSha1));
        } catch (UnsupportedEncodingException ex) {
          throw new RuntimeException(ex);
        } catch (NoSuchAlgorithmException ex) {
          throw new RuntimeException(ex);
        }
      }
      if (pathPrefix != null && pathPrefix.trim().length() != 0) {
        updateProperty(userGraphNode, OSGI.agent_path_prefix,
            new PlainLiteralImpl(pathPrefix));
      }
      if (!assignedRoles.isEmpty()) {
        userGraphNode.deleteProperties(SIOC.has_function);
        addRolesToUser(assignedRoles, (NonLiteral) userGraphNode.getNode());
        //refresh the policy so it will recheck the permissions
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      return systemGraph.filter(null, PLATFORM.userName,
        new PlainLiteralImpl(name)).hasNext();
    } finally {
      readLock.unlock();
    }   
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

  @Override
  public GraphNode getUserInContentGraph(final String name) {
    final LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    Iterator<Triple> triples = contentGraph.filter(null, PLATFORM.userName,
        new PlainLiteralImpl(name));
    GraphNode resultNode = null;
    if (triples.hasNext()) {
      Lock readLock = contentGraph.getLock().readLock();
      readLock.lock();
      try {
        resultNode = new GraphNode(triples.next().getSubject(), contentGraph);
      } finally {
        readLock.unlock();
      }     
    } else {
      NonLiteral user = AccessController.doPrivileged(
          new PrivilegedAction<NonLiteral>() {

            @Override
            public NonLiteral run() {
              return getUserByUserName(name);
            }
          });
      if (user != null) {
        Lock writeLock = contentGraph.getLock().writeLock();
        writeLock.lock();
        try {
          resultNode = new GraphNode(new BNode(), contentGraph);
        resultNode.addProperty(PLATFORM.userName,
            new PlainLiteralImpl(name));
        } finally {
          writeLock.unlock();
        }
       
      }
View Full Code Here

Examples of org.apache.clerezza.rdf.core.impl.PlainLiteralImpl

    LockableMGraph systemGraph = getSystemGraph();
    Lock readLock = systemGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> triples = systemGraph.filter(null, PLATFORM.userName,
          new PlainLiteralImpl(name));
      if (triples.hasNext()) {
        return triples.next().getSubject();
      }
      return null;
    } finally {
View Full Code Here

Examples of org.ontoware.rdf2go.model.node.impl.PlainLiteralImpl

  public void testNotificationOnLiteralObject() {
    this.notifyingModel.open();
    ModelChangedListener listener = new AbstractModelChangeListener() {
      @Override
      public void addedStatement(Statement statement) {
        assertEquals(new PlainLiteralImpl("Sebastian"), statement
            .getObject());
      }
    };
    this.notifyingModel.addModelChangedListener(listener,
        new TriplePatternImpl(Variable.ANY, Variable.ANY,
            new PlainLiteralImpl("Sebastian")));
    this.notifyingModel.addStatement(subject, predicate, "Sebastian Gerke");
    this.notifyingModel.addStatement(predicate, object, "Sebastian");
    this.notifyingModel.close();
  }
View Full Code Here

Examples of org.ontoware.rdf2go.model.node.impl.PlainLiteralImpl

    this.notifyingModel.open();
    ModelChangedListener listener = new AbstractModelChangeListener() {
      @Override
      public void addedStatement(Statement statement) {
        System.out.println(statement.getObject().getClass());
        assertEquals(new PlainLiteralImpl("Sebastian"), statement
            .getObject());
        assertEquals(predicate, statement.getPredicate());
      }
    };
    this.notifyingModel.addModelChangedListener(listener,
        new TriplePatternImpl(Variable.ANY, predicate,
            new PlainLiteralImpl("Sebastian")));
    this.notifyingModel.addStatement(subject, predicate, "Sebastian Gerke");
    this.notifyingModel.addStatement(subject, predicate, "Sebastian");
    this.notifyingModel.addStatement(predicate, object, "Sebastian");
    this.notifyingModel.close();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.