/** * Get a module configuration property as an integer * * @param module the name of the module * @param property the name of the property * @return the value of the property. <code>0</code> is returned if the * property does not exist. To differentiate between this case and * when the property actually is zero, use <code>getProperty</code>. */ public static int getIntProperty(String module, String property) { if (module == null) { return getIntProperty(property); } // Assume "module" properties are always prefixed with the module name return getIntProperty(module + "." + property); }
/** * Get a module configuration property as an integer, with default * * @param module the name of the module * @param property the name of the property * @param defaultValue value to return if property is not found or is not an Integer. * @return the value of the property. <code>default</code> is returned if * the property does not exist or is not an Integer. To differentiate between this case * and when the property actually is false, use * <code>getProperty</code>. */ public static int getIntProperty(String module, String property, int defaultValue) { if (module == null) { return getIntProperty(property, defaultValue); } // Assume "module" properties are always prefixed with the module name return getIntProperty(module + "." + property, defaultValue); }
/** * Initalise the servlet */ public void init() { // Set the lmimt to the number of items that may be changed in one go, default to 20 limit = ConfigurationManager.getIntProperty("bulkedit", "gui-item-limit", 20); log.debug("Setting bulk edit limit to " + limit + " items"); }
@Override public void init(ServletConfig arg0) throws ServletException { super.init(arg0); threshold = ConfigurationManager .getIntProperty("webui.content_disposition_threshold"); }
@Override public void init(ServletConfig arg0) throws ServletException { super.init(arg0); threshold = ConfigurationManager .getIntProperty("webui.content_disposition_threshold"); }
private static void getThumbSettings() { showThumbs = ConfigurationManager .getBooleanProperty("webui.browse.thumbnail.show"); if (showThumbs) { thumbItemListMaxHeight = ConfigurationManager .getIntProperty("webui.browse.thumbnail.maxheight"); if (thumbItemListMaxHeight == 0) { thumbItemListMaxHeight = ConfigurationManager .getIntProperty("thumbnail.maxheight"); } thumbItemListMaxWidth = ConfigurationManager .getIntProperty("webui.browse.thumbnail.maxwidth"); if (thumbItemListMaxWidth == 0) { thumbItemListMaxWidth = ConfigurationManager .getIntProperty("thumbnail.maxwidth"); } } String linkBehaviour = ConfigurationManager .getProperty("webui.browse.thumbnail.linkbehaviour"); if ("bitstream".equals(linkBehaviour)) { linkToBitstream = true; } }
private static void getThumbSettings() { showThumbs = ConfigurationManager .getBooleanProperty("webui.browse.thumbnail.show"); if (showThumbs) { thumbItemListMaxHeight = ConfigurationManager .getIntProperty("webui.browse.thumbnail.maxheight"); if (thumbItemListMaxHeight == 0) { thumbItemListMaxHeight = ConfigurationManager .getIntProperty("thumbnail.maxheight"); } thumbItemListMaxWidth = ConfigurationManager .getIntProperty("webui.browse.thumbnail.maxwidth"); if (thumbItemListMaxWidth == 0) { thumbItemListMaxWidth = ConfigurationManager .getIntProperty("thumbnail.maxwidth"); } } String linkBehaviour = ConfigurationManager .getProperty("webui.browse.thumbnail.linkbehaviour"); if (linkBehaviour != null && linkBehaviour.equals("bitstream")) { linkToBitstream = true; } }
/** * Create an HTML Servlet */ public HTMLServlet() { super(); if (ConfigurationManager.getProperty("webui.html.max-depth-guess") != null) { maxDepthGuess = ConfigurationManager .getIntProperty("webui.html.max-depth-guess"); } else { maxDepthGuess = 3; } }
@Override public void deleteOldExportArchives(EPerson eperson) throws Exception { int hours = ConfigurationManager .getIntProperty("org.dspace.app.itemexport.life.span.hours"); Calendar now = Calendar.getInstance(); now.setTime(new Date()); now.add(Calendar.HOUR, (-hours)); File downloadDir = new File(getExportDownloadDirectory(eperson)); if (downloadDir.exists()) { File[] files = downloadDir.listFiles(); for (File file : files) { if (file.lastModified() < now.getTimeInMillis()) { if (!file.delete()) { log.error("Unable to delete export file"); } } } } }
@Override public List<HarvestedCollection> findReady(Context context) throws SQLException { int harvestInterval = ConfigurationManager.getIntProperty("oai", "harvester.harvestFrequency"); if (harvestInterval == 0) { harvestInterval = 720; } int expirationInterval = ConfigurationManager.getIntProperty("oai", "harvester.threadTimeout"); if (expirationInterval == 0) { expirationInterval = 24; } Date startTime; Date expirationTime; Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); calendar.add(Calendar.MINUTE, -1 * harvestInterval); startTime = calendar.getTime(); calendar.setTime(startTime); calendar.add(Calendar.HOUR, -2 * expirationInterval); expirationTime = calendar.getTime(); int[] statuses = new int[] {HarvestedCollection.STATUS_READY, HarvestedCollection.STATUS_OAI_ERROR}; return harvestedCollectionDAO .findByLastHarvestedAndHarvestTypeAndHarvestStatusesAndHarvestTime(context, startTime, HarvestedCollection.TYPE_NONE, statuses, HarvestedCollection.STATUS_BUSY, expirationTime); }
public InputStream getThumb(Item currentItem, BufferedImage buf, boolean verbose) throws Exception { // get config params float xmax = (float) ConfigurationManager .getIntProperty("thumbnail.maxwidth"); float ymax = (float) ConfigurationManager .getIntProperty("thumbnail.maxheight"); boolean blurring = (boolean) ConfigurationManager .getBooleanProperty("thumbnail.blurring"); boolean hqscaling = (boolean) ConfigurationManager .getBooleanProperty("thumbnail.hqscaling"); return getThumbDim(currentItem, buf, verbose, xmax, ymax, blurring, hqscaling, 0, 0, null); }
@Override public void deleteOldExportArchives() throws Exception { int hours = ConfigurationManager.getIntProperty("org.dspace.app.itemexport.life.span.hours"); Calendar now = Calendar.getInstance(); now.setTime(new Date()); now.add(Calendar.HOUR, (-hours)); File downloadDir = new File(ConfigurationManager.getProperty("org.dspace.app.itemexport.download.dir")); if (downloadDir.exists()) { // Get a list of all the sub-directories, potentially one for each ePerson. File[] dirs = downloadDir.listFiles(); for (File dir : dirs) { // For each sub-directory delete any old files. File[] files = dir.listFiles(); for (File file : files) { if (file.lastModified() < now.getTimeInMillis()) { if (!file.delete()) { log.error("Unable to delete old files"); } } } // If the directory is now empty then we delete it too. if (dir.listFiles().length == 0) { if (!dir.delete()) { log.error("Unable to delete directory"); } } } } }
public HarvestScheduler() throws SQLException, AuthorizeException { mainContext = new Context(); String harvestAdminParam = ConfigurationManager.getProperty("oai", "harvester.eperson"); harvestAdmin = null; if (harvestAdminParam != null && harvestAdminParam.length() > 0) { harvestAdmin = EPersonServiceFactory.getInstance().getEPersonService() .findByEmail(mainContext, harvestAdminParam); } harvestThreads = new Stack<HarvestThread>(); maxActiveThreads = ConfigurationManager.getIntProperty("oai", "harvester.maxThreads"); if (maxActiveThreads == 0) { maxActiveThreads = 3; } minHeartbeat = ConfigurationManager.getIntProperty("oai", "harvester.minHeartbeat") * 1000; if (minHeartbeat == 0) { minHeartbeat = 30000; } maxHeartbeat = ConfigurationManager.getIntProperty("oai", "harvester.maxHeartbeat") * 1000; if (maxHeartbeat == 0) { maxHeartbeat = 3600000; } }
.getIntProperty("webui.preview.maxwidth"); float ymax = (float) ConfigurationManager .getIntProperty("webui.preview.maxheight"); boolean blurring = (boolean) ConfigurationManager .getBooleanProperty("webui.preview.blurring"); boolean hqscaling = (boolean) ConfigurationManager .getBooleanProperty("webui.preview.hqscaling"); int brandHeight = ConfigurationManager.getIntProperty("webui.preview.brand.height"); String brandFont = ConfigurationManager.getProperty("webui.preview.brand.font"); int brandFontPoint = ConfigurationManager.getIntProperty("webui.preview.brand.fontpoint");
int mus = ConfigurationManager.getIntProperty("sword-server", "max-upload-size"); if (mus > 0)
throws IOException { Resolver res = new ExtendedResolver(); int timeout = ConfigurationManager.getIntProperty("usage-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout);
int numRecentSubmissions = ConfigurationManager.getIntProperty("recent.submissions.count", RECENT_SUBMISSIONS); if(numRecentSubmissions == 0)
public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } } }
/** * Resolve an IP address to a host name. * * @param hostIp dotted decimal IPv4 address. * @return name if resolved, or the address. * @throws IOException from infrastructure. */ public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("usage-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } }
int etAl = ConfigurationManager.getIntProperty("webui.browse.author-limit"); if (etAl != 0)