Old Initializer entfernt.

git-svn-id: https://svn.libreccm.org/ccm/trunk@721 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-01-30 23:28:07 +00:00
parent dfc9636031
commit ac7b44156c
8 changed files with 142 additions and 32 deletions

View File

@ -4,7 +4,7 @@ application context: [webapps]/ccm-ldn-rss.
Now it is installed inside the main APLAWS application context along Now it is installed inside the main APLAWS application context along
with all other applications. with all other applications.
If shortcuts should be installed as its own web context again following If rss should be installed as its own web context again following
modifications are necessary: modifications are necessary:
1. remove webapp="xxx" from application.xml 1. remove webapp="xxx" from application.xml
2. move the files in this dir to WEB-INF/ 2. move the files in this dir to WEB-INF/
@ -15,7 +15,7 @@ modifications are necessary:
Running it in its own webapplication context nevertheless is not suggestive. Running it in its own webapplication context nevertheless is not suggestive.
It needs several xsl files of the main application (esp. core) for basic It needs several xsl files of the main application (esp. core) for basic
operations, which hac been directly mapped from the main applications directory operations, which had been directly mapped from the main applications directory
tree into its own directory tree. So no module separation is possible, no tree into its own directory tree. So no module separation is possible, no
security context useable etc. security context useable etc.

View File

