info.magnolia.module.exchangesimple
Class BaseSyndicatorImpl

java.lang.Object
  extended by info.magnolia.module.exchangesimple.BaseSyndicatorImpl
All Implemented Interfaces:
info.magnolia.cms.exchange.Syndicator
Direct Known Subclasses:
SimpleSyndicator

public abstract class BaseSyndicatorImpl
extends Object
implements info.magnolia.cms.exchange.Syndicator

Default implementation of Syndicator. Activates all the content to a subscriber configured on the server.

Author:
Sameer Charles $Id: $

Field Summary
static String ACTION
           
static String ACTIVATE
           
static String ACTIVATION_ATTRIBUTE_MESSAGE
           
static String ACTIVATION_ATTRIBUTE_STATUS
           
static String ACTIVATION_ATTRIBUTE_VERSION
           
static String ACTIVATION_AUTH
           
static String ACTIVATION_AUTH_KEY
           
static String ACTIVATION_FAILED
           
static String ACTIVATION_HANDSHAKE
           
static String ACTIVATION_SUCCESSFUL
           
static String COMMIT
           
static String CONTENT_FILTER_RULE
           
protected  info.magnolia.cms.util.Rule contentFilterRule
           
static String DEACTIVATE
           
static String DEFAULT_HANDLER
          URI used for activation.
static String MAPPED_PARENT_PATH
           
static String NODE_UUID
           
protected  String parent
           
static String PARENT_PATH
           
static String PATH
          Path to be activated or deactivated.
static String REPOSITORY_NAME
          Deprecated. since 4.5 - use logical workspace instead.
protected  String repositoryName
          Deprecated. since 4.5 - should no longer be needed when operating with logical workspace names
static String RESOURCE_MAPPING_FILE
          Name of the resource containing reading sequence for importing the data in activation target.
static String RESOURCE_MAPPING_FILE_ELEMENT
           
static String RESOURCE_MAPPING_ID_ATTRIBUTE
           
static String RESOURCE_MAPPING_MD_ATTRIBUTE
           
static String RESOURCE_MAPPING_NAME_ATTRIBUTE
           
static String RESOURCE_MAPPING_ROOT_ELEMENT
           
static String RESOURCE_MAPPING_UUID_ATTRIBUTE
           
static String ROLLBACK
           
static String SIBLING_UUID
           
static String SIBLINGS_ELEMENT
           
static String SIBLINGS_ROOT_ELEMENT
          Name of the element in the resource file describing siblings of activated node.
protected  info.magnolia.cms.security.User user
           
static String UTF8_STATUS
           
static String VERSION_NAME
           
static String WORKSPACE_NAME
           
protected  String workspaceName
           
 
Constructor Summary
BaseSyndicatorImpl()
           
 
Method Summary
protected static void acquireIgnoringInterruption(EDU.oswego.cs.dl.util.concurrent.Sync latch)
          Acquires a Sync ignoring any interruptions.
abstract  void activate(ActivationContent activationContent, String nodePath)
           
 void activate(String parent, info.magnolia.cms.core.Content content)
          This will activate specifies page (sub pages) to all configured subscribers.
 void activate(String parent, info.magnolia.cms.core.Content content, List<String> orderBefore)
          This will activate specified node to all configured subscribers.
 String activate(info.magnolia.cms.exchange.Subscriber subscriber, ActivationContent activationContent, String nodePath)
          Send request of activation of activationContent to the subscriber.
 void activate(info.magnolia.cms.exchange.Subscriber subscriber, String parent, info.magnolia.cms.core.Content content)
          This will activate specifies page (sub pages) to the specified subscriber.
 void activate(info.magnolia.cms.exchange.Subscriber subscriber, String parent, info.magnolia.cms.core.Content content, List<String> orderBefore)
          This will activate specifies node to the specified subscriber.
protected  void addActivationHeaders(URLConnection connection, ActivationContent activationContent, String handshakeKey)
          Adds headers fields describing activation request.
protected  void addDeactivationHeaders(URLConnection connection, String nodeUUID, String handshakeKey)
          Adds header fields describing deactivation request.
protected  void addHandshakeInfo(URLConnection connection, String handshakeKey)
           
protected  void cleanTemporaryStore(ActivationContent activationContent)
          Cleans up temporary file store after activation.
 void deactivate(info.magnolia.cms.core.Content node)
           
 void deactivate(String path)
           
 void deactivate(info.magnolia.cms.exchange.Subscriber subscriber, info.magnolia.cms.core.Content node)
           
