Skip to content

Commit

Permalink
XX-11117 move openfire configuration to mongo
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristi Ciuc Starasciuc committed Jun 5, 2014
1 parent 9957e42 commit 30d203e
Show file tree
Hide file tree
Showing 77 changed files with 7,580 additions and 1,132 deletions.
4 changes: 3 additions & 1 deletion sipXopenfire/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<classpath>
<classpathentry kind="lib" path="/sipxcommons/lib/xmlrpc-common-3.1.jar"/>
<classpathentry kind="src" path="config-plugin/src"/>
<classpathentry kind="src" path="mongo-lib/test/java"/>
<classpathentry excluding="test/java/" kind="src" path="mongo-lib/src"/>
<classpathentry kind="src" path="mongo-sync-plugin/src"/>
<classpathentry kind="src" path="sqa-plugin/src"/>
<classpathentry kind="src" path="vcard-provider/src"/>
<classpathentry kind="src" path="presence-plugin/test"/>
<classpathentry kind="src" path="presence-plugin/src"/>
<classpathentry kind="src" path="ws-plugin/src"/>
Expand Down
3 changes: 2 additions & 1 deletion sipXopenfire/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ SUBDIRS = \
presence-plugin \
sqa-plugin \
vcard-synchserver \
vcard-provider \
config-plugin \
ws-plugin \
mongo-lib \
mongo-sync-plugin \
etc \
bin

Expand Down
5 changes: 4 additions & 1 deletion sipXopenfire/common.am
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,7 @@ provider_PKGS_RT = \
gnu-crypto

sipxvcard_JAVAROOT = $(abspath $(top_builddir)/vcard-provider/classes)
vcardsynchserver_JAVAROOT = $(abspath $(top_builddir)/vcard-synchserver/classes)
vcardsynchserver_JAVAROOT = $(abspath $(top_builddir)/vcard-synchserver)

mongolib_JAVAROOT = $(abspath $(top_builddir)/mongo-lib/classes)
mongosync_JAVAROOT = $(abspath $(top_builddir)/mongo-sync-plugin)
3 changes: 2 additions & 1 deletion sipXopenfire/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ AC_CONFIG_FILES([
presence-plugin/Makefile
sqa-plugin/Makefile
vcard-synchserver/Makefile
vcard-provider/Makefile
config-plugin/Makefile
ws-plugin/Makefile
mongo-lib/Makefile
mongo-sync-plugin/Makefile
])
AC_OUTPUT
39 changes: 39 additions & 0 deletions sipXopenfire/mongo-lib/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include $(top_srcdir)/config/utility.am
include $(top_srcdir)/config/java.am
include $(top_srcdir)/common.am

EXTRA_DIST = \
$(cfg_SRC) \
$(test_SRC)

noinst_DATA = \
javac-cfg

cfg_JAR = sipx-ofmongo-lib.jar
jar_DATA = $(cfg_JAR)
jardir = @SIPX_JAVADIR@/sipXopenfire/lib

cfg_DEPS = \
$(call JavaDep,@SIPX_JAVADIR@/sipXcommons,$(plugin_PKGS)) \
@OPENFIRE_HOME@/lib/openfire.jar \
${vcardsynchserver_JAVAROOT}/sipx-openfire-vcard-synchserver.jar

cfg_SRC = \
$(shell cd $(srcdir); find src -name '*.java')

$(cfg_JAR) : javac-cfg
jar -cf $@ \
$(call JarInclude,$(mongolib_JAVAROOT),.)

test_JAVAROOT = classes.test
test_PKGS = \
$(openfire_PKGS) \
junit \
easymock \
commons-io \
sipxcommons

test_DEPS = \
$(call JavaDep,@SIPX_JAVADIR@/sipXcommons @SIPX_JAVADIR@/sipXconfig,$(test_PKGS))

test_SRC = $(shell cd $(srcdir); find test -name '*.java')
25 changes: 25 additions & 0 deletions sipXopenfire/mongo-lib/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
include $(top_srcdir)/config/utility.am
include $(top_srcdir)/config/java.am
include $(top_srcdir)/common.am

EXTRA_DIST = \
$(cfg_SRC)

noinst_DATA = \
javac-cfg

cfg_JAR = sipx-ofmongo-lib.jar
jar_DATA = $(cfg_JAR)
jardir = @SIPX_JAVADIR@/sipXopenfire/lib

cfg_DEPS = \
$(call JavaDep,@SIPX_JAVADIR@/sipXcommons,$(plugin_PKGS)) \
@OPENFIRE_HOME@/lib/openfire.jar \
@SIPX_JAVADIR@/sipXopenfire/lib/sipx-openfire-vcard-synchserver.jar

cfg_SRC = \
$(shell cd $(srcdir); find . -name '*.java')

$(cfg_JAR) : javac-cfg
jar -cf $@ \
$(call JarInclude,$(mongolib_JAVAROOT),.)
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package org.sipfoundry.openfire.connection;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

import org.jivesoftware.database.ConnectionProvider;
import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.provider.ConnectionManagerWrapper;

/**
* Wraps access to mongodb-enabled storage
*
* @see ConnectionManagerWrapper
* @author Alex Mateescu
*
*/
public class MongoConnMgrWrapper implements ConnectionManagerWrapper {

private static boolean profilingEnabled;
private static ConnectionProvider provider;
private static final Object PROVIDER_LOCK = new Object();

/**
* {@inheritDoc} <br/>
* Newer versions of openuc provide an up-to-date schema. Nothing to do here.
*/
@Override
public boolean checkPluginSchema(Plugin plugin) {
return true;
}

/**
* {@inheritDoc} <br/>
*/
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return new MongoMetaData();
}

/**
* {@inheritDoc}
*/
@Override
public String getTestQuery(String driver) {
return "";
}

/**
* {@inheritDoc}
*/
@Override
public int getTransactionIsolation() {
return Connection.TRANSACTION_NONE;
}

/**
* {@inheritDoc}
*/
@Override
public boolean isEmbeddedDB() {
return false;
}

/**
* {@inheritDoc}
*/
@Override
public boolean isProfilingEnabled() {
return profilingEnabled;
}

/**
* {@inheritDoc}
*/
@Override
public boolean isSetupMode() {
return provider == null;
}

/**
* {@inheritDoc}
*/
@Override
public void setConnectionProvider(ConnectionProvider provider) {
synchronized (new byte[0]) {
MongoConnMgrWrapper.provider = provider;
}
}

/**
* {@inheritDoc}
*/
@Override
public ConnectionProvider getConnectionProvider() {
return provider;
}

/**
* {@inheritDoc}
*/
@Override
public void setProfilingEnabled(boolean enabled) {
synchronized (new byte[0]) {
profilingEnabled = enabled;
}
}

/**
* {@inheritDoc}
*/
@Override
public void shutdown() {
synchronized (PROVIDER_LOCK) {
if (provider != null) {
provider.destroy();
provider = null;
}
}
}

}
Loading

0 comments on commit 30d203e

Please sign in to comment.