org.alfresco.repo.publishing
Class AbstractChannelType

java.lang.Object
  extended by org.alfresco.repo.publishing.AbstractChannelType
All Implemented Interfaces:
ChannelTypePublishingOperations, ChannelType
Direct Known Subclasses:
AbstractOAuth1ChannelType, FacebookChannelType, MockChannelType, SlideShareChannelType, TestChannelType1, TestChannelType2, TestChannelType3, YouTubeChannelType

public abstract class AbstractChannelType
extends java.lang.Object
implements ChannelType, ChannelTypePublishingOperations

Since:
4.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.service.cmr.publishing.channels.ChannelType
ChannelType.AuthStatus
 
Constructor Summary
AbstractChannelType()
           
 
Method Summary
 ChannelType.AuthStatus acceptAuthorisationCallback(Channel channel, java.util.Map callbackHeaders, java.util.Map callbackParams)
          This operation is called after the service provider represented by this channel type has redirected the user back to Alfresco.
 java.lang.String getAuthorisationUrl(Channel channel, java.lang.String callbackUrl)
          When creating a new channel of this type, this operation is called to find out where the user should be taken in order to authorise Alfresco to publish content / status updates to that channel.
protected  ChannelService getChannelService()
           
protected  MetadataEncryptor getEncryptor()
           
 org.springframework.core.io.Resource getIcon(java.lang.String sizeSuffix)
          Obtain the resource that represents an icon for this channel type.
 java.lang.String getIconFileExtension()
           
 int getMaximumStatusLength()
          If this channel type supports status updates then this operation returns the maximum permitted length of those status updates.
protected  org.alfresco.service.cmr.repository.NodeService getNodeService()
           
 java.lang.String getNodeUrl(org.alfresco.service.cmr.repository.NodeRef node)
          Returns the URL for a piece of content represented by the supplied node.
 java.util.Set getSupportedContentTypes()
          Returns the set of content types supported by channels of this type.
 java.util.Set getSupportedMimeTypes()
          Returns the set of MIME types supported by channels of this type.
protected  ChannelType.AuthStatus internalAcceptAuthorisation(Channel channel, java.util.Map callbackHeaders, java.util.Map callbackParams)
           
 void publish(org.alfresco.service.cmr.repository.NodeRef nodeToPublish, java.util.Map channelProperties)
           
 void sendStatusUpdate(Channel channel, java.lang.String status)
          Send the specified status update to the specified channel
 void setChannelService(ChannelService channelService)
           
 void setEncryptor(MetadataEncryptor encryptor)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void unpublish(org.alfresco.service.cmr.repository.NodeRef nodeToUnpublish, java.util.Map channelProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.service.cmr.publishing.channels.ChannelType
canPublish, canPublishStatusUpdates, canUnpublish, getChannelNodeType, getId
 

Constructor Detail

AbstractChannelType

public AbstractChannelType()
Method Detail

setChannelService

public void setChannelService(ChannelService channelService)

getChannelService

protected ChannelService getChannelService()

setEncryptor

public void setEncryptor(MetadataEncryptor encryptor)

getEncryptor

protected MetadataEncryptor getEncryptor()

getNodeService

protected org.alfresco.service.cmr.repository.NodeService getNodeService()

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)

getMaximumStatusLength

public int getMaximumStatusLength()
If this channel type supports status updates then this operation returns the maximum permitted length of those status updates.

Specified by:
getMaximumStatusLength in interface ChannelType
Returns:
The maximum length of status updates on channels of this type. A value of zero indicates that there is no maximum.

getAuthorisationUrl

public java.lang.String getAuthorisationUrl(Channel channel,
                                            java.lang.String callbackUrl)
Description copied from interface: ChannelType
When creating a new channel of this type, this operation is called to find out where the user should be taken in order to authorise Alfresco to publish content / status updates to that channel.

Specified by:
getAuthorisationUrl in interface ChannelType
Parameters:
channel - The channel that needs to be authorised.
callbackUrl - Where the service provider represented by this channel type should redirect the user to once the authorisation procedure is complete.
Returns:
The URL that the user should be taken to in order to authorise access to Alfresco for the specified channel.

acceptAuthorisationCallback

public final ChannelType.AuthStatus acceptAuthorisationCallback(Channel channel,
                                                                java.util.Map callbackHeaders,
                                                                java.util.Map callbackParams)
Description copied from interface: ChannelType
This operation is called after the service provider represented by this channel type has redirected the user back to Alfresco. The HTTP headers and parameters received from the service provider are included, as they are likely to contain essential information such as tokens, error codes, and so on.

Specified by:
acceptAuthorisationCallback in interface ChannelType
Parameters:
channel - The channel related to this authorisation callback.
callbackHeaders - All the HTTP headers received in the callback.
callbackParams - All the HTTP parameters received in the callback.
Returns:
A value indicating whether the authorisation was successful or not. If not, there is an indication as to whether the user may try again or not.

internalAcceptAuthorisation

protected ChannelType.AuthStatus internalAcceptAuthorisation(Channel channel,
                                                             java.util.Map callbackHeaders,
                                                             java.util.Map callbackParams)

getIcon

public org.springframework.core.io.Resource getIcon(java.lang.String sizeSuffix)
Description copied from interface: ChannelType
Obtain the resource that represents an icon for this channel type.

Specified by:
getIcon in interface ChannelType
Parameters:
sizeSuffix - A text representation of the icon size required. "16", "32", etc.
Returns:
The resource that represents the requested icon if available. null otherwise.

getIconFileExtension

public java.lang.String getIconFileExtension()

getSupportedContentTypes

public java.util.Set getSupportedContentTypes()
Description copied from interface: ChannelType
Returns the set of content types supported by channels of this type.

Specified by:
getSupportedContentTypes in interface ChannelType
Returns:
The set of content types supported by channels of this type or an empty set if content of any content type can be published.

getSupportedMimeTypes

public java.util.Set getSupportedMimeTypes()
Description copied from interface: ChannelType
Returns the set of MIME types supported by channels of this type.

Specified by:
getSupportedMimeTypes in interface ChannelType
Returns:
The set of MIME types supported by channels of this type or an empty set if content of any MIME type can be published.

sendStatusUpdate

public void sendStatusUpdate(Channel channel,
                             java.lang.String status)
Description copied from interface: ChannelType
Send the specified status update to the specified channel

Specified by:
sendStatusUpdate in interface ChannelType

publish

public void publish(org.alfresco.service.cmr.repository.NodeRef nodeToPublish,
                    java.util.Map channelProperties)
Specified by:
publish in interface ChannelTypePublishingOperations

unpublish

public void unpublish(org.alfresco.service.cmr.repository.NodeRef nodeToUnpublish,
                      java.util.Map channelProperties)
Specified by:
unpublish in interface ChannelTypePublishingOperations

getNodeUrl

public java.lang.String getNodeUrl(org.alfresco.service.cmr.repository.NodeRef node)
Description copied from interface: ChannelType
Returns the URL for a piece of content represented by the supplied node.

Specified by:
getNodeUrl in interface ChannelType
Parameters:
node - The published content node in the live environment.
Returns:
a URL for the published content.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.