You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@abdera.apache.org by jm...@apache.org on 2012/02/01 18:55:02 UTC
svn commit: r1239237 [2/12] - in /abdera/abdera2-server: ./ .settings/ etc/
examples/ examples/src/ examples/src/main/ examples/src/main/java/
examples/src/main/java/org/ examples/src/main/java/org/apache/
examples/src/main/java/org/apache/abdera2/ exa...
Added: abdera/abdera2-server/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/pom.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/pom.xml (added)
+++ abdera/abdera2-server/pom.xml Wed Feb 1 17:54:54 2012
@@ -0,0 +1,789 @@
+<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>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-server-project</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Abdera2 - Server</name>
+ <version>2.0-SNAPSHOT</version>
+ <description>Atom Specification Implementation</description>
+ <inceptionYear>2006</inceptionYear>
+ <url>http://abdera.apache.org</url>
+
+ <organization>
+ <name>Apache Software Foundation</name>
+ <url>http://www.apache.org/</url>
+ </organization>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://issues.apache.org/jira/browse/ABDERA</url>
+ </issueManagement>
+
+ <mailingLists>
+ <mailingList>
+ <name>Abdera Developer List</name>
+ <subscribe>dev-subscribe@abdera.apache.org</subscribe>
+ <unsubscribe>dev-unsubscribe@abdera.apache.org</unsubscribe>
+ <post>dev@abdera.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/abdera-dev/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Abdera User List</name>
+ <subscribe>user-subscribe@abdera.apache.org</subscribe>
+ <unsubscribe>user-unsubscribe@abdera.apache.org</unsubscribe>
+ <post>user@abdera.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/abdera-user/</archive>
+ </mailingList>
+ <mailingList>
+ <name>Abdera Source Control List</name>
+ <subscribe>commits-subscribe@abdera.apache.org</subscribe>
+ <unsubscribe>commits-unsubscribe@abdera.apache.org</unsubscribe>
+ <archive>http://mail-archives.apache.org/mod_mbox/abdera-commits/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/abdera/abdera2-server</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/abdera/abdera2-server</developerConnection>
+ <url>http://svn.apache.org/repos/asf/abdera/abdera2-server</url>
+ </scm>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <source>1.5</source>
+ <links>
+ <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+ </links>
+ <aggregate>true</aggregate>
+ <excludePackageNames></excludePackageNames>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Specification-Title>${project.name}</Specification-Title>
+ <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Implementation-Title>${project.name}</Implementation-Title>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <tagBase>https://svn.apache.org/repos/asf/abdera/java/tags</tagBase>
+ <useReleaseProfile>false</useReleaseProfile>
+ <preparationGoals>clean install</preparationGoals>
+ <goals>deploy</goals>
+ <arguments>-Pdeploy</arguments>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache:apache-jar-resource-bundle:1.3</resourceBundle>
+ </resourceBundles>
+ <supplementalModels>
+ <supplementalModel>${topDir}/etc/notice-supplements.xml</supplementalModel>
+ </supplementalModels>
+ <properties>
+ <projectName>Apache Abdera2</projectName>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>2.1.0</version>
+ <extensions>true</extensions>
+ <inherited>true</inherited>
+ <configuration>
+ <instructions>
+ <Export-Package>${abdera.osgi.exports}</Export-Package>
+ <Import-Package>${abdera.osgi.imports}</Import-Package>
+ <Embed-Dependency>${abdera.osgi.embed.dependencies}</Embed-Dependency>
+ <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+ </instructions>
+ <versions>
+ <abdera.osgi.version.clean>${project.version}</abdera.osgi.version.clean>
+ </versions>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>cleanVersions</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*TestSuite*</exclude>
+ <exclude>**/*$*</exclude>
+ <exclude>**/TestAdapter*</exclude>
+ <exclude>**/TestChannelServlet*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.6</version>
+ </plugin>
+
+ <plugin>
+ <groupId>com.google.code.maven-license-plugin</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <version>1.4.0</version>
+ <configuration>
+ <basedir>${basedir}</basedir>
+ <header>${basedir}/etc/license.txt</header>
+ <quiet>false</quiet>
+ <failIfMissing>true</failIfMissing>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
+
+ <profiles>
+ <profile>
+ <id>java6</id>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <source>1.6</source>
+ <links>
+ <link>http://java.sun.com/javase/6/docs/api/</link>
+ </links>
+ <aggregate>true</aggregate>
+ <excludePackageNames></excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+ <profile>
+ <id>deploy</id>
+ <modules>
+ <module>distribution</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>no-online-tests</id>
+ <activation>
+ <property>
+ <name>offline-tests</name>
+ <value>false</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/*TestSuite*</exclude>
+ <exclude>**/*$*</exclude>
+ <exclude>**/*TestAdapter*</exclude>
+ <exclude>**/FeedValidatorTest.java</exclude>
+ <exclude>**/DSigThirdPartyVerifyTest.java</exclude>
+ <exclude>**/AtomConformanceTest.java</exclude>
+ <exclude>**/TestChannelServlet*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>java.net2</id>
+ <name>Repository hosting the jee6 artifacts</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-common</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-core</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-activities</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-client</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-ext</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-security</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-cache</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>1.7.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.12</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.12</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.1_spec</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <version>6.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ <version>4.8.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test, compile, package</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.6</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>xom</groupId>
+ <artifactId>xom</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.santuario</groupId>
+ <artifactId>xmlsec</artifactId>
+ <version>1.4.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <version>8.0.0.v20110901</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ <version>8.0.0.v20110901</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.8.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>3.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>11.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>nu.validator.htmlparser</groupId>
+ <artifactId>htmlparser</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-activities</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-client</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-ext</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-security</artifactId>
+ </dependency>
+
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient-cache</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.1_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.ibm.icu</groupId>
+ <artifactId>icu4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test, compile, package</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.santuario</groupId>
+ <artifactId>xmlsec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlet</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>nu.validator.htmlparser</groupId>
+ <artifactId>htmlparser</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <modules>
+ <module>server</module>
+ <module>test</module>
+ <module>examples</module>
+ </modules>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>apache.snapshots</id>
+ <name>Apache Development Snapshot Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-snapshot-repository</url>
+ </snapshotRepository>
+
+ <repository>
+ <id>apache.releases</id>
+ <name>Apache Release Distribution Repository</name>
+ <url>scp://people.apache.org/www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
+ </repository>
+ </distributionManagement>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jetty.version>6.1.24</jetty.version>
+ <easymock.version>3.0</easymock.version>
+ <topDir>${basedir}</topDir>
+ <abdera.osgi.imports>${abdera.osgi.abdera.imports},${abdera.osgi.default.imports}</abdera.osgi.imports>
+ <abdera.osgi.exports>${abdera.osgi.default.exports};version=${project.version};-noimport:=true</abdera.osgi.exports>
+ <abdera.osgi.abdera.imports>org.apache.abdera2.*;version="[$(version;===;${abdera.osgi.version.clean}),$(version;==+;${abdera.osgi.version.clean}))"</abdera.osgi.abdera.imports>
+ <abdera.osgi.default.imports>*</abdera.osgi.default.imports>
+ <abdera.osgi.default.exports>org.apache.abdera2.*</abdera.osgi.default.exports>
+ <abdera.osgi.embed.dependencies></abdera.osgi.embed.dependencies>
+ </properties>
+
+</project>
Propchange: abdera/abdera2-server/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/pom.xml?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/pom.xml (added)
+++ abdera/abdera2-server/server/pom.xml Wed Feb 1 17:54:54 2012
@@ -0,0 +1,60 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<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>org.apache.abdera2</groupId>
+ <artifactId>abdera2-server-project</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>abdera2-server</artifactId>
+ <packaging>bundle</packaging>
+ <name>Abdera2 Server</name>
+ <version>2.0-SNAPSHOT</version>
+ <description>Atom Publishing Protocol Server Implementation</description>
+
+ <properties>
+ <topDir>${basedir}/..</topDir>
+ <abdera.osgi.default.exports>
+ org.apache.abdera2.protocol.server.*
+ </abdera.osgi.default.exports>
+ <abdera.osgi.default.imports>
+ org.apache.commons.codec*;version="[1.3,2)",
+ *
+ </abdera.osgi.default.imports>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-core</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.abdera2</groupId>
+ <artifactId>abdera2-common</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: abdera/abdera2-server/server/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.abdera2.activities.model.ASBase;
+import org.apache.abdera2.activities.model.ASObject;
+import org.apache.abdera2.activities.model.Collection;
+import org.apache.abdera2.activities.model.Collection.CollectionBuilder;
+import org.apache.abdera2.activities.model.objects.ServiceObject;
+import org.apache.abdera2.common.misc.ExceptionHelper;
+import org.apache.abdera2.common.protocol.AbstractCollectionAdapter;
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+import org.apache.abdera2.common.protocol.CollectionInfo;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.ResponseContextException;
+
+import static org.apache.abdera2.activities.protocol.AbstractActivitiesProvider.*;
+import static org.apache.abdera2.activities.model.objects.PersonObject.makePerson;
+import static org.apache.abdera2.activities.model.objects.ServiceObject.makeService;
+import static org.apache.abdera2.activities.model.Collection.makeCollection;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+public abstract class AbstractActivitiesCollectionAdapter
+ extends AbstractCollectionAdapter
+ implements CollectionAdapter,
+ CollectionInfo {
+
+ public AbstractActivitiesCollectionAdapter(String href) {
+ super(href);
+ }
+
+ public Iterable<String> getAccepts(RequestContext request) {
+ return Arrays.asList("application/json");
+ }
+
+ protected <T extends ASBase>ResponseContext buildCreateEntryResponse(
+ String link,
+ ASBase.Builder<T,?> builder) {
+ return
+ new ActivitiesResponseContext<T>(builder)
+ .setLocation(link)
+ .setContentLocation(link)
+ .setEntityTag(calculateEntityTag(builder.get()))
+ .setStatus(201);
+ }
+
+ protected <T extends ASObject>ResponseContext buildGetEntryResponse(
+ RequestContext request,
+ ASObject.Builder<T,?> builder)
+ throws ResponseContextException {
+ builder.source(createSourceObject(request));
+ return
+ new ActivitiesResponseContext<T>(builder)
+ .setEntityTag(calculateEntityTag(builder.get()));
+ }
+
+ protected <T extends ASObject>ResponseContext buildGetFeedResponse(
+ CollectionBuilder<T> builder) {
+ return
+ new ActivitiesResponseContext<Collection<T>>(builder)
+ .setEntityTag(calculateEntityTag(builder.get()));
+ }
+
+ protected ServiceObject createSourceObject(
+ RequestContext request)
+ throws ResponseContextException {
+ return
+ makeService()
+ .displayName(getTitle(request))
+ .id(getId(request))
+ .author(
+ makePerson()
+ .displayName(getAuthor(request)))
+ .get();
+ }
+
+ /**
+ * Create the base feed for the requested collection.
+ */
+ protected Collection<ASObject> createCollectionBase(
+ RequestContext request)
+ throws ResponseContextException {
+ return
+ makeCollection()
+ .id(getId(request))
+ .updatedNow()
+ .author(
+ makePerson()
+ .displayName(getAuthor(request)))
+ .displayName(getTitle(request))
+ .get();
+ }
+
+ protected ASObject getEntryFromRequest(
+ RequestContext request)
+ throws ResponseContextException {
+ ASObject object;
+ try {
+ object =
+ AbstractActivitiesProvider
+ .getASBaseFromRequestContext(request);
+ } catch (IOException e) {
+ throw ExceptionHelper.propogate(e);
+ }
+ return object;
+ }
+
+ public Predicate<RequestContext> acceptable() {
+ return Predicates.or(
+ super.acceptable(),
+ AbstractActivitiesWorkspaceProvider.isJson());
+ }
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesCollectionAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesProvider.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesProvider.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.activities.model.ASBase;
+import org.apache.abdera2.activities.model.ASDocument;
+import org.apache.abdera2.activities.model.ASObject;
+import org.apache.abdera2.activities.model.Activity;
+import org.apache.abdera2.activities.model.Collection;
+import org.apache.abdera2.activities.model.IO;
+import org.apache.abdera2.activities.model.TypeAdapter;
+import org.apache.abdera2.activities.model.objects.ErrorObject;
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.misc.ArrayBuilder;
+import org.apache.abdera2.common.misc.ExceptionHelper;
+import org.apache.abdera2.common.protocol.AbstractProvider;
+import org.apache.abdera2.common.protocol.CollectionRequestProcessor;
+import org.apache.abdera2.common.protocol.EntryRequestProcessor;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.WorkspaceManager;
+import org.apache.abdera2.common.protocol.RequestContext.Scope;
+import org.joda.time.DateTime;
+import static org.apache.abdera2.activities.model.objects.ErrorObject.makeError;
+import static org.apache.abdera2.common.date.DateTimes.format;
+import static org.apache.abdera2.common.date.DateTimes.formatNow;
+import static org.apache.abdera2.common.http.EntityTag.generate;
+import static java.util.UUID.randomUUID;
+
+public abstract class AbstractActivitiesProvider
+ extends AbstractProvider
+ implements ActivitiesProvider {
+
+ protected Set<TypeAdapter<?>> typeAdapters =
+ new HashSet<TypeAdapter<?>>();
+ protected final WorkspaceManager workspaceManager;
+
+ protected AbstractActivitiesProvider(
+ WorkspaceManager workspaceManager) {
+ this.workspaceManager = workspaceManager;
+ addRequestProcessor(
+ TargetType.TYPE_COLLECTION,
+ CollectionRequestProcessor.class,
+ AbstractActivitiesWorkspaceProvider.isJson(),
+ workspaceManager
+ );
+ addRequestProcessor(
+ TargetType.TYPE_ENTRY,
+ EntryRequestProcessor.class,
+ workspaceManager);
+ }
+
+ public void addTypeAdapter(TypeAdapter<?> typeAdapter) {
+ typeAdapters.add(typeAdapter);
+ }
+
+ public void removeTypeAdapter(TypeAdapter<?> typeAdapter) {
+ typeAdapters.remove(typeAdapter);
+ }
+
+ public Set<TypeAdapter<?>> getTypeAdapters() {
+ return typeAdapters;
+ }
+
+ public ResponseContext createErrorResponse(
+ int code,
+ String message,
+ Throwable t) {
+ return
+ new ActivitiesResponseContext<ErrorObject>(
+ makeError()
+ .code(code)
+ .displayName(message))
+ .setStatus(code)
+ .setStatusText(message);
+ }
+
+ public static EntityTag calculateEntityTag(ASBase base) {
+ String id = null;
+ String modified = null;
+ if (base instanceof Activity) {
+ Activity ac = (Activity)base;
+ id = ac.getId();
+ modified = format(
+ ac.getUpdated() != null ?
+ ac.getUpdated() :
+ ac.getPublished());
+ } else if (base instanceof Collection) {
+ Collection<?> col = (Collection<?>)base;
+ id = col.getProperty("id");
+ if (id == null) id = randomUUID().toString();
+ modified = col.getProperty("updated");
+ } else if (base instanceof ASObject) {
+ ASObject as = (ASObject)base;
+ id = as.getId().toString();
+ modified = format(
+ as.getUpdated() != null ?
+ as.getUpdated() :
+ as.getPublished());
+ }
+ if (modified == null) modified = formatNow();
+ return generate(id, modified);
+ }
+
+ public static String getEditUriFromEntry(ASObject object) {
+ String editLink = object.getProperty("editLink");
+ return editLink;
+ }
+
+ public static IO getIO(
+ ActivitiesProvider provider,
+ TypeAdapter<?>... adapters) {
+ return IO.get(
+ ArrayBuilder.<TypeAdapter<?>>set(TypeAdapter.class)
+ .addAll(provider.getTypeAdapters())
+ .add(adapters)
+ .build());
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends ASBase>T getASBaseFromRequestContext(
+ RequestContext context)
+ throws IOException {
+ ASBase entity = context.getAttribute(Scope.REQUEST, ASBase.class.getName());
+ try {
+ if (entity == null) {
+ Reader reader = context.getReader();
+ IO io = getIO(context.<ActivitiesProvider>getProvider());
+ if (reader != null)
+ entity = io.read(reader);
+ else // try input stream, but this should've worked
+ entity = io.read(context.getInputStream(), "UTF-8");
+ }
+ } catch (Throwable t) {
+ throw ExceptionHelper.propogate(t);
+ }
+ if (entity != null)
+ context.setAttribute(ASBase.class.getName(), getDoc(entity,context));
+ return (T)entity;
+ }
+
+ private static <T extends ASBase>ASDocument<T> getDoc(T base, RequestContext context) {
+ ASDocument.Builder<T> builder =
+ ASDocument.make(base);
+ String etag = context.getHeader("ETag");
+ if (etag != null)
+ builder.entityTag(etag);
+ DateTime lm = context.getDateHeader("Last-Modified");
+ if (lm != null)
+ builder.lastModified(lm);
+ MimeType mt = context.getContentType();
+ if (mt != null)
+ builder.contentType(mt.toString());
+ String language = context.getContentLanguage();
+ if (language != null)
+ builder.language(language);
+ String slug = context.getSlug();
+ if (slug != null)
+ builder.slug(slug);
+ return builder.get();
+ }
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesWorkspaceProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesWorkspaceProvider.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesWorkspaceProvider.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.activities.model.TypeAdapter;
+import org.apache.abdera2.activities.model.objects.ErrorObject;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.AbstractWorkspaceProvider;
+import org.apache.abdera2.common.protocol.CollectionRequestProcessor;
+import org.apache.abdera2.common.protocol.EntryRequestProcessor;
+import org.apache.abdera2.common.protocol.Provider;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.WorkspaceManager;
+import static org.apache.abdera2.activities.model.objects.ErrorObject.makeError;
+
+import com.google.common.base.Predicate;
+
+public abstract class AbstractActivitiesWorkspaceProvider
+ extends AbstractWorkspaceProvider
+ implements Provider,
+ WorkspaceManager,
+ ActivitiesProvider {
+
+ protected final Set<TypeAdapter<?>> typeAdapters =
+ new HashSet<TypeAdapter<?>>();
+
+ public static Predicate<RequestContext> isJson() {
+ return new Predicate<RequestContext>() {
+ public boolean apply(RequestContext input) {
+ MimeType ct = input.getContentType();
+ if (ct == null) return false;
+ return MimeTypeHelper.isJson(ct.toString());
+ }
+ };
+ }
+
+ protected AbstractActivitiesWorkspaceProvider() {
+ addRequestProcessor(
+ TargetType.TYPE_COLLECTION,
+ CollectionRequestProcessor.class,
+ isJson(),
+ this);
+ addRequestProcessor(
+ TargetType.TYPE_ENTRY,
+ EntryRequestProcessor.class,
+ this);
+ }
+
+ public void addTypeAdapter(TypeAdapter<?> typeAdapter) {
+ typeAdapters.add(typeAdapter);
+ }
+
+ public void removeTypeAdapter(TypeAdapter<?> typeAdapter) {
+ typeAdapters.remove(typeAdapter);
+ }
+
+ public Set<TypeAdapter<?>> getTypeAdapters() {
+ return typeAdapters;
+ }
+
+ public ResponseContext createErrorResponse(
+ int code,
+ String message,
+ Throwable t) {
+ return
+ new ActivitiesResponseContext<ErrorObject>(
+ makeError()
+ .code(code)
+ .displayName(message))
+ .setStatus(code)
+ .setStatusText(message);
+ }
+}
\ No newline at end of file
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/AbstractActivitiesWorkspaceProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesProvider.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesProvider.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.util.Set;
+
+import org.apache.abdera2.activities.model.TypeAdapter;
+import org.apache.abdera2.common.protocol.Provider;
+
+public interface ActivitiesProvider extends Provider {
+
+ void addTypeAdapter(TypeAdapter<?> typeAdapter);
+
+ void removeTypeAdapter(TypeAdapter<?> typeAdapter);
+
+ Set<TypeAdapter<?>> getTypeAdapters();
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesResponseContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesResponseContext.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesResponseContext.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesResponseContext.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.activities.model.ASBase;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.AbstractResponseContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ActivitiesResponseContext<T extends ASBase>
+ extends AbstractResponseContext {
+
+ private final static Log log = LogFactory.getLog(ActivitiesResponseContext.class);
+
+ private final ASBase.Builder<T,?> builder;
+ private final boolean chunked;
+
+ public ActivitiesResponseContext(ASBase.Builder<T,?> builder) {
+ this(builder, true);
+ }
+
+ public ActivitiesResponseContext(ASBase.Builder<T,?> builder, boolean chunked) {
+ this.builder = builder;
+ setStatus(200);
+ setStatusText("OK");
+ this.chunked = chunked;
+ try {
+ MimeType type = getContentType();
+ String charset = type.getParameter("charset");
+ if (charset == null)
+ type.setParameter("charset", "UTF-8");
+ setContentType(type.toString());
+ } catch (Exception e) {
+ // it's ok to ignore this exception
+ log.debug("Error setting charset parameter",e);
+ }
+ log.debug(String.format("Content-Type: %s", getContentType()));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <X extends ASBase.Builder<T,?>>X getBuilder() {
+ return (X)builder;
+ }
+
+ public T getEntity() {
+ return builder.get();
+ }
+
+ public boolean hasEntity() {
+ return (builder != null);
+ }
+
+ public void writeTo(java.io.Writer javaWriter) throws IOException {
+ log.debug("Writing...");
+ if (hasEntity())
+ getEntity().writeTo(javaWriter);
+ }
+
+ public void writeTo(OutputStream out) throws IOException {
+ log.debug("Writing...");
+ if (hasEntity())
+ getEntity().writeTo(out);
+ }
+
+ public MimeType getContentType() {
+ return MimeTypeHelper.unmodifiableMimeType("application/json");
+ }
+
+ public long getContentLength() {
+ long len = super.getContentLength();
+ if (hasEntity() && len == -1 && !chunked) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ getEntity().writeTo(out);
+ len = out.size();
+ super.setContentLength(len);
+ } catch (Exception e) {
+ }
+ }
+ log.debug(String.format("Content-Length: %d", len));
+ return len;
+ }
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesResponseContext.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesServiceManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesServiceManager.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesServiceManager.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesServiceManager.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import static org.apache.abdera2.common.misc.MoreFunctions.*;
+
+import java.util.Map;
+
+import org.apache.abdera2.activities.model.IO;
+import org.apache.abdera2.activities.model.TypeAdapter;
+import org.apache.abdera2.common.protocol.AbstractServiceManager;
+import org.apache.abdera2.common.protocol.Provider;
+
+/**
+ * The ServiceManager is used by the AbderaServlet to bootstrap the server
+ * instance. There should be little to no reason why an end user would need
+ * to use this class directly.
+ */
+public class ActivitiesServiceManager
+ extends AbstractServiceManager {
+
+ public ActivitiesServiceManager() {}
+
+ public static IO getIO(TypeAdapter<?>... adapters) {
+ return IO.get(adapters);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <P extends Provider>P newProvider(
+ Map<String, Object> properties) {
+ return (P)discoverInitializable(
+ Provider.class,
+ DefaultActivitiesProvider.class)
+ .apply(properties);
+ }
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ActivitiesServiceManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/DefaultActivitiesProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/DefaultActivitiesProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/DefaultActivitiesProvider.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/DefaultActivitiesProvider.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import java.util.Collection;
+
+import javax.security.auth.Subject;
+
+import org.apache.abdera2.common.protocol.DefaultWorkspaceManager;
+import org.apache.abdera2.common.protocol.Request;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.RouteManager;
+import org.apache.abdera2.common.protocol.Target;
+import org.apache.abdera2.common.protocol.TargetBuilder;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.WorkspaceInfo;
+import org.apache.abdera2.common.protocol.WorkspaceManager;
+
+import com.google.common.base.Function;
+
+public class DefaultActivitiesProvider
+ extends AbstractActivitiesProvider {
+
+ protected Function<RequestContext,Target> targetResolver;
+ protected Function<Request,Subject> subjectResolver;
+ protected TargetBuilder<?> targetBuilder;
+ protected RouteManager<TargetType,RequestContext,String> routeManager;
+
+ public DefaultActivitiesProvider() {
+ this("/");
+ }
+
+ public DefaultActivitiesProvider(String base) {
+ super(new DefaultWorkspaceManager());
+ if (base == null) base = "/";
+ routeManager =
+ RouteManager.<TargetType,RequestContext,String>make()
+ .with("stream", base + ":stream", TargetType.TYPE_COLLECTION)
+ .with("activity", base + ":stream/:activity", TargetType.TYPE_ENTRY)
+ .get()
+ ;
+
+ targetBuilder = routeManager;
+ targetResolver = routeManager;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public RouteManager getRouteManager() {
+ return routeManager;
+ }
+
+ protected Function<RequestContext,Target> getTargetResolver(RequestContext request) {
+ return targetResolver;
+ }
+
+ public void setTargetResolver(Function<RequestContext,Target> targetResolver) {
+ this.targetResolver = targetResolver;
+ }
+
+ protected Function<Request,Subject> getSubjectResolver(RequestContext request) {
+ return subjectResolver;
+ }
+
+ public void setSubjectResolver(Function<Request,Subject> subjectResolver) {
+ this.subjectResolver = subjectResolver;
+ }
+
+ public Function<RequestContext,Target> getTargetResolver() {
+ return targetResolver;
+ }
+
+ public Function<Request,Subject> getSubjectResolver() {
+ return subjectResolver;
+ }
+
+ protected WorkspaceManager getWorkspaceManager(RequestContext request) {
+ return getWorkspaceManager();
+ }
+
+ public WorkspaceManager getWorkspaceManager() {
+ return workspaceManager;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public TargetBuilder getTargetBuilder() {
+ return (TargetBuilder)targetBuilder;
+ }
+
+ public void setTargetBuilder(TargetBuilder<?> targetBuilder) {
+ this.targetBuilder = targetBuilder;
+ }
+
+ public void addWorkspace(WorkspaceInfo workspace) {
+ ((DefaultWorkspaceManager)getWorkspaceManager()).addWorkspace(workspace);
+ }
+
+ public void addWorkspaces(Collection<WorkspaceInfo> workspaces) {
+ for (WorkspaceInfo w : workspaces)
+ ((DefaultWorkspaceManager)getWorkspaceManager()).addWorkspace(w);
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected TargetBuilder getTargetBuilder(Request request) {
+ return (TargetBuilder)targetBuilder;
+ }
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/DefaultActivitiesProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ProtocolException.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ProtocolException.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ProtocolException.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ProtocolException.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol;
+
+import org.apache.abdera2.activities.model.objects.ErrorObject;
+import org.apache.abdera2.common.misc.MoreFunctions;
+
+import static org.apache.abdera2.activities.model.objects.ErrorObject.makeError;
+
+public class ProtocolException extends RuntimeException {
+
+ private static final long serialVersionUID = 1017447143200419489L;
+ private final transient ErrorObject error;
+
+ public ProtocolException(ErrorObject error) {
+ super(String.format("%d::%s",error.getCode(),error.getDisplayName()));
+ this.error = error;
+ }
+
+ public ProtocolException(int code, String message) {
+ super(String.format("%d::%s",code,message));
+ this.error =
+ makeError()
+ .code(code)
+ .displayName(message)
+ .get();
+ }
+
+ public ErrorObject getError() {
+ return error;
+ }
+
+ @Override
+ public int hashCode() {
+ String message = error != null ? error.getDisplayName() : null;
+ int code = error != null ? error.getCode() : 0;
+ return MoreFunctions.genHashCode(1,message,code);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final ProtocolException other = (ProtocolException)obj;
+ String message = error != null ? error.getDisplayName() : null;
+ int code = error != null ? error.getCode() : 0;
+ String omessage = other.error != null ? other.error.getDisplayName() : null;
+ int ocode = other.error != null ? other.error.getCode() : 0;
+ if (message == null) {
+ if (omessage != null)
+ return false;
+ } else if (!message.equals(omessage))
+ return false;
+ if (code != ocode)
+ return false;
+ return true;
+ }
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/ProtocolException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol.basic;
+
+import java.util.UUID;
+import java.util.logging.Logger;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.activities.model.ASBase;
+import org.apache.abdera2.activities.model.ASObject;
+import org.apache.abdera2.activities.model.Collection;
+import org.apache.abdera2.activities.model.Collection.CollectionBuilder;
+import org.apache.abdera2.activities.model.objects.ErrorObject;
+import org.apache.abdera2.activities.model.objects.PersonObject;
+import org.apache.abdera2.activities.protocol.ActivitiesResponseContext;
+import org.apache.abdera2.activities.protocol.managed.FeedConfiguration;
+import org.apache.abdera2.activities.protocol.managed.ManagedCollectionAdapter;
+import org.apache.abdera2.common.mediatype.MimeTypeHelper;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContext;
+import org.apache.abdera2.common.protocol.Target;
+import org.apache.abdera2.common.protocol.TargetType;
+import org.apache.abdera2.common.protocol.RequestContext.Scope;
+import org.apache.abdera2.common.pusher.ChannelManager;
+import org.apache.abdera2.common.pusher.Pusher;
+import org.joda.time.DateTime;
+
+import com.google.common.base.Function;
+import static com.google.common.base.Preconditions.*;
+import static org.apache.abdera2.common.misc.ExceptionHelper.*;
+import static org.apache.abdera2.common.protocol.ProviderHelper.*;
+
+/**
+ * The BasicAdapter provides a simplistic interface for working with Atompub collections with a restricted set of
+ * options/features. The idea of the basic adapter is to make it easy to provide a minimally capable Atompub server
+ */
+@SuppressWarnings("unchecked")
+public abstract class BasicAdapter extends ManagedCollectionAdapter {
+
+ public final static Logger logger = Logger.getLogger(BasicAdapter.class.getName());
+
+ protected BasicAdapter(FeedConfiguration config) {
+ super(config);
+ putHandler(TargetType.TYPE_COLLECTION,"GET",getItemList());
+ putHandler(TargetType.TYPE_COLLECTION,"HEAD",getItemList());
+ putHandler(TargetType.TYPE_COLLECTION,"POST",postItem());
+ putHandler(TargetType.TYPE_ENTRY,"GET",getItem());
+ putHandler(TargetType.TYPE_ENTRY,"HEAD",getItem());
+ putHandler(TargetType.TYPE_ENTRY,"DELETE",deleteItem());
+ putHandler(TargetType.TYPE_ENTRY,"PUT",putItem());
+ }
+
+ public String getProperty(String key) throws Exception {
+ Object val = config.getProperty(key);
+ checkNotNull(
+ val,
+ "Cannot find property in Adapter properties file for feed ",
+ key,
+ config.getFeedId());
+ checked(
+ val instanceof String,
+ RuntimeException.class);
+ return (String)val;
+ }
+
+ protected <T extends ASObject>CollectionBuilder<T> createCollection() {
+ return
+ Collection
+ .<T>makeCollection()
+ .id(config.getFeedUri())
+ .set("title", config.getFeedTitle())
+ .set("updated", DateTime.now())
+ .set("author",
+ PersonObject
+ .makePerson()
+ .displayName(config.getFeedAuthor())
+ .get());
+ }
+
+ protected <T extends ASObject>void addEditLinkToObject(
+ ASObject.Builder<T,?> builder,
+ String id) throws Exception {
+ builder.set("editLink", id);
+ }
+
+ protected <T extends ASObject>void setObjectId(ASObject.Builder<T,?> builder) throws Exception {
+ String uuidUri = UUID.randomUUID().toString();
+ String[] segments = uuidUri.split(":");
+ String entryId = segments[segments.length - 1];
+ builder.id(createEntryIdUri(entryId));
+ }
+
+ protected String createEntryIdUri(String entryId) throws Exception {
+ return config.getFeedUri() + "/" + entryId;
+ }
+
+ private <T extends ASObject>void push(RequestContext context, String channel, ASObject.Builder<T,?> builder) {
+ if (context.getAttribute(Scope.CONTAINER, "AbderaChannelManager") != null) {
+ ChannelManager cm = (ChannelManager) context.getAttribute(
+ Scope.CONTAINER, "AbderaChannelManager");
+ if (cm != null) {
+ Pusher<ASObject> pusher =
+ cm.getPusher(channel);
+ if (pusher != null)
+ pusher.push(builder.get());
+ }
+ }
+ }
+
+ ResponseContext createOrUpdateObject(RequestContext request, boolean createFlag) {
+ try {
+ MimeType mimeType = request.getContentType();
+ String contentType = mimeType == null ? null : mimeType.toString();
+ if (contentType != null && !MimeTypeHelper.isJson(contentType))
+ return notsupported(request);
+
+ ASBase base = getEntryFromRequest(request);
+ Target target = request.getTarget();
+
+ if (base instanceof Collection &&
+ createFlag &&
+ target.getType() == TargetType.TYPE_COLLECTION) {
+ // only allow multiposts on collections.. these always create, never update
+ Collection<ASObject> coll = (Collection<ASObject>) base;
+ CollectionBuilder<ASObject> retl = Collection.makeCollection();
+ int c = 0;
+ for (ASObject inputEntry : coll.getItems()) {
+ ASObject.Builder<?,?> newEntry = createItem(inputEntry,c++);
+ if (newEntry != null) {
+ push(request,target.getParameter(BasicProvider.PARAM_FEED),newEntry);
+ retl.item(newEntry.get());
+ } else {
+ retl.item(
+ ErrorObject
+ .makeError()
+ .code(-100)
+ .displayName("Error adding object")
+ .get());
+ }
+ }
+ return
+ new ActivitiesResponseContext<Collection<ASObject>>(retl)
+ .setStatus(createFlag?201:200);
+ } else if (base instanceof ASObject){
+ String entryId = !createFlag ?
+ target.getParameter(BasicProvider.PARAM_ENTRY) :
+ null;
+ ASObject inputEntry = (ASObject) base;
+ ASObject.Builder<ASObject,?> newEntry = createFlag ?
+ createItem(inputEntry) :
+ updateItem(entryId, inputEntry);
+ if (newEntry != null) {
+ push(request,target.getParameter(BasicProvider.PARAM_FEED),newEntry);
+ String loc = newEntry.get().getProperty("editLink");
+ return
+ new ActivitiesResponseContext<ASObject>(newEntry)
+ .setStatus(createFlag?201:200)
+ .setLocation(loc);
+ } else
+ return notfound(request);
+ } else
+ return notallowed(request);
+ } catch (Exception e) {
+ return servererror(request, e.getMessage(), e);
+ }
+ }
+
+ private Function<RequestContext,ResponseContext> postItem() {
+ return new Function<RequestContext,ResponseContext>() {
+ public ResponseContext apply(RequestContext input) {
+ return createOrUpdateObject(input,true);
+ }
+ };
+ }
+
+ private Function<RequestContext,ResponseContext> deleteItem() {
+ return new Function<RequestContext,ResponseContext>() {
+ public ResponseContext apply(RequestContext input) {
+ Target target = input.getTarget();
+ String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
+ try {
+ return deleteItem(entryId) ?
+ nocontent() :
+ notfound(input);
+ } catch (Exception e) {
+ return servererror(
+ input, e.getMessage(), e);
+ }
+ }
+ };
+ }
+
+ private Function<RequestContext,ResponseContext> putItem() {
+ return new Function<RequestContext,ResponseContext>() {
+ public ResponseContext apply(RequestContext input) {
+ return createOrUpdateObject(input,false);
+ }
+ };
+ }
+
+ private Function<RequestContext,ResponseContext> getItem() {
+ return new Function<RequestContext,ResponseContext>() {
+ public ResponseContext apply(RequestContext input) {
+ Target target = input.getTarget();
+ String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
+ try {
+ ASObject.Builder<ASObject,?> object = getItem(entryId);
+ if (object != null) {
+ return
+ new ActivitiesResponseContext<ASObject>(object)
+ .setStatus(200);
+ } else return notfound(input);
+ } catch (Exception e) {
+ return servererror(input, e.getMessage(), e);
+ }
+ }
+ };
+ }
+
+ public Function<RequestContext,ResponseContext> getItemList() {
+ return new Function<RequestContext,ResponseContext>() {
+ public ResponseContext apply(RequestContext input) {
+ try {
+ CollectionBuilder<ASObject> collection =
+ getCollection();
+ if (collection != null) {
+ return
+ new ActivitiesResponseContext<Collection<ASObject>>(collection)
+ .setStatus(200);
+ } else return notfound(input);
+ } catch (Exception e) {
+ return servererror(input, e.getMessage(), e);
+ }
+ }
+ };
+ }
+
+ public abstract <T extends ASObject>CollectionBuilder<T> getCollection() throws Exception;
+
+ public abstract <T extends ASObject>ASObject.Builder<T,?> getItem(Object objectId) throws Exception;
+
+ public abstract <T extends ASObject>ASObject.Builder<T,?> createItem(ASObject object) throws Exception;
+
+ public abstract <T extends ASObject>ASObject.Builder<T,?> createItem(ASObject object, int c) throws Exception;
+
+ public abstract <T extends ASObject>ASObject.Builder<T,?> updateItem(Object objectId, ASObject object) throws Exception;
+
+ public abstract boolean deleteItem(Object objectId) throws Exception;
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol.basic;
+
+import org.apache.abdera2.activities.protocol.managed.BasicServerConfiguration;
+import org.apache.abdera2.activities.protocol.managed.ManagedProvider;
+import org.apache.abdera2.activities.protocol.managed.ServerConfiguration;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+import org.apache.abdera2.common.protocol.RouteManager;
+import org.apache.abdera2.common.protocol.TargetType;
+
+/**
+ * Provider implementation intended to be used with BasicAdapter implementations
+ */
+public class BasicProvider
+ extends ManagedProvider {
+
+ public static final String PARAM_FEED = "stream";
+ public static final String PARAM_ENTRY = "activity";
+
+ public BasicProvider() {
+ super();
+ init();
+ }
+
+ private void init() {
+ RouteManager<TargetType,RequestContext,String> routeManager =
+ RouteManager.<TargetType,RequestContext,String>make()
+ .with(
+ "stream",
+ "/:stream",
+ TargetType.TYPE_COLLECTION)
+ .with(
+ "activity",
+ "/:stream/:activity",
+ TargetType.TYPE_ENTRY)
+ .get();
+ setTargetBuilder(
+ routeManager);
+ setTargetResolver(
+ routeManager);
+ }
+
+ public CollectionAdapter getCollectionAdapter(RequestContext request) {
+ try {
+ return getCollectionAdapterManager(request)
+ .getAdapter(
+ request.getTarget().getParameter(PARAM_FEED));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ protected ServerConfiguration getServerConfiguration(RequestContext request) {
+ return new BasicServerConfiguration(request);
+ }
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicServiceManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicServiceManager.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicServiceManager.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicServiceManager.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol.basic;
+
+import java.util.Map;
+
+import org.apache.abdera2.activities.protocol.ActivitiesServiceManager;
+import org.apache.abdera2.common.protocol.Provider;
+
+public class BasicServiceManager extends ActivitiesServiceManager {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <P extends Provider> P newProvider(Map<String, Object> properties) {
+ BasicProvider bp = new BasicProvider();
+ bp.init(properties);
+ return (P)bp;
+ }
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicServiceManager.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol.managed;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.abdera2.common.protocol.RequestContext;
+
+public abstract class AbstractServerConfiguration
+ extends ServerConfiguration {
+
+ private final String host;
+ private final int port;
+ private final boolean secure;
+
+ protected AbstractServerConfiguration(RequestContext request) {
+ Object ohost = request.getProperty(RequestContext.Property.SERVERNAME);
+ Object oport = request.getProperty(RequestContext.Property.SERVERPORT);
+ Object osec = request.getProperty(RequestContext.Property.SECURE);
+ host = ohost != null ? (String)ohost : "localhost";
+ port = oport != null ? ((Integer)oport).intValue() : 9002;
+ secure = osec != null ? ((Boolean)osec).booleanValue() : false;
+ }
+
+ @Override
+ public String getAdapterConfigLocation() {
+ return "activities/adapter/config/";
+ }
+
+ @Override
+ public String getFeedConfigLocation() {
+ return "activities/adapter/";
+ }
+
+ @Override
+ public String getFeedConfigSuffix() {
+ return ".properties";
+ }
+
+ @Override
+ public int getPort() {
+ return port;
+ }
+
+ @Override
+ public String getServerUri() {
+ StringBuilder buf = new StringBuilder();
+ buf.append(secure ? "https://" : "http://");
+ buf.append(host);
+ if (port != 80)
+ buf.append(":")
+ .append(port);
+ return buf.toString();
+ }
+
+ @Override
+ public FeedConfiguration loadFeedConfiguration(String feedId) throws IOException {
+ String fileName = getFeedConfigLocation() + feedId + getFeedConfigSuffix();
+ InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
+ if (in == null)
+ throw new FileNotFoundException();
+ Properties props = new Properties();
+ props.load(in);
+ in.close();
+ return FeedConfiguration.getFeedConfiguration(feedId, props, this);
+ }
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java?rev=1239237&view=auto
==============================================================================
--- abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java (added)
+++ abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java Wed Feb 1 17:54:54 2012
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.activities.protocol.managed;
+
+import org.apache.abdera2.common.protocol.RequestContext;
+
+public class BasicServerConfiguration extends AbstractServerConfiguration {
+
+ public BasicServerConfiguration(RequestContext request) {
+ super(request);
+ }
+
+
+}
Propchange: abdera/abdera2-server/server/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java
------------------------------------------------------------------------------
svn:mime-type = text/plain