Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

nyeholt edited this page · 4 revisions

External Content

A module for connecting to external content sources from SilverStripe, and making items from those remote sources available to use within SilverStripe as though they were native SilverStripe content. Additionally, these external content items can then be imported and transformed into SilverStripe as complete SilverStripe managed objects.

(Please make sure you have also installed the filesystem-connector module when starting with this module!)

Requirements

  • SilverStripe >= 2.4.x

Configuration Options

  • CacheService::$store_type = 'CacheStoreImplementor'; - Tells the underlying cache mechanism to use a particular store type. By default, it uses a filesystem based store, however if you go hunting around at http://public.silverstripe.com.au/open/modules/couchdb/trunk/ you may find a completely unsupported and unreleased couchdb cachestore implementation
  • WebApiClient::$cache_length = 300; - The amount of time that the webapiclient will cache external requests for. Any connector using the WebApiClient will benefit from this caching. Each remote call is cached based on the following parameters
    • baseUrl - the base url being called (eg localhost:8080/alfresco) to ensure that method calls made to the same system types on different hosts don't clash
    • The name of the method being called
    • the arguments being passed to the call
    • Any global parameters being included in the call (eg authentication token)

Version Information

Check the SILVERSTRIPE_VERSION file to see which version of silverstripe the module is compatible with

External Content Connectors =

Aside from the default filesystem connector defined above, the following connectors have also been contributed

Features

  • Browse hierarchical external content source from the SilverStripe backend
  • Browse external content directly from a page within a SilverStripe website, presenting that content in SilverStripe themes.
  • Link to external content from normal SilverStripe WYSIWYG content blocks
  • Import content from an external source into native SilverStripe formats

Backend 'External Content Administration' Components

ExternalContentAdmin

The main backend container for various remote content providers.

ExternalContentSource

Abstraction of a connector that provides access to a remote data source. It should define a method such as 'getRepo' or 'getSource' which will return an object with an API for retrieving information from the external source.

ExternalContentItem

A wrapper around content sourced from a remote system. An external content item contains a 'remoteProperties' array and custom implementations of __get and __set that read and write properties into this array. It is up to the specific external content item implementations to provide mappings between the remote data item and this array (or an alternative if so desired). Typically, an ExternalContentItem should be passed its parent ExernalContentSource when created. It can then use the ExternalContentSource's 'getRepo' method for retrieving the object that actually implements the remote content source data retrieval API.


Migration Components

ExternalContentImporter

Implementations should provide a specific content importer class that is used for determining what transformations are supported for each remote content type.

ExternalContentTransformer

Implementations should define a mapping between an ExternalContentItem and a SilverStripe DataObject (page or file). It must return a TransformResult object that contains the newly created page (used for hierarchical import) and the list of child objects that should also be imported. The transformer is responsible for dictating which children should be imported due to some children being imported in the context of its parent, and not requiring a standalone representation in SilverStripe (for example). There may be other instances in which the child of a content item should not be imported.


SiteTree Components

ExternalContentPage

A page type that is connected to a remote content source, or a specific remote content item. In templates, the remote content source is available via the $ContentItem variable. From this, all remote metadata properties are available, as well as access to the remote children of the remote content object.

Additionally, there are properties such as $DownloadLink, which will return a URL that streams the external content directly to the browser.

The ExternalContentPage serves as an example page type for iterating external content items.

ExternalTreeDropdownField

A custom TreeDropdownField that is capable of handling the composite IDs that the external content sources provide from the remote system.

ExternalHtmlEditorField_Toolbar

A custom toolbar for the wysiwyg editor that allows for creating links to external content sources.


Supplementary Libraries

SeaMist

The beginnings of a generic CMIS interface library for PHP. Currently, only the following section of the CMIS api is implemented for Alfresco

  • getRepositoryInfo
  • getProperties
  • getChildren

A SeaMistRepository returns either SeaMistObjects, which map to a single 'entry' element in Atom, or a SeaMistObjectList which maps to a 'feed' element in an Atom feed (a list of 'entry' elements). Further work may be done to support SOAP based creation of SeaMistObjects and abstracting the existing class definitions to interfaces with impls such as

  class AtomSeaMistObject implements SeaMistObject

instead.

There is an implementation of the Alfresco CMIS API that makes use of the webscript base APIs for retrieving the relevant content, via the WebApiClient

WebApiClient

The WebApiClient provides URL based RPC where the response is mapped back to some form of relevant data. The WebApiClient requires a list of defined methods in the form

    $methods = array (
        'methodName' => array(
            'url' => '/path/at/remote/url',
            'params' => array('param', 'names'),
            'return' => 'xml',
            'cache' => 60,
        )
    );

See the WebApiClient class for a list of supported information for a method.

To call a remote method

    $api = new WebApiClient($remoteUrlBase, $methodDefinitions)
    $api->callMethod('methodName', array('param1' => 'value', 'param2' => 'value2'));

The return of a method call is determined by the 'return' parameter defined in the method definition. This is mapped to a 'ReturnHandler' implementation that takes the raw response from the method call and attemps to transform it into a certain kind of object. For example, the XmlReturnHandler converts responses into a SimpleXML object, whereas the JsonReturnHandler converts a raw response via the json_decode method to a raw stdClass object.

Something went wrong with that request. Please try again.