abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [5/49] - in /abdera/abdera2: ./ .settings/ activities/ activities/src/ activities/src/main/ activities/src/main/java/ activities/src/main/java/org/ activities/src/main/java/org/apache/ activities/src/main/java/org/apache/abdera2/ a...
Date Tue, 20 Sep 2011 15:57:20 GMT
Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,241 @@
+/*
+ * 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.Date;
+import java.util.LinkedHashSet;
+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.objects.PersonObject;
+import org.apache.abdera2.activities.protocol.AbstractActivitiesProvider;
+import org.apache.abdera2.activities.protocol.ActivitiesRequestContext;
+import org.apache.abdera2.activities.protocol.ActivitiesResponseContext;
+import org.apache.abdera2.activities.protocol.ErrorObject;
+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.ProviderHelper;
+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;
+
+/**
+ * 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 static Logger logger = Logger.getLogger(BasicAdapter.class.getName());
+
+    protected BasicAdapter(FeedConfiguration config) {
+        super(config);
+    }
+
+    public String getProperty(String key) throws Exception {
+        Object val = config.getProperty(key);
+        if (val == null) {
+            logger.warning("Cannot find property " + key + "in Adapter properties file for feed " + config.getFeedId());
+            throw new RuntimeException();
+        }
+        if (val instanceof String)
+            return (String)val;
+        throw new RuntimeException();
+    }
+
+    protected Collection<ASObject> createCollection() {
+      Collection<ASObject> col = new Collection<ASObject>();
+      col.setProperty("id", config.getFeedUri());
+      col.setProperty("title", config.getFeedTitle());
+      col.setProperty("updated", new Date());
+      PersonObject person = new PersonObject();
+      person.setDisplayName(config.getFeedAuthor());
+      col.setProperty("author", person);
+      col.setItems(new LinkedHashSet<ASObject>());
+      return col;
+    }
+    
+    protected void addEditLinkToObject(ASObject object) throws Exception {
+      if (AbstractActivitiesProvider.getEditUriFromEntry(object) == null) {
+        object.setProperty("editLink", object.getId());
+      }
+    }
+
+    protected void setObjectIdIfNull(ASObject object) throws Exception {
+        if (object.getId() != null)
+            return;
+        String uuidUri = UUID.randomUUID().toString();
+        String[] segments = uuidUri.split(":");
+        String entryId = segments[segments.length - 1];
+        object.setId(createEntryIdUri(entryId));
+    }
+
+    protected String createEntryIdUri(String entryId) throws Exception {
+        return config.getFeedUri() + "/" + entryId;
+    }
+
+    private void push(RequestContext context, String channel, ASObject object) {
+      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(object);
+          }
+        }
+      }
+    }
+    
+    private <S extends ResponseContext>S createOrUpdateObject(RequestContext context, boolean createFlag) {
+        try {
+            ActivitiesRequestContext request = (ActivitiesRequestContext) context;
+            MimeType mimeType = request.getContentType();
+            String contentType = mimeType == null ? null : mimeType.toString();
+            if (contentType != null && !MimeTypeHelper.isJson(contentType))
+                return (S)ProviderHelper.notsupported(request);
+            
+            ASBase base = (ASBase)request.getEntity();
+            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;
+              Collection<ASObject> retl = new Collection<ASObject>();
+              int c = 0;
+              for (ASObject inputEntry : coll.getItems()) {
+                ASObject newEntry = createItem(inputEntry,c++);
+                push(context,target.getParameter(BasicProvider.PARAM_FEED),newEntry);
+                if (newEntry != null) {
+                  retl.addItem(newEntry);
+                } else {
+                  ErrorObject err = new ErrorObject();
+                  err.setCode(-100);
+                  err.setDisplayName("Error adding object");
+                  retl.addItem(err);
+                }
+              }
+              ActivitiesResponseContext<Collection<ASObject>> rc = 
+                new ActivitiesResponseContext<Collection<ASObject>>(retl);
+              rc.setStatus(createFlag?201:200);
+              return (S)rc;
+            } else if (base instanceof ASObject){
+              String entryId = !createFlag ? target.getParameter(BasicProvider.PARAM_ENTRY) : null;
+              ASObject inputEntry = (ASObject) base;
+              ASObject newEntry = createFlag ? createItem(inputEntry) : updateItem(entryId, inputEntry);
+              push(context,target.getParameter(BasicProvider.PARAM_FEED),newEntry);
+              if (newEntry != null) {
+                  String loc = newEntry.getProperty("editLink");
+                  ActivitiesResponseContext<ASObject> rc = 
+                    new ActivitiesResponseContext<ASObject>(newEntry);
+                  rc.setStatus(createFlag?201:200);
+                  rc.setLocation(loc);
+                  return (S)rc;
+              } else {
+                  return (S)ProviderHelper.notfound(request);
+              }
+            } else {
+              return (S)ProviderHelper.notallowed(request);
+            }
+            
+        } catch (Exception e) {
+            return (S)ProviderHelper.servererror(context, e.getMessage(), e);
+        }
+    }
+
+    public <S extends ResponseContext>S postItem(RequestContext request) {
+        return createOrUpdateObject(request, true);
+    }
+
+    public <S extends ResponseContext>S deleteItem(RequestContext request) {
+        Target target = request.getTarget();
+        String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
+        try {
+            return (S)(deleteItem(entryId) ? ProviderHelper.nocontent() : ProviderHelper.notfound(request));
+        } catch (Exception e) {
+            return (S)ProviderHelper.servererror(request, e.getMessage(), e);
+        }
+    }
+
+    public <S extends ResponseContext>S putItem(RequestContext request) {
+        return createOrUpdateObject(request, false);
+    }
+
+    public <S extends ResponseContext>S getItem(RequestContext request) {
+        Target target = request.getTarget();
+        String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
+        try {
+            ASObject object = getItem(entryId);
+            
+            if (object != null) {
+              ActivitiesResponseContext<ASObject> rc = 
+                new ActivitiesResponseContext<ASObject>(object);
+              rc.setStatus(200);
+              return (S)rc;
+            } else return (S)ProviderHelper.notfound(request);       
+        } catch (Exception e) {
+            return (S)ProviderHelper.servererror(request, e.getMessage(), e);
+        }
+    }
+
+    public <S extends ResponseContext>S getItemList(RequestContext request) {
+        try {
+            Collection<ASObject> collection = 
+              getCollection();
+
+            if (collection != null) { 
+              ActivitiesResponseContext<Collection<ASObject>> rc = 
+                new ActivitiesResponseContext<Collection<ASObject>>(collection);
+              rc.setStatus(200);
+              return (S)rc;
+            } else return (S)ProviderHelper.notfound(request);
+        } catch (Exception e) {
+            return (S)ProviderHelper.servererror(request, e.getMessage(), e);
+        }
+    }
+
+    public <S extends ResponseContext>S extensionRequest(RequestContext request) {
+        return (S)ProviderHelper.notallowed(request, ProviderHelper.getDefaultMethods(request));
+    }
+
+    public <S extends ResponseContext>S getCategories(RequestContext request) {
+        return (S)ProviderHelper.notfound(request);
+    }
+
+    public abstract Collection<ASObject> getCollection() throws Exception;
+
+    public abstract ASObject getItem(Object objectId) throws Exception;
+
+    public abstract ASObject createItem(ASObject object) throws Exception;
+
+    public abstract ASObject createItem(ASObject object, int c) throws Exception;
+    
+    public abstract ASObject updateItem(Object objectId, ASObject object) throws Exception;
+
+    public abstract boolean deleteItem(Object objectId) throws Exception;
+
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,72 @@
+/*
+ * 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();
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    private void init() {
+        RouteManager routeManager =
+            new RouteManager()
+              .addRoute(
+                "stream",
+                "/:stream",
+                TargetType.TYPE_COLLECTION)
+              .addRoute(
+                "activity", 
+                "/:stream/:activity", 
+                TargetType.TYPE_ENTRY);
+        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/activities/src/main/java/org/apache/abdera2/activities/protocol/basic/BasicProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,86 @@
+/*
+ * 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(":");
+            buf.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/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/AbstractServerConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java Tue Sep 20 15:56:46 2011
@@ -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/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/BasicServerConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterConfiguration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterConfiguration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterConfiguration.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,47 @@
+/*
+ * 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.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+public class CollectionAdapterConfiguration extends Configuration {
+
+    private final String fileLocation;
+    private final ServerConfiguration serverConfiguration;
+
+    public CollectionAdapterConfiguration(ServerConfiguration serverConfiguration, String fileLocation) {
+        this.fileLocation = fileLocation;
+        this.serverConfiguration = serverConfiguration;
+    }
+
+    public InputStream getConfigAsFileInputStream() throws IOException {
+        String filePath = serverConfiguration.getAdapterConfigLocation() + fileLocation;
+        return Configuration.loadFileAsInputStream(filePath);
+    }
+
+    public Reader getAdapterConfigAsReader() throws IOException {
+        return new InputStreamReader(getConfigAsFileInputStream());
+    }
+
+    public ServerConfiguration getServerConfiguration() {
+        return serverConfiguration;
+    }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterManager.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterManager.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterManager.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterManager.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,107 @@
+/*
+ * 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.File;
+import java.io.FileFilter;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+
+public class CollectionAdapterManager {
+
+    public static Logger logger = Logger.getLogger(CollectionAdapterManager.class.getName());
+
+    // maps a feed id to an adapter instance
+    protected static Map<String, CollectionAdapter> adapterInstanceMap = 
+      new HashMap<String, CollectionAdapter>();
+
+    protected final ServerConfiguration config;
+
+    public CollectionAdapterManager(ServerConfiguration config) {
+        this.config = config;
+    }
+
+    public CollectionAdapter getAdapter(String feedId) throws Exception {
+        FeedConfiguration feedConfiguration = config.loadFeedConfiguration(feedId);
+        return createAdapterInstance(feedConfiguration);
+    }
+
+    public Map<String, FeedConfiguration> listAdapters() throws Exception {
+        Map<String, FeedConfiguration> results = new HashMap<String, FeedConfiguration>();
+        Enumeration<URL> e =
+            Thread.currentThread().getContextClassLoader().getResources(config.getFeedConfigLocation());
+        while (e.hasMoreElements()) {
+            URL url = e.nextElement();
+            File file = new File(url.toURI());
+            if (!file.exists()) {
+                throw new RuntimeException("Could not convert properties path to a File! \"" + file.getAbsolutePath()
+                    + "\" does not exist.");
+            }
+            File[] files = file.listFiles(new FileFilter() {
+                public boolean accept(File file) {
+                    return !file.isDirectory();
+                }
+            });
+            if (files != null) {
+                for (File _file : files) {
+                    String name = _file.getName();
+                    int i = name.indexOf(config.getFeedConfigSuffix());
+                    String id = i > -1 ? name.substring(0, i) : null;
+                    if (id != null) {
+                        FeedConfiguration feedConfiguration = loadFeedInfo(id);
+                        if (null != feedConfiguration)
+                            results.put(id, feedConfiguration);
+                    }
+                }
+            }
+        }
+        return results;
+    }
+
+    protected FeedConfiguration loadFeedInfo(String feedId) throws Exception {
+        return config.loadFeedConfiguration(feedId);
+    }
+
+    protected static synchronized CollectionAdapter createAdapterInstance(FeedConfiguration config)
+        throws Exception {
+        CollectionAdapter basicAdapter = adapterInstanceMap.get(config.getFeedId());
+        if (basicAdapter != null) {
+            return basicAdapter;
+        }
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        Class<?> adapterClass = cl.loadClass(config.getAdapterClassName());
+        Constructor<?>[] ctors = adapterClass.getConstructors();
+        for (Constructor<?> element : ctors) {
+            logger.finest("Public constructor found: " + element.toString());
+        }
+        Constructor<?> c = adapterClass.getConstructor(new Class[] {FeedConfiguration.class});
+        c.setAccessible(true);
+        CollectionAdapter adapterInstance = (CollectionAdapter)c.newInstance(config);
+
+        // put this adapter instance in adapterInstanceMap
+        adapterInstanceMap.put(config.getFeedId(), adapterInstance);
+        return adapterInstance;
+    }
+
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/CollectionAdapterManager.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/Configuration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/Configuration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/Configuration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/Configuration.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,46 @@
+/*
+ * 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.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public abstract class Configuration {
+
+    static Properties loadFileAsProperties(String fileLocation) throws IOException {
+        Properties props = new Properties();
+        props.load(new FileInputStream(fileLocation));
+        return props;
+    }
+
+    static InputStream loadFileAsInputStream(String fileLocation) throws IOException {
+        return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileLocation);
+    }
+
+    static String getProperty(Properties prop, String key) {
+        String val = prop.getProperty(key);
+        if (val == null)
+            throw new RuntimeException();
+        return val;
+    }
+
+    protected Configuration() {
+    }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/Configuration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/FeedConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/FeedConfiguration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/FeedConfiguration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/FeedConfiguration.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,149 @@
+/*
+ * 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.util.Map;
+import java.util.Properties;
+
+import org.apache.abdera2.common.protocol.CollectionInfo;
+import org.apache.abdera2.common.protocol.RequestContext;
+
+public class FeedConfiguration extends Configuration implements CollectionInfo {
+    public static final String PROP_NAME_ADAPTER_CLASS = "adapterClassName";
+    public static final String PROP_SUB_URI_NAME = "subUri";
+    public static final String PROP_AUTHOR_NAME = "author";
+    public static final String PROP_TITLE_NAME = "title";
+    public static final String PROP_ACCEPTS = "accepts";
+    public static final String PROP_ENTRY_TITLE_NAME = "entryTitle";
+    public static final String PROP_FEED_CONFIG_LOCATION_NAME = "configFile";
+
+    public static final String ENTRY_ELEM_NAME_ID = "id";
+    public static final String ENTRY_ELEM_NAME_TITLE = "title";
+    public static final String ENTRY_ELEM_NAME_CONTENT = "content";
+    public static final String ENTRY_ELEM_NAME_AUTHOR = "author";
+    public static final String ENTRY_ELEM_NAME_UPDATED = "updated";
+    public static final String ENTRY_ELEM_NAME_LINK = "link";
+
+    private final String feedId;
+    private final String subUri;
+    private final String adapterClassName;
+    private final String feedConfigLocation;
+    private final ServerConfiguration serverConfiguration;
+    private String feedTitle = "unknown";
+    private String feedAuthor = "unknown";
+    private Map<Object, Object> optionalProperties;
+    private final CollectionAdapterConfiguration adapterConfiguration;
+
+    public FeedConfiguration(String feedId,
+                             String subUri,
+                             String adapterClassName,
+                             String feedConfigLocation,
+                             ServerConfiguration serverConfiguration) {
+        this.feedId = feedId;
+        this.subUri = subUri;
+        this.adapterClassName = adapterClassName;
+        this.feedConfigLocation = feedConfigLocation;
+        this.adapterConfiguration = new CollectionAdapterConfiguration(serverConfiguration, feedConfigLocation);
+        this.serverConfiguration = serverConfiguration;
+    }
+
+    public static FeedConfiguration getFeedConfiguration(String feedId,
+                                                         Properties properties,
+                                                         ServerConfiguration serverConfiguration) {
+        FeedConfiguration feedConfiguration =
+            new FeedConfiguration(feedId, Configuration.getProperty(properties, PROP_SUB_URI_NAME), Configuration
+                .getProperty(properties, PROP_NAME_ADAPTER_CLASS), Configuration
+                .getProperty(properties, PROP_FEED_CONFIG_LOCATION_NAME), serverConfiguration);
+        if (properties.containsKey(PROP_AUTHOR_NAME)) {
+            feedConfiguration.setFeedAuthor(Configuration.getProperty(properties, PROP_AUTHOR_NAME));
+        }
+
+        if (properties.containsKey(PROP_TITLE_NAME)) {
+            feedConfiguration.setFeedTitle(Configuration.getProperty(properties, PROP_TITLE_NAME));
+        }
+        feedConfiguration.optionalProperties = properties;
+        return feedConfiguration;
+    }
+
+    public String getAdapterClassName() {
+        return adapterClassName;
+    }
+
+    public String getFeedAuthor() {
+        return feedAuthor;
+    }
+
+    public String getFeedConfigLocation() {
+        return feedConfigLocation;
+    }
+
+    public String getFeedId() {
+        return feedId;
+    }
+
+    public String getFeedTitle() {
+        return feedTitle;
+    }
+
+    public String getSubUri() {
+        return subUri;
+    }
+
+    public void setFeedAuthor(String feedAuthor) {
+        this.feedAuthor = feedAuthor;
+    }
+
+    public void setFeedTitle(String feedTitle) {
+        this.feedTitle = feedTitle;
+    }
+
+    public String getFeedUri() {
+        return serverConfiguration.getServerUri() + "/" + getSubUri();
+    }
+
+    public boolean hasProperty(String key) {
+        return optionalProperties.containsKey(key);
+    }
+
+    public Object getProperty(String key) {
+        return optionalProperties.get(key);
+    }
+
+    public CollectionAdapterConfiguration getAdapterConfiguration() {
+        return adapterConfiguration;
+    }
+    
+    public String[] getAccepts(RequestContext request) {
+        Object accepts = optionalProperties.get(PROP_ACCEPTS);
+        if (accepts == null || !(accepts instanceof String))
+            return new String[] {"application/json"};
+        return ((String)accepts).split("\\s*,\\s*");
+    }
+
+    public String getHref(RequestContext request) {
+        return getFeedUri();
+    }
+
+    public String getTitle(RequestContext request) {
+        return getFeedTitle();
+    }
+
+    public ServerConfiguration getServerConfiguration() {
+        return adapterConfiguration.getServerConfiguration();
+    }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/FeedConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedCollectionAdapter.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedCollectionAdapter.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedCollectionAdapter.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,50 @@
+/*
+ * 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.activities.protocol.AbstractActivitiesCollectionAdapter;
+import org.apache.abdera2.common.protocol.CollectionAdapter;
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.ResponseContextException;
+
+public abstract class ManagedCollectionAdapter 
+  extends AbstractActivitiesCollectionAdapter 
+  implements CollectionAdapter {
+
+    protected final FeedConfiguration config;
+
+    protected ManagedCollectionAdapter(FeedConfiguration config) {
+        this.config = config;
+    }
+
+    public FeedConfiguration getConfiguration() {
+        return this.config;
+    }
+
+    public String getAuthor(RequestContext request) throws ResponseContextException {
+        return config.getFeedAuthor();
+    }
+
+    public String getId(RequestContext request) {
+        return config.getFeedId();
+    }
+
+    public String getTitle(RequestContext request) {
+        return config.getFeedTitle();
+    }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedCollectionAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedProvider.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedProvider.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedProvider.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedProvider.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,42 @@
+/*
+ * 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.activities.protocol.AbstractActivitiesWorkspaceProvider;
+import org.apache.abdera2.common.protocol.RequestContext;
+
+/**
+ * The ManagedProvider uses *.properties files discovered in the webapp classpath to configure CollectionAdapter
+ * instances. The ManagedWorkspace implementation will automatically discover the *.properties files and will use those
+ * to create the appropriate CollectionAdapter objects. Properties files must be located in the classpath at
+ * /abdera/adapter/*.properties. Refer to the Abdera Server Implementation Guide for additional details
+ */
+public abstract class ManagedProvider 
+  extends AbstractActivitiesWorkspaceProvider {
+  
+    protected abstract ServerConfiguration getServerConfiguration(RequestContext request);
+
+    protected ManagedProvider() {
+        addWorkspace(new ManagedWorkspace(this));
+    }
+
+    public CollectionAdapterManager getCollectionAdapterManager(RequestContext request) {
+      return new CollectionAdapterManager(getServerConfiguration(request));
+  }
+
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedWorkspace.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedWorkspace.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedWorkspace.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedWorkspace.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,59 @@
+/*
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.abdera2.common.protocol.RequestContext;
+import org.apache.abdera2.common.protocol.CollectionInfo;
+import org.apache.abdera2.common.protocol.WorkspaceInfo;
+
+public class ManagedWorkspace implements WorkspaceInfo {
+
+    private final ManagedProvider provider;
+
+    private String title = "Abdera - Activities";
+
+    public ManagedWorkspace(ManagedProvider provider) {
+        this.provider = provider;
+    }
+
+    public Collection<CollectionInfo> getCollections(RequestContext request) {
+        CollectionAdapterManager cam = provider.getCollectionAdapterManager(request);
+        List<CollectionInfo> collections = new ArrayList<CollectionInfo>();
+        try {
+            Map<String, FeedConfiguration> map = cam.listAdapters();
+            for (FeedConfiguration config : map.values())
+                collections.add(config);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return collections;
+    }
+    
+    public String getTitle(RequestContext request) {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ManagedWorkspace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ServerConfiguration.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ServerConfiguration.java (added)
+++ abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ServerConfiguration.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+public abstract class ServerConfiguration extends Configuration {
+
+    public abstract int getPort();
+
+    public abstract String getServerUri();
+
+    public abstract String getFeedConfigLocation();
+
+    public abstract String getFeedConfigSuffix();
+
+    public abstract String getAdapterConfigLocation();
+
+    public abstract FeedConfiguration loadFeedConfiguration(String feedId) throws Exception;
+
+}

Propchange: abdera/abdera2/activities/src/main/java/org/apache/abdera2/activities/protocol/managed/ServerConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/pom.xml?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/pom.xml (added)
+++ abdera/abdera2/client/pom.xml Tue Sep 20 15:56:46 2011
@@ -0,0 +1,88 @@
+<!--
+   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</artifactId>
+    <version>2.0-SNAPSHOT</version>  
+  </parent>  
+
+  <artifactId>abdera2-client</artifactId>
+  <packaging>bundle</packaging>
+  <name>Abdera2 Client</name>
+  <version>2.0-SNAPSHOT</version>  
+  <description>Atom Publishing Protocol Client Implementation</description>
+
+  <properties>
+    <topDir>${basedir}/..</topDir>
+    <!-- 
+    <abdera.osgi.default.exports>
+		  org.apache.abdera2.protocol.client.*
+	  </abdera.osgi.default.exports>
+    <abdera.osgi.default.imports>
+      org.apache.commons.codec*;version="[1.5,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>   
+    <dependency>
+      <groupId>org.apache.abdera2</groupId>
+      <artifactId>abdera2-activities</artifactId>
+      <version>2.0-SNAPSHOT</version>  
+      <scope>compile</scope>
+    </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>
+     
+  </dependencies>
+</project>

Propchange: abdera/abdera2/client/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaBody.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaBody.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaBody.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaBody.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,118 @@
+/*
+ * 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.protocol.client;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element.Helper;
+import org.apache.http.entity.mime.content.AbstractContentBody;
+
+/**
+ * Used with the MultipartRelatedEntity to include an Atom Entry as a 
+ * multipart message part. This is primarily used internally by the 
+ * Abdera client and there will be very little reason, if any, for 
+ * applications to use this class directly. 
+ */
+public class AbderaBody 
+  extends AbstractContentBody {
+
+  private final Base base;
+  private final long len;
+  
+  /**
+   * Create the body using the specified Abdera document or element. 
+   * The content length will not be calculated automatically so the 
+   * Content-Length header in the part will not be specified. The 
+   * Content-Type will be automatically detected based on the type of
+   * element passed in.
+   */
+  public AbderaBody(Base base) {
+    this(base,false,null);
+  }
+  
+  /**
+   * Create the body using the specified Abdera document or element.
+   * The content length will not be calculated. The Content-Type 
+   * specified will be used. If contentType is null, the Content-Type 
+   * will be automatically detected based on the type of element passed in.
+   */
+  public AbderaBody(Base base, String contentType) {
+    this(base,false,contentType);
+  }
+
+  /**
+   * Create the body using the specified Abdera document or element.
+   * The content length will be automatically calculated if the 
+   * calclen argument is true. The Content-Type will be automatically
+   * detected based on the type of element passed in.
+   */
+  public AbderaBody(Base base, boolean calclen) {
+    this(base,calclen,null);
+  }
+  
+  /**
+   * Create the body using the specified Abdera document or element.
+   * The content length will be automatically calculated if the 
+   * calclen argument is true. The Content-Type specified will be
+   * used. If contentType is null, the Content-Type will be automatically
+   * detected based on the type of element passed in.
+   */
+  public AbderaBody(Base base,boolean calclen,String contentType) {
+    super(contentType!=null?contentType:Helper.getMimeType(base));
+    this.base = base;
+    if (calclen) {
+      long l = -1;
+      try {
+        ByteArrayOutputStream out = 
+          new ByteArrayOutputStream();
+        base.writeTo(out);
+        l = out.toByteArray().length;
+      } catch (Throwable t) {}
+      len = l;
+    } else {
+      len = -1;
+    }
+  }
+
+  public String getFilename() {
+    return null;
+  }
+
+  public void writeTo(OutputStream out) throws IOException {
+    base.writeTo(out);
+  }
+
+  public String getCharset() {
+    if (base instanceof Document)
+      return ((Document<?>)base).getCharset();
+    return null;
+  }
+
+  public long getContentLength() {
+    return len;
+  }
+
+  public String getTransferEncoding() {
+    return "8bit";
+  }
+
+}

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaBody.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,141 @@
+/*
+ * 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.protocol.client;
+
+import java.io.IOException;
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.parser.ParserOptions;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.impl.client.DefaultHttpClient;
+
+/**
+ * The default Abdera Client.
+ */
+public class AbderaClient extends ClientWrapper {
+
+  protected Abdera abdera;
+  
+  public AbderaClient() {
+    this(
+      new BasicClient(), 
+      Abdera.getInstance(), 
+      DEFAULT_USER_AGENT);
+  }
+  
+  public AbderaClient(Client client) {
+    this(
+      client, 
+      Abdera.getInstance(), 
+      DEFAULT_USER_AGENT);
+  }
+  
+  public AbderaClient(String useragent) {
+    this(
+      new BasicClient(), 
+      Abdera.getInstance(), 
+      useragent);
+  }
+  
+  public AbderaClient(
+    Client client, 
+    String useragent) {
+      this(client, Abdera.getInstance(), useragent);
+  }
+  
+  public AbderaClient(
+      Client client, 
+      Abdera abdera, 
+      String useragent) {
+        super(client);
+        this.abdera = abdera;
+  }
+  
+  public AbderaClient(DefaultHttpClient client) {
+    this(new BasicClient(client), Abdera.getInstance(), DEFAULT_USER_AGENT);
+  }
+  
+  public AbderaClient(Abdera abdera, DefaultHttpClient client) {
+    this(new BasicClient(client), abdera, DEFAULT_USER_AGENT);
+  }
+  
+  public AbderaClient(Abdera abdera) {
+    this(new BasicClient(), abdera, DEFAULT_USER_AGENT);
+  }
+
+  public Abdera getAbdera() {
+    return abdera;
+  }
+    
+  /**
+   * Convenience method for performing a session-less get on a given URI.
+   */
+  public <T extends Element>Document<T> get(String uri) 
+    throws ClientProtocolException, IOException {
+      return get(uri,null,null);
+  }
+
+  /**
+   * Convenience method for performing a session-less get on a given URI.
+   */
+  public <T extends Element>Document<T> get(String uri, ParserOptions options) 
+    throws ClientProtocolException, IOException {
+      return get(uri,null,options);
+  }
+  
+  /**
+   * Convenience method for performing a session-less get on a given URI.
+   */
+  public <T extends Element>Document<T> get(
+    String uri, 
+    RequestOptions options) {
+      return get(uri,options,null);
+  }
+  
+  /**
+   * Convenience method for performing a session-less get on a given URI.
+   */
+  @SuppressWarnings("unchecked")
+  public <T extends Element>Document<T> get(
+    String uri, 
+    RequestOptions options, 
+    ParserOptions parserOptions) {
+    try {
+      HttpUriRequest request = 
+        RequestHelper.createRequest(
+          "GET", uri, null, options);
+      AbderaResponseHandler h = 
+        parserOptions != null ?
+        new AbderaResponseHandler(abdera,parserOptions) :
+        new AbderaResponseHandler(abdera);
+      return (Document<T>) getClient().execute(request,h);
+    } catch (Throwable t) {
+      throw new RuntimeException(t);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public <T extends Session>T newSession() {
+    return (T)new AbderaSession(this);
+  }
+
+  
+}

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClient.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,23 @@
+package org.apache.abdera2.protocol.client;
+
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.parser.ParseException;
+import org.apache.abdera2.parser.Parser;
+import org.apache.abdera2.parser.ParserOptions;
+
+public interface AbderaClientResponse extends ClientResponse {
+
+  public abstract <T extends Element> Document<T> getDocument()
+      throws ParseException;
+
+  public abstract <T extends Element> Document<T> getDocument(
+      ParserOptions options) throws ParseException;
+
+  public abstract <T extends Element> Document<T> getDocument(Parser parser)
+      throws ParseException;
+
+  public abstract <T extends Element> Document<T> getDocument(Parser parser,
+      ParserOptions options) throws ParseException;
+
+}
\ No newline at end of file

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponse.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,96 @@
+/*
+ * 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.protocol.client;
+
+import java.util.Date;
+
+import javax.activation.MimeType;
+
+import org.apache.abdera2.common.http.EntityTag;
+import org.apache.abdera2.common.iri.IRI;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.parser.ParseException;
+import org.apache.abdera2.parser.Parser;
+import org.apache.abdera2.parser.ParserOptions;
+
+class AbderaClientResponseImpl 
+  extends ClientResponseWrapper implements AbderaClientResponse {
+  
+  public AbderaClientResponseImpl(
+    ClientResponse response) {
+    super(response);
+  }
+  
+  protected AbderaSession getAbderaSession() {
+    return (AbderaSession) this.getSession();
+  }
+  
+  public <T extends Element> Document<T> getDocument() throws ParseException {
+    return getDocument(getAbderaSession().getAbdera().getParser());
+  }
+
+  public <T extends Element> Document<T> getDocument(ParserOptions options)
+      throws ParseException {
+    return getDocument(getAbderaSession().getAbdera().getParser(),options);
+  }
+
+  public <T extends Element> Document<T> getDocument(Parser parser)
+      throws ParseException {
+      return getDocument(parser,null);
+  }
+
+  public <T extends Element> Document<T> getDocument(Parser parser,
+      ParserOptions options) throws ParseException {
+    try {
+      if (options == null) 
+      options = parser.getDefaultParserOptions();
+      
+      String charset = getCharacterEncoding();
+      if (charset != null)
+          options.setCharset(charset);
+      IRI cl = getContentLocation();
+      if (cl != null && !cl.isAbsolute()) {
+          IRI r = new IRI(getUri());
+          cl = r.resolve(cl);
+      }
+      String base = (cl != null) ? cl.toASCIIString() : getUri();
+      
+      Document<T> doc = parser.parse(getInputStream(),base,options);
+      EntityTag etag = getEntityTag();
+      if (etag != null)
+          doc.setEntityTag(etag);
+      Date lm = getLastModified();
+      if (lm != null)
+          doc.setLastModified(lm);
+      MimeType mt = getContentType();
+      if (mt != null)
+          doc.setContentType(mt.toString());
+      String language = getContentLanguage();
+      if (language != null)
+          doc.setLanguage(language);
+      String slug = getSlug();
+      if (slug != null)
+          doc.setSlug(slug);
+      return doc;
+    } catch (Throwable t) {
+      throw new ParseException(t);
+    }
+  }
+
+}
\ No newline at end of file

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaClientResponseImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaEntity.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaEntity.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaEntity.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaEntity.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,139 @@
+/*
+ * 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.protocol.client;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Element.Helper;
+import org.apache.http.Header;
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHeader;
+
+/**
+ * Wraps an Abdera object for use with the Apache HTTP client.
+ */
+public class AbderaEntity
+  extends BasicHttpEntity 
+  implements HttpEntity {
+
+    private final Header ct;
+    private final Base base;
+    private final long len;
+    private byte[] buf = null;
+
+    /**
+     * Create the entity using the specified Abdera document or element. 
+     * The content length will not be calculated automatically so the 
+     * Content-Length header in the part will not be specified. The 
+     * Content-Type will be automatically detected based on the type of
+     * element passed in.
+     */
+    public AbderaEntity(Base base) {
+        this(base, false, null);
+    }
+    
+    /**
+     * Create the entity using the specified Abdera document or element.
+     * The content length will not be calculated. The Content-Type 
+     * specified will be used. If contentType is null, the Content-Type 
+     * will be automatically detected based on the type of element passed in.
+     */
+    public AbderaEntity(Base base, String contentType) {
+      this(base, false, contentType);
+    }
+    
+    /**
+     * Create the entity using the specified Abdera document or element.
+     * The content length will be automatically calculated if the 
+     * calclen argument is true. The Content-Type will be automatically
+     * detected based on the type of element passed in.
+     */
+    public AbderaEntity(Base base, boolean calclen) {
+      this(base, calclen, null);
+    }
+    
+    /**
+     * Create the entity using the specified Abdera document or element.
+     * The content length will be automatically calculated if the 
+     * calclen argument is true. The Content-Type specified will be
+     * used. If contentType is null, the Content-Type will be automatically
+     * detected based on the type of element passed in.
+     */
+    public AbderaEntity(Base base, boolean calclen, String contentType) {
+      if (base == null) 
+        throw new IllegalArgumentException();
+      this.base = base;
+      this.ct = new BasicHeader(
+        "Content-Type", 
+        contentType!=null?contentType:Helper.getMimeType(base));
+      if (calclen) {
+        long l = -1;
+        try {
+          ByteArrayOutputStream out = 
+            new ByteArrayOutputStream();
+          base.writeTo(out);
+          buf = out.toByteArray();
+          l = buf.length;
+        } catch (Throwable t) {}
+        len = l;
+      } else {
+        len = -1;
+      }
+    }
+
+    public boolean isRepeatable() {
+        return true;
+    }
+
+    public void writeTo(OutputStream out) throws IOException {
+      base.writeTo(out);
+    }
+    
+    public InputStream getContent() {
+      try {
+        if (buf == null) {
+          ByteArrayOutputStream out = 
+            new ByteArrayOutputStream();
+          base.writeTo(out);
+          buf = out.toByteArray();
+        }
+        return new ByteArrayInputStream(buf);
+      } catch (Throwable t) {
+        throw new RuntimeException(t);
+      }
+    }
+
+    public long getContentLength() {
+        return len;
+    }
+
+    public boolean isChunked() {
+      return len == -1;
+    }
+    
+    public Header getContentType() {
+        return ct;
+    }
+
+}

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaEntity.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaResponseHandler.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaResponseHandler.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaResponseHandler.java (added)
+++ abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaResponseHandler.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,88 @@
+/*
+ * 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.protocol.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.http.ResponseType;
+import org.apache.abdera2.common.io.Compression;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.parser.ParserOptions;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.entity.BufferedHttpEntity;
+import org.apache.http.util.EntityUtils;
+
+class AbderaResponseHandler 
+  implements ResponseHandler<Document<? extends Element>> {
+
+  private final Abdera abdera;
+  private final ParserOptions options;
+  
+  public AbderaResponseHandler() {
+    this(Abdera.getInstance());
+  }
+  
+  public AbderaResponseHandler(Abdera abdera) {
+    this(Abdera.getInstance(),null);
+  }
+  
+  public AbderaResponseHandler(ParserOptions options) {
+    this(Abdera.getInstance(),options);
+  }
+  
+  public AbderaResponseHandler(Abdera abdera, ParserOptions options) {
+    this.abdera = abdera;
+    this.options = null;
+  }
+  
+  public Document<? extends Element> handleResponse(HttpResponse response) throws ClientProtocolException,
+      IOException {
+    ResponseType type = ResponseType.select(response.getStatusLine().getStatusCode());
+    switch(type) {
+      case SUCCESSFUL:
+        return options == null ? 
+            abdera.getParser().parse(getInputStream(response)) :
+            abdera.getParser().parse(getInputStream(response), options);
+      default:
+        EntityUtils.consume(response.getEntity());
+        StatusLine status = response.getStatusLine();
+        throw new HttpResponseException(status.getStatusCode(),status.getReasonPhrase());
+    }
+    
+  }
+
+  private static InputStream getInputStream(HttpResponse response) throws IOException {
+    InputStream in = null;
+    Header he = response.getFirstHeader("Content-Encoding");
+    String ce = he != null ? he.getValue() : null;
+    BufferedHttpEntity buffer = 
+      new BufferedHttpEntity(response.getEntity());
+    in = buffer.getContent();
+    if (ce != null && in != null)
+        in = Compression.wrap(in, ce);
+    return in;
+  }
+}

Propchange: abdera/abdera2/client/src/main/java/org/apache/abdera2/protocol/client/AbderaResponseHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message