Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# mgaerber 2/24/2006 12:20 AM (edited 2/24/2006 12:23 AM)
Sorry for reposting this but I think it is better suited for "architecture":

While working on some ideas and looking at the JSR stuff for CMS repositories, I got to the point where I am thinking about NOT differing between "ContentItem" and "FileItem", in the first place.

If I search a site, or filter by categories, I want everything included.

So, if everything is based on ContentItem, how do I offer specialized services for certain types of content?

What I think about is, adding a set of further specialized base classes (derived from ContentItem) and corresponding handlers to the core.

The question is, where does it make sense to differ?
I would opt for something like this:

- Image
- Binary
- Text
- Mixed (something like word documents etc.)
- etc.

A question, where I am not sure about how the best solution would look like is:

When (in a module) I am going to use these classes but combining them (e.g. a class "Product" having "Images"), both objects could be added to categories but essentially a product image should inherit these settings from the parent product. Or shouldn't it?

Should a parent ContentItem be responsible for its children?
Should the settings on a parent influence its children's settings?

This becomes particulary interesting when adding versioning. Do child versions inherit parents versions?
If a child version changes, the parent version should actually change, if, for example we are speaking about a product as a whole, since we changed a part (Image) of it.

Any ideas?
# big_al 2/25/2006 11:38 PM
Hi mgaerber

how about a type of 'TypeHandler' interface, so the content item also inherits from a class that inherits from TypeHandler which exposes all the functionality of a particular type.

This way we abstract the handling of a particular type (image, text etc) to another class, while still having all ContentItems defined as such, it will also allow for a type to have other contentItems and TypeHandlers with varying implementations of how a type and it's sub types behave.

Hope these ramblings make sense :p

Al
# martijnb 2/26/2006 5:09 AM
Guys, keep the ideas coming!

I feel a little guilty in not participating that much in these discussions, but don't let that discourage you :).
# mgaerber 2/26/2006 10:05 AM
big_alhow about a type of 'TypeHandler' interface, so the content item also inherits from a class that inherits from TypeHandler which exposes all the functionality of a particular type.

I think we are going both in the same direction, maybe you can give an example?

Or write some more here:
http://wiki.cuyahoga-project.org/wiki/index.php/Content_abstraction

So wether you offer specialized services or integrate different "TypeHandlers" to a ContentItem,
I really think one base class is the way to go. Adding different TypeHandlers would even more simplify things, because you have all methods at your hand, the moment you've got an instance of a "specialized" ContentItem.

I've seen other applications do something similar (DocuPortal.NET, for example) but they only offer "flat" objects, so this makes it quite trivial to handle them.

The biggest obstacle I see, is how to handle object graphs, because every non-trivial module will have ContentItems which themselves contain collections of other ContentItems and so on.

Looking at versioning and categorization, a set of rules would have to be defined, how these graphs are to be handled as "a whole".


# tabryant 2/26/2006 10:09 PM
big_alHi mgaerber

how about a type of 'TypeHandler' interface, so the content item also inherits from a class that inherits from TypeHandler which exposes all the functionality of a particular type.


Here is how we might proceed.

I think we should pick something pretty simple just so we can figure out how to work together. So far Martijn has done most of the work, and we need to figure out how we are going to move forward from here.

I think we should add content approval as quickly as possible, perhaps at the expense of some of the other 1.1 "candidate" features. We need to keep people interested.

I think we Use Castle/Windsor for IOC and registration of Core services. As we identify core services, we define a standard set of interfaces for each one. We implement each of these services using the provider model, allowing substitution at will by simply changing an XML file.

I think it is important to leverage or at least acknowledge the work that MS has already done in certain areas. They have done a pretty good job defining users, roles, and role membership in .NET 2.0. We could mimic a lot of these interfaces to maintain our Mono compatibility while still being able to leverage their work moving forward.

If you are intent on creating a generic content handling system, you might want to take apart the "SQL Reporting Services" API. It does exactly what mgaerber describes, and is a pretty good example of content handling, although I'm not sure that we need that level of abstraction at this point.

# mgaerber 2/27/2006 12:02 AM
tabyrantHere is how we might proceed.
...

I fully comply to your suggestions.

At this point though, we should really honour martijn's efforts in providing tools (*wiki*) for the community by actually using them and bringing together what we've got so far.

There are still things that need to be agreed on "officially", for example, that we use Castle IoC, how the content abstraction has to be implemented and which services we implement in what order.

From there we could then decide for a roadmap.

@Martijn: How do you want to handle this? Since you're the captain of the team, the last word surely is yours ;-)
# mgaerber 2/27/2006 1:00 AM (edited 2/27/2006 1:45 AM)
One addition to big_al's and tabyrant's remarks:

I've found a really good description of how to handle the provider pattern for ASP.NET 2.0:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNETProvMod_Prt8.asp

For now, we can mimic some of the aspects and will be well prepared for transition to ASP.NET 2.0

For the idea of a TypeHandler:

Since we will have an IoC container, I think a good way of solving this would be:

1. Define Providers (e.g ImageProvider)
2. Implement provider
3. Create a service that uses the provider
4. Have base classes that auto load the services via dependency injection
5. The classes could even use the service internally to
perform common tasks.

This could lead to something like this (in a module):

e.g. for uploading:
ImageItem img = new ImageItem();

//load image, assign section, fill properties etc.
img.LoadFromPath("...");

