Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » registering a time provider
registering a time provider [message #612910] Wed, 19 December 2007 19:45
Jean-Claude Cote is currently offline Jean-Claude CoteFriend
Messages: 56
Registered: July 2009
Member
Hi,

I'm working on an EMFT project called Temporality. This project focuses on
keeping a historical record of the state of modeled instances.

A central concept of this feature is the current date. I'd rather not hard
code access to the current time like this System.currentMilliseconds() but
rather hide access to the current time behind an interface and provide a way
to plug different time provider implementations.

That way I could have a testing time provider and a runtime etc.

What is the best way to plug this type of provider in EMF? The idea would be
to give developers a way to plug the implemenation of an interface. Can I
register such a class in an EPackage?

interface TemporalDate {
setNow(Date d);
Date now();
boolean areEqual(Date a, Date b, int granularity);
}

class RuntimeTemporalDate{
...
Date now(){
return new Date(System.currentMili);
}

}

class DebugTemporalDate{
Date now;
...
void setNow(Date d){
now = d;
}
}

Thanks
Jean-Claude
Previous Topic:[CDO] Performance problem
Next Topic:[CDO][0.8.0] TypeManager
Goto Forum:
  


Current Time: Sun Sep 20 05:55:47 GMT 2020

Powered by FUDForum. Page generated in 0.01488 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top