@ -10,11 +10,11 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.Session; import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
/** /**
* Domain object for an RSS channel. * Domain object for an RSS channel.
* @author Simon Buckle (sbuckle@arsdigita.com) * @author Simon Buckle (sbuckle@arsdigita.com)
*/ */
public class Feed extends ACSObject { public class Feed extends ACSObject {
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE

View File

@ -79,7 +79,7 @@ public class Initializer extends CompoundInitializer {
("ccm-ldn-rss.pdl.mf", ("ccm-ldn-rss.pdl.mf",
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
add(new LegacyInitializer("com/arsdigita/london/rss/enterprise.init")); // add(new LegacyInitializer("com/arsdigita/london/rss/enterprise.init"));
} }
/** /**

View File

@ -18,12 +18,21 @@
package com.arsdigita.london.rss; package com.arsdigita.london.rss;
import com.arsdigita.categorization.CategoryPurpose;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader; import com.arsdigita.loader.PackageLoader;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.PortletType; import com.arsdigita.portal.PortletType;
import com.arsdigita.runtime.ScriptContext; import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet; import com.arsdigita.london.rss.portlet.WorkspaceDirectoryPortlet;
import com.arsdigita.web.Application;
import com.arsdigita.web.ApplicationSetup;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.URL;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -43,11 +52,84 @@ public class Loader extends PackageLoader {
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
// CatgegoryPurpose is deprecated and replaced by terms in
// some way. So this step may be ommitted.
String catKey = RSS.getConfig().getCategoryKey();
s_log.info("Setting RSS Category Key to " + catKey + ".");
if (!CategoryPurpose.purposeExists(catKey)) {
(new CategoryPurpose(catKey, "RSS Feed")).save();
}
// load application type for admin application into database
// (i.e. create application type)
setupChannelControlCenter();
// Load local fveeds into database
setupLocalFeeds();
// load portlet type into database
loadWorkspaceDirectoryPortlet(); loadWorkspaceDirectoryPortlet();
} }
}.run(); }.run();
} }
/**
* Creates the application type for the admin application as an
* (old style) compatible applicaiton.
*/
public void setupChannelControlCenter() {
ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(RSS.BASE_DATA_OBJECT_TYPE);
setup.setKey("rss");
setup.setTitle("RSS Channels");
setup.setDescription("RSS Channels");
setup.setSingleton(true);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new RSS(dataObject);
}
});
ApplicationType type = setup.run();
type.save();
if (!Application.isInstalled(RSS.BASE_DATA_OBJECT_TYPE,
"/channels/")) {
Application app =
Application.createApplication(type,
"channels",
"RSS",
null);
app.save();
}
}
public void setupLocalFeeds() {
URL external = URL.there("/channels/rss/external.rss", null);
try {
Feed feed = Feed.retrieve(external.getURL());
} catch (DataObjectNotFoundException ex) {
Feed feed = Feed.create(external.getURL(),
"External feeds",
"External rss content feeds",
true);
feed.save();
}
URL index = URL.there("/channels/rss/index.rss", null);
try {
Feed feed = Feed.retrieve(index.getURL());
} catch (DataObjectNotFoundException ex) {
Feed feed = Feed.create(index.getURL(),
"Local content feeds",
"Local CMS content feeds",
true);
feed.save();
}
}
private void loadWorkspaceDirectoryPortlet() { private void loadWorkspaceDirectoryPortlet() {
PortletType type = PortletType.createPortletType("Workspace Directory", PortletType type = PortletType.createPortletType("Workspace Directory",
PortletType.WIDE_PROFILE, PortletType.WIDE_PROFILE,

View File

@ -27,26 +27,24 @@ import org.apache.log4j.Logger;
/** /**
* The file that contains all configuration information for * The file that contains all configuration information for
* the RSS application * the RSS application.
* @version $Id: RSSConfig.java 1319 2006-09-15 10:52:49Z apevec $
*/ */
public final class RSSConfig extends AbstractConfig { public final class RSSConfig extends AbstractConfig {
public static final String versionId =
"$Id: RSSConfig.java 1319 2006-09-15 10:52:49Z apevec $" +
"$Author: apevec $" +
"$DateTime: 2003/11/27 11:55:32 $";
private static final Logger s_log = Logger.getLogger(RSSConfig.class); private static final Logger s_log = Logger.getLogger(RSSConfig.class);
private final Parameter m_categoryKey; /** */
private final Parameter m_processingInstruction_xslt; private final Parameter m_categoryKey= new RSSCategoryKeyParameter
("com.arsdigita.london.rss.categoryKey", Parameter.REQUIRED, "RSS");
/** */
private final Parameter m_processingInstruction_xslt= new StringParameter
("com.arsdigita.london.rss.processingInstruction_xslt",
Parameter.OPTIONAL, null);
public RSSConfig() { public RSSConfig() {
m_categoryKey = new RSSCategoryKeyParameter
("com.arsdigita.london.rss.categoryKey", Parameter.REQUIRED, "RSS");
register(m_categoryKey);
m_processingInstruction_xslt = new StringParameter register(m_categoryKey);
("com.arsdigita.london.rss.processingInstruction_xslt", Parameter.OPTIONAL, null);
register(m_processingInstruction_xslt); register(m_processingInstruction_xslt);
loadInfo(); loadInfo();

View File

@ -35,11 +35,27 @@ import org.jdom.output.XMLOutputter;
public abstract class RSSDispatcher implements Dispatcher { public abstract class RSSDispatcher implements Dispatcher {
/**
*
* @param request
* @param response
* @param actx
* @return
* @throws ServletException
*/
public abstract RSSChannel getChannel(HttpServletRequest request, public abstract RSSChannel getChannel(HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
RequestContext actx) RequestContext actx)
throws ServletException; throws ServletException;
/**
*
* @param request
* @param response
* @param actx
* @throws IOException
* @throws ServletException
*/
public void dispatch(HttpServletRequest request, public void dispatch(HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
RequestContext actx) RequestContext actx)

View File

@ -30,10 +30,22 @@ public class SimpleRSSDispatcher extends RSSDispatcher {
private RSSChannel m_channel; private RSSChannel m_channel;
/**
* Constructor.
* @param channel
*/
public SimpleRSSDispatcher(RSSChannel channel) { public SimpleRSSDispatcher(RSSChannel channel) {
m_channel = channel; m_channel = channel;
} }
/**
* Implementation auf abstract method in parent class
* @param request
* @param response
* @param actx
* @return
* @throws ServletException
*/
public RSSChannel getChannel(HttpServletRequest request, public RSSChannel getChannel(HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
RequestContext actx) RequestContext actx)

View File

@ -21,15 +21,15 @@ package com.arsdigita.london.rss.installer;
import com.arsdigita.initializer.Configuration; import com.arsdigita.initializer.Configuration;
import com.arsdigita.initializer.InitializationException; import com.arsdigita.initializer.InitializationException;
import com.arsdigita.persistence.TransactionContext; // import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.persistence.SessionManager; //import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.kernel.BaseInitializer; import com.arsdigita.kernel.BaseInitializer;
import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.categorization.CategoryPurpose; // import com.arsdigita.categorization.CategoryPurpose;
import com.arsdigita.london.rss.RSS; import com.arsdigita.london.rss.RSS;
import com.arsdigita.london.rss.Feed; import com.arsdigita.london.rss.Feed;
@ -68,21 +68,23 @@ public class Initializer extends BaseInitializer {
**/ **/
protected void doStartup() throws InitializationException { protected void doStartup() throws InitializationException {
String catKey = RSS.getConfig().getCategoryKey(); // Moved into loader
s_log.info("Setting RSS Category Key to " + catKey + "."); // String catKey = RSS.getConfig().getCategoryKey();
// s_log.info("Setting RSS Category Key to " + catKey + ".");
TransactionContext txn = SessionManager.getSession() // TransactionContext txn = SessionManager.getSession()
.getTransactionContext(); // .getTransactionContext();
txn.beginTxn(); // txn.beginTxn();
if (!CategoryPurpose.purposeExists(catKey)) { // if (!CategoryPurpose.purposeExists(catKey)) {
(new CategoryPurpose(catKey, "RSS Feed")).save(); // (new CategoryPurpose(catKey, "RSS Feed")).save();
} // }
setupChannelControlCenter(); // Moved into loader
// setupChannelControlCenter();
setupLocalFeeds(); setupLocalFeeds();
txn.commitTxn(); // txn.commitTxn();
} }
public void setupChannelControlCenter() { public void setupChannelControlCenter() {
@ -120,8 +122,8 @@ public class Initializer extends BaseInitializer {
public void setupLocalFeeds() { public void setupLocalFeeds() {
URL external = URL.there("/channels/rss/external.rss", null);
URL external = URL.there("/channels/rss/external.rss", null);
try { try {
Feed feed = Feed.retrieve(external.getURL()); Feed feed = Feed.retrieve(external.getURL());
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {