public abstract class AbstractResource extends Object
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_SCHEMA_JSON |
static jakarta.ws.rs.core.MediaType |
APPLICATION_SCHEMA_JSON_TYPE |
protected PersistenceContextFactory |
factory |
static String |
SERVICE_VERSION_FORMAT |
Constructor and Description |
---|
AbstractResource() |
Modifier and Type | Method and Description |
---|---|
protected PersistenceContextFactory |
buildPersistenceContextFactory(ClassLoader loader)
Builds the persistence context factory.
|
protected static Map<String,String> |
getMatrixParameters(jakarta.ws.rs.core.UriInfo info,
String segment)
Get a map of the matrix parameters associated with the URI path segment of the current request
In JPA-RS, things that user sets (such as parameters of named queries, etc.) are treated as matrix parameters
List of valid matrix parameters for JPA-RS is defined in MatrixParameters
|
protected PersistenceContext |
getPersistenceContext(String persistenceUnit,
String entityType,
URI baseURI,
String version,
Map<String,Object> initializationProperties)
Gets the persistence context.
|
PersistenceContextFactory |
getPersistenceFactory()
Gets the persistence factory.
|
PersistenceContextFactory |
getPersistenceFactory(ClassLoader loader)
Gets the persistence factory.
|
static Map<String,Object> |
getQueryParameters(jakarta.ws.rs.core.UriInfo info)
Get the URI query parameters of the current request
In JPA-RS, predefined attributes (such as eclipselink query hints) are treated as query parameters
List of valid query parameters for JPA-RS is defined in QueryParameters
|
protected String |
getRelationshipPartner(Map<String,String> matrixParams,
Map<String,Object> queryParams)
Gets the relationship partner.
|
protected static boolean |
isValidVersion(String version)
Checks if is valid version.
|
protected String |
marshallMetadata(Object metadata,
String mediaType)
Marshall metadata.
|
void |
setPersistenceFactory(PersistenceContextFactory factory)
Sets the persistence factory.
|
protected void |
setRequestUniqueId() |
public static final String SERVICE_VERSION_FORMAT
public static final String APPLICATION_SCHEMA_JSON
public static final jakarta.ws.rs.core.MediaType APPLICATION_SCHEMA_JSON_TYPE
protected PersistenceContextFactory factory
public void setPersistenceFactory(PersistenceContextFactory factory)
factory
- the new persistence factorypublic PersistenceContextFactory getPersistenceFactory()
public PersistenceContextFactory getPersistenceFactory(ClassLoader loader)
protected PersistenceContextFactory buildPersistenceContextFactory(ClassLoader loader)
loader
- the loaderprotected static Map<String,String> getMatrixParameters(jakarta.ws.rs.core.UriInfo info, String segment)
info
- the infosegment
- the segmentMatrixParameters
public static Map<String,Object> getQueryParameters(jakarta.ws.rs.core.UriInfo info)
info
- the infoQueryParameters
protected static boolean isValidVersion(String version)
version
- the versionprotected PersistenceContext getPersistenceContext(String persistenceUnit, String entityType, URI baseURI, String version, Map<String,Object> initializationProperties)
persistenceUnit
- the persistence unitbaseURI
- the base uriversion
- the versioninitializationProperties
- the initialization propertiesprotected String getRelationshipPartner(Map<String,String> matrixParams, Map<String,Object> queryParams)
matrixParams
- the matrix paramsqueryParams
- the query paramsprotected String marshallMetadata(Object metadata, String mediaType) throws jakarta.xml.bind.JAXBException
metadata
- the metadatamediaType
- the media typejakarta.xml.bind.JAXBException
- the jAXB exceptionprotected void setRequestUniqueId()
Copyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.