public ProtocolPort(String protocol, String port) throws GeneralException { if (!ServerUtility.HTTP.equals(protocol) && !ServerUtility.HTTPS.equals(protocol)) { throw new GeneralException("bad protocol in ProtocolPort constructor"); } if (port == null || port.isEmpty()) { throw new GeneralException("bad port in ProtocolPort constructor"); } this.protocol = protocol; this.port = port; }
public ProtocolPort(String protocol, String port) throws GeneralException { if (!ServerUtility.HTTP.equals(protocol) && !ServerUtility.HTTPS.equals(protocol)) { throw new GeneralException("bad protocol in ProtocolPort constructor"); } if (port == null || port.isEmpty()) { throw new GeneralException("bad port in ProtocolPort constructor"); } this.protocol = protocol; this.port = port; }
public DOValidatorXMLSchema(String schemaPath) throws GeneralException { try { File schemaFile = new File(schemaPath); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); m_schema = schemaFactory.newSchema(schemaFile); } catch (Exception e) { logger.error("Error constructing validator", e); throw new GeneralException(e.getMessage()); } }
public DOValidatorXMLSchema(String schemaPath) throws GeneralException { try { File schemaFile = new File(schemaPath); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); m_schema = schemaFactory.newSchema(schemaFile); } catch (Exception e) { logger.error("Error constructing validator", e); throw new GeneralException(e.getMessage()); } }
@Override public void reservePIDs(String[] pidList) throws ServerException { try { for (String element : pidList) { m_pidGenerator.neverGeneratePID(element); } } catch (IOException e) { throw new GeneralException("Error reserving PIDs", e); } }
static String getSubjectPID(String subject) throws ServerException { if (isPid(subject)) { return subject; } // check for info:uri scheme if (subject.startsWith(Constants.FEDORA.uri)) { // pid is everything after the first / to the 2nd / or to the end of the string return subject.split("/", 3)[1]; } else { throw new GeneralException("Subject URI must be in the " + Constants.FEDORA.uri + " scheme."); } }
@Override public void reservePIDs(String[] pidList) throws ServerException { try { for (String element : pidList) { m_pidGenerator.neverGeneratePID(element); } } catch (IOException e) { throw new GeneralException("Error reserving PIDs", e); } }
static String getSubjectPID(String subject) throws ServerException { if (isPid(subject)) { return subject; } // check for info:uri scheme if (subject.startsWith(Constants.FEDORA.uri)) { // pid is everything after the first / to the 2nd / or to the end of the string return subject.split("/", 3)[1]; } else { throw new GeneralException("Subject URI must be in the " + Constants.FEDORA.uri + " scheme."); } }
public void validate(File objectAsFile) throws ObjectValidityException, GeneralException { try { validate(new StreamSource(new FileInputStream(objectAsFile))); } catch (IOException e) { String msg = "DOValidatorXMLSchema returned error.\n" + "The underlying exception was a " + e.getClass().getName() + ".\n" + "The message was " + "\"" + e.getMessage() + "\""; throw new GeneralException(msg); } }
private void updatePolicy(String pid, InputStream dsContent) throws GeneralException { LOG.info("Updating policy " + pid); String policy; try { policy = IOUtils.toString(dsContent); dsContent.close(); m_policyIndex.updatePolicy(pid, policy); } catch (IOException e) { throw new GeneralException("Error adding policy " + pid + " to policy index: " + e.getMessage(), e); } catch (PolicyIndexException e) { throw new GeneralException("Error adding policy " + pid + " to policy index: " + e.getMessage(), e); } }
public void validate(File objectAsFile) throws ObjectValidityException, GeneralException { try { validate(new StreamSource(new FileInputStream(objectAsFile))); } catch (IOException e) { String msg = "DOValidatorXMLSchema returned error.\n" + "The underlying exception was a " + e.getClass().getName() + ".\n" + "The message was " + "\"" + e.getMessage() + "\""; throw new GeneralException(msg); } }
private void addPolicy(String pid, InputStream dsContent) throws GeneralException { LOG.info("Adding policy " + pid); String policy; try { policy = IOUtils.toString(dsContent); dsContent.close(); m_policyIndex.addPolicy(pid, policy); } catch (IOException e) { throw new GeneralException("Error adding policy " + pid + " to policy index: " + e.getMessage(), e); } catch (PolicyIndexException e) { throw new GeneralException("Error adding policy " + pid + " to policy index: " + e.getMessage(), e); } } private void updatePolicy(String pid, InputStream dsContent) throws GeneralException {
private String resolveSubjectToDatastream(String subject) throws ServerException{ String pidURI = PID.toURI(m_obj.getPid()); if (subject.startsWith(pidURI)) { if (subject.length() == pidURI.length()) { return "RELS-EXT"; } if (subject.charAt(pidURI.length()) == '/') { return "RELS-INT"; } } throw new GeneralException("Cannot determine which relationship datastream to update for subject " + subject + ". Relationship subjects must be the URI of the object or the URI of a datastream within the object."); }
private String resolveSubjectToDatastream(String subject) throws ServerException{ String pidURI = PID.toURI(m_obj.getPid()); if (subject.startsWith(pidURI)) { if (subject.length() == pidURI.length()) { return "RELS-EXT"; } if (subject.charAt(pidURI.length()) == '/') { return "RELS-INT"; } } throw new GeneralException("Cannot determine which relationship datastream to update for subject " + subject + ". Relationship subjects must be the URI of the object or the URI of a datastream within the object."); }
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; }
/** * Get the current date from the context. If the context doesn't specify a * value for the current date, or the specified value cannot be parsed as an * ISO8601 date string, a GeneralException will be thrown. */ public static Date getCurrentDate(Context context) throws GeneralException { URI propName = Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId; String dateTimeValue = context.getEnvironmentValue(propName); if (dateTimeValue == null) { throw new GeneralException("Missing value for environment " + "context attribute: " + propName); } try { return DateUtility.parseDateStrict(dateTimeValue); } catch (ParseException e) { throw new GeneralException(e.getMessage()); } }
/** * Get the current date from the context. If the context doesn't specify a * value for the current date, or the specified value cannot be parsed as an * ISO8601 date string, a GeneralException will be thrown. */ public static Date getCurrentDate(Context context) throws GeneralException { URI propName = Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId; String dateTimeValue = context.getEnvironmentValue(propName); if (dateTimeValue == null) { throw new GeneralException("Missing value for environment " + "context attribute: " + propName); } try { return DateUtility.parseDateStrict(dateTimeValue); } catch (ParseException e) { throw new GeneralException(e.getMessage()); } }
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; }
+ " property count=" + properties.size()); if (serviceRoleID == null || serviceRoleID.isEmpty()) { throw new GeneralException("serviceRoleID is missing."); Hashtable<String, String> serviceProps = rolePropertiesTable.get(serviceRoleID); if (serviceProps == null) { throw new GeneralException("Cannot add method-level security properties" + " if there are no properties defined for the backend service that the " + " method is part of. ");
+ " property count=" + properties.size()); if (serviceRoleID == null || serviceRoleID.isEmpty()) { throw new GeneralException("serviceRoleID is missing."); Hashtable<String, String> serviceProps = rolePropertiesTable.get(serviceRoleID); if (serviceProps == null) { throw new GeneralException("Cannot add method-level security properties" + " if there are no properties defined for the backend service that the " + " method is part of. ");