de.deepamehta.plugins.time
Class TimePlugin

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.osgi.PluginActivator
      extended by de.deepamehta.plugins.time.TimePlugin
All Implemented Interfaces:
PluginContext, PostCreateAssociationListener, PostCreateTopicListener, PostUpdateAssociationListener, PostUpdateTopicListener, PostUpdateTopicRequestListener, PreSendAssociationListener, PreSendTopicListener, ServiceResponseFilterListener, EventListener, PluginService, TimeService, BundleActivator

public class TimePlugin
extends PluginActivator
implements TimeService, PostCreateTopicListener, PostCreateAssociationListener, PostUpdateTopicListener, PostUpdateTopicRequestListener, PostUpdateAssociationListener, PreSendTopicListener, PreSendAssociationListener, ServiceResponseFilterListener


Field Summary
private static String HEADER_LAST_MODIFIED
           
private  Logger logger
           
private static String PROP_URI_CREATED
           
private static String PROP_URI_MODIFIED
           
private  DateFormat rfc2822
           
 
Fields inherited from class de.deepamehta.core.osgi.PluginActivator
bundle, dms
 
Constructor Summary
TimePlugin()
           
 
Method Summary
private  long enrichWithTimestamp(DeepaMehtaObject object)
           
 Collection<Association> getAssociationsByCreationTime(long from, long to)
           
 Collection<Association> getAssociationsByModificationTime(long from, long to)
           
 long getCreationTime(DeepaMehtaObject object)
           
 long getModificationTime(DeepaMehtaObject object)
           
private  Set<DeepaMehtaObject> getParents(Topic topic)
          Returns all parent topics/associations of the given topic (recursively).
 Collection<Topic> getTopicsByCreationTime(long from, long to)
           
 Collection<Topic> getTopicsByModificationTime(long from, long to)
           
 void init()
           
 void postCreateAssociation(Association assoc)
           
 void postCreateTopic(Topic topic)
           
 void postUpdateAssociation(Association assoc, AssociationModel oldModel)
           
 void postUpdateTopic(Topic topic, TopicModel newModel, TopicModel oldModel)
           
 void postUpdateTopicRequest(Topic topic)
           
 void preSendAssociation(Association assoc)
           
 void preSendTopic(Topic topic)
           
private  DeepaMehtaObject responseObject(com.sun.jersey.spi.container.ContainerResponse response)
           
 void serviceResponseFilter(com.sun.jersey.spi.container.ContainerResponse response)
           
private  void setHeader(com.sun.jersey.spi.container.ContainerResponse response, String header, String value)
           
private  void setLastModifiedHeader(com.sun.jersey.spi.container.ContainerResponse response, long time)
           
private  void storeCreationTime(DeepaMehtaObject object, long time)
           
private  void storeModificationTime(DeepaMehtaObject object, long time)
           
private  void storeParentsTimestamp(Topic topic)
           
private  void storeTime(DeepaMehtaObject object, String propUri, long time)
           
private  void storeTimestamp(DeepaMehtaObject object)
           
private  void storeTimestamps(DeepaMehtaObject object)
           
 
Methods inherited from class de.deepamehta.core.osgi.PluginActivator
getBundleContext, getPluginName, getStaticResource, getUri, postInstall, publishDirectory, serviceArrived, serviceGone, setCoreService, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_URI_CREATED

private static String PROP_URI_CREATED

PROP_URI_MODIFIED

private static String PROP_URI_MODIFIED

HEADER_LAST_MODIFIED

private static String HEADER_LAST_MODIFIED

rfc2822

private DateFormat rfc2822

logger

private Logger logger
Constructor Detail

TimePlugin

public TimePlugin()
Method Detail

getCreationTime

public long getCreationTime(DeepaMehtaObject object)
Specified by:
getCreationTime in interface TimeService

getModificationTime

public long getModificationTime(DeepaMehtaObject object)
Specified by:
getModificationTime in interface TimeService

getTopicsByCreationTime

public Collection<Topic> getTopicsByCreationTime(long from,
                                                 long to)
Specified by:
getTopicsByCreationTime in interface TimeService

getTopicsByModificationTime

public Collection<Topic> getTopicsByModificationTime(long from,
                                                     long to)
Specified by:
getTopicsByModificationTime in interface TimeService

getAssociationsByCreationTime

public Collection<Association> getAssociationsByCreationTime(long from,
                                                             long to)
Specified by:
getAssociationsByCreationTime in interface TimeService

getAssociationsByModificationTime

public Collection<Association> getAssociationsByModificationTime(long from,
                                                                 long to)
Specified by:
getAssociationsByModificationTime in interface TimeService

init

public void init()
Specified by:
init in interface PluginContext
Overrides:
init in class PluginActivator

postCreateTopic

public void postCreateTopic(Topic topic)
Specified by:
postCreateTopic in interface PostCreateTopicListener

postCreateAssociation

public void postCreateAssociation(Association assoc)
Specified by:
postCreateAssociation in interface PostCreateAssociationListener

postUpdateTopic

public void postUpdateTopic(Topic topic,
                            TopicModel newModel,
                            TopicModel oldModel)
Specified by:
postUpdateTopic in interface PostUpdateTopicListener

postUpdateAssociation

public void postUpdateAssociation(Association assoc,
                                  AssociationModel oldModel)
Specified by:
postUpdateAssociation in interface PostUpdateAssociationListener

postUpdateTopicRequest

public void postUpdateTopicRequest(Topic topic)
Specified by:
postUpdateTopicRequest in interface PostUpdateTopicRequestListener

preSendTopic

public void preSendTopic(Topic topic)
Specified by:
preSendTopic in interface PreSendTopicListener

preSendAssociation

public void preSendAssociation(Association assoc)
Specified by:
preSendAssociation in interface PreSendAssociationListener

serviceResponseFilter

public void serviceResponseFilter(com.sun.jersey.spi.container.ContainerResponse response)
Specified by:
serviceResponseFilter in interface ServiceResponseFilterListener

storeTimestamps

private void storeTimestamps(DeepaMehtaObject object)

storeTimestamp

private void storeTimestamp(DeepaMehtaObject object)

storeParentsTimestamp

private void storeParentsTimestamp(Topic topic)

storeCreationTime

private void storeCreationTime(DeepaMehtaObject object,
                               long time)

storeModificationTime

private void storeModificationTime(DeepaMehtaObject object,
                                   long time)

storeTime

private void storeTime(DeepaMehtaObject object,
                       String propUri,
                       long time)

responseObject

private DeepaMehtaObject responseObject(com.sun.jersey.spi.container.ContainerResponse response)

enrichWithTimestamp

private long enrichWithTimestamp(DeepaMehtaObject object)

setLastModifiedHeader

private void setLastModifiedHeader(com.sun.jersey.spi.container.ContainerResponse response,
                                   long time)

setHeader

private void setHeader(com.sun.jersey.spi.container.ContainerResponse response,
                       String header,
                       String value)

getParents

private Set<DeepaMehtaObject> getParents(Topic topic)
Returns all parent topics/associations of the given topic (recursively). Traversal is informed by the "parent" and "child" role types. Traversal stops when no parent exists or when an association is met.



Copyright © 2014. All Rights Reserved.