/** * Returns true if clustering support is enabled. This does not mean * that clustering has started or that clustering will be able to start. * * @return true if clustering support is enabled. */ public static boolean isClusteringEnabled() { return JiveGlobals.getXMLProperty(CLUSTER_PROPERTY_NAME, false); }
if (!XML_ONLY_PROPERTIES.contains(propName)) { if (JiveGlobals.getProperty(propName) == null) { JiveGlobals.setProperty(propName, JiveGlobals.getXMLProperty(propName));
/** * Constructs a new JNDI pool. */ public JNDIDataSourceProvider() { dataSourceName = JiveGlobals.getXMLProperty("database.JNDIProvider.name"); }
public static boolean isOneTimeAccessTokenEnabled() { return org.apache.commons.lang3.StringUtils.isNotBlank(JiveGlobals.getXMLProperty(ONE_TIME_PROPERTY)); }
private String getBindInterface() { String interfaceName = JiveGlobals.getXMLProperty("network.interface"); String bindInterface = null; if (interfaceName != null) { if (interfaceName.trim().length() > 0) { bindInterface = interfaceName; } } return bindInterface; }
driver = JiveGlobals.getXMLProperty("database.defaultProvider.driver"); serverURL = JiveGlobals.getXMLProperty("database.defaultProvider.serverURL"); username = JiveGlobals.getXMLProperty("database.defaultProvider.username"); password = JiveGlobals.getXMLProperty("database.defaultProvider.password"); String minCons = JiveGlobals.getXMLProperty("database.defaultProvider.minConnections"); String maxCons = JiveGlobals.getXMLProperty("database.defaultProvider.maxConnections"); String conTimeout = JiveGlobals.getXMLProperty("database.defaultProvider.connectionTimeout"); testSQL = JiveGlobals.getXMLProperty("database.defaultProvider.testSQL", DbConnectionManager.getTestSQL(driver)); testBeforeUse = JiveGlobals.getXMLProperty("database.defaultProvider.testBeforeUse", false); testAfterUse = JiveGlobals.getXMLProperty("database.defaultProvider.testAfterUse", false); testTimeout = JiveGlobals.getXMLProperty("database.defaultProvider.testTimeout", (int) JiveConstants.SECOND / 2); timeBetweenEvictionRuns = JiveGlobals.getXMLProperty("database.defaultProvider.timeBetweenEvictionRuns", (int) (30 * JiveConstants.SECOND)); minIdleTime = JiveGlobals.getXMLProperty("database.defaultProvider.minIdleTime", (int) (15 * JiveConstants.MINUTE)); maxWaitTime = JiveGlobals.getXMLProperty("database.defaultProvider.maxWaitTime", (int) JiveConstants.SECOND / 2); mysqlUseUnicode = Boolean.valueOf(JiveGlobals.getXMLProperty("database.mysql.useUnicode")); try { if (minCons != null) {
/** * Returns <tt>null</tt> if the admin console will be available in all network interfaces of this machine * or a String representing the only interface where the admin console will be available. * * @return String representing the only interface where the admin console will be available or null if it * will be available in all interfaces. */ public String getBindInterface() { String adminInterfaceName = JiveGlobals.getXMLProperty("adminConsole.interface"); String globalInterfaceName = JiveGlobals.getXMLProperty("network.interface"); String bindInterface = null; if (adminInterfaceName != null && adminInterfaceName.trim().length() > 0) { bindInterface = adminInterfaceName; } else if (globalInterfaceName != null && globalInterfaceName.trim().length() > 0) { bindInterface = globalInterfaceName; } return bindInterface; }
/** * Returns a boolean value local property. Local properties are stored in the * file defined in <tt>JIVE_CONFIG_FILENAME</tt> that exists in the <tt>home</tt> * directory. Properties are always specified as "foo.bar.prop", which would map to * the following entry in the XML file: * <pre> * <foo> * <bar> * <prop>some value</prop> * </bar> * </foo> * </pre> * * If the specified property can't be found, the <tt>defaultValue</tt> will be returned. * If the property is found, it will be parsed using {@link Boolean#valueOf(String)}. * * @param name the name of the property to return. * @param defaultValue value returned if the property could not be loaded or was not * a number. * @return the property value specified by name or <tt>defaultValue</tt>. */ public static boolean getXMLProperty(String name, boolean defaultValue) { String value = getXMLProperty(name); if (value != null) { return Boolean.valueOf(value); } return defaultValue; }
/** * Returns the specific network interface on which Openfire is configured to listen, or null when no such preference * has been configured. * * @return A network interface or null. * @throws UnknownHostException When the configured network name cannot be resolved. */ public InetAddress getListenAddress() throws UnknownHostException { String interfaceName = JiveGlobals.getXMLProperty( "network.interface" ); InetAddress bindInterface = null; if (interfaceName != null) { if (interfaceName.trim().length() > 0) { bindInterface = InetAddress.getByName(interfaceName); } } return bindInterface; }
/** * Returns the specific network interface on which the Openfire administration * console should be configured to listen, or null when no such preference * has been configured. * * @return A network interface or null. * @throws UnknownHostException When the configured network name cannot be resolved. */ public InetAddress getAdminConsoleListenAddress() throws UnknownHostException { String acInterfaceName = JiveGlobals.getXMLProperty( "adminConsole.interface" ); InetAddress acBindInterface = null; if (acInterfaceName != null) { if (acInterfaceName.trim().length() > 0) { acBindInterface = InetAddress.getByName(acInterfaceName); } } return acBindInterface; }
String value = getXMLProperty(name); if (value != null) { try {
@Override public String getHostname() { final String fqdn = JiveGlobals.getXMLProperty( "fqdn" ); if ( fqdn != null && !fqdn.trim().isEmpty() ) { return fqdn.trim().toLowerCase(); } try { return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase(); } catch (UnknownHostException ex) { Log.warn( "Unable to determine local hostname.", ex ); return "localhost"; } }
@Override public void start() { if (dataSourceName == null || dataSourceName.equals("")) { Log.error("No name specified for DataSource. JNDI lookup will fail", new Throwable()); return; } try { Properties contextProperties = new Properties(); for (String key: jndiPropertyKeys) { String value = JiveGlobals.getXMLProperty(key); if (value != null) { contextProperties.setProperty(key, value); } } Context context; if (contextProperties.size() > 0) { context = new InitialContext(contextProperties); } else { context = new InitialContext(); } dataSource = (DataSource)context.lookup(dataSourceName); } catch (Exception e) { Log.error("Could not lookup DataSource at '" + dataSourceName + "'", e); } }
final String interfaceName = JiveGlobals.getXMLProperty( "network.interface" );
/** * Transforms XML data storage records into Pubsub node records * * @param oldRecords The records to transform (cannot be null) * @return Transformed records (never null, can be empty). */ private static List<PubsubRecordData> transform( List<PrivateXmlRecord> oldRecords ) { Log.info( "Transforming all data from Private XML Storage into Pubsub entities." ); String domain; try { domain = JiveGlobals.getProperty( "xmpp.domain", JiveGlobals.getXMLProperty( "fqdn", InetAddress.getLocalHost().getCanonicalHostName() ) ).toLowerCase(); } catch ( UnknownHostException e ) { domain = "localhost"; } final List<PubsubRecordData> result = new ArrayList<>(); for ( final PrivateXmlRecord oldRecord : oldRecords ) { final PubsubRecordData newRecord = new PubsubRecordData( oldRecord.username + '@' + domain, oldRecord.namespace, oldRecord.privateData ); result.add( newRecord ); } return result; }
public static AuthToken checkOneTimeAccessToken(String userToken) throws UnauthorizedException { String accessToken = JiveGlobals.getXMLProperty(ONE_TIME_PROPERTY); if (isOneTimeAccessTokenEnabled() && accessToken.equals(userToken)) { // Remove the one time token. // This invocation will overwrite the openfire.xml with removing the OneTimeAccessToken tag. JiveGlobals.deleteXMLProperty(ONE_TIME_PROPERTY); Log.info("Login with the one time access token."); return AuthToken.generateOneTimeToken(accessToken); } else { throw new UnauthorizedException(); } } }
Integer maxRetries = JiveGlobals.getXMLProperty(SETTING_DATABASE_MAX_RETRIES, 10); Integer retryWait = JiveGlobals.getXMLProperty(SETTING_DATABASE_RETRY_DELAY, 250); // milliseconds SQLException lastException = null; do {
List<String> values = new ArrayList<>(); for (String propName : propNames) { String value = getXMLProperty(parent + "." + propName); if (value != null) { values.add(value);
if (Boolean.valueOf(JiveGlobals.getXMLProperty("setup"))) { return false;
/** * Ensures that the connection provider exists and is set */ private static void ensureConnectionProvider() { if (connectionProvider != null) return; synchronized (providerLock) { if (connectionProvider != null) return; // Attempt to load the connection provider classname as a Jive property. String className = JiveGlobals.getXMLProperty("connectionProvider.className"); if (className != null) { // Attempt to load the class. try { Class conClass = ClassUtils.forName(className); setConnectionProvider((ConnectionProvider)conClass.newInstance()); } catch (Exception e) { Log.warn("Failed to create the " + "connection provider specified by connection" + "Provider.className. Using the default pool.", e); setConnectionProvider(new DefaultConnectionProvider()); } } else { setConnectionProvider(new DefaultConnectionProvider()); } } }