Package org.apache.clerezza.rdf.utils

Examples of org.apache.clerezza.rdf.utils.GraphNode


  @Path("find")
  @Produces("application/rdf+xml")
  public Graph getPersonRdf(@QueryParam("mbox") String mboxString) {
    MGraph mGraph = tcManager.getMGraph(graphName);
    NonLiteral person = getPersonByMbox(mboxString, mGraph);
    return new GraphNode(person, mGraph).getNodeContext();
  }
View Full Code Here


  @Path("find")
  @Produces("application/xhtml+xml")
  public GraphNode getPersonHtml(@QueryParam("mbox") String mboxString) {
    MGraph mGraph = tcManager.getMGraph(graphName);
    NonLiteral person = getPersonByMbox(mboxString, mGraph);
    return new GraphNode(person, mGraph);
  }
View Full Code Here

    @GET
    @Path("success")
    public GraphNode logoutSuccessPage(@Context UriInfo uriInfo) {
  TrailingSlash.enforcePresent(uriInfo);
  GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
  PlainLiteral message = new PlainLiteralImpl(
    "You successfully logged out.");
  result.addProperty(LOGIN.message, message);
  result.addProperty(RDF.type, LOGIN.LoginPage);

  String baseUri = uriInfo.getBaseUri().getScheme() + "://"
    + uriInfo.getBaseUri().getAuthority();

  result.addProperty(LOGIN.refererUri, new UriRef(baseUri + "/dashboard/overview"));
  return result;
    }
View Full Code Here

      additionalExpansionRes.removeAll(expandedResources);
      if (additionalExpansionRes.size() == 0) {
        return result;
      }
      for (Resource resource : additionalExpansionRes) {
        final GraphNode additionalNode = new GraphNode(resource, node.getGraph());
        result.addAll(additionalNode.getNodeContext());
        expandedResources.add(resource);
      }
    }
  }
View Full Code Here

  @GET
  public GraphNode loginPage(@Context UriInfo uriInfo,
      @QueryParam("referer") String refererUri,
      @QueryParam("cause") Integer cause) {
    TrailingSlash.enforceNotPresent(uriInfo);
    GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
    result.addProperty(RDF.type, LOGIN.LoginPage);
    result.addProperty(LOGIN.refererUri, new UriRef(refererUri));
    String user = getUserName();
    if (!user.equals("anonymous") && cause != null &&
        cause.equals(CookieAuthentication.NOT_ENOUGH_PERMISSIONS)) {
      try {
        result.addProperty(LOGIN.message, new PlainLiteralImpl("The user " +
            user + " does not have the required permissions to view this page" +
            " (" + URLDecoder.decode(refererUri, "UTF-8") + ")." +
            " Please log in as another user."));
      } catch (UnsupportedEncodingException ex) {
        throw new RuntimeException(ex);
View Full Code Here

      @DefaultValue("false") @FormParam("stayloggedin") final Boolean stayLoggedIn,
      @Context final UriInfo uriInfo) {
    return AccessController.doPrivileged(new PrivilegedAction<Object>() {
      @Override
      public Object run() {
        GraphNode result = new GraphNode(new BNode(), new SimpleMGraph());
        result.addProperty(RDF.type, LOGIN.LoginPage);
        PlainLiteral failedMessage = new PlainLiteralImpl(
            "Username name or password are wrong");
        try {
          if (authenticationService.authenticateUser(userName,password)) {
            Set<LoginListener> tempLoginListenerSet = null;
            synchronized(loginListenerSet) {
              tempLoginListenerSet = new HashSet<LoginListener>(loginListenerSet);
            }
            for (Iterator<LoginListener> it = tempLoginListenerSet.iterator(); it.hasNext();) {
              LoginListener listener = it.next();
              listener.userLoggedIn(userName);
            }
            ResponseBuilder responseBuilder = Response.fromResponse(
              RedirectUtil.createSeeOtherResponse(
              referer, uriInfo));
            responseBuilder.header(HttpHeaders.SET_COOKIE,
                getLoginCookie(userName, password, stayLoggedIn));
            return responseBuilder.build();
          } else {
            result.addProperty(LOGIN.message, failedMessage);
            result.addProperty(LOGIN.refererUri, new UriRef(referer));
          }
          return result;
        } catch (NoSuchAgent ex) {
          result.addProperty(LOGIN.message, failedMessage);
          result.addProperty(LOGIN.refererUri, new UriRef(referer));
          return result;
        }
      }
    });
  }
View Full Code Here

        result = children.get(propertyKey);
      }
      if (result == null) {
        result = new ArrayList<ExpandedNode>();
        if (node == null) {
          node = new GraphNode((NonLiteral) value, expandedNode.node.getGraph());
        }
                if (inverseResolve) {
                    Iterator<NonLiteral> subjects = node.getSubjects(property);
                    while (subjects.hasNext()) {
                        ExpandedNode childNode = new ExpandedNode(subjects.next());
View Full Code Here

  @Override
  public GraphNode addUserContext(GraphNode node) {

    final AccessControlContext context = AccessController.getContext();
    GraphNode agent = AccessController.doPrivileged(new PrivilegedAction<GraphNode>() {
      @Override
      public GraphNode run() {
        final String userName = UserUtil.getUserName(context);
        if (userName == null) {
          return null;
        }
        return userManager.getUserGraphNode(userName);
      }
    });
    if (agent != null) {
      if (agent.getNode() instanceof UriRef) {
        WebIdInfo webIdInfo = webIdGraphsService.getWebIdInfo((UriRef)agent.getNode());
        MGraph userGraph = webIdInfo.localPublicUserData();
        agent = new GraphNode(agent.getNode(), new UnionMGraph(agent.getGraph(), userGraph));
      }
      node.addProperty(PLATFORM.user, agent.getNode());
      MGraph userContext = new SimpleMGraph(agent.getNodeContext());
      removeTripleWithProperty(userContext, PERMISSION.password);
      removeTripleWithProperty(userContext, PERMISSION.passwordSha1);
      node.getGraph().addAll(userContext);     
    }
    return node;
View Full Code Here

  public GraphNode entry(@Context UriInfo uriInfo)
      throws IOException {
    AccessController.checkPermission(new LoggingManagerAccessPermission());
    TrailingSlash.enforcePresent(uriInfo);
    SimpleMGraph resultMGraph = new SimpleMGraph();
    GraphNode result = new GraphNode(new BNode(), resultMGraph);
    result.addPropertyValue(LOGGING.loggingConfig, getPropertiesAsString());
    result.addProperty(RDF.type, PLATFORM.HeadedPage);
    result.addProperty(RDF.type, LOGGING.LoggingConfigPage);
    return result;
  }
View Full Code Here

  /**
   *
   * @return the context of the currently selected URI
   */
  public Graph getCurrentContext() {
    return new GraphNode(new UriRef(selectedUri), mGraph).getNodeContext();
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.utils.GraphNode

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.