Permalink
Browse files

PT36956563 Additional properties needed for clustering.

  • Loading branch information...
alexm77 committed Oct 29, 2012
1 parent 6c1cf10 commit c388f7ce376d0db3e2fee33b6eca625d8b412206
View
@@ -164,5 +164,6 @@
<classpathentry exported="true" kind="lib" path="lib/jedis-2.1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/spring-data-redis-1.0.1.RELEASE.jar"/>
<classpathentry exported="true" kind="lib" path="lib/mongo-2.9.0.jar"/>
+ <classpathentry kind="var" path="SIPX_CONFIG"/>
<classpathentry kind="output" path="bin.eclipse/classes"/>
</classpath>
@@ -10,5 +10,6 @@
<classpathentry kind="var" path="SIPX_BUILDDIR/sipXconfig/neoconf/test"/>
<classpathentry kind="var" path="SIPX_JAVADIR/sipXecs/sipXconfig/agent-bindings.jar"/>
<classpathentry kind="var" path="SIPX_JAVADIR/sipXecs/sipXconfig/cdr-bindings.jar"/>
+ <classpathentry kind="var" path="SIPX_JAVADIR"/>
<classpathentry kind="output" path="bin.eclipse"/>
</classpath>
@@ -59,6 +59,9 @@
<property name="providerLdapAuthClassName" value="org.jivesoftware.openfire.ldap.LdapAuthProvider"/>
<property name="providerLdapUserClassName" value="org.jivesoftware.openfire.ldap.LdapUserProvider"/>
<property name="providerLdapVCardClassName" value="org.jivesoftware.openfire.ldap.LdapVCardProvider"/>
+ <property name="additionalProperties">
+ <map/>
+ </property>
</bean>
<bean id="openfireApiProvider" class="org.sipfoundry.sipxconfig.xmlrpc.XmlRpcApiProvider">
@@ -20,6 +20,7 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.io.IOUtils;
@@ -37,9 +38,9 @@
import org.sipfoundry.sipxconfig.common.event.DaoEventListener;
import org.sipfoundry.sipxconfig.commserver.Location;
import org.sipfoundry.sipxconfig.conference.Conference;
-import org.sipfoundry.sipxconfig.dialplan.config.XmlFile;
import org.sipfoundry.sipxconfig.event.WebSocket;
import org.sipfoundry.sipxconfig.feature.FeatureManager;
+import org.sipfoundry.sipxconfig.im.ImManager;
import org.sipfoundry.sipxconfig.imbot.ImBot;
import org.sipfoundry.sipxconfig.localization.LocalizationContext;
import org.sipfoundry.sipxconfig.setting.Group;
@@ -57,14 +58,14 @@
@Override
public void replicate(ConfigManager manager, ConfigRequest request) throws IOException {
- if (!request.applies(OpenfireImpl.FEATURE, LdapManager.FEATURE, LocalizationContext.FEATURE, ImBot.FEATURE)) {
+ if (!request.applies(ImManager.FEATURE, LdapManager.FEATURE, LocalizationContext.FEATURE, ImBot.FEATURE)) {
return;
}
Set<Location> locations = request.locations(manager);
for (Location location : locations) {
File dir = manager.getLocationDataDirectory(location);
- boolean enabled = manager.getFeatureManager().isFeatureEnabled(OpenfireImpl.FEATURE, location);
+ boolean enabled = manager.getFeatureManager().isFeatureEnabled(ImManager.FEATURE, location);
String datfile = "sipxopenfire.cfdat";
String sipxopenfireClass = "sipxopenfire";
if (!enabled) {
@@ -117,22 +118,22 @@ public void replicate(ConfigManager manager, ConfigRequest request) throws IOExc
}
}
//touch xmpp_update.xml on every location where openfire runs
- m_openfire.touchXmppUpdate(m_featureManager.getLocationsForEnabledFeature(OpenfireImpl.FEATURE));
+ m_openfire.touchXmppUpdate(m_featureManager.getLocationsForEnabledFeature(ImManager.FEATURE));
}
- void write(Writer wtr, String wsAddress, int wsPort, String adminRestUrl) throws IOException {
+ private static void write(Writer wtr, String wsAddress, int wsPort, String adminRestUrl) throws IOException {
KeyValueConfiguration config = KeyValueConfiguration.equalsSeparated(wtr);
config.write("websocket.address", wsAddress);
config.write("websocket.port", wsPort);
config.write("admin.rest.url", adminRestUrl);
}
- void writeOfPropertyConfig(Writer w, OpenfireSettings settings) throws IOException {
+ private void writeOfPropertyConfig(Writer w, OpenfireSettings settings) throws IOException {
YamlConfiguration config = new YamlConfiguration(w);
writeSettings(config, settings);
}
- void writeSettings(YamlConfiguration config, OpenfireSettings settings) throws IOException {
+ private void writeSettings(YamlConfiguration config, OpenfireSettings settings) throws IOException {
if (settings == null) {
return;
}
@@ -145,6 +146,10 @@ void writeSettings(YamlConfiguration config, OpenfireSettings settings) throws I
} else {
config.write(AUTH_CLASSNAME_KEY, m_config.getProviderAuthClassName());
}
+
+ for(Map.Entry<String, String> entry: m_config.getAdditionalProperties().entrySet()) {
+ config.write(entry.getKey(), entry.getValue());
+ }
}
public void setConfig(OpenfireConfigurationFile config) {
@@ -161,8 +166,8 @@ public void setSipxConfig(SipxOpenfireConfiguration sipxConfig) {
private void checkReplicate(Object entity) {
if (entity instanceof User || entity instanceof Conference || entity instanceof Group) {
- if (m_configManager.getFeatureManager().isFeatureEnabled(OpenfireImpl.FEATURE)) {
- m_configManager.configureEverywhere(OpenfireImpl.FEATURE);
+ if (m_configManager.getFeatureManager().isFeatureEnabled(ImManager.FEATURE)) {
+ m_configManager.configureEverywhere(ImManager.FEATURE);
}
}
}
@@ -20,6 +20,7 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -52,6 +53,9 @@
private String m_providerLdapUserClassName;
private String m_providerLdapVCardClassName;
private String m_multipleLdapConfFile;
+ private boolean m_clusteringState;
+
+ private Map<String, String> m_additionalProperties;
private LdapManager m_ldapManager;
private CoreContext m_coreContext;
@@ -71,7 +75,7 @@ public void write(Writer writer) throws IOException {
context.put("lockoutProvider", PROVIDER_LOCKOUT_CLASSNAME);
context.put("securityAuditProvider", PROVIDER_SECURITY_AUDIT_CLASSNAME);
context.put("sipxVcardProvider", m_providerVCardClassName);
- } else if (allParams != null && !allParams.isEmpty()) {
+ } else if (!allParams.isEmpty()) {
LdapConnectionParams ldapConnectionParams = allParams.get(0);
boolean isLdapAnonymousAccess = (StringUtils.isBlank(ldapConnectionParams.getPrincipal())) ? true
: false;
@@ -84,6 +88,7 @@ public void write(Writer writer) throws IOException {
}
context.put("authorizedUsernames", getAuthorizedUsernames());
+ context.put("clusteringState", m_clusteringState);
try {
m_velocityEngine.mergeTemplate("openfire/openfire.vm", context, writer);
@@ -186,10 +191,22 @@ public void setMultipleLdapConfFile(String multipleLdapConfFile) {
m_multipleLdapConfFile = multipleLdapConfFile;
}
+ public void setAdditionalProperties(Map<String, String> properties) {
+ m_additionalProperties = properties;
+ }
+
+ public Map<String, String> getAdditionalProperties() {
+ return m_additionalProperties;
+ }
+
+ public void setClusteringState(boolean state) {
+ m_clusteringState = state;
+ }
+
public static class LdapData {
- private LdapConnectionParams m_ldapParams;
- private AttrMap m_attrMap;
- private boolean m_ldapAnonymousAccess;
+ private final LdapConnectionParams m_ldapParams;
+ private final AttrMap m_attrMap;
+ private final boolean m_ldapAnonymousAccess;
public LdapData(LdapConnectionParams ldapParams, AttrMap attrMap) {
m_ldapParams = ldapParams;
m_attrMap = attrMap;
@@ -206,9 +223,9 @@ public AttrMap getAttrMap() {
public String getImAttribute() {
String imAttribute = m_attrMap.getImAttributeName();
String usernameAttribute = m_attrMap.getIdentityAttributeName();
- //if im id is not mapped, default it to username -
+ //if im id is not mapped, default it to username -
//because this is a rule, when a user gets created the im id has to automatically be defaulted to username
- return imAttribute == null ?
+ return imAttribute == null ?
usernameAttribute == null ? StringUtils.EMPTY : usernameAttribute : imAttribute;
}
@@ -91,4 +91,7 @@
<enabled>false</enabled>
</debug>
</log>
+ <clustering>
+ <enabled>$clusteringState</enabled>
+ </clustering>
</jive>
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (C) 2007 Pingtel Corp., certain elements licensed under a Contributor Agreement.
-# Contributors retain copyright to elements licensed under a Contributor Agreement.
-# Licensed to the User under the LGPL license.
-
-
-JavaCmd:=`@SIPX_BINDIR@/sipx-config --java`
-CommonsLibDir:=@SIPX_JAVADIR@/sipXcommons
-
-Classpath=`classpath ${CommonsLibDir}/*.jar @SIPX_JAVADIR@/preflight/preflight.jar`
-
-exec $JavaCmd \
- -XX:MaxPermSize=128M \
- -Xmx1024m \
- -classpath "$Classpath" \
- org.sipfoundry.preflight.PreflightShell $@

0 comments on commit c388f7c

Please sign in to comment.