abstract  void doDeactivate(String nodeUUID, String nodePath)
           
abstract  String doDeactivate(info.magnolia.cms.exchange.Subscriber subscriber, String nodeUUID, String nodePath)
          Deactivate content from specified subscriber.
protected static void executeInPool(Runnable job)
          Runs a given job in the thread pool.
protected  String getActivationURL(info.magnolia.cms.exchange.Subscriber subscriberInfo)
          Retrieves URL subscriber is listening on for (de)activation requests.
protected  String getDeactivationURL(info.magnolia.cms.exchange.Subscriber subscriberInfo)
          Return URI set for deactivation.
protected  String getMappedPath(String path, info.magnolia.cms.exchange.Subscription subscription)
          Gets target path to which the current path is mapped in given subscription.
 void init(info.magnolia.cms.security.User user, String repositoryName, String workspaceName, info.magnolia.cms.util.Rule rule)
           
protected  URLConnection prepareConnection(info.magnolia.cms.exchange.Subscriber subscriber, String urlString)
           
 void setResouceCollector(ResourceCollector resourceCollector)
           
protected  void updateActivationDetails(String path)
          Updates current content activation meta data with the time stamp and user details of the activation.
protected  void updateDeactivationDetails(String nodeUUID)
          Updates current content activation meta data with the timestamp and user details of the deactivation.
protected  void updateMetaData(info.magnolia.cms.core.Content node, String type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HANDLER

public static final String DEFAULT_HANDLER
URI used for activation.

See Also:
Constant Field Values

PARENT_PATH

public static final String PARENT_PATH
See Also:
Constant Field Values

MAPPED_PARENT_PATH

public static final String MAPPED_PARENT_PATH
See Also:
Constant Field Values

PATH

public static final String PATH
Path to be activated or deactivated.

See Also:
Constant Field Values

NODE_UUID

public static final String NODE_UUID
See Also:
Constant Field Values

REPOSITORY_NAME

@Deprecated
public static final String REPOSITORY_NAME
Deprecated. since 4.5 - use logical workspace instead.
See Also:
Constant Field Values

WORKSPACE_NAME

public static final String WORKSPACE_NAME
See Also:
Constant Field Values

VERSION_NAME

public static final String VERSION_NAME
See Also:
Constant Field Values

RESOURCE_MAPPING_FILE

public static final String RESOURCE_MAPPING_FILE
Name of the resource containing reading sequence for importing the data in activation target.

See Also:
Constant Field Values

UTF8_STATUS

public static final String UTF8_STATUS
See Also:
Constant Field Values

SIBLINGS_ROOT_ELEMENT

public static final String SIBLINGS_ROOT_ELEMENT
Name of the element in the resource file describing siblings of activated node. Siblings element will contain all siblings of the same node type which are "before" this node.

See Also:
Constant Field Values

SIBLINGS_ELEMENT

public static final String SIBLINGS_ELEMENT
See Also:
Constant Field Values

SIBLING_UUID

public static final String SIBLING_UUID
See Also:
Constant Field Values

RESOURCE_MAPPING_FILE_ELEMENT

public static final String RESOURCE_MAPPING_FILE_ELEMENT
See Also:
Constant Field Values

RESOURCE_MAPPING_NAME_ATTRIBUTE

public static final String RESOURCE_MAPPING_NAME_ATTRIBUTE
See Also:
Constant Field Values

RESOURCE_MAPPING_UUID_ATTRIBUTE

public static final String RESOURCE_MAPPING_UUID_ATTRIBUTE
See Also:
Constant Field Values

RESOURCE_MAPPING_ID_ATTRIBUTE

public static final String RESOURCE_MAPPING_ID_ATTRIBUTE
See Also:
Constant Field Values

RESOURCE_MAPPING_MD_ATTRIBUTE

public static final String RESOURCE_MAPPING_MD_ATTRIBUTE
See Also:
Constant Field Values

RESOURCE_MAPPING_ROOT_ELEMENT

public static final String RESOURCE_MAPPING_ROOT_ELEMENT
See Also:
Constant Field Values

ACTION

public static final String ACTION
See Also:
Constant Field Values

ACTIVATE

public static final String ACTIVATE
See Also:
Constant Field Values

DEACTIVATE

public static final String DEACTIVATE
See Also:
Constant Field Values

COMMIT

public static final String COMMIT
See Also:
Constant Field Values

ROLLBACK

public static final String ROLLBACK
See Also:
Constant Field Values

CONTENT_FILTER_RULE

public static final String CONTENT_FILTER_RULE
See Also:
Constant Field Values

ACTIVATION_SUCCESSFUL

public static final String ACTIVATION_SUCCESSFUL
See Also:
Constant Field Values

ACTIVATION_HANDSHAKE

public static final String ACTIVATION_HANDSHAKE
See Also:
Constant Field Values

ACTIVATION_FAILED

public static final String ACTIVATION_FAILED
See Also:
Constant Field Values

ACTIVATION_ATTRIBUTE_STATUS

public static final String ACTIVATION_ATTRIBUTE_STATUS
See Also:
Constant Field Values

ACTIVATION_ATTRIBUTE_MESSAGE

public static final String ACTIVATION_ATTRIBUTE_MESSAGE
See Also:
Constant Field Values

ACTIVATION_ATTRIBUTE_VERSION

public static final String ACTIVATION_ATTRIBUTE_VERSION
See Also:
Constant Field Values

ACTIVATION_AUTH

public static final String ACTIVATION_AUTH
See Also:
Constant Field Values

ACTIVATION_AUTH_KEY

public static final String ACTIVATION_AUTH_KEY
See Also:
Constant Field Values

repositoryName

@Deprecated
protected String repositoryName
Deprecated. since 4.5 - should no longer be needed when operating with logical workspace names

workspaceName

protected String workspaceName

parent

protected String parent

contentFilterRule

protected info.magnolia.cms.util.Rule contentFilterRule

user

protected info.magnolia.cms.security.User user
Constructor Detail

BaseSyndicatorImpl

public BaseSyndicatorImpl()
Method Detail

executeInPool

protected static void executeInPool(Runnable job)
                             throws info.magnolia.cms.exchange.ExchangeException
Runs a given job in the thread pool.

Parameters:
job - the job to run
Throws:
info.magnolia.cms.exchange.ExchangeException - if the job could not be put in the pool

acquireIgnoringInterruption

protected static void acquireIgnoringInterruption(EDU.oswego.cs.dl.util.concurrent.Sync latch)
Acquires a Sync ignoring any interruptions. Should any interruption occur the interruption status will be set. Might potentially block/wait forever.

Parameters:
latch - the latch on which to wait
See Also:
Sync.acquire()

init

public void init(info.magnolia.cms.security.User user,
                 String repositoryName,
                 String workspaceName,
                 info.magnolia.cms.util.Rule rule)
Specified by:
init in interface info.magnolia.cms.exchange.Syndicator
Parameters:
user -
repositoryName - repository ID
workspaceName - workspace ID
rule - content filter rule
See Also:
Syndicator.init(info.magnolia.cms.security.User, String, String, info.magnolia.cms.util.Rule)

activate

public void activate(String parent,
                     info.magnolia.cms.core.Content content)
              throws info.magnolia.cms.exchange.ExchangeException,
                     javax.jcr.RepositoryException
This will activate specifies page (sub pages) to all configured subscribers.

Specified by:
activate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
parent - parent under which this page will be activated
content - to be activated
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

activate

public void activate(String parent,
                     info.magnolia.cms.core.Content content,
                     List<String> orderBefore)
              throws info.magnolia.cms.exchange.ExchangeException,
                     javax.jcr.RepositoryException
This will activate specified node to all configured subscribers.

Specified by:
activate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
parent - parent under which this page will be activated
content - to be activated
orderBefore - List of UUID to be used by the implementation to order this node after activation
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

activate

public void activate(info.magnolia.cms.exchange.Subscriber subscriber,
                     String parent,
                     info.magnolia.cms.core.Content content)
              throws info.magnolia.cms.exchange.ExchangeException,
                     javax.jcr.RepositoryException
This will activate specifies page (sub pages) to the specified subscriber.

Specified by:
activate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
subscriber -
parent - parent under which this page will be activated
content - to be activated
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

activate

public void activate(info.magnolia.cms.exchange.Subscriber subscriber,
                     String parent,
                     info.magnolia.cms.core.Content content,
                     List<String> orderBefore)
              throws info.magnolia.cms.exchange.ExchangeException,
                     javax.jcr.RepositoryException
This will activate specifies node to the specified subscriber.

Specified by:
activate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
subscriber -
parent - parent under which this page will be activated
content - to be activated
orderBefore - List of UUID to be used by the subscriber to order this node after activation
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

activate

public abstract void activate(ActivationContent activationContent,
                              String nodePath)
                       throws info.magnolia.cms.exchange.ExchangeException
Throws:
info.magnolia.cms.exchange.ExchangeException

activate

public String activate(info.magnolia.cms.exchange.Subscriber subscriber,
                       ActivationContent activationContent,
                       String nodePath)
                throws info.magnolia.cms.exchange.ExchangeException
Send request of activation of activationContent to the subscriber. Subscriber might choose not to react if it is not subscribed to the URI under which activationContent exists.

Throws:
info.magnolia.cms.exchange.ExchangeException

cleanTemporaryStore

protected void cleanTemporaryStore(ActivationContent activationContent)
Cleans up temporary file store after activation.


deactivate

public void deactivate(String path)
                throws info.magnolia.cms.exchange.ExchangeException,
                       javax.jcr.RepositoryException
Throws:
info.magnolia.cms.exchange.ExchangeException
javax.jcr.RepositoryException

deactivate

public void deactivate(info.magnolia.cms.core.Content node)
                throws info.magnolia.cms.exchange.ExchangeException,
                       javax.jcr.RepositoryException
Specified by:
deactivate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
node - to deactivate
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

deactivate

public void deactivate(info.magnolia.cms.exchange.Subscriber subscriber,
                       info.magnolia.cms.core.Content node)
                throws info.magnolia.cms.exchange.ExchangeException,
                       javax.jcr.RepositoryException
Specified by:
deactivate in interface info.magnolia.cms.exchange.Syndicator
Parameters:
node - , to deactivate
subscriber -
Throws:
javax.jcr.RepositoryException
info.magnolia.cms.exchange.ExchangeException

doDeactivate

public abstract void doDeactivate(String nodeUUID,
                                  String nodePath)
                           throws info.magnolia.cms.exchange.ExchangeException
Throws:
info.magnolia.cms.exchange.ExchangeException

doDeactivate

public abstract String doDeactivate(info.magnolia.cms.exchange.Subscriber subscriber,
                                    String nodeUUID,
                                    String nodePath)
                             throws info.magnolia.cms.exchange.ExchangeException
Deactivate content from specified subscriber.

Parameters:
subscriber -
Throws:
info.magnolia.cms.exchange.ExchangeException

getDeactivationURL

protected String getDeactivationURL(info.magnolia.cms.exchange.Subscriber subscriberInfo)
Return URI set for deactivation.

Parameters:
subscriberInfo -

addDeactivationHeaders

protected void addDeactivationHeaders(URLConnection connection,
                                      String nodeUUID,
                                      String handshakeKey)
Adds header fields describing deactivation request.

Parameters:
connection -
handshakeKey - optional key to encrypt public key before sending it over

addHandshakeInfo

protected void addHandshakeInfo(URLConnection connection,
                                String handshakeKey)

getActivationURL

protected String getActivationURL(info.magnolia.cms.exchange.Subscriber subscriberInfo)
Retrieves URL subscriber is listening on for (de)activation requests.


addActivationHeaders

protected void addActivationHeaders(URLConnection connection,
                                    ActivationContent activationContent,
                                    String handshakeKey)
Adds headers fields describing activation request.

Parameters:
handshakeKey - Optional key previously received from subscriber, used to encrypt activation public key for delivery to said subscriber. Or null when such key is not known or present.

updateActivationDetails

protected void updateActivationDetails(String path)
                                throws javax.jcr.RepositoryException
Updates current content activation meta data with the time stamp and user details of the activation.

Throws:
javax.jcr.RepositoryException

updateDeactivationDetails

protected void updateDeactivationDetails(String nodeUUID)
                                  throws javax.jcr.RepositoryException
Updates current content activation meta data with the timestamp and user details of the deactivation.

Throws:
javax.jcr.RepositoryException

updateMetaData

protected void updateMetaData(info.magnolia.cms.core.Content node,
                              String type)
                       throws info.magnolia.cms.security.AccessDeniedException
Parameters:
node -
type - (activate / deactivate)
Throws:
info.magnolia.cms.security.AccessDeniedException

getMappedPath

protected String getMappedPath(String path,
                               info.magnolia.cms.exchange.Subscription subscription)
Gets target path to which the current path is mapped in given subscription. Provided path should be without trailing slash.


prepareConnection

protected URLConnection prepareConnection(info.magnolia.cms.exchange.Subscriber subscriber,
                                          String urlString)
                                   throws info.magnolia.cms.exchange.ExchangeException
Throws:
info.magnolia.cms.exchange.ExchangeException

setResouceCollector

@Inject
public void setResouceCollector(ResourceCollector resourceCollector)


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.