001/* 002 * Licensed to DuraSpace under one or more contributor license agreements. 003 * See the NOTICE file distributed with this work for additional information 004 * regarding copyright ownership. 005 * 006 * DuraSpace licenses this file to you under the Apache License, 007 * Version 2.0 (the "License"); you may not use this file except in 008 * compliance with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.fcrepo.kernel.modeshape.utils; 020 021/** 022 * @author Daniel Bernstein 023 * @since Apr 27, 2017 024 */ 025public class BNodeSkolemizationUtil { 026 027 private static final String FCREPO_BNODE_SKOLEMIZE_TO_HASH_FLAG = "fcrepo.bnode.hash-uri"; 028 029 /** 030 * prevents instantiation 031 */ 032 private BNodeSkolemizationUtil() { 033 } 034 035 /** 036 * Returns true if blank nodes should follow the new strategy of skolemizing blank nodes (bnodes) to hash URIs 037 * (rather than using /.well-known/genid/ - c.f. https://jira.duraspace.org/browse/FCREPO-2431). 038 * 039 * @return true if fcrepo.bnode.hash-uri system property is set to "true" 040 */ 041 public static boolean isSkolemizeToHashURIs() { 042 return Boolean.valueOf(System.getProperty(FCREPO_BNODE_SKOLEMIZE_TO_HASH_FLAG, "false")); 043 } 044 045 /** 046 * Sets the fcrepo.bnode.hash-uri system property. 047 * @param flag to toggle this feature 048 */ 049 public static void setSkolemizeToHashURIs(final boolean flag) { 050 System.setProperty(FCREPO_BNODE_SKOLEMIZE_TO_HASH_FLAG, Boolean.toString(flag)); 051 } 052}