Author: vmassol Date: 2008-01-30 18:49:49 +0100 (Wed, 30 Jan 2008) New Revision: 7200
Added: xwiki-platform/xwiki-plugins/trunk/swizzle/ xwiki-platform/xwiki-plugins/trunk/swizzle/pom.xml xwiki-platform/xwiki-plugins/trunk/swizzle/src/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPlugin.java xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPluginApi.java Modified: xwiki-platform/xwiki-plugins/trunk/pom.xml Log: XPSWIZZLE-1: Create first implementation of a Swizzle plugin Modified: xwiki-platform/xwiki-plugins/trunk/pom.xml =================================================================== --- xwiki-platform/xwiki-plugins/trunk/pom.xml 2008-01-30 17:28:47 UTC (rev 7199) +++ xwiki-platform/xwiki-plugins/trunk/pom.xml 2008-01-30 17:49:49 UTC (rev 7200) @@ -58,6 +58,7 @@ <module>wiki-manager</module> <module>mailsender</module> <module>watchlist</module> + <module>swizzle</module> </modules> </profile> <profile> Property changes on: xwiki-platform/xwiki-plugins/trunk/swizzle ___________________________________________________________________ Name: svn:ignore + target .classpath .project *.ipr *.iml .iws Added: xwiki-platform/xwiki-plugins/trunk/swizzle/pom.xml =================================================================== --- xwiki-platform/xwiki-plugins/trunk/swizzle/pom.xml (rev 0) +++ xwiki-platform/xwiki-plugins/trunk/swizzle/pom.xml 2008-01-30 17:49:49 UTC (rev 7200) @@ -0,0 +1,49 @@ +<!-- + * + * Copyright 2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.xpn.xwiki.platform.plugins</groupId> + <artifactId>xwiki-plugins</artifactId> + <version>4-SNAPSHOT</version> + </parent> + <artifactId>xwiki-plugin-swizzle</artifactId> + <version>1.0-SNAPSHOT</version> + <name>XWiki Platform - Plugins - Swizzle</name> + <packaging>jar</packaging> + <description>Plugin for using Codehaus Swizzle (http://swizzle.codehaus.org/)</description> + <dependencies> + <dependency> + <groupId>com.xpn.xwiki.platform</groupId> + <artifactId>xwiki-core</artifactId> + <version>1.2-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.codehaus.swizzle</groupId> + <artifactId>swizzle-jira</artifactId> + <version>1.3.3-20070817</version> + <classifier>xwiki</classifier> + </dependency> + </dependencies> +</project> Added: xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPlugin.java =================================================================== --- xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPlugin.java (rev 0) +++ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPlugin.java 2008-01-30 17:49:49 UTC (rev 7200) @@ -0,0 +1,94 @@ +/* + * Copyright 2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package com.xpn.xwiki.plugin.swizzle; + +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.api.Api; +import com.xpn.xwiki.plugin.XWikiDefaultPlugin; +import com.xpn.xwiki.plugin.XWikiPluginInterface; + +import org.codehaus.swizzle.jira.Jira; +import org.codehaus.swizzle.jira.Issue; +import org.codehaus.swizzle.jira.JiraRss; + +import java.net.MalformedURLException; + +/** + * Implementation of the Velocity API defined in [EMAIL PROTECTED] com.xpn.xwiki.plugin.swizzle.SwizzleJiraPluginApi}. + * + * @version $Id: $ + */ +public class SwizzleJiraPlugin extends XWikiDefaultPlugin +{ + /** + * [EMAIL PROTECTED] + * @see com.xpn.xwiki.plugin.XWikiDefaultPlugin#XWikiDefaultPlugin(String, String, com.xpn.xwiki.XWikiContext) + */ + public SwizzleJiraPlugin(String name, String className, XWikiContext context) + { + super(name, className, context); + } + + /** + * [EMAIL PROTECTED] + * @see com.xpn.xwiki.plugin.XWikiDefaultPlugin#getName() + */ + public String getName() + { + return "swizzle"; + } + + public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) + { + return new SwizzleJiraPluginApi((SwizzleJiraPlugin) plugin, context); + } + + /** + * @param url the JIRA URL to connect to. For example "http://jira.acme.org/rpc/xmlrpc". + * @return a Swizzle [EMAIL PROTECTED] Jira} object as described on the + * <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a>. + * @throws MalformedURLException in case of invalid URL + */ + public Jira getJira(String url) throws MalformedURLException + { + return new Jira(url); + } + + /** + * @param url the JIRA RSS URL to connect to. For example + * "http://jira.acme.org/secure/IssueNavigator.jspa?view=rss&&pid=11230....". + * @return a Swizzle [EMAIL PROTECTED] JiraRss} object as described on the + * <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a>. + * @throws MalformedURLException in case of invalid URL + */ + public JiraRss getJiraRss(String url) throws Exception + { + return new JiraRss(url); + } + + /** + * @return a Swizzle [EMAIL PROTECTED] Issue} object + * @see <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a> + */ + public Issue createIssue() + { + return new Issue(); + } +} \ No newline at end of file Added: xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPluginApi.java =================================================================== --- xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPluginApi.java (rev 0) +++ xwiki-platform/xwiki-plugins/trunk/swizzle/src/main/java/com/xpn/xwiki/plugin/swizzle/SwizzleJiraPluginApi.java 2008-01-30 17:49:49 UTC (rev 7200) @@ -0,0 +1,78 @@ +/* + * Copyright 2007, XpertNet SARL, and individual contributors as indicated + * by the contributors.txt. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package com.xpn.xwiki.plugin.swizzle; + +import com.xpn.xwiki.api.Api; +import com.xpn.xwiki.XWikiContext; + +import org.codehaus.swizzle.jira.Jira; +import org.codehaus.swizzle.jira.JiraRss; +import org.codehaus.swizzle.jira.Issue; + +import java.net.MalformedURLException; + +/** + * Allows getting Swizzle Objects (http://swizzle.codehaus.org/) so that it's easy to use from a + * Velocity page in a XWiki page. + * + * @version $Id: $ + */ +public class SwizzleJiraPluginApi extends Api +{ + private SwizzleJiraPlugin plugin; + + public SwizzleJiraPluginApi(SwizzleJiraPlugin plugin, XWikiContext context) + { + super(context); + this.plugin = plugin; + } + + /** + * @param url the JIRA URL to connect to. For example "http://jira.acme.org/rpc/xmlrpc". + * @return a Swizzle [EMAIL PROTECTED] Jira} object as described on the + * <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a>. + * @throws MalformedURLException in case of invalid URL + */ + public Jira getJira(String url) throws MalformedURLException + { + return this.plugin.getJira(url); + } + + /** + * @param url the JIRA RSS URL to connect to. For example + * "http://jira.acme.org/secure/IssueNavigator.jspa?view=rss&&pid=11230....". + * @return a Swizzle [EMAIL PROTECTED] JiraRss} object as described on the + * <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a>. + * @throws MalformedURLException in case of invalid URL + */ + public JiraRss getJiraRss(String url) throws Exception + { + return this.plugin.getJiraRss(url); + } + + /** + * @return a Swizzle [EMAIL PROTECTED] Issue} object + * @see <a href="http://swizzle.codehaus.org/Swizzle+Jira">Swizzle JIRA home page</a> + */ + public Issue createIssue() + { + return this.plugin.createIssue(); + } +} \ No newline at end of file _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications