org.restlet.resource.ResourceException Java Examples
The following examples show how to use
org.restlet.resource.ResourceException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestManager.java From lucene-solr with Apache License 2.0 | 6 votes |
@Override public void doGet(BaseSolrResource endpoint, String childId) { // filter results by /schema or /config String path = ManagedEndpoint.resolveResourceId(endpoint.getRequest()); Matcher resourceIdMatcher = resourceIdRegex.matcher(path); if (!resourceIdMatcher.matches()) { // extremely unlikely but didn't want to squelch it either throw new ResourceException(Status.SERVER_ERROR_NOT_IMPLEMENTED, path); } String filter = resourceIdMatcher.group(1); List<Map<String,String>> regList = new ArrayList<>(); for (ManagedResourceRegistration reg : restManager.registry.getRegistered()) { if (!reg.resourceId.startsWith(filter)) continue; // doesn't match filter if (RestManagerManagedResource.class.isAssignableFrom(reg.implClass)) continue; // internal, no need to expose to outside regList.add(reg.getInfo()); } endpoint.getSolrResponse().add("managedResources", regList); }
Example #2
Source File: EventsEid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Used by an Agent/Adapter that is capable of generating events to de-activate an event channel. This will * prohibit any other new objects to subscribe to that channel, and the objects that are already subscribed are * notified and removed from subscription list. * * @return statusMessage {@link StatusMessage StatusMessage} with the result of the operation. */ @Delete public Representation remove(Representation entity) { String attrEid = getAttribute(ATTR_EID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrEid == null){ logger.info("EID: " + attrEid + " Invalid identifier."); throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "Invalid identifier."); } String body = getRequestBody(entity, logger); CommunicationManager communicationManager = (CommunicationManager) getContext().getAttributes().get(Api.CONTEXT_COMMMANAGER); StatusMessage statusMessage = communicationManager.deactivateEventChannel(callerOid, attrEid, queryParams, body); return new JsonRepresentation(statusMessage.buildMessage().toString()); }
Example #3
Source File: ObjectsOidEventsEid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Retrieves status of a remote event channel. * * @return Latest property value. */ @Get public Representation represent(Representation entity) { String attrOid = getAttribute(ATTR_OID); String attrEid = getAttribute(ATTR_EID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrOid == null || attrEid == null){ logger.info("OID: " + attrOid + " EID: " + attrEid + " Invalid identifier."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid identifier."); } String body = getRequestBody(entity, logger); CommunicationManager communicationManager = (CommunicationManager) getContext().getAttributes().get(Api.CONTEXT_COMMMANAGER); return new JsonRepresentation(communicationManager.getEventChannelStatus(callerOid, attrOid, attrEid, queryParams, body).buildMessage().toString()); }
Example #4
Source File: AbstractResourceTest.java From ontopia with Apache License 2.0 | 6 votes |
protected void assertRequestFails(String url, Method method, MediaType preferred, Object object, OntopiaRestErrors expected) { OntopiaTestResource cr = new OntopiaTestResource(method, getUrl(url), preferred); try { cr.request(object, Object.class); Assert.fail("Expected Ontopia error " + expected.name() + ", but request succeeded"); } catch (OntopiaTestResourceException e) { Error result = e.getError(); try { Assert.assertNotNull("Expected error, found null", result); Assert.assertEquals("Ontopia error code mismatch", expected.getCode(), result.getCode()); Assert.assertEquals("HTTP status code mismatch", expected.getStatus().getCode(), result.getHttpcode()); Assert.assertNotNull("Error message is empty", result.getMessage()); } catch (AssertionError ae) { Assert.fail("Expected ontopia error " + expected.name() + ", but received [" + result.getHttpcode() + ":" + result.getCode() + ", " + result.getMessage() + "]"); } } catch (ResourceException re) { Assert.fail("Expected ontopia error " + expected.name() + ", but received [" + re.getStatus().getCode() + ":" + re.getStatus().getDescription() + "]"); } }
Example #5
Source File: EventsEid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Used by an Agent/Adapter, that is capable of generating events and is willing to send these events to subscribed * objects. A call to this end point activates the channel – from that moment, other objects in the network are able * to subscribe for receiving those messages. * * @param entity Optional JSON with parameters. * @return statusMessage {@link StatusMessage StatusMessage} with the result of the operation. */ @Post("json") public Representation accept(Representation entity) { String attrEid = getAttribute(ATTR_EID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrEid == null){ logger.info("EID: " + attrEid + " Invalid identifier."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid identifier."); } String body = getRequestBody(entity, logger); CommunicationManager communicationManager = (CommunicationManager) getContext().getAttributes().get(Api.CONTEXT_COMMMANAGER); StatusMessage statusMessage = communicationManager.activateEventChannel(callerOid, attrEid, queryParams, body); return new JsonRepresentation(statusMessage.buildMessage().toString()); }
Example #6
Source File: AgentsAgidObjectsUpdate.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
@Put("json") public Representation store(Representation entity) { String attrAgid = getAttribute(ATTR_AGID); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); XMLConfiguration config = (XMLConfiguration) getContext().getAttributes().get(Api.CONTEXT_CONFIG); if (attrAgid == null){ logger.info("AGID: " + attrAgid + " Invalid Agent ID."); throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "Invalid Agent ID."); } if (!entity.getMediaType().equals(MediaType.APPLICATION_JSON)){ logger.info("AGID: " + attrAgid + " Invalid object descriptions."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid object descriptions"); } return lightweightUpdate(entity, logger, config); }
Example #7
Source File: AgentsAgidObjects.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Update the thing descriptions of objects registered under the Agent. * * @param entity Representation of the incoming JSON. * */ @Put("json") public Representation store(Representation entity) { String attrAgid = getAttribute(ATTR_AGID); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); XMLConfiguration config = (XMLConfiguration) getContext().getAttributes().get(Api.CONTEXT_CONFIG); if (attrAgid == null){ logger.info("AGID: " + attrAgid + " Invalid Agent ID."); throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "Invalid Agent ID."); } if (!entity.getMediaType().equals(MediaType.APPLICATION_JSON)){ logger.info("AGID: " + attrAgid + " Invalid object descriptions."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid object descriptions"); } return heavyweightUpdate(entity, logger, config); }
Example #8
Source File: AgentsAgidObjects.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Register the IoT object(s) of the underlying eco-system e.g. devices, VA service. * * @param entity Representation of the incoming JSON. List of IoT thing descriptions that are to be registered * (from request). * @return All VICINITY identifiers of objects registered under VICINITY Gateway by this call. * */ @Post("json") public Representation accept(Representation entity) { String attrAgid = getAttribute(ATTR_AGID); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); XMLConfiguration config = (XMLConfiguration) getContext().getAttributes().get(Api.CONTEXT_CONFIG); if (attrAgid == null){ logger.info("AGID: " + attrAgid + " Invalid Agent ID."); throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "Invalid Agent ID."); } if (!entity.getMediaType().equals(MediaType.APPLICATION_JSON)){ logger.info("AGID: " + attrAgid + " Invalid object descriptions."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid object descriptions"); } return storeObjects(entity, logger, config); }
Example #9
Source File: RootResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@SubResource public void administration() { ChallengeResponse challenge = Request.getCurrent().getChallengeResponse(); if( challenge == null ) { Response.getCurrent() .setChallengeRequests( Collections.singletonList( new ChallengeRequest( ChallengeScheme.HTTP_BASIC, "Forum" ) ) ); throw new ResourceException( Status.CLIENT_ERROR_UNAUTHORIZED ); } User user = select( Users.class, Users.USERS_ID ).userNamed( challenge.getIdentifier() ); if( user == null || !user.isCorrectPassword( new String( challenge.getSecret() ) ) ) { throw new ResourceException( Status.CLIENT_ERROR_UNAUTHORIZED ); } current().select( user ); subResource( AdministrationResource.class ); }
Example #10
Source File: ObjectsOidActionsAidTasksTid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Gets a specific task status to perform an action of an available IoT object. * * @return Task status. */ @Get public Representation represent(Representation entity) { String attrOid = getAttribute(ATTR_OID); String attrAid = getAttribute(ATTR_AID); String attrTid = getAttribute(ATTR_TID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrOid == null || attrAid == null || attrTid == null){ logger.info("OID: " + attrOid + " AID: " + attrAid + " TID: " + attrTid + " Given identifier does not exist."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Given identifier does not exist."); } String body = getRequestBody(entity, logger); return getActionTaskStatus(callerOid, attrOid, attrAid, attrTid, queryParams, body); }
Example #11
Source File: FormRequestWriter.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override public boolean writeRequest(Object requestObject, Request request) throws ResourceException { if (requestObject instanceof Form) { // Form as query parameters if (request.getMethod().equals(Method.GET)) request.getResourceRef().setQuery(((Form)requestObject).getQueryString()); else request.setEntity(((Form)requestObject).getWebRepresentation(CharacterSet.UTF_8)); return true; } return false; }
Example #12
Source File: ObjectsOidPropertiesPid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Gets the property value of an available IoT object. * * @return Latest property value. */ @Get public Representation represent(Representation entity) { String attrOid = getAttribute(ATTR_OID); String attrPid = getAttribute(ATTR_PID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrOid == null || attrPid == null){ logger.info("OID: " + attrOid + " PID: " + attrPid + " Invalid identifier."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid identifier."); } String body = getRequestBody(entity, logger); return getObjectProperty(callerOid, attrOid, attrPid, body, queryParams); }
Example #13
Source File: ObjectsOidPropertiesPid.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Sets the property value of an available IoT object. * * @param entity Representation of the incoming JSON. * @param object Model. */ @Put("json") public Representation store(Representation entity) { String attrOid = getAttribute(ATTR_OID); String attrPid = getAttribute(ATTR_PID); String callerOid = getRequest().getChallengeResponse().getIdentifier(); Map<String, String> queryParams = getQuery().getValuesMap(); Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); if (attrOid == null || attrPid == null){ logger.info("OID: " + attrOid + " PID: " + attrPid + " Invalid identifier."); throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Invalid identifier."); } String body = getRequestBody(entity, logger); return updateProperty(callerOid, attrOid, attrPid, body, queryParams); }
Example #14
Source File: EntityResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
private Representation representRdfXml( final EntityState entity ) throws ResourceException { Representation representation = new WriterRepresentation( MediaType.APPLICATION_RDF_XML ) { @Override public void write( Writer writer ) throws IOException { try { Iterable<Statement> statements = entitySerializer.serialize( entity ); new RdfXmlSerializer().serialize( statements, writer ); } catch( RDFHandlerException e ) { throw new IOException( e ); } } }; representation.setCharacterSet( CharacterSet.UTF_8 ); return representation; }
Example #15
Source File: EntitiesResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override protected Representation post( Representation entity, Variant variant ) throws ResourceException { try { /* * InputStream in = entity.getStream(); ObjectInputStream oin = new ObjectInputStream( in ); String reference * = oin.readUTF(); Usecase usecase = (Usecase) oin.readUnshared(); MetaInfo unitofwork = (MetaInfo) * oin.readUnshared(); Iterable<UnitOfWorkEvent> events = (Iterable<UnitOfWorkEvent>) oin.readUnshared(); * * // Store state try { entityStore.apply( reference, events, usecase, unitofwork ).commit(); } catch( * ConcurrentEntityStateModificationException e ) { throw new ResourceException( * Status.CLIENT_ERROR_CONFLICT ); } */ } catch( Exception e ) { throw new ResourceException( e ); } return new EmptyRepresentation(); }
Example #16
Source File: EntityResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override protected Representation delete( Variant variant ) throws ResourceException { Usecase usecase = UsecaseBuilder.newUsecase( "Remove entity" ); EntityStoreUnitOfWork uow = entityStore.newUnitOfWork( module, usecase, SystemTime.now() ); try { EntityReference reference = EntityReference.create( identity ); uow.entityStateOf( module, reference ).remove(); uow.applyChanges().commit(); getResponse().setStatus( Status.SUCCESS_NO_CONTENT ); } catch( EntityNotFoundException e ) { uow.discard(); getResponse().setStatus( Status.CLIENT_ERROR_NOT_FOUND ); } return new EmptyRepresentation(); }
Example #17
Source File: IndexResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override public Representation get( Variant variant ) throws ResourceException { if( variant.getMediaType().equals( MediaType.APPLICATION_RDF_XML ) ) { return new RdfXmlOutputRepresentation(); } else if( variant.getMediaType().equals( MediaType.APPLICATION_RDF_TRIG ) ) { return new RdfTrigOutputRepresentation( MediaType.APPLICATION_RDF_TRIG ); } else if( variant.getMediaType().equals( MediaType.TEXT_PLAIN ) ) { return new RdfTrigOutputRepresentation( MediaType.TEXT_PLAIN ); } return null; }
Example #18
Source File: EntitiesResource.java From attic-polygene-java with Apache License 2.0 | 6 votes |
@Override protected Representation get( Variant variant ) throws ResourceException { // Generate the right representation according to its media type. if( MediaType.APPLICATION_JSON.equals( variant.getMediaType() ) ) { return representJson(); } else if( MediaType.APPLICATION_RDF_XML.equals( variant.getMediaType() ) ) { return representRdf(); } else if( MediaType.TEXT_HTML.equals( variant.getMediaType() ) ) { return representHtml(); } else if( MediaType.APPLICATION_ATOM.equals( variant.getMediaType() ) ) { return representAtom(); } throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND ); }
Example #19
Source File: ResourceValidity.java From attic-polygene-java with Apache License 2.0 | 6 votes |
void checkRequest() throws ResourceException { // Check command rules Instant unmodifiedSince = request.getConditions().getUnmodifiedSince().toInstant(); EntityState state = spi.entityStateOf( entity ); Instant lastModifiedSeconds = state.lastModified().with(ChronoField.NANO_OF_SECOND, 0 ); if( unmodifiedSince != null ) { if( lastModifiedSeconds.isAfter( unmodifiedSince ) ) { throw new ResourceException( Status.CLIENT_ERROR_CONFLICT ); } } // Check query rules Instant modifiedSince = request.getConditions().getModifiedSince().toInstant(); if( modifiedSince != null ) { if( !lastModifiedSeconds.isAfter( modifiedSince ) ) { throw new ResourceException( Status.REDIRECTION_NOT_MODIFIED ); } } }
Example #20
Source File: XEBatchSolverSaver.java From unitime with Apache License 2.0 | 6 votes |
protected XEInterface.RegisterResponse postChanges(ClientResource resource, XEInterface.RegisterRequest req) throws IOException { if (req.isEmpty()) req.empty(); try { resource.post(new GsonRepresentation<XEInterface.RegisterRequest>(req)); } catch (ResourceException e) { handleError(resource, e); } XEInterface.RegisterResponse response = new GsonRepresentation<XEInterface.RegisterResponse>(resource.getResponseEntity(), XEInterface.RegisterResponse.class).getObject(); if (response == null) throw new SectioningException("Failed to enroll student."); else if (!response.validStudent) { String reason = null; if (response.failureReasons != null) for (String m: response.failureReasons) { if (reason == null) reason = m; else reason += "\n" + m; } if (reason != null) throw new SectioningException(reason); throw new SectioningException("Failed to enroll student."); } return response; }
Example #21
Source File: AgentsAgidObjects.java From vicinity-gateway-api with GNU General Public License v3.0 | 6 votes |
/** * Returns the list of IoT objects registered under given Agent. * * @return All VICINITY identifiers of objects registered under specified agent. */ @Get public Representation represent() { Logger logger = (Logger) getContext().getAttributes().get(Api.CONTEXT_LOGGER); XMLConfiguration config = (XMLConfiguration) getContext().getAttributes().get(Api.CONTEXT_CONFIG); String attrAgid = getAttribute(ATTR_AGID); if (attrAgid == null){ logger.info("AGID: " + attrAgid + " Invalid Agent ID."); throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "Invalid Agent ID."); } return getAgentObjects(attrAgid, logger, config); }
Example #22
Source File: RestClientImpl.java From concierge with Eclipse Public License 1.0 | 5 votes |
/** * @see org.osgi.rest.client.RestClient#getBundle(java.lang.String) */ public BundleDTO getBundle(final String bundlePath) throws Exception { try { final Representation repr = new ClientResource(Method.GET, baseUri.resolve(bundlePath)).get(BUNDLE); return DTOReflector.getDTO(BundleDTO.class, repr); } catch (final ResourceException e) { if (Status.CLIENT_ERROR_NOT_FOUND.equals(e.getStatus())) { return null; } throw e; } }
Example #23
Source File: VariantResource.java From ontopia with Apache License 2.0 | 5 votes |
@Override protected void doInit() throws ResourceException { super.doInit(); // CTM LTM, TMXML and XTM cannot export a single variant name blockMimeType(Constants.CTM_MEDIA_TYPE, Constants.LTM_MEDIA_TYPE, Constants.TMXML_MEDIA_TYPE, Constants.XTM_MEDIA_TYPE); }
Example #24
Source File: BoardResource.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public void resource( String segment ) throws ResourceException { selectFromManyAssociation( ObjectSelection.current().get( Forum.class ).boards(), StringIdentity.identityOf( segment ) ); subResource( BoardResource.class ); }
Example #25
Source File: AbstractPagedResource.java From ontopia with Apache License 2.0 | 5 votes |
@Override protected void doInit() throws ResourceException { super.doInit(); paging = ContextUtils.getParameterAsBoolean(Constants.PAGING_PARAMETER, paging); offset = ContextUtils.getParameterAsInteger(Constants.DEFAULT_PAGING_OFFSET_PARAMETER, offset); limit = ContextUtils.getParameterAsInteger(Constants.DEFAULT_PAGING_LIMIT_PARAMETER, limit); }
Example #26
Source File: ContextResource.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public final void handle( Request request, Response response ) { ObjectSelection objectSelection = current(); // Check constraints for this resource if( !constraints.isValid( getClass(), objectSelection, module ) ) { throw new ResourceException( Status.CLIENT_ERROR_FORBIDDEN ); } // Find remaining segments List<String> segments = getSegments(); if( segments.size() > 0 ) { String segment = segments.remove( 0 ); if( segments.size() > 0 ) { handleSubResource( segment ); } else { handleResource( segment ); } } }
Example #27
Source File: ContextResource.java From attic-polygene-java with Apache License 2.0 | 5 votes |
protected <T> T select( Class<T> entityClass, Identity id ) throws ResourceException { try { T composite = uowf.currentUnitOfWork().get( entityClass, id ); current().select( composite ); return composite; } catch( NoSuchEntityTypeException | NoSuchEntityException e ) { throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND ); } }
Example #28
Source File: ContextResource.java From attic-polygene-java with Apache License 2.0 | 5 votes |
protected <T> T selectFromManyAssociation( ManyAssociation<T> manyAssociation, Identity id ) throws ResourceException { T entity = (T) uowf.currentUnitOfWork().get( Object.class, id ); if( !manyAssociation.contains( entity ) ) { throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND ); } current().select( entity ); return entity; }
Example #29
Source File: ManagedSynonymFilterFactory.java From lucene-solr with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override protected Object applyUpdatesToManagedData(Object updates) { boolean ignoreCase = getIgnoreCase(); boolean madeChanges = false; if (updates instanceof List) { madeChanges = applyListUpdates((List<String>)updates, ignoreCase); } else if (updates instanceof Map) { madeChanges = applyMapUpdates((Map<String,Object>)updates, ignoreCase); } else { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "Unsupported data format (" + updates.getClass().getName() + "); expected a JSON object (Map or List)!"); } return madeChanges ? getStoredView() : null; }
Example #30
Source File: JSONResponseReader.java From attic-polygene-java with Apache License 2.0 | 5 votes |
@Override public Object readResponse( Response response, Class<?> resultType ) { if( response.getEntity().getMediaType().equals( MediaType.APPLICATION_JSON ) ) { if( ValueComposite.class.isAssignableFrom( resultType ) ) { String jsonValue = response.getEntityAsText(); ValueCompositeType valueType = module.valueDescriptor( resultType.getName() ).valueType(); return jsonDeserializer.deserialize( module, valueType, jsonValue ); } else if( resultType.equals( Form.class ) ) { try( JsonReader reader = jsonFactories.readerFactory() .createReader( response.getEntity().getReader() ) ) { JsonObject jsonObject = reader.readObject(); Form form = new Form(); jsonObject.forEach( ( key, value ) -> { String valueString = value.getValueType() == JsonValue.ValueType.STRING ? ( (JsonString) value ).getString() : value.toString(); form.set( key, valueString ); } ); return form; } catch( IOException | JsonException e ) { throw new ResourceException( e ); } } } return null; }