Re: Prevayler Example on Home Page does not Compile

Karl Wettin <[email protected]> Mon, 27 May 2013 16:14:04 +0200
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
I know, and I honestly haven't thought it through clearly yet. Perhaps the factory needs to be rewritten from scratch. 

All I know for a fact is that I always end up cloning PrevaylerFactory and remove almost everything in there in order to get one that has no dependencies except for the serialization I use (which more or less always is java.io.Serializable).

My gut tells me that the factory should accept a JournalSerializationStrategy, a SnapshotSerializationStrategy and produce a Prevaler, nothing else. Configuration should to be located in the serialization strategy and not in the factory, don't want the factory tainted with settings that makes no sense in some scopes. 

PersistencyStragegy persistencyStrategy = new FileSystemPersistence(new File("PrevalenceBase"));
JournalStrategy journalStrategy = new JavaIOSerializableJournalStrategy(persistencyStrategy);
SnapshotStrategy snapshotStrategy = new JavaIOSerializableSnapshotStrategy(persistencyStrategy);
Prevayler<Root> prevayler = new PrevaylerFactory<Root>(journalStrategy, snapshotStrategy).createInstance();

PersistencyStragegy persistencyStrategy = new TransientPersistencyStrategy();
JournalStrategy journalStrategy = new JavaIOSerializableJournalStrategy(persistencyStrategy);
SnapshotStrategy snapshotStrategy = new JavaIOSerializableSnapshotStrategy(persistencyStrategy);
Prevayler<Root> prevayler = new PrevaylerFactory<Root>(journalStrategy, snapshotStrategy).createInstance();

PersistencyStragegy persistencyStrategy = new FileSystemPersistence(new File("PrevalenceBase"));
XStreamJournalStrategy journalStrategy = new XStreamJournalStrategy(persistencyStrategy);
journalStrategy.setXMLNamespace("org:prevaler:Elements");
SnapshotStrategy snapshotStrategy = new JavaIOSerializableSnapshotStrategy(persistencyStrategy);
Prevayler<Root> prevayler = new PrevaylerFactory<Root>(journalStrategy, snapshotStrategy).createInstance();


27 maj 2013 kl. 15:30 skrev Klaus Wuestefeld:

> Hi Karl, the factory has many methods. Would we duplicate all of them
> per serialization strategy? Or would we use the abstract serializer
> approach?
> 
> 
> On Mon, May 27, 2013 at 4:53 AM, Karl Wettin <[email protected]> wrote:
>> 
>> 27 maj 2013 kl. 02:38 skrev Klaus Wuestefeld:
>> 
>>>> Personally I like all-in-one things (even with unnecessary stuff)
>>> 
>>> Yes. I think its easier for advanced users to remove the xstream
>>> dependency if they ant to than for noobs to include the factory
>>> dependency.
>> 
>> I'm more for one Factory per serialization strategy.
>> 
>> 
>>                karl
>> 
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
>> _______________________________________________
>> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
>> _______________________________________________
>> "Databases in Memoriam" -- http://www.prevayler.org
> 
> 
> 
> -- 
> Valeu, Klaus.
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
> _______________________________________________
> "Databases in Memoriam" -- http://www.prevayler.org


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org