Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
31dfe253
Commit
31dfe253
authored
Feb 12, 2018
by
Greg Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HZ-8: Preserve Hazelcast settings between plugin upgrades
parent
de85ac82
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
53 deletions
+91
-53
hazelcast-cache-config.xml
src/plugins/hazelcast/classes/hazelcast-cache-config.xml
+1
-40
hazelcast-local-config.xml.template
...ins/hazelcast/classes/hazelcast-local-config.xml.template
+60
-0
HazelcastPlugin.java
...ava/org/jivesoftware/openfire/plugin/HazelcastPlugin.java
+30
-13
No files found.
src/plugins/hazelcast/classes/hazelcast-cache-config.xml
View file @
31dfe253
...
@@ -18,10 +18,7 @@
...
@@ -18,10 +18,7 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.hazelcast.com/schema/config
xsi:schemaLocation=
"http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd"
>
http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd"
>
<group>
<import
resource=
"${openfireHome}/conf/hazelcast-local-config.xml"
/>
<name>
openfire
</name>
<password>
openfire
</password>
</group>
<properties>
<properties>
<property
name=
"hazelcast.logging.type"
>
slf4j
</property>
<property
name=
"hazelcast.logging.type"
>
slf4j
</property>
<property
name=
"hazelcast.operation.call.timeout.millis"
>
30000
</property>
<property
name=
"hazelcast.operation.call.timeout.millis"
>
30000
</property>
...
@@ -29,42 +26,6 @@
...
@@ -29,42 +26,6 @@
<property
name=
"hazelcast.rest.enabled"
>
false
</property>
<property
name=
"hazelcast.rest.enabled"
>
false
</property>
</properties>
</properties>
<management-center
enabled=
"false"
/>
<management-center
enabled=
"false"
/>
<network>
<port
auto-increment=
"true"
port-count=
"100"
>
5701
</port>
<outbound-ports>
<ports>
0
</ports>
</outbound-ports>
<join>
<multicast
enabled=
"true"
>
<multicast-group>
224.2.2.3
</multicast-group>
<multicast-port>
54327
</multicast-port>
</multicast>
<tcp-ip
enabled=
"false"
/>
<aws
enabled=
"false"
/>
</join>
<interfaces
enabled=
"false"
>
<interface>
10.10.1.*
</interface>
</interfaces>
<ssl
enabled=
"false"
/>
<socket-interceptor
enabled=
"false"
/>
<symmetric-encryption
enabled=
"false"
>
<!--
encryption algorithm such as
DES/ECB/PKCS5Padding,
PBEWithMD5AndDES,
AES/CBC/PKCS5Padding,
Blowfish,
DESede
-->
<algorithm>
PBEWithMD5AndDES
</algorithm>
<!-- salt value to use when generating the secret key -->
<salt>
thesalt
</salt>
<!-- pass phrase to use when generating the secret key -->
<password>
thepass
</password>
<!-- iteration count to use when generating the secret key -->
<iteration-count>
19
</iteration-count>
</symmetric-encryption>
</network>
<partition-group
enabled=
"false"
/>
<partition-group
enabled=
"false"
/>
<executor-service
name=
"default"
>
<executor-service
name=
"default"
>
<pool-size>
16
</pool-size>
<pool-size>
16
</pool-size>
...
...
src/plugins/hazelcast/classes/hazelcast-local-config.xml.template
0 → 100644
View file @
31dfe253
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast
xmlns=
"http://www.hazelcast.com/schema/config"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd"
>
<group>
<name>
openfire
</name>
<password>
openfire
</password>
</group>
<network>
<port
auto-increment=
"true"
port-count=
"100"
>
5701
</port>
<outbound-ports>
<ports>
0
</ports>
</outbound-ports>
<!-- The following enables multicast discovery of cluster members
See http://docs.hazelcast.org/docs/3.9.2/manual/html-single/index.html#discovering-members-by-multicast
-->
<join>
<multicast
enabled=
"true"
>
<multicast-group>
224.2.2.3
</multicast-group>
<multicast-port>
54327
</multicast-port>
</multicast>
<tcp-ip
enabled=
"false"
/>
</join>
<!-- The following enables TCP/IP based discovery of cluster members
See http://docs.hazelcast.org/docs/3.9.2/manual/html-single/index.html#discovering-members-by-tcp
-->
<!--
<join>
<multicast enabled="false"/>
<tcp-ip enabled="true">
<member>10.10.1.1:5701</member>
<member>10.10.1.2:5701</member>
</tcp-ip>
</join>
-->
<interfaces
enabled=
"false"
>
<interface>
10.10.1.*
</interface>
</interfaces>
<ssl
enabled=
"false"
/>
<socket-interceptor
enabled=
"false"
/>
<symmetric-encryption
enabled=
"false"
>
<!--
encryption algorithm such as
DES/ECB/PKCS5Padding,
PBEWithMD5AndDES,
AES/CBC/PKCS5Padding,
Blowfish,
DESede
-->
<algorithm>
PBEWithMD5AndDES
</algorithm>
<!-- salt value to use when generating the secret key -->
<salt>
thesalt
</salt>
<!-- pass phrase to use when generating the secret key -->
<password>
thepass
</password>
<!-- iteration count to use when generating the secret key -->
<iteration-count>
19
</iteration-count>
</symmetric-encryption>
</network>
</hazelcast>
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/HazelcastPlugin.java
View file @
31dfe253
...
@@ -16,9 +16,6 @@
...
@@ -16,9 +16,6 @@
package
org
.
jivesoftware
.
openfire
.
plugin
;
package
org
.
jivesoftware
.
openfire
.
plugin
;
import
java.io.File
;
import
java.io.FileFilter
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.XMPPServer
;
import
org.jivesoftware.openfire.cluster.ClusterManager
;
import
org.jivesoftware.openfire.cluster.ClusterManager
;
import
org.jivesoftware.openfire.container.Plugin
;
import
org.jivesoftware.openfire.container.Plugin
;
...
@@ -28,6 +25,13 @@ import org.jivesoftware.util.JiveGlobals;
...
@@ -28,6 +25,13 @@ import org.jivesoftware.util.JiveGlobals;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
/**
/**
* Hazelcast clustering plugin. This implementation is based upon
* Hazelcast clustering plugin. This implementation is based upon
* (and borrows heavily from) the original Openfire clustering plugin.
* (and borrows heavily from) the original Openfire clustering plugin.
...
@@ -38,38 +42,51 @@ import org.slf4j.LoggerFactory;
...
@@ -38,38 +42,51 @@ import org.slf4j.LoggerFactory;
*/
*/
public
class
HazelcastPlugin
implements
Plugin
{
public
class
HazelcastPlugin
implements
Plugin
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
HazelcastPlugin
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
HazelcastPlugin
.
class
);
@Override
public
void
initializePlugin
(
final
PluginManager
manager
,
final
File
pluginDirectory
)
{
public
void
initializePlugin
(
final
PluginManager
manager
,
final
File
pluginDirectory
)
{
logger
.
info
(
"Waiting for other plugins to initialize before initializing clustering"
);
LOGGER
.
info
(
"Waiting for other plugins to initialize before initializing clustering"
);
manager
.
addPluginManagerListener
(
new
PluginManagerListener
()
{
manager
.
addPluginManagerListener
(
new
PluginManagerListener
()
{
@Override
@Override
public
void
pluginsMonitored
()
{
public
void
pluginsMonitored
()
{
manager
.
removePluginManagerListener
(
this
);
manager
.
removePluginManagerListener
(
this
);
initializeClustering
();
initializeClustering
(
pluginDirectory
);
}
}
});
});
}
}
private
void
initializeClustering
()
{
private
void
initializeClustering
(
final
File
hazelcastPluginDirectory
)
{
logger
.
info
(
"All plugins have initialized; initializing clustering"
);
LOGGER
.
info
(
"All plugins have initialized; initializing clustering"
);
// Check if another cluster is installed and stop loading this plugin if found
// Check if another cluster is installed and stop loading this plugin if found
File
pluginDir
=
new
File
(
JiveGlobals
.
getHomeDirectory
(),
"plugins"
);
final
String
openfireHome
=
JiveGlobals
.
getHomeDirectory
();
File
pluginDir
=
new
File
(
openfireHome
,
"plugins"
);
File
[]
jars
=
pluginDir
.
listFiles
(
new
FileFilter
()
{
File
[]
jars
=
pluginDir
.
listFiles
(
new
FileFilter
()
{
@Override
public
boolean
accept
(
File
pathname
)
{
public
boolean
accept
(
File
pathname
)
{
String
fileName
=
pathname
.
getName
().
toLowerCase
();
String
fileName
=
pathname
.
getName
().
toLowerCase
();
return
(
fileName
.
equalsIgnoreCase
(
"enterprise.jar"
)
||
return
(
fileName
.
equalsIgnoreCase
(
"enterprise.jar"
)
||
fileName
.
equalsIgnoreCase
(
"coherence.jar"
));
fileName
.
equalsIgnoreCase
(
"coherence.jar"
));
}
}
});
});
if
(
jars
.
length
>
0
)
{
if
(
jars
!=
null
&&
jars
.
length
>
0
)
{
// Do not load this plugin if a conflicting implementation exists
// Do not load this plugin if a conflicting implementation exists
logger
.
warn
(
"Conflicting clustering plugins found; remove Coherence and/or Enterprise jar files"
);
LOGGER
.
warn
(
"Conflicting clustering plugins found; remove Coherence and/or Enterprise jar files"
);
throw
new
IllegalStateException
(
"Clustering plugin configuration conflict (Coherence)"
);
return
;
}
try
{
final
Path
pathToLocalHazelcastConfig
=
Paths
.
get
(
openfireHome
,
"conf/hazelcast-local-config.xml"
);
if
(!
Files
.
exists
(
pathToLocalHazelcastConfig
))
{
Files
.
copy
(
Paths
.
get
(
hazelcastPluginDirectory
.
getAbsolutePath
(),
"classes/hazelcast-local-config.xml.template"
),
pathToLocalHazelcastConfig
);
}
}
ClusterManager
.
startup
();
ClusterManager
.
startup
();
}
catch
(
final
IOException
e
)
{
LOGGER
.
warn
(
"Unable to create local Hazelcast configuration file from template; clustering will not start"
,
e
);
}
}
}
@Override
public
void
destroyPlugin
()
{
public
void
destroyPlugin
()
{
// Shutdown is initiated by XMPPServer before unloading plugins
// Shutdown is initiated by XMPPServer before unloading plugins
if
(!
XMPPServer
.
getInstance
().
isShuttingDown
())
{
if
(!
XMPPServer
.
getInstance
().
isShuttingDown
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment