/** * Create an instance of SecuredPrefixMapping * * @param graph The SecuredGraph that contains the prefixmapping. * @param prefixMapping The prefixmapping returned from the base graph. * @return The SecuredPrefixMapping. */ static SecuredPrefixMapping getInstance( final SecuredGraphImpl graph, final PrefixMapping prefixMapping) { final ItemHolder<PrefixMapping, SecuredPrefixMapping> holder = new ItemHolder<PrefixMapping, SecuredPrefixMapping>(prefixMapping); final SecuredPrefixMappingImpl checker = new SecuredPrefixMappingImpl(graph, holder); // if we are going to create a duplicate proxy just return this one. if (prefixMapping instanceof SecuredPrefixMapping) { if (checker.isEquivalent((SecuredPrefixMapping) prefixMapping)) { return (SecuredPrefixMapping) prefixMapping; } } return holder.setSecuredItem(new SecuredItemInvoker(prefixMapping.getClass(), checker)); }
/** * Create an instance of the SecuredGraph * * @param securityEvaluator The security evaluator to use * @param graphIRI The IRI for the graph. * @param graph The graph that we are wrapping. * @return the secured graph */ public static SecuredGraph getInstance( final SecurityEvaluator securityEvaluator, final String graphIRI, final Graph graph) { final ItemHolder<Graph, SecuredGraphImpl> holder = new ItemHolder<Graph, SecuredGraphImpl>(graph); final SecuredGraphImpl checker = new SecuredGraphImpl(securityEvaluator, graphIRI, holder) {}; // If we going to create a duplicate proxy return this one. if (graph instanceof SecuredGraphImpl) { if (checker.isEquivalent((SecuredGraphImpl) graph)) { return (SecuredGraph) graph; } } return holder.setSecuredItem(new SecuredItemInvoker(graph.getClass(), checker)); }
/** * Create an instance of the SecuredBulkUpdateHandler * * @param graph The SecuredGraph that created the handler * @param handler The unsecured handler from the base graph. * @return SecuredBulkUpdateHandler. */ static SecuredBulkUpdateHandler getInstance( final SecuredGraphImpl graph, final Graph baseGraph, final BulkUpdateHandler handler) { final ItemHolder<BulkUpdateHandler, SecuredBulkUpdateHandler> holder = new ItemHolder<BulkUpdateHandler, SecuredBulkUpdateHandler>(handler); final SecuredBulkUpdateHandlerImpl checker = new SecuredBulkUpdateHandlerImpl(graph, baseGraph, holder); // if we are going to create a duplicate proxy, just return this // one. if (handler instanceof SecuredBulkUpdateHandler) { if (checker.isEquivalent((SecuredBulkUpdateHandler) handler)) { return (SecuredBulkUpdateHandler) handler; } } return holder.setSecuredItem(new SecuredItemInvoker(handler.getClass(), checker)); }