Package org.eclipse.lyo.oslc4j.core
Class OSLC4JUtils
java.lang.Object
org.eclipse.lyo.oslc4j.core.OSLC4JUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static RDFDatatype
getDataTypeBasedOnResourceShapeType
(HashSet<String> rdfTypesList, Property property) This method receives the property name and the property value and tries to infer the property Data Type from the pre-defined list of Resource Shapes.static String
static String
Returns the value of org.eclipse.lyo.oslc4j.publicURI or null if not set.static String
Return the servlet path value.static String
Return the public URI including the servlet path.static List<ResourceShape>
Returns a list of Resource Shapes to be used when inferring a property type from the Resource Shape.static String
static Object
getValueBasedOnResourceShapeType
(HashSet<String> rdfTypesList, QName propertyQName, Object originalValue) This method receives the property name and the property value and tries to infer the property type from the pre-defined list of Resource Shapes.static boolean
static boolean
static boolean
Returns the boolean value of org.eclipse.lyo.oslc4j.disableHostResolution Default is false if not set or invalid (hostname resolution will take place)static boolean
static boolean
Return if the query result list type will be http://www.w3.org/2000/01/rdf-schema#Container or there will be no type.static boolean
isWellFormed
(String xmlLiteral) static boolean
isWellFormed
(XMLLiteral literal) static boolean
Returns the boolean value of org.eclipse.lyo.oslc4j.disableRelativeURIs Default is true if not set or invalid (relative URIs will not be allowed)static String
resolveFullUri
(jakarta.servlet.http.HttpServletRequest request) Resolve a full request URI (usually a resource subject or info URI) based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution.static String
resolveServletUri
(jakarta.servlet.http.HttpServletRequest request) Resolve a servlet URI based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution.static String
resolveURI
(jakarta.servlet.http.HttpServletRequest request, boolean includePath) Deprecated.static void
setHostResolutionDisabled
(boolean hostResDisabled) static void
setInferTypeFromShape
(String inferTypeFromShape) static void
setLyoStorePagingPreciseLimit
(boolean value) static void
setLyoStorePagingUnsafe
(boolean value) static void
setPublicURI
(String newPublicURI) Sets the value of org.eclipse.lyo.oslc4j.publicURIstatic void
setServletPath
(String newServletPath) Sets the value of the servlet path.static void
setShapes
(List<ResourceShape> shapes) Sets a list of Resource Shapes to be used when inferring a property type from the Resource Shape.static void
setUseBeanClassForParsing
(String useBeanClassForParsing) static boolean
static boolean
-
Constructor Details
-
OSLC4JUtils
public OSLC4JUtils()
-
-
Method Details
-
useStrictDatatypes
public static boolean useStrictDatatypes() -
alwaysAbbrevXML
public static boolean alwaysAbbrevXML() -
relativeURIsAreDisabled
public static boolean relativeURIsAreDisabled()Returns the boolean value of org.eclipse.lyo.oslc4j.disableRelativeURIs Default is true if not set or invalid (relative URIs will not be allowed)- Returns:
- true if relative URIs are disabled, or if the property is not set or invalid.
-
getValueBasedOnResourceShapeType
public static Object getValueBasedOnResourceShapeType(HashSet<String> rdfTypesList, QName propertyQName, Object originalValue) throws DatatypeConfigurationException, IllegalArgumentException, InstantiationException This method receives the property name and the property value and tries to infer the property type from the pre-defined list of Resource Shapes. Then returns the corresponding java object for the given object value. Returns a null object when it was not possible to infer the property type from the list of Resource Shapes.- Parameters:
propertyQName
- Property informationoriginalValue
- Property value- Returns:
- Java object related to the Resource Shape type.
- Throws:
DatatypeConfigurationException
- , IllegalArgumentException, InstantiationException, InvocationTargetException onIllegalArgumentException
InstantiationException
-
getPublicURI
Returns the value of org.eclipse.lyo.oslc4j.publicURI or null if not set.- Returns:
- Public URI, or null if not set
-
setPublicURI
Sets the value of org.eclipse.lyo.oslc4j.publicURI- Parameters:
newPublicURI
- The new public URI to use.- Throws:
MalformedURLException
-
getServletPath
Return the servlet path value.- Returns:
- Servlet Path, or its default "services/" if not set.
-
resolveURI
@Deprecated public static String resolveURI(jakarta.servlet.http.HttpServletRequest request, boolean includePath) Deprecated.UseresolveFullUri(HttpServletRequest)
instead.Resolve a URI (usually a resource subject or info URI) based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution. If the publicURI property is set, it takes precedence and is used to build the full URI. If the disableHostResolution property is false or not set, resolution of the local hostname is attempted. If the disableHostResolution property is true or resolution has failed, the hostname is retrieved from the request. Query parameters from the request are not copied to the resolved URI.- Parameters:
request
- - request to base resolved URI onincludePath
- - if the path (after the context root) should be included in the resolved URI- Returns:
- String containing the resolved URI
-
getServletURI
Return the public URI including the servlet path. Typically, this would be something like "localhost:8080/adaptor-webapp/services", whereas the publicURI would typically be the base "localhost:8080/adaptor-webapp" -
useBeanClassForParsing
public static boolean useBeanClassForParsing() -
getUseBeanClassForParsing
-
getShapes
Returns a list of Resource Shapes to be used when inferring a property type from the Resource Shape. This method should only be used when the property inferTypeFromShape is set to true.- Returns:
- List of Resource Shapes
-
inferTypeFromShape
public static boolean inferTypeFromShape() -
getInferTypeFromShape
-
setShapes
Sets a list of Resource Shapes to be used when inferring a property type from the Resource Shape. This method should only be used when the property inferTypeFromShape is set to true.- Parameters:
shapes
- List of Resource Shapes
-
isHostResolutionDisabled
public static boolean isHostResolutionDisabled()Returns the boolean value of org.eclipse.lyo.oslc4j.disableHostResolution Default is false if not set or invalid (hostname resolution will take place)- Returns:
- true if host resolution is disabled, false if not set or invalid
-
isQueryResultListAsContainer
public static boolean isQueryResultListAsContainer()Return if the query result list type will be http://www.w3.org/2000/01/rdf-schema#Container or there will be no type. Default is no type. -
setUseBeanClassForParsing
-
setHostResolutionDisabled
public static void setHostResolutionDisabled(boolean hostResDisabled) -
resolveFullUri
Resolve a full request URI (usually a resource subject or info URI) based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution. If the publicURI property is set, it takes precedence and is used to build the full URI. If the servletPath property is set, it takes precedence and is used to build the full URI. If the disableHostResolution property is false or not set, resolution of the local hostname is attempted. If the disableHostResolution property is true or resolution has failed, the hostname is retrieved from the request. Query parameters from the request are not copied to the resolved URI.- Parameters:
request
- - request to base resolved URI on- Returns:
- String containing the resolved URI
-
resolveServletUri
Resolve a servlet URI based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution. If the publicURI property is set, it takes precedence and is used to build the full URI. If the servletPath property is set, it takes precedence and is used to build the full URI. If the disableHostResolution property is false or not set, resolution of the local hostname is attempted. If the disableHostResolution property is true or resolution has failed, the hostname is retrieved from the request. Query parameters from the request are not copied to the resolved URI.- Parameters:
request
- - request to base resolved URI on- Returns:
- String containing the resolved URI
-
setServletPath
Sets the value of the servlet path. This method also sets the resulting value of the servletURI (combining the publicURI with the servlet path). This requires publicURI to be configured beforehand.- Parameters:
newServletPath
- New servlet path to set or NULL to reset it.
-
setInferTypeFromShape
-
getDataTypeBasedOnResourceShapeType
public static RDFDatatype getDataTypeBasedOnResourceShapeType(HashSet<String> rdfTypesList, Property property) This method receives the property name and the property value and tries to infer the property Data Type from the pre-defined list of Resource Shapes. Returns a null object when it was not possible to infer the property Data Type from the list of Resource Shapes.- Parameters:
rdfTypesList
- List of rdf:typesproperty
- Property information- Returns:
- Java object related to the Resource Shape type.
-
isLyoStorePagingUnsafe
public static boolean isLyoStorePagingUnsafe()- Returns:
- the boolean value of org.eclipse.lyo.oslc4j.unsafePaging Default is false if not set.
- See Also:
-
setLyoStorePagingUnsafe
public static void setLyoStorePagingUnsafe(boolean value) -
hasLyoStorePagingPreciseLimit
public static boolean hasLyoStorePagingPreciseLimit()- Returns:
- the boolean value of org.eclipse.lyo.oslc4j.unsafePaging Default is true if not set.
- See Also:
-
setLyoStorePagingPreciseLimit
public static void setLyoStorePagingPreciseLimit(boolean value) -
isWellFormed
-
isWellFormed
-
resolveFullUri(HttpServletRequest)
instead.