public static void getObjectProfile(String reposBaseURL, ObjectProfile objProfile, Date versDateTime, Writer out) throws ServerException { // use REST serializer try { DefaultSerializer.objectProfileToXML(objProfile, versDateTime, out); } catch (IOException e) { throw new StreamIOException(e.getMessage(), e); } }
throw new ValidationException("Failed to get content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
protected DigitalObject doDeserializeOrFail(DigitalObject obj) { DigitalObject result = null; try { result = doDeserialize(obj); } catch (ObjectIntegrityException e) { e.printStackTrace(); fail("Deserializer threw ObjectIntegrityException"); } catch (StreamIOException e) { e.printStackTrace(); fail("Deserializer threw StreamIOException"); } return result; }
throw new ValidationException("Failed to get content stream for " + pid + "/" + dsId + ": " + e.getMessage(), e);
public static void getObjectProfile(String reposBaseURL, ObjectProfile objProfile, Date versDateTime, Writer out) throws ServerException { // use REST serializer try { DefaultSerializer.objectProfileToXML(objProfile, versDateTime, out); } catch (IOException e) { throw new StreamIOException(e.getMessage(), e); } }
public DCFields(InputStream in) throws RepositoryConfigurationException, ObjectIntegrityException, StreamIOException { try { XmlTransformUtility.parseWithoutValidating(in, this); } catch (SAXException saxe) { throw new ObjectIntegrityException("Parse error parsing DC XML Metadata: " + saxe.getMessage()); } catch (IOException ioe) { throw new StreamIOException("Stream error parsing DC XML Metadata: " + ioe.getMessage()); } }
public DCFields(InputStream in) throws RepositoryConfigurationException, ObjectIntegrityException, StreamIOException { try { XmlTransformUtility.parseWithoutValidating(in, this); } catch (SAXException saxe) { throw new ObjectIntegrityException("Parse error parsing DC XML Metadata: " + saxe.getMessage()); } catch (IOException ioe) { throw new StreamIOException("Stream error parsing DC XML Metadata: " + ioe.getMessage()); } }
protected void serializeDatastreamContent(Datastream dsc, PrintWriter writer) throws StreamIOException { writer.print("<"); writer.print(METS.prefix); writer.print(":FContent> \n"); Reader encoded = new InputStreamReader(Base64.encodeToStream(dsc.getContentStream())); char [] buffer = new char[80]; int len = 0; try{ while ((len = encoded.read(buffer)) > -1){ writer.write(DOSerializer.DS_INDENT); writer.write(buffer,0,len); writer.write('\n'); } } catch (IOException ioe) { throw new StreamIOException(ioe.getMessage()); } writer.print("</"); writer.print(METS.prefix); writer.print(":FContent>\n"); }
public ObjectFields(String[] fieldNames, InputStream in) throws UnrecognizedFieldException, RepositoryConfigurationException, ObjectIntegrityException, StreamIOException { this(fieldNames); try { XmlTransformUtility.parseWithoutValidating(in, this); } catch (SAXException saxe) { throw new ObjectIntegrityException("Parse error parsing ObjectFields: " + saxe.getMessage()); } catch (IOException ioe) { throw new StreamIOException("Stream error parsing ObjectFields: " + ioe.getMessage()); } }
protected void serializeDatastreamContent(Datastream dsc, PrintWriter writer) throws StreamIOException { writer.print("<"); writer.print(FOXML.prefix); writer.print(":binaryContent> \n"); Reader encoded = new InputStreamReader(Base64.encodeToStream(dsc.getContentStream())); char [] buffer = new char[80]; int len = 0; try{ while ((len = encoded.read(buffer)) > -1){ writer.write(DOSerializer.DS_INDENT); writer.write(buffer,0,len); writer.write('\n'); } } catch (IOException ioe) { throw new StreamIOException(ioe.getMessage()); } writer.print("</"); writer.print(FOXML.prefix); writer.print(":binaryContent> \n"); }
public ObjectFields(String[] fieldNames, InputStream in) throws UnrecognizedFieldException, RepositoryConfigurationException, ObjectIntegrityException, StreamIOException { this(fieldNames); try { XmlTransformUtility.parseWithoutValidating(in, this); } catch (SAXException saxe) { throw new ObjectIntegrityException("Parse error parsing ObjectFields: " + saxe.getMessage()); } catch (IOException ioe) { throw new StreamIOException("Stream error parsing ObjectFields: " + ioe.getMessage()); } }
protected void serializeDatastreamContent(Datastream dsc, PrintWriter writer) throws StreamIOException { writer.print("<"); writer.print(FOXML.prefix); writer.print(":binaryContent> \n"); Reader encoded = new InputStreamReader(Base64.encodeToStream(dsc.getContentStream())); char [] buffer = new char[80]; int len = 0; try{ while ((len = encoded.read(buffer)) > -1){ writer.write(DOSerializer.DS_INDENT); writer.write(buffer,0,len); writer.write('\n'); } } catch (IOException ioe) { throw new StreamIOException(ioe.getMessage()); } writer.print("</"); writer.print(FOXML.prefix); writer.print(":binaryContent> \n"); }
protected void serializeDatastreamContent(Datastream dsc, PrintWriter writer) throws StreamIOException { writer.print("<"); writer.print(METS.prefix); writer.print(":FContent> \n"); Reader encoded = new InputStreamReader(Base64.encodeToStream(dsc.getContentStream())); char [] buffer = new char[80]; int len = 0; try{ while ((len = encoded.read(buffer)) > -1){ writer.write(DOSerializer.DS_INDENT); writer.write(buffer,0,len); writer.write('\n'); } } catch (IOException ioe) { throw new StreamIOException(ioe.getMessage()); } writer.print("</"); writer.print(METS.prefix); writer.print(":FContent>\n"); }
public BackendSecuritySpec deserialize(String inFilePath) throws GeneralException, StreamIOException, UnsupportedEncodingException { logger.debug("Parsing beSecurity file..."); tmp_level = 0; try { FileInputStream fis = new FileInputStream(new File(inFilePath)); tmp_parser.parse(fis, this); } catch (IOException ioe) { throw new StreamIOException("BackendSecurityDeserializer: " + "Stream IO problem while parsing backend security config file."); } catch (SAXException se) { throw new GeneralException("BackendSecurityDeserializer: " + "Error parsing backend security config file. " + se.getMessage()); } if (!tmp_rootElementFound) { throw new GeneralException("BackendSecurityDeserializer: " + "Root element not found in backend security config file."); } logger.debug("Parse successful."); return beSS; }
public BackendSecuritySpec deserialize(String inFilePath) throws GeneralException, StreamIOException, UnsupportedEncodingException { logger.debug("Parsing beSecurity file..."); tmp_level = 0; try { FileInputStream fis = new FileInputStream(new File(inFilePath)); tmp_parser.parse(fis, this); } catch (IOException ioe) { throw new StreamIOException("BackendSecurityDeserializer: " + "Stream IO problem while parsing backend security config file."); } catch (SAXException se) { throw new GeneralException("BackendSecurityDeserializer: " + "Error parsing backend security config file. " + se.getMessage()); } if (!tmp_rootElementFound) { throw new GeneralException("BackendSecurityDeserializer: " + "Root element not found in backend security config file."); } logger.debug("Parse successful."); return beSS; }
DSLocation = TEMP_SCHEME + tempFile.getAbsolutePath(); } catch (Exception e) { throw new StreamIOException("Error creating new temp file for updated managed content (existing content is:" + oldDSLocation + ")", e); oldFile = new File(oldDSLocation.substring(TEMP_SCHEME.length())); } catch (Exception e) { throw new StreamIOException("Error removing old temp file while updating managed content (location: " + oldDSLocation + ")", e);
DSLocation = TEMP_SCHEME + tempFile.getAbsolutePath(); } catch (Exception e) { throw new StreamIOException("Error creating new temp file for updated managed content (existing content is:" + oldDSLocation + ")", e); oldFile = new File(oldDSLocation.substring(TEMP_SCHEME.length())); } catch (Exception e) { throw new StreamIOException("Error removing old temp file while updating managed content (location: " + oldDSLocation + ")", e);
throw uee; } catch (IOException ioe) { throw new StreamIOException("Error reading from inline xml datastream."); } finally { try { in.close(); } catch (IOException closeProb) { throw new StreamIOException("Error closing read stream.");
throw uee; } catch (IOException ioe) { throw new StreamIOException("Error reading from inline xml datastream."); } finally { try { in.close(); } catch (IOException closeProb) { throw new StreamIOException("Error closing read stream.");
private void addAuditDatastream(DigitalObject obj, Entry entry, String encoding, File tempDir) throws ObjectIntegrityException, StreamIOException { try { Reader auditTrail; if (m_format.equals(ATOM_ZIP1_1)) { File f = getContentSrcAsFile(entry.getContentSrc(), tempDir); auditTrail = new InputStreamReader(new FileInputStream(f), encoding); } else { auditTrail = new StringReader(entry.getContent()); } obj.getAuditRecords().addAll(DOTranslationUtility .getAuditRecords(auditTrail)); auditTrail.close(); } catch (XMLStreamException e) { throw new ObjectIntegrityException(e.getMessage(), e); } catch (IOException e) { throw new StreamIOException(e.getMessage(), e); } }