Adding New Calendar Types

The bare minimum

To create a new calendar type, a calendar adapter must be registered. Create an implementation of CalendarAdapter.java, then add it to the list of registered adapters in the spring configuration file. A bean should be defined with an id equal to the full name of the adapter class.

For example:

<bean id="edu.yale.its.tp.portlets.calendar.ICalFeed" class="edu.yale.its.tp.portlets.calendar.ICalFeed">
	<property name="cache" ref="calendarCache"/>
</bean>

Defining adapters as spring beans means you have the opportunity to declaratively configure your adapter if you wish. The CasifiedICalFeed adapter includes some additional configuration information:

	
<bean id="casService" class="edu.yale.its.tp.cas.portlet.ProxyTicketService">
	<property name="casValidateUrl" value="${cas.validateUrl}"/>
	<property name="serviceUrl" value="${cas.serviceUrl}"/>
	<property name="urlOfProxyCallbackServlet" value="${cas.proxyCallbackUrl}"/>
</bean>

<bean id="edu.yale.its.tp.portlets.calendar.CasifiedICalFeed" class="edu.yale.its.tp.portlets.calendar.CasifiedICalFeed">
	<property name="proxyTicketService" ref="casService"/>
	<property name="cache" ref="calendarCache"/>
</bean>

You can also define service beans, database objects, proxy the class with a cache, etc.

Currently the CalendarPortlet only provides an interface for users to add ICalFeed calendars. If you'd like, you can add other adapaters as predefined calendars.

Optional steps

Caching

The CalendarPortlet uses ehcache. If you'd like your calendars to be cached, you can use ehcache programmatically, or configure it in the spring configuration.

User editing

If you'd like your new adapter to be user-editable, create an edit page, then register it in the editCalendarController bean:

<bean id="editCalendarController"
    class="edu.yale.its.tp.portlets.calendar.mvc.controller.EditCalendarPreferencesController">
    <property name="predefinedEditActions">
        <map>
            <entry key="edu.yale.its.tp.portlets.calendar.yaleopa.YaleEventCalendarAdapter" value="editYaleEventsCalendar"/>
        </map>
    </property>
    <property name="calendarStore" ref="calendarStore"/>
</bean>

<!-- add or edit a user-defined calendar -->
<bean id="editYaleEventsCalendarController"
    class="edu.yale.its.tp.portlets.calendar.yaleopa.EditYaleEventsCalendarController">
    <property name="formView">
        <value>editYaleEventsCalendar</value>
    </property>
    <property name="sessionForm">
        <value>false</value>
    </property>
    <property name="categories">
        <list>
            <value>Music</value>
            <value>Theater</value>
            <value>Talks</value>
            <value>Films</value>
            <value>Conferences/Symposia</value>
            <value>Biomedical Sciences</value>
            <value>Sports</value>
            <value>Tours</value>
            <value>Exhibitions</value>
            <value>Meetings</value>
            <value>Language Tables</value>
            <value>Religion</value>
            <value>Training</value>
            <value>And...</value>
        </list>
    </property>
    <property name="calendarStore" ref="calendarStore"/>
</bean>