Update Skript für ccm-core (Umstellung auf legacy free) komplettiert. admin/sitemap entfernt, da nicht mehr sinnvoll. Einen Teil der Klassen vorerst noch im Code belassen, dient im Moment als Experimentierbases für Erweiterung admin um einen 3. Tab Applications.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1552 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f26e144578
commit
8b4b7cb929
|
|
@ -18,7 +18,7 @@
|
|||
-- for some unkown reason for some ccm installations an index for
|
||||
-- users tables has been lost. Just in case it is recreated here.
|
||||
|
||||
-- First: Drop index to avoid an error it it already exists
|
||||
-- First: Drop index to avoid an error if it already exists
|
||||
drop index if exists users_lower_screen_name_idx ;
|
||||
|
||||
create unique index users_lower_screen_name_idx on users
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
-- $Id: remove_bebop_legacy_entries.sql $
|
||||
|
||||
-- CoreLoader used to load a bebop package_type into database, but without
|
||||
-- mounting any instance or to associate a dispatcher class. Si it never had
|
||||
-- mounting any instance or to associate a dispatcher class. So it never had
|
||||
-- had a function as application.
|
||||
-- entries in tables apm_package_types and apm_packages are no longer needed.
|
||||
|
||||
|
|
|
|||
|
|
@ -35,12 +35,15 @@
|
|||
<script sql="ccm-core/upgrade/::database::-6.5.5-6.5.6.sql"/>
|
||||
</version>
|
||||
<version from="6.6.0" to="6.6.1">
|
||||
<!-- Drop deprecated and unused stylesheet tables -->
|
||||
<script sql="ccm-core/upgrade/::database::-6.6.0-6.6.1.sql"/>
|
||||
</version>
|
||||
<version from="6.6.1" to="6.6.2">
|
||||
<!-- unused table web_apps removed -->
|
||||
<script sql="ccm-core/upgrade/::database::-6.6.1-6.6.2.sql"/>
|
||||
</version>
|
||||
<version from="6.6.2" to="6.6.3">
|
||||
<!-- core portal legacy free -->
|
||||
<script sql="ccm-core/upgrade/::database::-6.6.2-6.6.3.sql"/>
|
||||
</version>
|
||||
<version from="6.6.3" to="6.6.4">
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import com.arsdigita.runtime.PDLInitializer;
|
|||
import com.arsdigita.runtime.RuntimeConfig;
|
||||
import com.arsdigita.toolbox.CharsetEncodingProvider;
|
||||
import com.arsdigita.ui.admin.Admin;
|
||||
import com.arsdigita.ui.sitemap.SiteMap;
|
||||
import com.arsdigita.util.URLRewriter;
|
||||
import com.arsdigita.xml.FactoriesSetup;
|
||||
import com.arsdigita.web.Host;
|
||||
|
|
@ -170,15 +169,6 @@ public class Initializer extends CompoundInitializer {
|
|||
}
|
||||
});
|
||||
|
||||
e.getFactory().registerInstantiator
|
||||
(SiteMap.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(final DataObject data) {
|
||||
return new SiteMap(data);
|
||||
}
|
||||
});
|
||||
|
||||
e.getFactory().registerInstantiator
|
||||
(Permissions.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
|
|
@ -196,26 +186,6 @@ public class Initializer extends CompoundInitializer {
|
|||
}
|
||||
});
|
||||
|
||||
/* MimeType used to have its own initializer in the old initialize system
|
||||
* based on enterprise.ini. This initializer performed a DomainObjectFactgory
|
||||
* instantiation and some handling of INSO filter, an Oracle db related
|
||||
* filter for intermedia textsearch. INSO filter handling is moved to
|
||||
* intermedia search engine so no configuration was left in the domain
|
||||
* instantiation could be moved to the central core initializer
|
||||
From old Initializer system:
|
||||
|
||||
if (DomainObjectFactory.getInstantiator
|
||||
(MimeType.BASE_DATA_OBJECT_TYPE) == null) {
|
||||
DomainObjectInstantiator instMimeType = new DomainObjectInstantiator() {
|
||||
public DomainObject doNewInstance(DataObject dataObject) {
|
||||
return new MimeType(dataObject);
|
||||
}
|
||||
};
|
||||
DomainObjectFactory.registerInstantiator
|
||||
(MimeType.BASE_DATA_OBJECT_TYPE, instMimeType);
|
||||
}
|
||||
|
||||
*/
|
||||
e.getFactory().registerInstantiator
|
||||
(MimeType.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
|
|
@ -269,23 +239,4 @@ public class Initializer extends CompoundInitializer {
|
|||
s_log.info("Core init(DomainInitEvent) done");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
// public final void init(final LegacyInitEvent e) {
|
||||
// super.init(e);
|
||||
|
||||
// s_log.info("Running core init(LegacyInitEvent) ...");
|
||||
|
||||
// Session session = SessionManager.getSession();
|
||||
// TransactionContext txn = session.getTransactionContext();
|
||||
// txn.beginTxn();
|
||||
// CoreLoader.loadHost();
|
||||
// txn.commitTxn();
|
||||
|
||||
// FactoriesSetup.setupFactories();
|
||||
|
||||
// s_log.info("Core init(LegacyInitEvent) done");
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,6 @@ package com.arsdigita.core.upgrade;
|
|||
import com.arsdigita.loader.CoreLoader;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.PackageInstance;
|
||||
import com.arsdigita.kernel.PackageInstanceCollection;
|
||||
import com.arsdigita.kernel.PackageType;
|
||||
import com.arsdigita.kernel.Resource;
|
||||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.packaging.Program;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
|
|
@ -91,18 +86,46 @@ public class Upgrade664 extends Program {
|
|||
tc.beginTxn();
|
||||
|
||||
|
||||
// Update core Login application
|
||||
// Previously login had been managed by a (virtual) root
|
||||
// sitenode with login dispatcher associated.
|
||||
// Login application is newly created, old sitenote deactivated.
|
||||
CoreLoader.loadLoginApp();
|
||||
|
||||
|
||||
// Update core Admin application
|
||||
// Old style package type already removed by sql script.
|
||||
// Create a (new type, legacy free) web.ApplicationType type
|
||||
// application
|
||||
CoreLoader.loadAdminApp();
|
||||
|
||||
|
||||
// Update core permission support
|
||||
// Old style package type already removed by sql script.
|
||||
// Create a (new type, legacy free) web.ApplicationType type
|
||||
// application
|
||||
CoreLoader.loadPermissionsApp();
|
||||
|
||||
|
||||
// Update core WebDeveloperSupport
|
||||
// Old style package type already removed by sql script.
|
||||
// Create a (new type, legacy free) web.ApplicationType type
|
||||
// application
|
||||
CoreLoader.loadWebDev();
|
||||
|
||||
|
||||
// Update core permission support
|
||||
// Create a (new type, legacy free) web.ApplicationType type
|
||||
// application
|
||||
CoreLoader.loadPermissionsApp();
|
||||
// Note: Old PackageType sitenode removed. It's useless now
|
||||
// because it is based on SiteNode / PackageType which is
|
||||
// empty when all applications are migrated to new style
|
||||
// legacy free applications.
|
||||
// SQL script removes its table entries.
|
||||
|
||||
|
||||
// Note 2: SQL script part of this update removes bebop
|
||||
// PackageType. It had never been used and not instantiated.
|
||||
// So no replacement is needed.
|
||||
// SQL script removes its table entries.
|
||||
|
||||
tc.commitTxn();
|
||||
}
|
||||
}.run();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ import com.arsdigita.runtime.ScriptContext;
|
|||
import com.arsdigita.ui.admin.Admin;
|
||||
import com.arsdigita.ui.login.Login;
|
||||
import com.arsdigita.ui.permissions.Permissions;
|
||||
import com.arsdigita.ui.sitemap.SiteMap;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -272,18 +271,12 @@ public class CoreLoader extends PackageLoader {
|
|||
s_log.debug("CoreLoader: Going to execute loadSubsite().");
|
||||
loadSubsite(loadKernel());
|
||||
|
||||
// !! s_log.debug("CoreLoader: Going to execute loadBebop().");
|
||||
// !! loadBebop();
|
||||
|
||||
s_log.debug("CoreLoader: Going to execute loadLoginApp().");
|
||||
loadLoginApp();
|
||||
|
||||
s_log.debug("CoreLoader: Going to execute loadAdminApp().");
|
||||
loadAdminApp();
|
||||
|
||||
s_log.debug("CoreLoader: Going to execute loadSiteMapAdminApp().");
|
||||
loadSiteMapAdminApp(null);
|
||||
|
||||
s_log.debug("CoreLoader: Going to execute loadPermissionsApp().");
|
||||
loadPermissionsApp(); // new style legacy free
|
||||
|
||||
|
|
@ -308,8 +301,8 @@ public class CoreLoader extends PackageLoader {
|
|||
* Subject to change.
|
||||
*/
|
||||
public static void loadHost() {
|
||||
final HttpHost hhost = Web.getConfig().getHost();
|
||||
|
||||
final HttpHost hhost = Web.getConfig().getHost();
|
||||
Assert.exists(hhost, HttpHost.class);
|
||||
|
||||
final Host host = Host.retrieve(hhost);
|
||||
|
|
@ -330,11 +323,14 @@ public class CoreLoader extends PackageLoader {
|
|||
// c.ad.search.lucene.Initializer (public final static Loader LOADER)
|
||||
// doesn't work!
|
||||
com.arsdigita.search.lucene.Initializer.LOADER.load();
|
||||
//
|
||||
// As of version 6.6.0 release 2 refactored to the new initializer system
|
||||
//--com.arsdigita.search.lucene.LegacyInitializer.LOADER.load();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param rootNode
|
||||
* @deprecated will be removed without replacement. Naot needed anymore
|
||||
*/
|
||||
private void loadSubsite(SiteNode rootNode) {
|
||||
s_log.debug("CoreLoader: Going to execute method loadSubsite().");
|
||||
String sDispatcher = "";
|
||||
|
|
@ -363,6 +359,7 @@ public class CoreLoader extends PackageLoader {
|
|||
/**
|
||||
* Create Root Site Node for loadSubsite()
|
||||
* @return root node
|
||||
* @deprecated will be removed without replacement. Naot needed anymore
|
||||
*/
|
||||
private SiteNode loadKernel() {
|
||||
// Create Root Site Node
|
||||
|
|
@ -454,28 +451,13 @@ public class CoreLoader extends PackageLoader {
|
|||
|
||||
}
|
||||
|
||||
// Not really used. Commented out in run() method
|
||||
// NOTE: There is no dispatcher class assoziated and no mount (i.e. no
|
||||
// site_nodes entry creeated).
|
||||
// Update script 6.6.3 - 6.6.4 removes entries.
|
||||
/*
|
||||
private void loadBebop() {
|
||||
// Create Package Types and Instances
|
||||
|
||||
PackageType bebop = PackageType.create
|
||||
("bebop", "Bebop", "Bebops",
|
||||
"http://arsdigita.com/bebop/");
|
||||
bebop.createInstance("Bebop Service");
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Setup Login application. Loads type into database and instances the
|
||||
* single default instance.
|
||||
* Has to be public access in order to enable script Upgrade664 to use it.
|
||||
* @return
|
||||
*/
|
||||
private Application loadLoginApp() {
|
||||
public static void loadLoginApp() {
|
||||
|
||||
ApplicationType loginType =
|
||||
new ApplicationType("login",
|
||||
|
|
@ -490,20 +472,15 @@ public class CoreLoader extends PackageLoader {
|
|||
null);
|
||||
login.setDescription("CCM login instance");
|
||||
|
||||
return login;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* Setup core Admin application. Loads type into database and instances the
|
||||
* single default instance.
|
||||
* Has to be public access in order to enable script Upgrade664 to use it.
|
||||
*/
|
||||
private Application loadAdminApp() {
|
||||
// ApplicationType adminType = ApplicationType
|
||||
// .createApplicationType("admin",
|
||||
// "CCM Admin Application",
|
||||
// Admin.BASE_DATA_OBJECT_TYPE);
|
||||
// adminType.setDispatcherClass("com.arsdigita.ui.admin.AdminDispatcher");
|
||||
public static void loadAdminApp() {
|
||||
|
||||
ApplicationType adminType =
|
||||
new ApplicationType("admin",
|
||||
|
|
@ -512,52 +489,18 @@ public class CoreLoader extends PackageLoader {
|
|||
adminType.save();
|
||||
|
||||
|
||||
|
||||
|
||||
Application admin = Application.createApplication(adminType,
|
||||
"admin",
|
||||
"CCM Admin",
|
||||
null);
|
||||
admin.setDescription("CCM user and group administration instance");
|
||||
|
||||
return admin;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
private void loadSiteMapAdminApp(Application parent) {
|
||||
|
||||
// ApplicationType sitemapType = ApplicationType
|
||||
// .createApplicationType("sitemap",
|
||||
// "SiteMap Admin Application",
|
||||
// SiteMap.BASE_DATA_OBJECT_TYPE);
|
||||
// sitemapType.setDispatcherClass("com.arsdigita.ui.sitemap.SiteMapDispatcher");
|
||||
|
||||
/* 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: "Sitemap" will become "sitemap".
|
||||
*/
|
||||
ApplicationType sitemapType =
|
||||
new ApplicationType("Sitemap",
|
||||
SiteMap.BASE_DATA_OBJECT_TYPE );
|
||||
|
||||
sitemapType.setDescription("CCM sitemap administration");
|
||||
|
||||
Application sitemap = Application.createApplication(sitemapType,
|
||||
"sitemap",
|
||||
"CCM Admin Sitemap",
|
||||
parent);
|
||||
sitemap.setDescription("CCM sitemap administration instance");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Setup core Admin application. Loads type into database and instances the
|
||||
* single default instance.
|
||||
* Has to be public access in order to enable script Upgrade664 to use it.
|
||||
*/
|
||||
public static void loadPermissionsApp() {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2004 Red Hat Inc. 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.ui.sitemap;
|
||||
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Sitemap administration application. Currently a trivial
|
||||
* subclass of com.arsdigita.web.Application
|
||||
* @see com.arsdigita.web.Application
|
||||
*/
|
||||
public class SiteMap extends Application {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(SiteMap.class);
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.ui.sitemap.SiteMap";
|
||||
|
||||
public SiteMap(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public SiteMap(OID oid)
|
||||
throws DataObjectNotFoundException {
|
||||
|
||||
super(oid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter to retrieve the base database object type name
|
||||
*
|
||||
* @return base data aoject type as String
|
||||
*/
|
||||
@Override
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServletPath() {
|
||||
return "/admin-sitemap";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Red Hat Inc. 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.ui.sitemap;
|
||||
|
||||
|
||||
import com.arsdigita.ui.util.GlobalizationUtil ;
|
||||
|
||||
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||
import com.arsdigita.bebop.SplitPanel;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageFactory;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.kernel.SiteNode;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Dispatcher for SiteMap Admin functionality
|
||||
*
|
||||
* @version $Id: SiteMapDispatcher.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class SiteMapDispatcher extends BebopMapDispatcher {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SiteMapDispatcher.class);
|
||||
|
||||
static final String SEARCH_KEY = "search";
|
||||
|
||||
/**
|
||||
* Constructor. Instantiates the subsite url/page mapping.
|
||||
*/
|
||||
public SiteMapDispatcher() {
|
||||
super();
|
||||
|
||||
s_log.debug("Construct SiteMapDispatcher");
|
||||
|
||||
Map m = new HashMap();
|
||||
m.put("", buildAdminPage());
|
||||
m.put("denied", buildDeniedPage());
|
||||
setMap(m);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* @param req
|
||||
* @param resp
|
||||
* @param ctx
|
||||
* @throws IOException
|
||||
* @throws javax.servlet.ServletException
|
||||
*/
|
||||
public void dispatch(HttpServletRequest req,
|
||||
HttpServletResponse resp,
|
||||
RequestContext ctx)
|
||||
throws IOException, javax.servlet.ServletException {
|
||||
/**
|
||||
* Authenicate user.
|
||||
*/
|
||||
String requestURI = Web.getContext().getRequestURL().getRequestURI();
|
||||
|
||||
if (requestURI.endsWith("/denied")) {
|
||||
super.dispatch(req, resp, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
UserContext userCtx = Web.getUserContext();
|
||||
|
||||
// If the user is not logged in, then redirect to the log in page.
|
||||
|
||||
if (!userCtx.isLoggedIn()) {
|
||||
throw new LoginSignal(req);
|
||||
} else {
|
||||
// Check if user has an admin privilege.
|
||||
String processedURL = ctx.getProcessedURLPart();
|
||||
|
||||
SiteNode node;
|
||||
|
||||
node = SiteNode.getSiteNode(processedURL);
|
||||
|
||||
User user = userCtx.getUser();
|
||||
|
||||
if (user == null) {
|
||||
throw new RuntimeException("User does not exist");
|
||||
}
|
||||
|
||||
PermissionDescriptor admin = new PermissionDescriptor
|
||||
(PrivilegeDescriptor.ADMIN, node, user);
|
||||
|
||||
// Turn off caching for everything...
|
||||
DispatcherHelper.cacheDisable(resp);
|
||||
|
||||
if (PermissionService.checkPermission(admin)) {
|
||||
super.dispatch(req, resp, ctx);
|
||||
} else {
|
||||
final URL url = URL.there(req, node.getURL() + "denied");
|
||||
|
||||
throw new RedirectSignal(url, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Access Denied" page for the SiteMap.
|
||||
*/
|
||||
private Page buildDeniedPage() {
|
||||
Page p = PageFactory.buildPage("admin",
|
||||
new Label(new GlobalizedMessage
|
||||
("ui.admin.dispatcher.accessDenied",
|
||||
"com.arsdigita.ui.admin.AdminResources" )));
|
||||
|
||||
Label label = new Label(GlobalizationUtil.globalize(
|
||||
"ui.sitemap.access_denied_to_sitemap"));
|
||||
label.setClassAttr("AccessDenied");
|
||||
p.add(label);
|
||||
|
||||
p.lock();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin Page for the SiteMap application
|
||||
* @return
|
||||
*/
|
||||
private Page buildAdminPage() {
|
||||
Page p = PageFactory.buildPage("admin", "Sitemap Administration");
|
||||
|
||||
SiteListing listing = new SiteListing();
|
||||
listing.setClassAttr("navbar");
|
||||
|
||||
SingleSelectionModel m = listing.getTree().getSelectionModel();
|
||||
SiteMapAdminPane details = new SiteMapAdminPane(m, listing.getCFGLink());
|
||||
|
||||
BoxPanel box = new BoxPanel();
|
||||
box.setClassAttr("main");
|
||||
box.add(details);
|
||||
|
||||
SplitPanel panel = new SplitPanel();
|
||||
panel.setClassAttr("sidebarNavPanel");
|
||||
panel.setLeftComponent(listing);
|
||||
panel.setRightComponent(box);
|
||||
|
||||
p.add(panel);
|
||||
p.lock();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
/*
|
||||
* 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.ui.sitemap;
|
||||
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageFactory;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.SplitPanel;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
import com.arsdigita.dispatcher.AccessDeniedException;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.BaseApplicationServlet;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Core admin SiteMap 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 SiteMapServlet extends BaseApplicationServlet {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SiteMapServlet.class.getName());
|
||||
|
||||
/** URL (pathinfo) -> Page object mapping. Based on it (and the http
|
||||
* request url) the doService method to selects a page to display */
|
||||
private final Map m_pages = new HashMap();
|
||||
|
||||
|
||||
/**
|
||||
* User extension point, overwrite this method to setup a URL - page mapping
|
||||
*
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Override
|
||||
public void doInit() throws ServletException {
|
||||
|
||||
addPage("/", buildAdminIndexPage()); // index page at address ~/ds
|
||||
// addPage("/index.jsp", buildIndexPage()); // index page at address ~/ds
|
||||
|
||||
// addPage("/log4j", buildLog4jPage()); // Logger Adjuster at addr. ~/ds/log4j
|
||||
// addPage("/config", buildConfigPage()); // config browser @ ~/ds/config
|
||||
// cache table browser @ ~/ds/cache-table
|
||||
// addPage("/cache-table", buildCacheTablePage());
|
||||
|
||||
// XXXX!!
|
||||
// QueryLog is a class of its own in webdevsupport, based upon
|
||||
// dispatcher.Disp and prints out all queries in a request
|
||||
// put("query-log", new QueryLog());
|
||||
|
||||
// addPage("/request-info", buildRequestInfoPage());
|
||||
// addPage("/query-info", buildQueryInfoPage());
|
||||
// addPage("/query-plan", buildQueryPlanPage());
|
||||
|
||||
}
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
|
||||
|
||||
// /////// Some preparational steps ///////////////
|
||||
|
||||
/* Determine access privilege: only logged in users may access DS */
|
||||
Party party = Kernel.getContext().getParty();
|
||||
if (party == null) {
|
||||
throw new LoginSignal(sreq);
|
||||
}
|
||||
/* Determine access privilege: Admin privileges must be granted */
|
||||
PermissionDescriptor admin = new PermissionDescriptor
|
||||
(PrivilegeDescriptor.ADMIN, app, party);
|
||||
if (!PermissionService.checkPermission(admin)) {
|
||||
throw new AccessDeniedException("User is not an administrator");
|
||||
}
|
||||
/* Want admin to always show the latest stuff... */
|
||||
DispatcherHelper.cacheDisable(sresp);
|
||||
|
||||
|
||||
// /////// Everything OK here - DO IT ///////////////
|
||||
|
||||
String pathInfo = sreq.getPathInfo();
|
||||
Assert.exists(pathInfo, "String pathInfo");
|
||||
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
|
||||
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
|
||||
* start with a '/' character. It currently carries a
|
||||
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
|
||||
* result of a servlet mapping. But Application requires url
|
||||
* NOT to end with a trailing '/' for legacy free applications. */
|
||||
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
|
||||
}
|
||||
|
||||
final Page page = (Page) m_pages.get(pathInfo);
|
||||
|
||||
if (page != null) {
|
||||
|
||||
final Document doc = page.buildDocument(sreq, sresp);
|
||||
|
||||
PresentationManager pm = Templating.getPresentationManager();
|
||||
pm.servePage(doc, sreq, sresp);
|
||||
|
||||
} else {
|
||||
|
||||
sresp.sendError(404, "No such page for path " + pathInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one Url-Page mapping to the internal mapping table.
|
||||
*
|
||||
* @param pathInfo url stub for a page to display
|
||||
* @param page Page object to display
|
||||
*/
|
||||
private void addPage(final String pathInfo, final Page page) {
|
||||
|
||||
Assert.exists(pathInfo, String.class);
|
||||
Assert.exists(page, Page.class);
|
||||
// Current Implementation requires pathInfo to start with a leading '/'
|
||||
// SUN Servlet API specifies: "PathInfo *may be empty* or will start
|
||||
// with a '/' character."
|
||||
Assert.isTrue(pathInfo.startsWith("/"), "path starts not with '/'");
|
||||
|
||||
m_pages.put(pathInfo, page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index Page for the SiteMap application
|
||||
* @return
|
||||
*/
|
||||
private Page buildAdminIndexPage() {
|
||||
|
||||
Page p = PageFactory.buildPage("admin", "Sitemap Administration");
|
||||
|
||||
SiteListing listing = new SiteListing();
|
||||
listing.setClassAttr("navbar");
|
||||
|
||||
SingleSelectionModel m = listing.getTree().getSelectionModel();
|
||||
SiteMapAdminPane details = new SiteMapAdminPane(m, listing.getCFGLink());
|
||||
|
||||
BoxPanel box = new BoxPanel();
|
||||
box.setClassAttr("main");
|
||||
box.add(details);
|
||||
|
||||
SplitPanel panel = new SplitPanel();
|
||||
panel.setClassAttr("sidebarNavPanel");
|
||||
panel.setLeftComponent(listing);
|
||||
panel.setRightComponent(box);
|
||||
|
||||
p.add(panel);
|
||||
p.lock();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -133,11 +133,6 @@
|
|||
<servlet-class>com.arsdigita.ui.admin.AdminServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>webadmin-sitemap</servlet-name>
|
||||
<servlet-class>com.arsdigita.ui.sitemap.SiteMapServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>webadmin-permissions</servlet-name>
|
||||
<servlet-class>com.arsdigita.ui.permissions.PermissionsServlet</servlet-class>
|
||||
|
|
@ -495,11 +490,6 @@
|
|||
<url-pattern>/admin/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>webadmin-sitemap</servlet-name>
|
||||
<url-pattern>/admin-sitemap/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>webadmin-permissions</servlet-name>
|
||||
<url-pattern>/admin-permissions/*</url-pattern>
|
||||
|
|
|
|||
|
|
@ -133,11 +133,6 @@
|
|||
<servlet-class>com.arsdigita.ui.admin.AdminServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>webadmin-sitemap</servlet-name>
|
||||
<servlet-class>com.arsdigita.ui.sitemap.SiteMapServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>webadmin-permissions</servlet-name>
|
||||
<servlet-class>com.arsdigita.ui.permissions.PermissionsServlet</servlet-class>
|
||||
|
|
@ -479,11 +474,6 @@
|
|||
<url-pattern>/admin/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>webadmin-sitemap</servlet-name>
|
||||
<url-pattern>/admin-sitemap/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>webadmin-permissions</servlet-name>
|
||||
<url-pattern>/admin-permissions/*</url-pattern>
|
||||
|
|
|
|||
Loading…
Reference in New Issue