Package org.apache.abdera.model

Examples of org.apache.abdera.model.Service


    new UsernamePasswordCredentials(
      "username", "password"));
   
    // Get the service doc and locate the href of the collection
    Document<Service> service_doc = client.get(start).getDocument();
    Service service = service_doc.getRoot();
    Collection collection = service.getWorkspaces().get(0).getCollections().get(1);
    String uri = collection.getHref().toString();
     
    // Set the filename.  Note: the Title header was used by older drafts
    // of the Atom Publishing Protocol and should no longer be used.  The
    // current Roller APP implementation still currently requires it.
View Full Code Here


    // Perform introspection.  This is an optional step.  If you already
    // know the URI of the APP collection to POST to, you can skip it.
    Document<Service> introspection =
      client.get(
        args[0]).getDocument();
    Service service =
      introspection.getRoot();
    Collection collection =
      service.getCollection(
        args[1],
        args[2]);
    report("The Collection Element", collection.toString());
   
    // Create the entry to post to the collection
View Full Code Here

  private Document<Service> service_doc;
  private Document<Feed> feed_doc;
 
  private Document<Service> init_service_doc(Abdera abdera) {
    Factory factory = abdera.getFactory();
    Service service = factory.newService();
    Workspace workspace = service.addWorkspace("Simple");
    try {
      Collection collection = workspace.addCollection("Simple", "atom/feed");
      collection.setAccept("entry");
      collection.addCategories().setFixed(false);
    } catch (Exception e) {}
    return service.getDocument();
  }
View Full Code Here

        ClientResponse resp = client.get("http://localhost:9002/");
        assertNotNull(resp);
        assertEquals(ResponseType.SUCCESS, resp.getType());
        assertTrue(MimeTypeHelper.isMatch(resp.getContentType().toString(), Constants.APP_MEDIA_TYPE));
        Document<Service> doc = resp.getDocument();
        Service service = doc.getRoot();
        assertEquals(1, service.getWorkspaces().size());
        Workspace workspace = service.getWorkspace("Abdera");
        assertEquals(2, workspace.getCollections().size());
        Collection collection = workspace.getCollection("Filesystem Feed");
        assertNotNull(collection);
        assertTrue(collection.acceptsEntry());
        assertEquals("http://localhost:9002/fs", collection.getResolvedHref().toString());
View Full Code Here

            } else if (element instanceof Service) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
                if (!isSameAsParentBase(element))
                    jstream.writeField("xml:base", element.getResolvedBaseUri());
                Service service = (Service)element;
                writeList("workspaces", service.getWorkspaces(), jstream);
                writeExtensions((ExtensibleElement)element, jstream);
                jstream.endObject();
            } else if (element instanceof Source) {
                jstream.startObject();
                writeLanguageFields(element, jstream);
View Full Code Here

    private static AppTest INSTANCE = null;

    private static Document<Service> init_service_document(String base) {
        try {
            Service service = getFactory().newService();
            Workspace workspace = service.addWorkspace("Test");
            workspace.addCollection("Entries", base + "/collections/entries").setAcceptsEntry();
            workspace.addCollection("Other", base + "/collections/other").setAccept("text/plain");
            Document<Service> doc = service.getDocument();
            return doc;
        } catch (Exception e) {
        }
        return null;
    }
View Full Code Here

public class Features {

    public static void main(String... args) throws Exception {

        Abdera abdera = new Abdera();
        Service service = abdera.newService();
        Workspace workspace = service.addWorkspace("My workspace");
        Collection collection = workspace.addCollection("My collection", "foo");

        // Specify which features are supported by the collection
        org.apache.abdera.ext.features.Features features = FeaturesHelper.addFeaturesElement(collection);
        features.addFeature(FeaturesHelper.FEATURE_SUPPORTS_DRAFTS);
View Full Code Here

        assertEquals(now.getTime(), dateTime.getTime());
        dateTime = factory.newPublished();
        dateTime.setString(AtomDate.format(now));
        assertEquals(AtomDate.format(now), dateTime.getString());
        assertEquals(now, dateTime.getDate());
        Service service = factory.newService();
        assertNotNull(service);
        Source source = factory.newSource();
        assertNotNull(source);
        el = factory.newElement(Constants.NAME);
        assertNotNull(el);
View Full Code Here

            assertEquals(200, res.getStatus());
            assertEquals(ResponseType.SUCCESS, res.getType());
            assertTrue(MimeTypeHelper.isMatch(res.getContentType().toString(), Constants.APP_MEDIA_TYPE));

            Document<Service> doc = res.getDocument();
            Service service = doc.getRoot();
            assertEquals(1, service.getWorkspaces().size());

            Workspace workspace = service.getWorkspaces().get(0);
            assertEquals(1, workspace.getCollections().size());

            // Keep the loop in case we add other collections to the test.

            for (Collection collection : workspace.getCollections()) {
View Full Code Here

    }

    protected abstract WorkspaceManager getWorkspaceManager(RequestContext request);

    protected Service getServiceElement(RequestContext request) {
        Service service = abdera.newService();
        for (WorkspaceInfo wi : getWorkspaceManager(request).getWorkspaces(request)) {
            service.addWorkspace(wi.asWorkspaceElement(request));
        }
        return service;
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Service

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.