Commit f50f43b7 authored by patrick's avatar patrick

forums "plugin" (doesn't really work as a plugin, it turns out)


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1730 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0efafc41
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true" type="J2EE_WEB_MODULE" j2ee-integration="Tomcat Server">
<component name="ModuleRootManager" />
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
<exploded url="file://$MODULE_DIR$/target/exploded" />
<exclude-exploded />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="JDK 1.5.0" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Admin" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/forums-ws.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/hessian-3.0.8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntryProperties />
</component>
<component name="WebModuleBuildComponent">
<setting name="EXPLODED_URL" value="file://$MODULE_DIR$/target/exploded" />
<setting name="EXPLODED_ENABLED" value="true" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
<setting name="SYNC_EXPLODED_DIR" value="true" />
<setting name="BUILD_ON_FRAME_DEACTIVATION" value="false" />
<setting name="RUN_JASPER_VALIDATION" value="false" />
</component>
<component name="WebModuleProperties">
<containerElement type="module" name="Admin">
<attribute name="method" value="4" />
<attribute name="URI" value="&lt;N/A&gt;" />
</containerElement>
<containerElement type="module" name="Messenger">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/ant-contrib.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/ant-contrib.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/ant-subdirtask.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/ant-subdirtask.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/ant.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/ant.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/commons-el.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/commons-el.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
<url>file://$MODULE_DIR$/../../../build/lib/dist</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/activation.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/dist/activation.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/hsqldb.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/dist/hsqldb.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/mail.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/dist/mail.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/mysql.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/dist/mysql.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/postgres.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/dist/postgres.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jasper-compiler.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/jasper-compiler.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jasper-runtime.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/jasper-runtime.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/junit.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/junit.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/commons-logging.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/commons-logging.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/dom4j.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/dom4j.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jaxen.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/jaxen.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jdic.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/jdic.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jetty.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/jetty.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jmdns.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/jmdns.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/jstl.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/jstl.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/standard.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/standard.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/whack.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/whack.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/xpp3.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/merge/xpp3.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/xmltask.jar" />
<url>jar://$MODULE_DIR$/../../../build/lib/xmltask.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/forums-ws.jar" />
<url>jar://$MODULE_DIR$/lib/forums-ws.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/lib/hessian-3.0.8.jar" />
<url>jar://$MODULE_DIR$/lib/hessian-3.0.8.jar!/</url>
</containerElement>
<containerElement type="library" level="module">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
<url>file://$MODULE_DIR$/../../resources/jar</url>
</containerElement>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/web/WEB-INF/web.xml" version="2.4" />
<webroots>
<root url="file://$MODULE_DIR$/web" relative="/plugins/forums" />
</webroots>
</component>
<component name="WeblogicWebModuleProperties">
<option name="IS_RUN_APPC" value="false" />
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<class>org.jivesoftware.messenger.plugin.ForumsPlugin</class>
<name>Forums</name>
<description>Provides user and group support for Jive Forums</description>
<author>Patrick Lightbody</author>
<version>1.0</version>
<minServerVersion>2.1.3</minServerVersion>
<adminconsole>
<tab id="tab-users">
<sidebar id="sidebar-users">
<item id="jive-forums-settings" name="Jive Forums"
url="jive-forums-settings.jsp"
description="Jive Forums Settings" />
</sidebar>
</tab>
</adminconsole>
</plugin>
\ No newline at end of file
package org.jivesoftware.messenger.plugin;
import org.jivesoftware.messenger.container.Plugin;
import org.jivesoftware.messenger.container.PluginManager;
import org.jivesoftware.messenger.user.UserManager;
import org.jivesoftware.messenger.auth.AuthFactory;
import org.jivesoftware.util.JiveGlobals;
import java.io.File;
/**
* User: patrick
* Date: Jul 21, 2005
* Time: 3:38:41 PM
*/
public class ForumsPlugin implements Plugin {
public void initializePlugin(PluginManager manager, File pluginDirectory) {
JiveGlobals.setXMLProperty("provider.user.className", ForumsUserProvider.class.getName());
JiveGlobals.setXMLProperty("provider.auth.className", ForumsUserProvider.class.getName());
}
public void destroyPlugin() {
}
}
package org.jivesoftware.messenger.plugin;
import com.opensymphony.forums.ws.AuthContext;
import org.jivesoftware.util.JiveGlobals;
/**
* User: patrick
* Date: Jul 22, 2005
* Time: 4:09:01 PM
*/
public class ForumsSettings {
String url;
String username;
String password;
public ForumsSettings() {
url = JiveGlobals.getProperty("forums.url", "http://localhost:8080/forums/webservices");
username = JiveGlobals.getProperty("forums.username", "admin");
password = JiveGlobals.getProperty("forums.password", "admin");
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public AuthContext getContext() {
AuthContext ac = new AuthContext();
ac.setUsername(username);
ac.setPassword(password);
return ac;
}
}
package org.jivesoftware.messenger.plugin;
import com.caucho.hessian.client.HessianProxyFactory;
import com.opensymphony.forums.ws.WSUser;
import com.opensymphony.forums.ws.WebServices;
import org.jivesoftware.messenger.auth.AuthProvider;
import org.jivesoftware.messenger.auth.UnauthorizedException;
import org.jivesoftware.messenger.user.User;
import org.jivesoftware.messenger.user.UserAlreadyExistsException;
import org.jivesoftware.messenger.user.UserNotFoundException;
import org.jivesoftware.messenger.user.UserProvider;
import java.net.MalformedURLException;
import java.util.Collection;
import java.util.Date;
import java.util.Set;
/**
* User: patrick
* Date: Jul 22, 2005
* Time: 3:10:13 PM
*/
public class ForumsUserProvider implements UserProvider, AuthProvider {
private ForumsSettings settings = new ForumsSettings();
private WebServices getWebServices() {
HessianProxyFactory factory = new HessianProxyFactory();
WebServices ws = null;
try {
ws = (WebServices) factory.create(WebServices.class, settings.getUrl());
}
catch (MalformedURLException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return ws;
}
public boolean isPlainSupported() {
return true;
}
public boolean isDigestSupported() {
return false;
}
public void authenticate(String username, String password) throws UnauthorizedException {
try {
boolean auth = !getWebServices().authenticate(username, password);
System.out.println("Auth result was: " + auth);
if (auth) {
throw new UnauthorizedException();
}
} catch (Exception e) {
e.printStackTrace();
if (e instanceof UnauthorizedException) {
throw (UnauthorizedException) e;
}
}
}
public void authenticate(String username, String token, String digest) throws UnauthorizedException {
throw new UnauthorizedException();
}
public User loadUser(String username) throws UserNotFoundException {
WSUser wsUser = getWebServices().getUser(settings.getContext(), username);
return new User(wsUser.getUsername(), wsUser.getName(), wsUser.getName(),
wsUser.getCreated(), wsUser.getLastModified());
}
public User createUser(String username, String password, String name, String email) throws UserAlreadyExistsException {
return null;
}
public void deleteUser(String username) {
}
public int getUserCount() {
return 0;
}
public Collection<User> getUsers() {
return null;
}
public Collection<User> getUsers(int startIndex, int numResults) {
return null;
}
public String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException {
return null;
}
public void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException {
}
public void setName(String username, String name) throws UserNotFoundException {
}
public void setEmail(String username, String email) throws UserNotFoundException {
}
public void setCreationDate(String username, Date creationDate) throws UserNotFoundException {
}
public void setModificationDate(String username, Date modificationDate) throws UserNotFoundException {
}
public Set<String> getSearchFields() throws UnsupportedOperationException {
return null;
}
public Collection<User> findUsers(Set<String> fields, String query) throws UnsupportedOperationException {
return null;
}
public Collection<User> findUsers(Set<String> fields, String query, int startIndex, int numResults) throws UnsupportedOperationException {
return null;
}
public boolean isReadOnly() {
return true;
}
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Jive Messenger</display-name>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>messenger_i18n</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
<param-value>zh_CN</param-value>
</context-param>
<filter>
<filter-name>AuthCheck</filter-name>
<filter-class>org.jivesoftware.admin.AuthCheckFilter</filter-class>
<init-param>
<param-name>excludes</param-name>
<param-value>login.jsp,index.jsp?logout=true,setup-,.gif,.png,error-serverdown.jsp</param-value>
</init-param>
</filter>
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>org.jivesoftware.util.SetCharacterEncodingFilter</filter-class>
</filter>
<filter>
<filter-name>LocaleFilter</filter-name>
<filter-class>org.jivesoftware.util.LocaleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthCheck</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>LocaleFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AuthCheck</filter-name>
<servlet-name>PluginServlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>PluginServlet</servlet-name>
<servlet-class>org.jivesoftware.messenger.container.PluginServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Uncomment this servlet when starting the server in a webapp -->
<!--
<servlet>
<servlet-name>XMPPBootServlet</servlet-name>
<servlet-class>org.jivesoftware.messenger.XMPPBootServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-->
<servlet>
<servlet-name>XMPPBootServlet</servlet-name>
<servlet-class>org.jivesoftware.messenger.XMPPBootServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!--@@JSPC-SERVLETS@@-->
<servlet-mapping>
<servlet-name>PluginServlet</servlet-name>
<url-pattern>/plugin/*</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>admin</taglib-uri>
<taglib-location>/WEB-INF/admin.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment