Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

Introduction

By definition, the OpenSocial spec supports extensions to its data model.  In Apache Shindig, implementing data model extensions requires familiarity with Java and Shindig's back-end and requires continued maintenance as extensions evolve.  This article documents how to enable arbitrary extensions in Apache Shindig's data model, circumventing the need for explicitly hardcoding and maintaining extensions.

For example, the following is an Activity from the Activity Streams API with arbitrary extensions:

{
  id: "activity123",
  ...
  object: {
    ...
    replies: [{...}, {...}, {...}]    // This field isn't hardcoded in Shindig, but it will handle it
  },
  extensions: {
    dynamicExtension: "Another extension that was not predefined"
  }
}

How to Enable Arbitrary Extensions

Currently, Activity Streams support arbitrary extensions in Apache Shindig.  Additional data models may support arbitrary extensions with a very quick and simple change.  The data model's interface must extend ExtendableBean, and the interface's implementing class must extend ExtendableBeanImpl.

For example, the following shows how to enable Activity Streams to support arbitrary extensions.

ActivityEntry.java interface definitition:

@ImplementedBy(ActivityEntryImpl.class)
@Exportablebean
public interface ActivityEntry extends Comparable<ActivityEntry>, ExtendableBean { . . . }

ActivityEntryImpl.java class definition:

public class ActivityEntryImpl extends ExtendableBeanImpl implements ActivityEntry { . . . }
  • No labels