Project

General

Profile

« Previous | Next » 

Revision 7155

handle CN.archive() rest call: PUT /archive/{pid}
https://redmine.dataone.org/issues/2678

View differences:

src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java
279 279
                        status = true;
280 280
                    }
281 281

  
282
                } else if (resource.startsWith(Constants.RESOURCE_ARCHIVE)) {
283
                    logMetacat.debug("Using resource " + Constants.RESOURCE_ARCHIVE);
284
                    // handle archive events
285
                    if (httpVerb == PUT) {
286
                        extra = parseTrailing(resource, Constants.RESOURCE_ARCHIVE);
287
                        archive(extra);
288
                        status = true;
289
                    }
282 290
                } else if (resource.startsWith(Constants.RESOURCE_CHECKSUM)) {
283 291
                    logMetacat.debug("Using resource: " + Constants.RESOURCE_CHECKSUM);
284 292

  
......
784 792
        TypeMarshaller.marshalTypeToOutputStream(id, out);
785 793
        
786 794
    }
795
    
796
    /**
797
     * Archives the given pid
798
     * @param pid
799
     * @throws InvalidToken
800
     * @throws ServiceFailure
801
     * @throws NotAuthorized
802
     * @throws NotFound
803
     * @throws NotImplemented
804
     * @throws IOException
805
     * @throws JiBXException
806
     */
807
    private void archive(String pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, IOException, JiBXException {
787 808

  
809
        OutputStream out = response.getOutputStream();
810
        response.setStatus(200);
811
        response.setContentType("text/xml");
812

  
813
        Identifier id = new Identifier();
814
        id.setValue(pid);
815

  
816
        logMetacat.debug("Calling archive");
817
        CNodeService.getInstance(request).archive(session, id);
818
        
819
        TypeMarshaller.marshalTypeToOutputStream(id, out);
820
        
821
    }
822

  
788 823
    /**
789 824
     * Return the requested object format
790 825
     * 

Also available in: Unified diff