List of usage examples for org.apache.commons.collections ExtendedProperties getInt
public int getInt(String name, int def)
From source file:bboss.org.apache.velocity.runtime.resource.loader.URLResourceLoader.java
/** * @see bboss.org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties) *///www .ja v a 2s. c o m public void init(ExtendedProperties configuration) { log.trace("URLResourceLoader : initialization starting."); roots = configuration.getStringArray("root"); if (log.isDebugEnabled()) { for (int i = 0; i < roots.length; i++) { log.debug("URLResourceLoader : adding root '" + roots[i] + "'"); } } timeout = configuration.getInt("timeout", -1); if (timeout > 0) { try { Class[] types = new Class[] { Integer.TYPE }; Method conn = URLConnection.class.getMethod("setConnectTimeout", types); Method read = URLConnection.class.getMethod("setReadTimeout", types); timeoutMethods = new Method[] { conn, read }; log.debug("URLResourceLoader : timeout set to " + timeout); } catch (NoSuchMethodException nsme) { log.debug("URLResourceLoader : Java 1.5+ is required to customize timeout!", nsme); timeout = -1; } } // init the template paths map templateRoots = new HashMap(); log.trace("URLResourceLoader : initialization complete."); }
From source file:org.apache.cayenne.access.DataRowStore.java
protected void initWithProperties(Map properties) { ExtendedProperties propertiesWrapper = new ExtendedProperties(); if (properties != null) { propertiesWrapper.putAll(properties); }/*from w ww. ja v a 2s .c om*/ long snapshotsExpiration = propertiesWrapper.getLong(SNAPSHOT_EXPIRATION_PROPERTY, SNAPSHOT_EXPIRATION_DEFAULT); maxSize = propertiesWrapper.getInt(SNAPSHOT_CACHE_SIZE_PROPERTY, SNAPSHOT_CACHE_SIZE_DEFAULT); boolean notifyRemote = propertiesWrapper.getBoolean(REMOTE_NOTIFICATION_PROPERTY, REMOTE_NOTIFICATION_DEFAULT); String eventBridgeFactory = propertiesWrapper.getString(EVENT_BRIDGE_FACTORY_PROPERTY, EVENT_BRIDGE_FACTORY_DEFAULT); if (logger.isDebugEnabled()) { logger.debug("DataRowStore property " + SNAPSHOT_EXPIRATION_PROPERTY + " = " + snapshotsExpiration); logger.debug("DataRowStore property " + SNAPSHOT_CACHE_SIZE_PROPERTY + " = " + maxSize); logger.debug("DataRowStore property " + REMOTE_NOTIFICATION_PROPERTY + " = " + notifyRemote); logger.debug("DataRowStore property " + EVENT_BRIDGE_FACTORY_PROPERTY + " = " + eventBridgeFactory); } // init ivars from properties this.notifyingRemoteListeners = notifyRemote; this.snapshots = new ConcurrentLinkedHashMap.Builder<ObjectId, DataRow>().maximumWeightedCapacity(maxSize) .build(); // init event bridge only if we are notifying remote listeners if (notifyingRemoteListeners) { try { EventBridgeFactory factory = (EventBridgeFactory) Class.forName(eventBridgeFactory).newInstance(); Collection<EventSubject> subjects = Collections.singleton(getSnapshotEventSubject()); String externalSubject = EventBridge.convertToExternalSubject(getSnapshotEventSubject()); this.remoteNotificationsHandler = factory.createEventBridge(subjects, externalSubject, properties); } catch (Exception ex) { throw new CayenneRuntimeException("Error initializing DataRowStore.", ex); } startListeners(); } }
From source file:org.apache.velocity.runtime.resource.loader.URLResourceLoader.java
/** * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#init(org.apache.commons.collections.ExtendedProperties) *//*from ww w . j a v a2 s . c o m*/ public void init(ExtendedProperties configuration) { Logger.debug(this, "URLResourceLoader : initialization starting."); roots = configuration.getStringArray("root"); if (Logger.isDebugEnabled(this.getClass())) { for (int i = 0; i < roots.length; i++) { Logger.debug(this, "URLResourceLoader : adding root '" + roots[i] + "'"); } } timeout = configuration.getInt("timeout", -1); if (timeout > 0) { try { Class[] types = new Class[] { Integer.TYPE }; Method conn = URLConnection.class.getMethod("setConnectTimeout", types); Method read = URLConnection.class.getMethod("setReadTimeout", types); timeoutMethods = new Method[] { conn, read }; Logger.debug(this, "URLResourceLoader : timeout set to " + timeout); } catch (NoSuchMethodException nsme) { Logger.debug(this, "URLResourceLoader : Java 1.5+ is required to customize timeout!", nsme); timeout = -1; } } // init the template paths map templateRoots = new HashMap(); Logger.debug(this, "URLResourceLoader : initialization complete."); }
From source file:org.kalypso.ui.editor.diagrameditor.ObservationDiagramEditor.java
@Override public IExportableObject[] createExportableObjects(final ExtendedProperties conf) { return new IExportableObject[] { new ExportableChart(m_obsChart, conf.getString(ImageExportPage.CONF_IMAGE_FORMAT, ExportableChart.DEFAULT_FORMAT), conf.getInt(ImageExportPage.CONF_IMAGE_WIDTH, ExportableChart.DEFAULT_WIDTH), conf.getInt(ImageExportPage.CONF_IMAGE_HEIGHT, ExportableChart.DEFAULT_HEIGHT), getTitle(), Messages.getString("org.kalypso.ui.editor.diagrameditor.ObservationDiagramEditor.1"), null) }; //$NON-NLS-1$ }
From source file:org.kalypso.ui.editor.mapeditor.MapExportableObjectFactory.java
@Override public IExportableObject[] createExportableObjects(final ExtendedProperties conf) { final String preferredDocumentName = m_mapPanel.getMapModell().getName().getValue(); final int width = conf.getInt(ImagePropertiesWizardPage.CONFIG_IMAGE_WIDTH, m_mapPanel.getWidth()); final int height = conf.getInt(ImagePropertiesWizardPage.CONFIG_IMAGE_HEIGHT, m_mapPanel.getHeight()); final Insets insets = (Insets) conf.getProperty(ImagePropertiesWizardPage.CONFIG_INSETS); final boolean border = conf.getBoolean(ImagePropertiesWizardPage.CONFIG_HAS_BORDER, false); final int borderWidth = border ? 1 : 0; final String format = conf.getString(ImagePropertiesWizardPage.CONFIG_IMAGE_FORMAT, "PNG"); //$NON-NLS-1$ return new IExportableObject[] { new MapExportableObject(m_mapPanel, preferredDocumentName, width, height, insets, borderWidth, format) }; }
From source file:org.objectstyle.cayenne.access.DataRowStore.java
protected void initWithProperties(Map properties) { ExtendedProperties propertiesWrapper = new ExtendedProperties(); if (properties != null) { propertiesWrapper.putAll(properties); }/*from ww w . j a v a 2 s.com*/ long snapshotsExpiration = propertiesWrapper.getLong(SNAPSHOT_EXPIRATION_PROPERTY, SNAPSHOT_EXPIRATION_DEFAULT); int snapshotsCacheSize = propertiesWrapper.getInt(SNAPSHOT_CACHE_SIZE_PROPERTY, SNAPSHOT_CACHE_SIZE_DEFAULT); boolean notifyRemote = propertiesWrapper.getBoolean(REMOTE_NOTIFICATION_PROPERTY, REMOTE_NOTIFICATION_DEFAULT); String eventBridgeFactory = propertiesWrapper.getString(EVENT_BRIDGE_FACTORY_PROPERTY, EVENT_BRIDGE_FACTORY_DEFAULT); if (logObj.isDebugEnabled()) { logObj.debug("DataRowStore property " + SNAPSHOT_EXPIRATION_PROPERTY + " = " + snapshotsExpiration); logObj.debug("DataRowStore property " + SNAPSHOT_CACHE_SIZE_PROPERTY + " = " + snapshotsCacheSize); logObj.debug("DataRowStore property " + REMOTE_NOTIFICATION_PROPERTY + " = " + notifyRemote); logObj.debug("DataRowStore property " + EVENT_BRIDGE_FACTORY_PROPERTY + " = " + eventBridgeFactory); } // init ivars from properties this.notifyingRemoteListeners = notifyRemote; // TODO: ENTRY EXPIRATION is not supported by commons LRU Map this.snapshots = new LRUMap(snapshotsCacheSize); // TODO: cache size should really be a sum of all result lists sizes... // so we must track it outside the LRUMap... this.snapshotLists = new LRUMap(snapshotsCacheSize); // init event bridge only if we are notifying remote listeners if (notifyingRemoteListeners) { try { EventBridgeFactory factory = (EventBridgeFactory) Class.forName(eventBridgeFactory).newInstance(); this.remoteNotificationsHandler = factory.createEventBridge(getSnapshotEventSubject(), properties); // listen to EventBridge EventManager.getDefaultManager().addListener(this, "processRemoteEvent", SnapshotEvent.class, getSnapshotEventSubject(), remoteNotificationsHandler); // start EventBridge - it will listen to all event sources for this // subject remoteNotificationsHandler.startup(EventManager.getDefaultManager(), EventBridge.RECEIVE_LOCAL_EXTERNAL); } catch (Exception ex) { throw new CayenneRuntimeException("Error initializing DataRowStore.", ex); } } }