http-auth und ccm-bookmarks jetzt legacy free. Update Skripte müssen noch ergänzt werden.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1532 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-04 12:49:57 +00:00
parent 4b80e714bb
commit 8a19a65917
24 changed files with 721 additions and 165 deletions

View File

@ -20,5 +20,6 @@ model com.arsdigita.auth.http;
import com.arsdigita.web.Application;
object type HTTPAuth extends Application {
reference key (auth_http.application_id);
// reference key (auth_http.application_id);
// nothing to store here
}

View File

@ -18,33 +18,31 @@
package com.arsdigita.auth.http;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.kernel.User;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.Application;
import org.apache.log4j.Logger;
/**
* Loads the HTTP Auth application and type
* <p>Executes nonrecurring at install time and loads (installs and initializes)
* the HTTP Auth application and type persistently into database.</p>
*
* @author Daniel Berrange
* @version $Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class Loader extends PackageLoader {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class);
private StringParameter m_adminEmail = new StringParameter
@ -53,40 +51,77 @@ public class Loader extends PackageLoader {
("auth.http.admin_identifier", Parameter.REQUIRED, null);
/**
* Constructor registers parameters
*/
public Loader() {
register(m_adminEmail);
register(m_adminIdent);
loadInfo();
}
/**
*
* @param ctx
*/
public void run(final ScriptContext ctx) {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
setupAdministrator();
setupHTTPAuth();
}
}.run();
}
/**
* Loads HTTPAuth type as a legacy free type of application and
* instantiates a (single) default instance.
*/
private void setupHTTPAuth() {
/*
ApplicationType type = ApplicationType
.createApplicationType("auth-http",
"CCM HTTP Authentication Admin",
HTTPAuth.BASE_DATA_OBJECT_TYPE);
*/
/* Create new type legacy free application type
* NOTE: The wording in the title parameter of ApplicationType
* determines the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and
* replacing blanks between words and illegal characters with an
* hyphen and converted to lower case.
* "Auth HTTP" will become "auth-http". */
ApplicationType type = new ApplicationType("Auth HTTP",
HTTPAuth.BASE_DATA_OBJECT_TYPE );
type.setDescription("CCM HTTP authentication administration");
type.save();
Application admin = Application.retrieveApplicationForPath("/admin/");
Application app =
Application.createApplication(type,
Application app = Application
.createApplication(type,
"auth-http",
"CCM HTTP Authentication Admin",
admin);
app.save();
}
/**
*
*/
private void setupAdministrator() {
DataCollection coll = SessionManager.getSession().retrieve
( User.BASE_DATA_OBJECT_TYPE );
s_log.warn("Administrator eMail is retrieved as: " + getAdminEmail());
DataCollection coll = SessionManager.getSession()
.retrieve(User.BASE_DATA_OBJECT_TYPE);
coll.addEqualsFilter( "primaryEmail", getAdminEmail() );
if (!coll.next()) {
@ -98,6 +133,7 @@ public class Loader extends PackageLoader {
User admin = User.retrieve( coll.getDataObject() );
coll.close();
s_log.warn("Administrator is retrieved as: " + admin);
UserLogin login = UserLogin.findByUser(admin);
if (login == null) {
@ -106,10 +142,18 @@ public class Loader extends PackageLoader {
}
}
/**
*
* @return
*/
private String getAdminEmail() {
return (String) get(m_adminEmail);
}
/**
*
* @return
*/
private String getAdminIdentifier() {
return (String) get(m_adminIdent);
}

View File

@ -9,5 +9,6 @@
</provides>
<scripts>
<schema directory="ccm-bookmarks"/>
<data class="com.arsdigita.bookmarks.Loader"/>
</scripts>
</load>

View File

@ -28,16 +28,15 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal;
/**
* A bookmark.
* Represents a single bookmark.
*
* @author Jim Parsons
*
*/
public class Bookmark extends ACSObject {
private static final int SORT_KEY_JUMP = 10;
private BookmarkApplication m_bmrkapp = null;
private Bookmarks m_bmrkapp = null;
/**
* The type of the {@link com.arsdigita.persistence.DataObject}
@ -105,17 +104,17 @@ public class Bookmark extends ACSObject {
return Bookmark.retrieveBookmark(dataObject);
}
public BookmarkApplication getBookmarkApplication() {
public Bookmarks getBookmarkApplication() {
if(m_bmrkapp == null) {
DataObject bmrkdata = (DataObject)get("bookmarkapp");
if(bmrkdata != null) {
m_bmrkapp = new BookmarkApplication(bmrkdata);
m_bmrkapp = new Bookmarks(bmrkdata);
}
}
return m_bmrkapp;
}
public void setBookmarkApplication(BookmarkApplication bmrkapp) {
public void setBookmarkApplication(Bookmarks bmrkapp) {
m_bmrkapp = bmrkapp;
setAssociation("bookmarkapp",bmrkapp);
}

View File

@ -24,7 +24,7 @@ import java.math.BigDecimal;
/**
*
* Represents a collection of single bookmarks
*
*/
public class BookmarkCollection extends DomainCollection {

View File

@ -25,33 +25,34 @@ import com.arsdigita.web.Application;
import java.math.BigDecimal;
/**
* BookmarkApplication class.
*
* Bookmarks application domain class.
* Central entry point into the bookmarks application.
* @author dennis
* @version $Id: BookmarkApplication.java#3 2003/07/10 14:47:30 $
* @version $Id: Bookmarks.java#3 2003/07/10 14:47:30 $
*/
public class BookmarkApplication extends Application {
public class Bookmarks extends Application {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.BookmarkApplication";
private static final int SORT_KEY_JUMP = 10;
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
private static final org.apache.log4j.Logger log =
org.apache.log4j.Logger.getLogger(BookmarkApplication.class);
org.apache.log4j.Logger.getLogger(Bookmarks.class);
public BookmarkApplication(OID oid) throws DataObjectNotFoundException {
public Bookmarks(OID oid) throws DataObjectNotFoundException {
super(oid);
}
public BookmarkApplication(BigDecimal key) throws DataObjectNotFoundException {
public Bookmarks(BigDecimal key) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, key));
}
public BookmarkApplication(DataObject dataObject) {
public Bookmarks(DataObject dataObject) {
super(dataObject);
}
@ -59,9 +60,9 @@ public class BookmarkApplication extends Application {
* Use this instead of the constructor to create new Bookmark
* Application objects
*/
public static BookmarkApplication create(String urlName, String title,
public static Bookmarks create(String urlName, String title,
Application parent) {
return (BookmarkApplication) Application.createApplication
return (Bookmarks) Application.createApplication
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
}
@ -113,4 +114,33 @@ public class BookmarkApplication extends Application {
b.save();
}
}
/**
* Returns the servletPath part of the URL to the application servlet.
* (see Servlet API specification or web.URL for more information)
*
* The method overwrites the super class to provide an application specific
* location for servlets/JSP. This is necessary if you whish to install the
* module (application) along with others in one context. If you install the
* module into its own context (no longer recommended for versions newer
* than 1.0.4) you may use a standard location.
*
* Usually it is a symbolic name/path, which will be mapped in the web.xml
* to the real location in the file system. Example:
* <servlet>
* <servlet-name>bookmarks</servlet-name>
* <servlet-class>com.arsdigita.bookmarks.BookmarksServlet</servlet-class>
* </servlet>
*
* <servlet-mapping>
* <servlet-name>bookmarks</servlet-name>
* <url-pattern>/bookmarks/*</url-pattern>
* </servlet-mapping>
*
* @return ServelPath of the applications servlet
*/
@Override
public String getServletPath() {
return "/bookmarks/";
}
}

View File

@ -31,13 +31,13 @@ import org.apache.log4j.Logger;
* @author Jim Parsons
*/
public class BookmarkDispatcher extends BebopMapDispatcher {
public class BookmarksDispatcher extends BebopMapDispatcher {
private static final Logger s_log =
Logger.getLogger(BookmarkDispatcher.class);
Logger.getLogger(BookmarksDispatcher.class);
public BookmarkDispatcher() {
public BookmarksDispatcher() {
super();
Map m = new HashMap();

View File

@ -0,0 +1,112 @@
/*
* Copyright (C) 2012 Peter Boy <pb@zes.uni-bremen.de> All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.bookmarks;
import com.arsdigita.bebop.Page;
import com.arsdigita.bookmarks.ui.BookmarkBasePage;
import com.arsdigita.bookmarks.ui.BookmarkEditPane;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet;
import com.arsdigita.xml.Document;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
/**
* Web Developer Support Application Servlet class, central entry point to
* create and process the applications UI.
*
* We should have subclassed BebopApplicationServlet but couldn't overwrite
* doService() method to add permission checking. So we use our own page
* mapping. The general logic is the same as for BebopApplicationServlet.
* {@see com.arsdigita.bebop.page.BebopApplicationServlet}
*
* @author pb
*/
public class BookmarksServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(BookmarksServlet.class);
private Page adminPage;
/**
* User extension point, overwrite this method to setup a URL - page mapping
*
* @throws ServletException
*/
@Override
public void doInit() throws ServletException {
adminPage = buildAdminPage();
}
/**
* Central service method, checks for required permission, determines the
* requested page and passes the page object to PresentationManager.
*/
public final void doService(HttpServletRequest sreq,
HttpServletResponse sresp,
Application app)
throws ServletException, IOException {
if (adminPage != null) {
final Document doc = adminPage.buildDocument(sreq, sresp);
PresentationManager pm = Templating.getPresentationManager();
pm.servePage(doc, sreq, sresp);
} else {
sresp.sendError(404, "No such page.");
}
}
/**
*
* @return
*/
private Page buildAdminPage() {
BookmarkBasePage p = new BookmarkBasePage();
p.addRequestListener(new ApplicationAuthenticationListener("admin"));
p.getBody().add(new BookmarkEditPane());
p.lock();
return p;
}
}

View File

@ -18,46 +18,34 @@
package com.arsdigita.bookmarks;
import com.arsdigita.bookmarks.ui.BookmarkPortlet;
import com.arsdigita.db.DbHelper;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.persistence.SessionManager;
// unused import com.arsdigita.persistence.OID;
import com.arsdigita.web.*;
import com.arsdigita.kernel.*;
// unused import com.arsdigita.sitenode.*;
import com.arsdigita.bookmarks.ui.*;
// unused import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.domain.DomainObject;
// import com.arsdigita.initializer.Configuration;
// unused import com.arsdigita.initializer.InitializationException;
// unused import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.portal.PortletType;
import com.arsdigita.portal.apportlet.AppPortletSetup;
import com.arsdigita.runtime.CompoundInitializer;
// unused import com.arsdigita.runtime.DataInitEvent;
import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig;
// unusd import com.arsdigita.util.Assert;
import org.apache.log4j.Logger;
/**
* <p><strong>Experimental</strong></p>
*
* @author <a href="mailto:jparsons@redhat.com">Jim Parsons</a>
*/
public class Initializer extends CompoundInitializer {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger
(Initializer.class);
// required by Old Initializer.
// private Configuration m_conf = new Configuration();
/**
*
*/
public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url);
@ -69,70 +57,34 @@ public class Initializer extends CompoundInitializer {
}
/**
*
* @param e
*/
@Override
public void init(DomainInitEvent e) {
s_log.info("Bookmarks app is initializing using .init(DomainInitEvent e)");
// setupDomainFactory();
super.init(e);
TransactionContext txn = SessionManager.getSession()
.getTransactionContext();
txn.beginTxn();
setupBookmarks();
txn.commitTxn();
s_log.info("Bookamrks Initializer completed.");
}
// public final void doStartup() {
// s_log.warn("Initializing Bookmarks...");
// TransactionContext txn =
// SessionManager.getSession().getTransactionContext();
// txn.beginTxn();
// setupBookmarks();
// txn.commitTxn();
// }
private void setupBookmarks() {
ApplicationSetup appsetup = new ApplicationSetup(s_log);
appsetup.setApplicationObjectType( BookmarkApplication.BASE_DATA_OBJECT_TYPE);
appsetup.setKey("bookmarks");
appsetup.setTitle("Bookmarks Application");
appsetup.setDescription("Bookmarks for a Portal");
appsetup.setDispatcherClass("com.arsdigita.bookmarks.BookmarkDispatcher");
appsetup.setPortalApplication(true);
appsetup.setInstantiator(new ACSObjectInstantiator() {
protected DomainObject doNewInstance(DataObject dataObject) {
return new BookmarkApplication(dataObject);
/* Register object instantiator for Bookmarks Application */
e.getFactory().registerInstantiator(
Bookmarks.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new Bookmarks(dataObject);
}
});
ApplicationType bmrkAppType = appsetup.run();
AppPortletSetup setup = new AppPortletSetup(s_log);
setup.setPortletObjectType
(BookmarkPortlet.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Portal Bookmarks");
setup.setDescription("Displays bookmarks for this portal.");
setup.setProfile(PortletType.NARROW_PROFILE);
setup.setPortalApplication(false);
setup.setProviderApplicationType(bmrkAppType);
setup.setInstantiator(new ACSObjectInstantiator() {
/* Register object instantiator for Bookmarks Portlet */
e.getFactory().registerInstantiator(
BookmarkPortlet.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new BookmarkPortlet(dataObject);
}
});
setup.run();
}
// public final void doShutdown() {}
}

View File

@ -0,0 +1,126 @@
/*
* Copyright (C) 2012 Peter Boy <pb@zes.uni-bremen.de> All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.arsdigita.bookmarks;
import com.arsdigita.bookmarks.ui.BookmarkPortlet;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.portal.PortletType;
import com.arsdigita.portal.apportlet.AppPortletType;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.web.ApplicationType;
import com.arsdigita.web.Application;
import org.apache.log4j.Logger;
/**
* <p>Executes nonrecurring at install time and loads (installs and initializes)
* the HTTP Auth application and type persistently into database.</p>
*
* @author Daniel Berrange
* @version $Id: Loader.java 287 2005-02-22 00:29:02Z sskracic $
*/
/**
*
* @author pb
*/
public class Loader extends PackageLoader {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class);
/**
*
* @param ctx
*/
public void run(final ScriptContext ctx) {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
ApplicationType bmrkAppType = loadBookmarksApp();
loadBookmarksPortlet(bmrkAppType);
setupDefaultBookmarkApplicationInstance();
}
}.run();
}
/**
* Load the Bookmarks application into persistent storage.
*
* @return Bookmarks application type, requirred to load the portlet type
*/
private ApplicationType loadBookmarksApp() {
/* Create new type legacy free application type
* NOTE: The wording in the title parameter of ApplicationType
* determines the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and
* replacing blanks between words and illegal characters with an
* hyphen and converted to lower case.
* "Bookmarks" will become "bookmarks". */
ApplicationType type = new ApplicationType("Bookmarks",
Bookmarks.BASE_DATA_OBJECT_TYPE );
type.setDescription("Bookmarks for a Portal");
type.save();
return type;
}
private void loadBookmarksPortlet(ApplicationType bmrkAppType ) {
AppPortletType type = AppPortletType.createAppPortletType(
"Portal Bookmarks",
PortletType.NARROW_PROFILE,
BookmarkPortlet.BASE_DATA_OBJECT_TYPE);
type.setProviderApplicationType(bmrkAppType);
type.setDescription("Displays bookmarks for this portal.");
}
/**
* Instantiates the Bookmarks application admin instance.
*
*/
public static void setupDefaultBookmarkApplicationInstance() {
/* Determine a parent application. Bookmarks admin page will be
* installed beyond the admin's applications URL. */
Application admin = Application.retrieveApplicationForPath("/admin/");
// create application instance
// Whether a legacy compatible or a legacy free application is
// created depends on the type of ApplicationType above. No need to
// modify anything here in the migration process
// old-style package key used as url fragment where to install the instance
s_log.debug("Creating BookmarkApplication instance ...");
Bookmarks app = Bookmarks.create("bookmarks", "Bookmarks", admin);
s_log.debug("Bookmarks instance " + " created.");
s_log.debug("Done loading bookmarks.");
}
}

View File

@ -117,10 +117,12 @@ public class BookmarkBasePage extends Page {
}
@Override
public void lock() {
buildPage();
buildPage();
super.lock();
}
// Only the PortalPage.lock() should invoke this
@ -342,10 +344,12 @@ public class BookmarkBasePage extends Page {
Application parent = app.getParentApplication();
if (parent != null) {
link.setChild(new Label(parent.getTitle()));
link.setTarget(parent.getPath());
}
}
}
protected class CurrentApplicationLabelPrinter implements PrintListener {
public CurrentApplicationLabelPrinter() {

View File

@ -18,7 +18,7 @@ package com.arsdigita.bookmarks.ui;
import com.arsdigita.bookmarks.util.GlobalizationUtil;
import com.arsdigita.bookmarks.BookmarkCollection;
import com.arsdigita.bookmarks.BookmarkApplication;
import com.arsdigita.bookmarks.Bookmarks;
import com.arsdigita.bookmarks.Bookmark;
import com.arsdigita.web.Application;
@ -89,7 +89,7 @@ public class BookmarkEditPane extends DynamicListWizard {
BookmarkCollection m_bmrks;
Bookmark m_bmrk;
public BmrkListModel(PageState s) {
BookmarkApplication bmrkapp = (BookmarkApplication)Application.getCurrentApplication(s.getRequest());
Bookmarks bmrkapp = (Bookmarks)Application.getCurrentApplication(s.getRequest());
m_bmrks = bmrkapp.getBookmarks();
}
public boolean next() {
@ -129,7 +129,7 @@ public class BookmarkEditPane extends DynamicListWizard {
m_prtlRL = new RequestLocal() {
protected Object initialValue(PageState ps) {
return (BookmarkApplication)Application.getCurrentApplication(
return (Bookmarks)Application.getCurrentApplication(
ps.getRequest());
}
};
@ -181,7 +181,7 @@ public class BookmarkEditPane extends DynamicListWizard {
public void validate(FormSectionEvent ev) {
// check that the user has permission to create bookmarks.
PageState ps = ev.getPageState();
BookmarkApplication ba = (BookmarkApplication)m_prtlRL.get(ps);
Bookmarks ba = (Bookmarks)m_prtlRL.get(ps);
ba.assertPrivilege(PrivilegeDescriptor.CREATE);
}
});
@ -190,7 +190,7 @@ public class BookmarkEditPane extends DynamicListWizard {
addForm.addProcessListener(new FormProcessListener() {
public void process(FormSectionEvent ev) {
PageState ps = ev.getPageState();
final BookmarkApplication ba = (BookmarkApplication)m_prtlRL.get(ps);
final Bookmarks ba = (Bookmarks)m_prtlRL.get(ps);
final Bookmark newBmrk =
new Bookmark(newBmrkName.getValue(ps).toString(),
newBmrkURL.getValue(ps).toString());
@ -252,7 +252,7 @@ public class BookmarkEditPane extends DynamicListWizard {
public Component getComponent(List list, PageState state,
Object value, String key, int index, boolean isSelected) {
BookmarkApplication app = (BookmarkApplication) Web.getContext()
Bookmarks app = (Bookmarks) Web.getContext()
.getApplication();
BookmarkCollection bColl = app.getBookmarks();
final long size = bColl.size();
@ -303,13 +303,13 @@ public class BookmarkEditPane extends DynamicListWizard {
if (EVENT_SWAP_UP.equals(name)) {
BigDecimal bID = new BigDecimal(bIDstr);
Bookmark b = Bookmark.retrieveBookmark(bID);
BookmarkApplication bApp = b.getBookmarkApplication();
Bookmarks bApp = b.getBookmarkApplication();
bApp.swapBookmarkWithPrevious(b);
}
else if (EVENT_SWAP_DOWN.equals(name)) {
BigDecimal bID = new BigDecimal(bIDstr);
Bookmark b = Bookmark.retrieveBookmark(bID);
BookmarkApplication bApp = b.getBookmarkApplication();
Bookmarks bApp = b.getBookmarkApplication();
bApp.swapBookmarkWithNext(b);
}
else {
@ -536,7 +536,7 @@ public class BookmarkEditPane extends DynamicListWizard {
BigDecimal bd =
new BigDecimal((String) getSelectionModel().getSelectedKey(s));
Bookmark bmrk = Bookmark.retrieveBookmark(bd);
BookmarkApplication ba = (BookmarkApplication)Application.getCurrentApplication(s.getRequest());
Bookmarks ba = (Bookmarks)Application.getCurrentApplication(s.getRequest());
bmrk.setName(bookmarkName.getValue(s).toString());
bmrk.setURL(bookmarkURL.getValue(s).toString());
bmrk.setDescription(bookmarkDescription.getValue(s).toString());
@ -592,7 +592,7 @@ public class BookmarkEditPane extends DynamicListWizard {
if(button.isSelected(s)) {
BigDecimal bmrkID = new BigDecimal((String)getSelectionModel().getSelectedKey(s));
Bookmark bmrk = Bookmark.retrieveBookmark(bmrkID);
BookmarkApplication bmrkapp = (BookmarkApplication)Application.getCurrentApplication(s.getRequest());
Bookmarks bmrkapp = (Bookmarks)Application.getCurrentApplication(s.getRequest());
bmrkapp.removeBookmark(bmrk);
getSelectionModel().clearSelection(s);
reset(s);

View File

@ -23,7 +23,7 @@ import com.arsdigita.bebop.GridPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
import com.arsdigita.bookmarks.BookmarkApplication;
import com.arsdigita.bookmarks.Bookmarks;
import com.arsdigita.bookmarks.BookmarkCollection;
import com.arsdigita.bookmarks.util.GlobalizationUtil;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -44,44 +44,82 @@ import com.arsdigita.xml.Element;
*/
public class BookmarkPortlet extends AppPortlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(BookmarkPortlet.class);
/** PDL stuff - Data Object */
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workspace.BookmarkPortlet";
/**
* Provide the Data Object Type.
* @return DataObjectType as String
*/
@Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
/**
* Constructor
*
* @param dataObject
*/
public BookmarkPortlet(DataObject dataObject) {
super(dataObject);
}
/**
*
* @return
*/
@Override
public String getZoomURL() {
Application app = getParentApplication();
if (!PermissionService.checkPermission(
new PermissionDescriptor(PrivilegeDescriptor.READ, app, Web.getContext().getUser()))) {
new PermissionDescriptor(PrivilegeDescriptor.READ,
app,
Web.getContext().getUser()))) {
return null;
}
return (URL.getDispatcherPath() + app.getPrimaryURL());
}
/**
*
* @return
*/
@Override
protected AbstractPortletRenderer doGetPortletRenderer() {
return new BookmarkPortletRenderer(this);
}
}
/**
*
*
*/
class BookmarkPortletRenderer extends AbstractPortletRenderer {
private BookmarkPortlet m_portlet;
/**
*
* @param portlet
*/
public BookmarkPortletRenderer
(BookmarkPortlet portlet) {
m_portlet = portlet;
}
/**
*
* @param pageState
* @param parentElement
*/
protected void generateBodyXML(PageState pageState, Element parentElement) {
BookmarkApplication bmrkapp =
(BookmarkApplication)m_portlet.getParentApplication();
Bookmarks bmrkapp =
(Bookmarks)m_portlet.getParentApplication();
// Variables used cursorwise.
int counter;

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<!-- Servlets for the docrepo applications -->
<servlet>
<servlet-name>bookmarks</servlet-name>
<servlet-class>com.arsdigita.bookmarks.BookmarksServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>bookmarks</servlet-name>
<url-pattern>/bookmarks/*</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -341,17 +341,16 @@ public abstract class DomainObject {
}
/**
* Set an association DomainObjects DataObject.
* This should only be used inside of a setXXX
* method.
* Set an association DomainObjects DataObject. This should only be used
* inside of a setXXX method.
* <p>
* Specificall, this method should only be used to set
* associations whose multiplicity is 0..1 or 1..1.
* If the upper bound of the multiplicity is greater than 1
* then the {@link #add(String, DataObject)} method should be used.
* Specifically, this method should only be used to set associations
* whose multiplicity is 0..1 or 1..1.
* If the upper bound of the multiplicity is greater than 1 then the
* {@link #add(String, DataObject)} method should be used.
*
* @see com.arsdigita.persistence.DataObject#set(String, Object)
**/
*/
protected void setAssociation(String attr, DomainObject dobj) {
set(attr, dobj == null ? null : dobj.m_dataObject);
}
@ -515,8 +514,9 @@ public abstract class DomainObject {
* whether the object is new, modified, deleted, or unknown. Unknown is for
* objects that have been invalidated.
*/
@Override
public String toString() {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
OID oid = getOID();
if ( oid != null ) {
result.append(oid.toString());
@ -586,37 +586,47 @@ public abstract class DomainObject {
private DomainObject getDomainObject() { return DomainObject.this; }
@Override
public void set(DataObject object, String property, Object previous,
Object value) { }
@Override
public void add(DataObject object, String property,
DataObject value) { }
@Override
public void remove(DataObject object, String property,
DataObject value) { }
@Override
public void clear(DataObject object, String property) { }
@Override
public void beforeSave(DataObject object) {
getDomainObject().beforeSave();
}
@Override
public void afterSave(DataObject object) {
getDomainObject().afterSave();
}
@Override
public void beforeDelete(DataObject object) {
getDomainObject().beforeDelete();
}
@Override
public void afterDelete(DataObject object) {
getDomainObject().afterDelete();
}
@Override
public int hashCode() {
return getDomainObject().hashCode();
}
@Override
public boolean equals(Object other) {
if (other instanceof SaveObserver) {
return getDomainObject().equals(
@ -639,6 +649,7 @@ public abstract class DomainObject {
return false;
}
@Override
public String toString() {
return "Save observer for: " + getDomainObject().getOID() + " (" +
super.toString() + ")";

View File

@ -109,19 +109,7 @@ public class PortletType extends ResourceType {
Assert.exists(title, "title");
Assert.exists(profile, "profile");
Assert.exists(portletObjectType, "portletObjectType");
/* Portal now legacy free. To be deleted when transistion is completed.
PackageType packageType = null;
// is com.arsdigita.portal.Portal initialized
try {
packageType = PackageType.findByKey("portal");
} catch (DataObjectNotFoundException nfe) {
String message =
"The PackageType 'portal' is not installed. It must be " +
"installed in order to create a new PortletType.";
s_cat.error(message);
throw new IllegalStateException(message);
}
*/
// is com.arsdigita.portal.Portal initialized?
if ( !ResourceType.isInstalled(Portal.BASE_DATA_OBJECT_TYPE) ) {
String message =

View File

@ -82,6 +82,7 @@ public class AppPortlet extends Portlet {
}
}
@Override
public PortletRenderer getPortletRenderer() {
AbstractPortletRenderer portletRenderer = doGetPortletRenderer();

View File

@ -37,17 +37,18 @@ public final class AppPortletType extends PortletType {
private static final Logger s_cat =
Logger.getLogger(AppPortletType.class.getName());
private final static String IS_PORTAL_APPLICATION =
"isWorkspaceApplication";
private final static String IS_PORTAL_APPLICATION = "isWorkspaceApplication";
protected AppPortletType(DataObject dataObject) {
super(dataObject);
}
// Create from packageType.
protected AppPortletType
(String dataObjectType, String title, String profile,
protected AppPortletType(String dataObjectType,
String title,
String profile,
String portletObjectType) {
super(dataObjectType,title,profile,portletObjectType);
}

View File

@ -11,7 +11,7 @@
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-article" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-mparticle" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-ldn-navigation" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-navigation" version="6.6.0" relation="ge"/>
</ccm:dependencies>
<ccm:contacts>

View File

@ -0,0 +1,222 @@
/*
* Copyright (C) 2012 Peter Boy <pb@zes.uni-bremen.de> All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.docmgr;
import com.arsdigita.docrepo.ui.RecentUpdatedDocsPortlet;
// import com.arsdigita.mimetypes.*;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.PortletType;
import com.arsdigita.portal.apportlet.AppPortletSetup;
import com.arsdigita.runtime.ScriptContext;
import com.arsdigita.web.ApplicationSetup;
import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger;
/**
* CMS Document Manager (DocMgr) Loader
*
* @author pboy &lt;pboy@barkhof.uni-bremen.de&gt;
* @version $Id: Loader.java $
**/
public class Loader extends PackageLoader {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(Loader.class);
/**
* Run script invoked by com.arsdigita.packing loader script.
*
* @param ctx
*/
public void run(final ScriptContext ctx) {
new KernelExcursion() {
public void excurse() {
setEffectiveParty(Kernel.getSystemParty());
loadDocRepositoryApplicationType(); //former setupDocs
setupDocRepositoryPortlet(null); //former setupDocManagerPortlet
setupDefaultDocRepository();
}
}.run();
s_log.info("Done");
}
// ////////////////////////////////////////////////////////////////////////
//
// S e t u p o f a p p l i c a t i o n t y p e s
//
// ////////////////////////////////////////////////////////////////////////
/**
* Creates a document repository application type, the domain class of the
* document repository (docrepo) package, as a legacy-compatible type of
* application.
*
* Creates an entry in table application_types and a corresponding entry in
* apm_package_types
*
* TODO: migrate to a new style, legacy free application type.
*/
private ApplicationType loadDocRepositoryApplicationType() {
ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(Repository.BASE_DATA_OBJECT_TYPE);
setup.setKey("cmsdocs");
setup.setTitle("Document Manager (CMS) Application");
setup.setSingleton(false);
setup.setDescription
("The document manager empowers users to share documents.");
setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher");
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new Repository(dataObject);
}
});
return setup.run();
/* Legacy free initialization
* NOTE: The wording in the title parameter of ApplicationType determines
* the name of the subdirectory for the XSL stylesheets.
* It gets "urlized", i.e. trimming leading and trailing blanks and replacing
* blanks between words and illegal characters with an hyphen and converted
* to lower case.
* Example: "DocRepo" will become "docrepo".
*/
// ApplicationType type = new
// ApplicationType("DocRepo",
// Repository.BASE_DATA_OBJECT_TYPE );
// type.setDescription
// ("The document repository empowers users to share documents.");
}
private ApplicationType setupCategoryBrowsing() {
ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(DocumentCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE);
setup.setKey("cmsdocs-categories");
setup.setTitle("Browse Documents Application");
setup.setSingleton(true);
setup.setDescription
("Browse documents by category.");
setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new DocumentCategoryBrowserApplication(dataObject);
}
});
return setup.run();
}
private ApplicationType setupLegacyCategoryBrowsing() {
ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(LegacyCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE);
setup.setKey("cmsdocs-categories-legacy");
setup.setTitle("Taxonomy Browser");
setup.setSingleton(true);
setup.setDescription
("Browse documents by category.");
setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DCNDispatcher");
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new LegacyCategoryBrowserApplication(dataObject);
}
});
return setup.run();
}
// ////////////////////////////////////////////////////////////////////////
//
// S e t u p a D O C M G R a p p l i c a t i o n
//
// ////////////////////////////////////////////////////////////////////////
private void setupDefaultDocRepository() {
// try {
// SiteNode sn = SiteNode.getSiteNode("/administration", false);
// if (!"administration".equals(sn.getName())) {
Repository repo = Repository.create(
"repository", "Default Document Repository", null);
repo.save();
// }
// } catch (DataObjectNotFoundException e) {
// Assert.fail(e.getMessage());
// }
}
// ////////////////////////////////////////////////////////////////////////
//
// S e t u p o f i n t e r n a l p o r t l e t s
//
// ////////////////////////////////////////////////////////////////////////
/**
* Creates a PortletType (persistent object) for the RecentUpdatedDocs
* Portlet.
*
* Instances (Portlets) are created by user interface or programmatically
* by configuration.
*/
private void setupDocRepositoryPortlet(ApplicationType provider) {
// Create the document repository portlet
AppPortletSetup setup = new AppPortletSetup(s_log);
setup.setPortletObjectType(RecentUpdatedDocsPortlet.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Recently Updated Documents");
setup.setDescription(
"Displays the most recent documents in the document repository.");
setup.setProfile(PortletType.WIDE_PROFILE);
// setup.setProviderApplicationType(provider);
setup.setProviderApplicationType(Repository.BASE_DATA_OBJECT_TYPE);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new RecentUpdatedDocsPortlet(dataObject);
}
});
setup.run();
}
}

View File

@ -78,6 +78,7 @@ public class Initializer extends CompoundInitializer {
// return m_conf;
// }
@Override
public void init(DomainInitEvent e) {
s_log.debug("Document (CCM) Manager is initializing using .init(DomainInitEvent e)");
startup();
@ -127,9 +128,6 @@ public class Initializer extends CompoundInitializer {
setup.setDescription
("The document manager empowers users to share documents.");
setup.setDispatcherClass("com.arsdigita.cms.docmgr.ui.DMDispatcher");
// Class Stylesheet and database backed stylesheet locations are
// deprecated and removed. New StylesheetResolver is pattern based.
// setup.setStylesheet("/packages/cms-docmgr/xsl/docs.xsl");
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {

View File

@ -51,6 +51,9 @@ public class Initializer extends CompoundInitializer {
private Thread[] m_workers;
/**
*
*/
public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url);

View File

@ -123,6 +123,9 @@ themedirector.default_theme_context=
themedirector.default_theme_path=themes/static/aplaws-generic
themedirector.file_extensions=bmp css gif jpeg jpg js png xml xsl
# ccm-auth-http application
auth.http.admin_email=webmaster@scientificcms.org
auth.http.admin_identifier=webmaster
# ccm-sci-bundle (Loader only)
#com.arsdigita.bundle.loader.category_files=bundle/categories/sci-nav-domain-1.00.xml,bundle/categories/sci-nav-hierarchy-1.00.xml

View File

@ -138,10 +138,10 @@
<!-- Applications -->
<!--
-->
<ccm:application name="ccm-auth-http"/>
<ccm:application name="ccm-bookmarks"/>
<ccm:application name="ccm-docmgr"/>
-->
<ccm:application name="ccm-docrepo"/>
<ccm:application name="ccm-faq"/>
<ccm:application name="ccm-forum"/>
@ -154,10 +154,10 @@
<!-- LDN extension -->
<!--
-->
<ccm:application name="ccm-ldn-exporter"/>
<ccm:application name="ccm-ldn-freeform"/>
<ccm:application name="ccm-ldn-importer"/>
-->
@ -167,20 +167,24 @@
<!-- Content Types -->
<!-- <ccm:application name="ccm-cms-types-motditem"/>
Current code does not include any xsl templates, conent type does not
Current code does not include any xsl templates, content type does not
appear in the list of types in content center.
For the moment no longer supported (2012-02-06) -->
<!-- Applications -->
<!-- currently doesn't work for unknown reason
<ccm:application name="ccm-simplesurvey"/> -->
<!-- Without known funcionality
<ccm:application name="ccm-formbuilder-pdf"/>
<ccm:application name="ccm-user-preferences"/> -->
<!-- LDN extension -->
<!-- Conflicts with ccm-sci-bundle (this package) -->
<!-- <ccm:application name="ccm-ldn-aplaws"/> -->
<!-- In it's current implementation very ldn / aplaws specific
<ccm:application name="ccm-ldn-atoz"/>
<ccm:application name="ccm-ldn-dublin"/>