Package org.apache.clerezza.rdf.core.access

Examples of org.apache.clerezza.rdf.core.access.LockableMGraph


        try {
            otimizationIndicator.createNewFile();
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        LockableMGraph result = new LockableMGraphWrapper(getMGraph(tcDir));
        mGraphMap.put(name, result);
        return result;
    }
View Full Code Here


    }
    return getTypeHandler(absoluteUriPath);
  }

  private Object getTypeHandler(String absoluteUriPath) throws ResourceMethodException {
    LockableMGraph contentMGraph = tcManager.getMGraph(Constants.CONTENT_GRAPH_URI);
    UriRef uri = new UriRef(absoluteUriPath);

    Set<UriRef> rdfTypes = getRdfTypesOfUriRef(contentMGraph, uri);

    return typeHandlerDiscovery.getTypeHandler(rdfTypes);
View Full Code Here

    resultGraph.add(new TripleImpl(addUserPage, RDF.type,
        USERMANAGER.AddUserPage));
    resultGraph.add(new TripleImpl(addUserPage, RDF.type,
        PLATFORM.HeadedPage));

    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    Lock readLock = contentGraph.getLock().readLock();
    readLock.lock();
    try {
      Iterator<Triple> formFields = contentGraph.filter(null, RDF.type,
          USERMANAGER.UserFormField);
      while (formFields.hasNext()) {
        resultGraph.add(new TripleImpl(addUserPage,
            CUSTOMPROPERTY.customfield, formFields.next().getSubject()));
      }
View Full Code Here

    String message = writer.toString();
    if (!message.isEmpty()) {
      returnInputErrorMessages(message);
    }
    userManager.storeUser(userName, email, psw, userRoles, pathPrefix);
    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    NonLiteral user = new BNode();
   
    Lock writeLock = contentGraph.getLock().writeLock();
    writeLock.lock();
    try {
      contentGraph.add(new TripleImpl(user, RDF.type, FOAF.Agent));
      contentGraph.add(new TripleImpl(user, PLATFORM.userName, new PlainLiteralImpl(
          userName)));
    } finally {
      writeLock.unlock();
    }
View Full Code Here

      @QueryParam(value = "resource") UriRef resource,
      @QueryParam(value = "roles") String roles,
      @QueryParam(value = "user") String userName,
      @Context UriInfo uriInfo) throws ParseException {
    AccessController.checkPermission(new UserManagerAccessPermission());
    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    MGraph resultGraph = new SimpleMGraph();
    NonLiteral node = new BNode();

    resultGraph.add(new TripleImpl(resource, USERMANAGER.custominformation,
        node));
    resultGraph.add(new TripleImpl(node, RDF.type,
        USERMANAGER.CustomUserInformationPage));

    ArrayList<NonLiteral> customfields = new ArrayList<NonLiteral>();

    if (!roles.equals("") && roles.trim().length() > 0) {
      String[] rolesArray = roles.split(",");
      for (int i = 0; i < rolesArray.length; i++) {
        NonLiteral collection = customPropertyManager
            .getCustomPropertyCollection(PERMISSION.Role,
                rolesArray[i]);
        customfields.addAll(customPropertyManager
            .getCustomfieldsOfCollection(collection));
      }
    }

    for (NonLiteral customField : customfields) {
      UriRef property = customPropertyManager
  .getCustomFieldProperty(customField);

      if (userName != null && !userName.equals("")
          && userName.trim().length() > 0) {
        NonLiteral user = getCustomUser(contentGraph, userName);
        if (user != null) {
          Lock readLock = contentGraph.getLock().readLock();
          readLock.lock();
          try {
            Iterator<Triple> values = contentGraph.filter(user,
                property, null);
            while (values.hasNext()) {
              Resource value = values.next().getObject();
              resultGraph.add(new TripleImpl(customField,
                  CUSTOMPROPERTY.actualvalues, value));
View Full Code Here

      @Context UriInfo uriInfo) {

    AccessController.checkPermission(new UserManagerAccessPermission());
    checkUserParam(userName);
    userManager.deleteUser(userName);
    LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
    NonLiteral user = getCustomUser(contentGraph, userName);
    if (user != null) {
      Lock writeLock = contentGraph.getLock().writeLock();
      writeLock.lock();
      try {
        Iterator<Triple> userTriples = contentGraph.filter(user, null, null);
        while (userTriples.hasNext()) {
          userTriples.next();
          userTriples.remove();
        }
      } finally {
View Full Code Here

          USERMANAGER.UpdateUserPage));
      resultGraph.add(new TripleImpl(updateUserPage, RDF.type,
          PLATFORM.HeadedPage));
     

      LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
      resultGraph.add(new TripleImpl(updateUserPage, USERMANAGER.user,
          user));

      Iterator<NonLiteral> userRoles = userManager
          .getRolesOfUser(user);

      ArrayList<NonLiteral> customfields = new ArrayList<NonLiteral>();

      while (userRoles.hasNext()) {
        customfields.addAll(customPropertyManager
            .getCustomfieldsOfCollection(customPropertyManager
                .getCustomPropertyCollection(PERMISSION.Role,
                    userRoles.next().toString())));
      }
      for (NonLiteral customfield : customfields) {
        resultGraph.add(new TripleImpl(updateUserPage,
            CUSTOMPROPERTY.customfield, customfield));
        UriRef property = customPropertyManager.getCustomFieldProperty(customfield);
        NonLiteral contentUser = getCustomUser(contentGraph, userName);

        Lock readLock = contentGraph.getLock().readLock();
        readLock.lock();
        try {
          Iterator<Triple> values = contentGraph.filter(contentUser,
              property, null);
          while (values.hasNext()) {
            PlainLiteral value = (PlainLiteral) values.next().getObject();
            resultGraph.add(new TripleImpl(customfield,
                CUSTOMPROPERTY.actualvalues, value));
View Full Code Here

   * </ul>
   */
  @MOVE
  public Response move(@Context UriInfo uriInfo, @Context HttpHeaders headers) {
    UriRef nodeUri = new UriRef(uriInfo.getAbsolutePath().toString());
    final LockableMGraph mGraph = cgProvider.getContentGraph();
    GraphNode node = new GraphNode(nodeUri, mGraph);
    String targetString = WebDavUtils.getHeaderAsString(headers,
          "Destination");
    UriRef targetUri = new UriRef(targetString);
    String overwriteHeader = WebDavUtils.getHeaderAsString(headers, "Overwrite");
    boolean overwriteTarget = "T".equalsIgnoreCase(overwriteHeader);
    if (nodeAtUriExists(targetUri)) {
      if (overwriteTarget) {
        new GraphNode(targetUri, mGraph).deleteNodeContext();
      } else {
        return Response.status(Status.PRECONDITION_FAILED).build();
      }
    }
    Lock l = mGraph.getLock().writeLock();
    l.lock();
    try {
      Iterator<Triple> oldParentTripleIter
          = mGraph.filter(nodeUri, HIERARCHY.parent, null);
      if (oldParentTripleIter.hasNext()) {
        oldParentTripleIter.next();
        oldParentTripleIter.remove();
      }
      while (oldParentTripleIter.hasNext()) {
View Full Code Here

        return Response.status(Status.FORBIDDEN).entity("You don't have the "
            + "permission to assign these permissions to the user.").build();
      }
      userManager.updateUser(userName, email, null, userRoleList,
          pathPrefix);
      LockableMGraph contentGraph = (LockableMGraph) cgProvider.getContentGraph();
      saveCustomUserInformation(contentGraph, userName, userRoleList, form);
      return RedirectUtil.createSeeOtherResponse("list-users", uriInfo);
    }
    return Response.status(Status.NOT_FOUND).entity(
        "User " + userName + "does not exist in our database").build();
View Full Code Here

    UriRef nodeUri = new UriRef(uriInfo.getAbsolutePath().toString());
    if (!nodeAtUriExists(nodeUri)) {
      return Response.status(Status.NOT_FOUND).entity(
          uriInfo.getAbsolutePath()).type(MediaType.TEXT_PLAIN).build();
    }
    final LockableMGraph mGraph = cgProvider.getContentGraph();
    GraphNode node = new GraphNode(nodeUri, mGraph);
    node.deleteNodeContext();
    return Response.ok().build();
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.access.LockableMGraph

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.