//fill additional properties
img.Description = "this is foo";

img.Save();

Internally the Save and LoadImageFromPath call the Service routines.
public class ImageItem : ContentItem
{
    private IImageService service;
    private Section section;

    //auto wired by IoC, base constructor tries to get the current section etc.
     public ImageItem(IImageService service): base() {

           this.service = service;
     }

     public void Save(){

           this.service.Save(this);
     }

}


Or, if we don't want to wrap all the Service routines in the base classes, we could as well attach the Service as a static member:
ImageItem img =  ImageItem.Service.LoadFromPath("...");

img.Description = "this is foo";

ImageItem.Service.Save(img);

This would make 3 lines of code to stuff an image into a gallery module ;-)






# tabryant 2/27/2006 8:51 AM
mgaerber
tabyrantHere is how we might proceed.
...


@Martijn: How do you want to handle this? Since you're the captain of the team, the last word surely is yours ;-)

Your proposal sounds good to me. Where to start?
# big_al 2/27/2006 12:19 PM
Way to take the ideas bounced around, your implementation sounds great, I espcially like your idea od using the IoC along with it. :)
# martijnb 2/27/2006 3:33 PM
Very interesting stuff.

I see however one issue and that is that an IoC container is perfectly capable of glueing services together, but I'm afraid there are some issues with registering every domain object (ContentItem and ImageItem are domain objects, not services) in the container.

Potentially you'll end up with lots and lots of objects in the container and I think that might be beyond the capabilities of the current containers.

Somewhere I read that only the next version of Spring (java) will have better facilities for IoC related to domain objects and that it is not encouraged to to this right now.

Of course I might be wrong with this. I'm not an expert in this area, but my intuition says it's not a good idea.
# martijnb 2/27/2006 3:49 PM
tabryantHere is how we might proceed.

I think we should pick something pretty simple just so we can figure out how to work together. So far Martijn has done most of the work, and we need to figure out how we are going to move forward from here.

Agreed, but first we need to have the core infrastructure in place. It will serve as a foundation for new features. At the moment I'm still a little bit struggling with the dynamic aspect the modules. Loading and registering these in the container is quite easy, but it also involves rebuilding the NHibernate configuration and that's not too easy.
I think we should add content approval as quickly as possible, perhaps at the expense of some of the other 1.1 "candidate" features. We need to keep people interested.

Content abstraction needs to be done before content approval is possible at all. Otherwise approval logic is going to require dependencies all over the place.
I think it is important to leverage or at least acknowledge the work that MS has already done in certain areas. They have done a pretty good job defining users, roles, and role membership in .NET 2.0. We could mimic a lot of these interfaces to maintain our Mono compatibility while still being able to leverage their work moving forward.

One thing to keep in mind here is that I also want to keep a reasonable upgrade path for current Cuyahoga users. That means that the current User - Role and permissions system will more or less stay the same. We could then wrap the membership API in one of the services. Or is this a bad idea?
# martijnb 2/27/2006 4:04 PM
mgaerberThere are still things that need to be agreed on "officially", for example, that we use Castle IoC, how the content abstraction has to be implemented and which services we implement in what order.

From there we could then decide for a roadmap.

@Martijn: How do you want to handle this? Since you're the captain of the team, the last word surely is yours ;-)

Yeahyeahyeah, last word :). I'm having a tough time evaluating all options here. You guys really have too many ideas ;)

But seriously, this is how we're going to do it:
- take the Castle container (done :))
- I'll create the low level infrastructure
- You guys continue with the content abstraction ideas (see my remarks in some post before)
- When the low level infrastructure is in place, we can split up and concentrate on separate area's.

I feel a little ashamed that I'll keep you guys on hold, but time is limited for me right now. I try to have a life besides work and Cuyahoga and sometimes other things have higher priorities (like performing two band gigs in one week :D).
# tabryant 2/27/2006 9:52 PM
martijnbI feel a little ashamed that I'll keep you guys on hold, but time is limited for me right now. I try to have a life besides work and Cuyahoga and sometimes other things have higher priorities (like performing two band gigs in one week :D).

I am jealous. I wish that I could just ATTEND two band gigs in a week. I'm probably going to be spotty over the next couple of weeks anyway. I will try to stay plugged in as much as I can.

Todd
# mgaerber 2/27/2006 11:23 PM (edited 2/27/2006 11:46 PM)
martijnb I'm afraid there are some issues with registering every domain object
That's true but we can still allow access to the services from the "specialized" base classes.
I like the approach of having a static Service reference like shown in one of my above posts. It would be still loose coupled if you have something like:
public static IImageService Service{

 return  container[ typeof(IImageService) ] as IImageService;

}
martijnbOne thing to keep in mind here is that I also want to keep a reasonable upgrade path for current Cuyahoga users. That means that the current User - Role and permissions system will more or less stay the same. We could then wrap the membership API in one of the services. Or is this a bad idea?

No, this the best we can do. As well this is the beauty of the provider approach, we can let the Cuyahoga UserService be based on the ASP.NET 2.0 like MembershipProvider and don't have to change all code that relies on the existing UserService!



For the content approval (workflow in general), I think a reasonable approach would be to let modules implement specific interfaces like "IPublishFlow" or similar which lets them expose events such as ContentAdded, ContentChanged, ContentPublished etc. so the Core Engine can forward these to a (dummy) workflow engine.

I will add some more ideas to a recent post and repost it in this forum.