Installation developerSupport umgestellt von package-based auf (legacy-compatible) web.Application based, Voraussetzung für Umstellung auf legacy free application. Update Skript im Moment noch nicht erforderlich. Ansonsten verschiedene Formatierungen, Kleinigkeiten, etc.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1511 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
16fedf169b
commit
f459b079b9
|
|
@ -44,7 +44,7 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class Service extends Application {
|
public class Service extends Application {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
private static final Logger s_log = Logger.getLogger(Service.class);
|
||||||
|
|
||||||
// pdl stuff (constants)
|
// pdl stuff (constants)
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,313 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012 Peter Boy 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;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.dispatcher.ResourceHandler;
|
||||||
|
import com.arsdigita.cms.dispatcher.SimpleCache;
|
||||||
|
import com.arsdigita.developersupport.DeveloperSupport;
|
||||||
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
|
import com.arsdigita.dispatcher.RequestContext;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
import com.arsdigita.web.ApplicationFileResolver;
|
||||||
|
import com.arsdigita.web.BaseApplicationServlet;
|
||||||
|
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
import com.arsdigita.xml.XML;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CMS Service application servlet serves all request made for the CMS
|
||||||
|
* service application.
|
||||||
|
*
|
||||||
|
* URLs of the available services are stored in a XML file which is processed
|
||||||
|
* into a cache of services on a request by request basis (lazy loading).
|
||||||
|
*
|
||||||
|
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||||
|
* @version $Id: WorkspaceServlet.java 2161 2011-02-02 00:16:13Z pboy $
|
||||||
|
*/
|
||||||
|
public class ServiceServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
|
/**Error logging */
|
||||||
|
private static Logger s_log = Logger
|
||||||
|
.getLogger(ServiceServlet.class.getName());
|
||||||
|
|
||||||
|
|
||||||
|
/** The path of the file that maps resources (relative urls - corresponding
|
||||||
|
* class names). */
|
||||||
|
private final static String MAP_FILE = "WEB-INF/resources/cms-service-map.xml";
|
||||||
|
|
||||||
|
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
|
||||||
|
private static HashMap s_pageClasses = new HashMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiated ResourceHandler cache. This allows for lazy loading.
|
||||||
|
*/
|
||||||
|
private static SimpleCache s_pages = new SimpleCache();
|
||||||
|
|
||||||
|
/** List of URLs which require a trailing slash. These are required for
|
||||||
|
* creating virtual directories, so that relative URLs and redirects
|
||||||
|
* work. */
|
||||||
|
private ArrayList m_trailingSlashList = new ArrayList();
|
||||||
|
|
||||||
|
/** Path to directory containg ccm-cms template files */
|
||||||
|
private String m_templatePath;
|
||||||
|
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
|
||||||
|
private ApplicationFileResolver m_resolver;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use parent's class initialization extension point to perform additional
|
||||||
|
* initialisation tasks.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void doInit() {
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.info("starting doInit method");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize List with an empty URL. Later URL's are added which are
|
||||||
|
* provided w/o trailing slash rsp. file extension. */
|
||||||
|
requireTrailingSlash("");
|
||||||
|
|
||||||
|
/* Process mapping file. */
|
||||||
|
readFromFile(MAP_FILE);
|
||||||
|
|
||||||
|
m_templatePath = ContentSection.getConfig().getTemplateRoot();
|
||||||
|
Assert.exists(m_templatePath, String.class);
|
||||||
|
Assert.isTrue(m_templatePath.startsWith("/"),
|
||||||
|
"template-path must start with '/'");
|
||||||
|
Assert.isTrue(!m_templatePath.endsWith("/"),
|
||||||
|
"template-path must not end with '/'");
|
||||||
|
m_resolver = Web.getConfig().getApplicationFileResolver();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements the (abstract) doService method of BaseApplicationServlet to
|
||||||
|
* create the Worspace page.
|
||||||
|
*
|
||||||
|
* @see com.arsdigita.web.BaseApplicationServlet#doService
|
||||||
|
* (HttpServletRequest, HttpServletResponse, Application)
|
||||||
|
*/
|
||||||
|
protected void doService( HttpServletRequest sreq,
|
||||||
|
HttpServletResponse sresp,
|
||||||
|
Application app)
|
||||||
|
throws ServletException, IOException {
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.info("starting doService method");
|
||||||
|
}
|
||||||
|
DeveloperSupport.startStage("ServiceServlet.doService");
|
||||||
|
|
||||||
|
Service service = (Service) app;
|
||||||
|
|
||||||
|
RequestContext ctx = DispatcherHelper.getRequestContext();
|
||||||
|
String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext
|
||||||
|
String originalUrl = ctx.getOriginalURL();
|
||||||
|
String requestUri = sreq.getRequestURI();
|
||||||
|
|
||||||
|
// An empty remaining URL or a URL which doesn't end in trailing slash:
|
||||||
|
// probably want to redirect.
|
||||||
|
if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) {
|
||||||
|
DispatcherHelper.sendRedirect(sresp, originalUrl + "/");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check user access.
|
||||||
|
// Deprecated and here implemented as a No-OP method!
|
||||||
|
/* heckUserAccess(request, response, actx); */
|
||||||
|
|
||||||
|
ResourceHandler page = getResource(url);
|
||||||
|
if ( page != null ) {
|
||||||
|
// Serve the page.
|
||||||
|
page.init();
|
||||||
|
page.dispatch(sreq, sresp, ctx);
|
||||||
|
} else {
|
||||||
|
// Fall back on the JSP application dispatcher.
|
||||||
|
// m_notFoundHandler.dispatch(request, response, actx);
|
||||||
|
if (s_log.isInfoEnabled()) {
|
||||||
|
s_log.info("NOT serving content item");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store content section in http request to make it available
|
||||||
|
* or admin index,jsp */
|
||||||
|
// sreq.setAttribute(CONTENT_SECTION, section);
|
||||||
|
|
||||||
|
RequestDispatcher rd = m_resolver.resolve(m_templatePath,
|
||||||
|
sreq, sresp, app);
|
||||||
|
if (rd != null) {
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.debug("Got dispatcher " + rd);
|
||||||
|
}
|
||||||
|
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
||||||
|
rd.forward(sreq,sresp);
|
||||||
|
} else {
|
||||||
|
// sresp.sendError(404, packageURL + " not found on this server.");
|
||||||
|
sresp.sendError(404, requestUri + " not found on this server.");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DeveloperSupport.endStage("ServiceServlet.doService");
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.info("doService method completed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch a page based on the URL stub.
|
||||||
|
*
|
||||||
|
* @param url The URL stub following the site-node URL
|
||||||
|
* @return A ResourceHandler or null if none exists.
|
||||||
|
* @pre (url != null)
|
||||||
|
*/
|
||||||
|
protected ResourceHandler getResource(String url) throws ServletException {
|
||||||
|
|
||||||
|
// First check the pages cache for existing pages.
|
||||||
|
ResourceHandler page = (ResourceHandler) s_pages.get(url);
|
||||||
|
if ( page == null ) {
|
||||||
|
|
||||||
|
// Next check if the URL maps to a page class.
|
||||||
|
String pageClassName = (String) s_pageClasses.get(url);
|
||||||
|
if ( pageClassName != null ) {
|
||||||
|
|
||||||
|
Class pageClass;
|
||||||
|
try {
|
||||||
|
pageClass = Class.forName(pageClassName);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
s_log.error("error fetching class for ResourceHandler", e);
|
||||||
|
throw new ServletException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try and instantiate the page.
|
||||||
|
try {
|
||||||
|
page = (ResourceHandler) pageClass.newInstance();
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
s_log.error("error instantiating a ResourceHandler", e);
|
||||||
|
throw new ServletException(e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
s_log.error("error instantiating a ResourceHandler", e);
|
||||||
|
throw new ServletException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
page.init();
|
||||||
|
s_pages.put(url, page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Initializes URL-to-Page/Dispatcher/Servlet mappings from a file.
|
||||||
|
*
|
||||||
|
* Format of the file is XML:
|
||||||
|
* <pre>
|
||||||
|
* <dispatcher-configuration>
|
||||||
|
* <url-mapping
|
||||||
|
* <url>my-page</url>
|
||||||
|
* OR <page-class>com.arsdigita.Page.class</page-class>
|
||||||
|
* <url-mapping
|
||||||
|
* </dispatcher-configuration>
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
private void readFromFile(final String file) {
|
||||||
|
|
||||||
|
// XML.parseResource(file, newParseConfigHandler(s_pageClasses));
|
||||||
|
XML.parseResource(file, new PageClassConfigHandler(s_pageClasses));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a URL to the list of URLs that are required to have trailing
|
||||||
|
* slashes. A request for url will be redirected to url + "/"
|
||||||
|
* if the original URL request (what you see in your browser)
|
||||||
|
* doesn't include a trailing slash. This is required for
|
||||||
|
* creating virtual directories, so that relative URLs and redirects
|
||||||
|
* work.
|
||||||
|
*/
|
||||||
|
public void requireTrailingSlash(String url) {
|
||||||
|
m_trailingSlashList.add(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a SAX event handler object for setting up a MapDispatcher
|
||||||
|
* using an XML config file.
|
||||||
|
* @param map A map to configure
|
||||||
|
* @return a SAX DefaultHandler object for handling SAX events
|
||||||
|
* @pre md.m_map != null
|
||||||
|
*/
|
||||||
|
// protected DefaultHandler newParseConfigHandler(Map map) {
|
||||||
|
// return new PageClassConfigHandler(map);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* SAX event handler class for parsing configuration file.
|
||||||
|
*/
|
||||||
|
protected static class PageClassConfigHandler extends DefaultHandler {
|
||||||
|
|
||||||
|
private Map m_map;
|
||||||
|
private StringBuffer m_buffer;
|
||||||
|
private String m_url;
|
||||||
|
private String m_className;
|
||||||
|
|
||||||
|
public PageClassConfigHandler(Map map) {
|
||||||
|
m_map = map;
|
||||||
|
m_buffer = new StringBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void characters(char[] ch, int start, int len) {
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
m_buffer.append(ch[start + i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endElement(String uri, String localName, String qn) {
|
||||||
|
if ( qn.equals("url") ) {
|
||||||
|
m_url = m_buffer.toString().trim();
|
||||||
|
} else if ( qn.equals("page-class") ) {
|
||||||
|
m_className = m_buffer.toString().trim();
|
||||||
|
} else if ( qn.equals("url-mapping") ) {
|
||||||
|
m_map.put(m_url, m_className);
|
||||||
|
}
|
||||||
|
m_buffer = new StringBuffer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -94,7 +94,7 @@ public class WorkspaceServlet extends BaseApplicationServlet {
|
||||||
|
|
||||||
DeveloperSupport.endStage("ContentCenterServlet.doService");
|
DeveloperSupport.endStage("ContentCenterServlet.doService");
|
||||||
if (s_log.isDebugEnabled()) {
|
if (s_log.isDebugEnabled()) {
|
||||||
s_log.info("doService method competed");
|
s_log.info("doService method completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class ServiceDispatcher extends LockableImpl implements Dispatcher {
|
||||||
public ServiceDispatcher() {
|
public ServiceDispatcher() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
m_trailingSlashList = new ArrayList();
|
// m_trailingSlashList = new ArrayList();
|
||||||
requireTrailingSlash("");
|
requireTrailingSlash("");
|
||||||
|
|
||||||
setNotFoundDispatcher(JSPApplicationDispatcher.getInstance());
|
setNotFoundDispatcher(JSPApplicationDispatcher.getInstance());
|
||||||
|
|
@ -130,7 +130,8 @@ public class ServiceDispatcher extends LockableImpl implements Dispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check user access.
|
// Check user access.
|
||||||
checkUserAccess(request, response, actx);
|
// Deprecated and here implemented as a No-OP method!
|
||||||
|
/* heckUserAccess(request, response, actx); */
|
||||||
|
|
||||||
ResourceHandler page = getResource(url);
|
ResourceHandler page = getResource(url);
|
||||||
if ( page != null ) {
|
if ( page != null ) {
|
||||||
|
|
@ -267,7 +268,7 @@ public class ServiceDispatcher extends LockableImpl implements Dispatcher {
|
||||||
*
|
*
|
||||||
* @exception ServletException If there is an exception thrown while
|
* @exception ServletException If there is an exception thrown while
|
||||||
* trying to redirect, wrap that exception in a ServletException
|
* trying to redirect, wrap that exception in a ServletException
|
||||||
**/
|
*/
|
||||||
protected void redirectToLoginPage(HttpServletRequest req,
|
protected void redirectToLoginPage(HttpServletRequest req,
|
||||||
HttpServletResponse resp)
|
HttpServletResponse resp)
|
||||||
throws ServletException {
|
throws ServletException {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2011 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
|
||||||
|
//
|
||||||
|
// $Id: WebDevSupport.pdl 1230 2012-02-22 11:50:59Z pboy $
|
||||||
|
// $DateTime: 2012/02/16 18:10:38 $
|
||||||
|
|
||||||
|
model com.arsdigita.webdevsupport;
|
||||||
|
|
||||||
|
import com.arsdigita.web.Application;
|
||||||
|
|
||||||
|
object type WebDevSupport extends Application {
|
||||||
|
// nothing to persist yet
|
||||||
|
// reference key (webdevsupport.application_id);
|
||||||
|
}
|
||||||
|
|
@ -52,6 +52,7 @@ import com.arsdigita.search.converter.OOConverter;
|
||||||
import com.arsdigita.search.converter.WordConverter;
|
import com.arsdigita.search.converter.WordConverter;
|
||||||
import com.arsdigita.search.converter.TextConverter;
|
import com.arsdigita.search.converter.TextConverter;
|
||||||
|
|
||||||
|
import com.arsdigita.webdevsupport.WebDevSupport;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -138,6 +139,17 @@ public class Initializer extends CompoundInitializer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* domain.ReflectionInstantiator instantiator for
|
||||||
|
* dataObject com.arsdigita.webdevsupport.WebDevSupport */
|
||||||
|
e.getFactory().registerInstantiator
|
||||||
|
(WebDevSupport.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new ACSObjectInstantiator() {
|
||||||
|
@Override
|
||||||
|
public DomainObject doNewInstance(final DataObject data) {
|
||||||
|
return new WebDevSupport(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
e.getFactory().registerInstantiator
|
e.getFactory().registerInstantiator
|
||||||
(Admin.BASE_DATA_OBJECT_TYPE,
|
(Admin.BASE_DATA_OBJECT_TYPE,
|
||||||
new ACSObjectInstantiator() {
|
new ACSObjectInstantiator() {
|
||||||
|
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The value of this class lies in its fairly unpredictable call tree.
|
|
||||||
*
|
|
||||||
* <p>This program expects sequences of 0 and 1 as input. Each such sequence is
|
|
||||||
* reduced by the application of the rules:</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* Rule 1. 0xyS --> S00
|
|
||||||
* Rule 2. 1xyS --> S1101
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* <p>where <code>x</code> and <code>y</code> can be any binary digit, and
|
|
||||||
* <code>S</code> any binary sequence, including the empty sequence.</p>
|
|
||||||
*
|
|
||||||
* <p>For example, <code>01011</code> reduces as follows</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* 01011 --> 1100 --> 01101 --> 0100 --> 000
|
|
||||||
* rule1 rule2 rule1 rule1
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* <p>Some sequences don't a finite reduction chain. For example,
|
|
||||||
* <code>1001</code> loops indefinitely.</p>
|
|
||||||
*
|
|
||||||
* <p>Usage:</p>
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* $ java PNSystem 0101 01010
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author: Vadim Nasardinov (vadimn@redhat.com)
|
|
||||||
* @since: 2004-02-12
|
|
||||||
* @version: $Id: PNSystem.java.txt 287 2005-02-22 00:29:02Z sskracic $
|
|
||||||
**/
|
|
||||||
public final class PNSystem implements Runnable {
|
|
||||||
private final String m_input;
|
|
||||||
private final Map m_visited;
|
|
||||||
private int m_rule1Count;
|
|
||||||
private int m_rule2Count;
|
|
||||||
|
|
||||||
private PNSystem(String input) {
|
|
||||||
m_input = input;
|
|
||||||
m_visited = new HashMap();
|
|
||||||
m_rule1Count = 0;
|
|
||||||
m_rule2Count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
if ( args.length==0 ) {
|
|
||||||
usage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int ii=0; ii<args.length; ii++) {
|
|
||||||
Thread tt = new Thread(new PNSystem(args[ii]));
|
|
||||||
tt.setName("thread" + ii);
|
|
||||||
tt.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void log(String str) {
|
|
||||||
System.out.println(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void usage() {
|
|
||||||
log("Usage:");
|
|
||||||
log(" java PNSystem [arg1 [arg2 ...]]");
|
|
||||||
log("Example:");
|
|
||||||
log(" java PNSystem 1000100101 0111");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
if ( checksOutOK() ) {
|
|
||||||
try {
|
|
||||||
log(Thread.currentThread().getName() + ": " +
|
|
||||||
m_input + " --> " + reduce(m_input) +
|
|
||||||
" (" + times("Rule 1", m_rule1Count) +
|
|
||||||
", " + times("Rule 2", m_rule2Count) + ".)");
|
|
||||||
} catch (StackOverflowError err) {
|
|
||||||
log("stack overflow");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String times(String rule, int count) {
|
|
||||||
return rule + " applied " + count +
|
|
||||||
(count==1 ? " time" : " times");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checksOutOK() {
|
|
||||||
String illegal =
|
|
||||||
m_input.replace('0', ' ').replace('1', ' ').trim();
|
|
||||||
if ("".equals(illegal)) { return true; }
|
|
||||||
|
|
||||||
log("Characters other than 0 or 1 are not allowed: '" +
|
|
||||||
illegal + "'");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String reduce(String str) {
|
|
||||||
final int count = m_rule1Count + m_rule2Count;
|
|
||||||
|
|
||||||
if ( m_visited.containsKey(str) ) {
|
|
||||||
Integer ordinal = (Integer) m_visited.get(str);
|
|
||||||
return "loops starting with " + str + " at position " +
|
|
||||||
count + " with a period of " +
|
|
||||||
(count - ordinal.intValue() + ".");
|
|
||||||
}
|
|
||||||
m_visited.put(str, new Integer(count));
|
|
||||||
|
|
||||||
if ( str.length() < 4 ) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( str.charAt(0) == '0' ) {
|
|
||||||
return rule1(str);
|
|
||||||
} else {
|
|
||||||
return rule2(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String rule1(String str) {
|
|
||||||
m_rule1Count++;
|
|
||||||
return reduce(str.substring(3) + "00");
|
|
||||||
}
|
|
||||||
|
|
||||||
private String rule2(String str) {
|
|
||||||
m_rule2Count++;
|
|
||||||
return reduce(str.substring(3) + "1101");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,7 +27,7 @@ import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.runtime.ContextInitEvent;
|
import com.arsdigita.runtime.ContextInitEvent;
|
||||||
import com.arsdigita.runtime.DomainInitEvent;
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
import com.arsdigita.runtime.GenericInitializer;
|
import com.arsdigita.runtime.GenericInitializer;
|
||||||
import com.arsdigita.webdevsupport.WebDevSupport;
|
import com.arsdigita.webdevsupport.WebDevSupportListener;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -170,7 +170,7 @@ public class Initializer extends GenericInitializer {
|
||||||
Boolean active = KernelConfig.getConfig().isWebdevSupportActive();
|
Boolean active = KernelConfig.getConfig().isWebdevSupportActive();
|
||||||
if (Boolean.TRUE.equals(active)) {
|
if (Boolean.TRUE.equals(active)) {
|
||||||
s_log.debug("Registering webdev listener");
|
s_log.debug("Registering webdev listener");
|
||||||
DeveloperSupport.addListener(WebDevSupport.getInstance());
|
DeveloperSupport.addListener(WebDevSupportListener.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
s_log.debug("kernel context init completed");
|
s_log.debug("kernel context init completed");
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ import com.arsdigita.web.ApplicationType;
|
||||||
import com.arsdigita.web.Host;
|
import com.arsdigita.web.Host;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
|
||||||
|
import com.arsdigita.webdevsupport.WebDevSupport;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
@ -76,6 +77,8 @@ import java.util.Map;
|
||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoreLoader
|
* CoreLoader
|
||||||
*
|
*
|
||||||
|
|
@ -260,12 +263,14 @@ public class CoreLoader extends PackageLoader {
|
||||||
|
|
||||||
s_log.debug("CoreLoader: Going to init KeyStorage.");
|
s_log.debug("CoreLoader: Going to init KeyStorage.");
|
||||||
KeyStorage.KERNEL_KEY_STORE.init();
|
KeyStorage.KERNEL_KEY_STORE.init();
|
||||||
|
|
||||||
s_log.debug("CoreLoader: Going to execute loadHost().");
|
s_log.debug("CoreLoader: Going to execute loadHost().");
|
||||||
loadHost();
|
loadHost();
|
||||||
|
|
||||||
s_log.debug("CoreLoader: Going to execute loadSubsite().");
|
s_log.debug("CoreLoader: Going to execute loadSubsite().");
|
||||||
loadSubsite(loadKernel());
|
loadSubsite(loadKernel());
|
||||||
s_log.debug("CoreLoader: Going to execute loadBebop().");
|
// !! s_log.debug("CoreLoader: Going to execute loadBebop().");
|
||||||
loadBebop();
|
// !! loadBebop();
|
||||||
s_log.debug("CoreLoader: Going to execute loadWebDev().");
|
s_log.debug("CoreLoader: Going to execute loadWebDev().");
|
||||||
loadWebDev();
|
loadWebDev();
|
||||||
s_log.debug("CoreLoader: Going to execute loadSiteMapAdminApp().");
|
s_log.debug("CoreLoader: Going to execute loadSiteMapAdminApp().");
|
||||||
|
|
@ -278,6 +283,7 @@ public class CoreLoader extends PackageLoader {
|
||||||
loadMimeTypes();
|
loadMimeTypes();
|
||||||
s_log.debug("CoreLoader: Going to execute loadGlobalization().");
|
s_log.debug("CoreLoader: Going to execute loadGlobalization().");
|
||||||
loadGlobalization();
|
loadGlobalization();
|
||||||
|
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
s_log.debug("CoreLoader run method completed.");
|
s_log.debug("CoreLoader run method completed.");
|
||||||
|
|
@ -314,8 +320,33 @@ public class CoreLoader extends PackageLoader {
|
||||||
//--com.arsdigita.search.lucene.LegacyInitializer.LOADER.load();
|
//--com.arsdigita.search.lucene.LegacyInitializer.LOADER.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadSubsite(SiteNode rootNode) {
|
||||||
|
s_log.debug("CoreLoader: Going to execute method loadSubsite().");
|
||||||
|
String sDispatcher = "";
|
||||||
|
|
||||||
|
PackageInstance packageInstance = rootNode.getPackageInstance();
|
||||||
|
if (packageInstance == null) {
|
||||||
|
throw new IllegalStateException
|
||||||
|
("No package instance mounted at the root node");
|
||||||
|
}
|
||||||
|
PackageType subsite = packageInstance.getType();
|
||||||
|
|
||||||
|
// getType() returns a disconnected object. To get a connected object
|
||||||
|
// we do a findByKey(key).
|
||||||
|
String packageKey = subsite.getKey();
|
||||||
|
try {
|
||||||
|
subsite = PackageType.findByKey(packageKey);
|
||||||
|
} catch (DataObjectNotFoundException e) {
|
||||||
|
throw new IllegalStateException
|
||||||
|
("Package Type with key \"" + packageKey + "\" was not found.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set subsite dispatcher class.
|
||||||
|
subsite.setDispatcherClass(getDispatcher());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Root Site Node
|
* Create Root Site Node for loadSubsite()
|
||||||
* @return root node
|
* @return root node
|
||||||
*/
|
*/
|
||||||
private SiteNode loadKernel() {
|
private SiteNode loadKernel() {
|
||||||
|
|
@ -341,9 +372,12 @@ public class CoreLoader extends PackageLoader {
|
||||||
return rootNode;
|
return rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that at least one User with universal "admin" permission
|
|
||||||
// exists after installation.
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure that at least one User with universal "admin" permission exists
|
||||||
|
* after installation.
|
||||||
|
*/
|
||||||
private void createSystemAdministrator() {
|
private void createSystemAdministrator() {
|
||||||
s_log.debug("CoreLoader: execution of method createSystemAdministrator().");
|
s_log.debug("CoreLoader: execution of method createSystemAdministrator().");
|
||||||
final String DO_NOT_CREATE = "*do not create*";
|
final String DO_NOT_CREATE = "*do not create*";
|
||||||
|
|
@ -405,31 +439,8 @@ public class CoreLoader extends PackageLoader {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSubsite(SiteNode rootNode) {
|
// Not really used. Commented out in run() method
|
||||||
s_log.debug("CoreLoader: Going to execute method loadSubsite().");
|
/*
|
||||||
String sDispatcher = "";
|
|
||||||
|
|
||||||
PackageInstance packageInstance = rootNode.getPackageInstance();
|
|
||||||
if (packageInstance == null) {
|
|
||||||
throw new IllegalStateException
|
|
||||||
("No package instance mounted at the root node");
|
|
||||||
}
|
|
||||||
PackageType subsite = packageInstance.getType();
|
|
||||||
|
|
||||||
// getType() returns a disconnected object. To get a connected object
|
|
||||||
// we do a findByKey(key).
|
|
||||||
String packageKey = subsite.getKey();
|
|
||||||
try {
|
|
||||||
subsite = PackageType.findByKey(packageKey);
|
|
||||||
} catch (DataObjectNotFoundException e) {
|
|
||||||
throw new IllegalStateException
|
|
||||||
("Package Type with key \"" + packageKey + "\" was not found.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set subsite dispatcher class.
|
|
||||||
subsite.setDispatcherClass(getDispatcher());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadBebop() {
|
private void loadBebop() {
|
||||||
// Create Package Types and Instances
|
// Create Package Types and Instances
|
||||||
|
|
||||||
|
|
@ -439,9 +450,11 @@ public class CoreLoader extends PackageLoader {
|
||||||
bebop.createInstance("Bebop Service");
|
bebop.createInstance("Bebop Service");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private void loadWebDev() {
|
private void loadWebDev() {
|
||||||
// Add the package type to the database
|
// Add the package type to the database
|
||||||
|
/*
|
||||||
PackageType packType = PackageType.create
|
PackageType packType = PackageType.create
|
||||||
("webdev-support", "WebDeveloper Support", "WebDeveloper Supports",
|
("webdev-support", "WebDeveloper Support", "WebDeveloper Supports",
|
||||||
"http://arsdigita.com/webdev-support");
|
"http://arsdigita.com/webdev-support");
|
||||||
|
|
@ -453,6 +466,25 @@ public class CoreLoader extends PackageLoader {
|
||||||
|
|
||||||
// Map the package type to a dispatcher class
|
// Map the package type to a dispatcher class
|
||||||
packType.setDispatcherClass("com.arsdigita.webdevsupport.Dispatcher");
|
packType.setDispatcherClass("com.arsdigita.webdevsupport.Dispatcher");
|
||||||
|
*/
|
||||||
|
ApplicationType webDevType = ApplicationType
|
||||||
|
.createApplicationType("webdev-support",
|
||||||
|
"WebDeveloper Support",
|
||||||
|
WebDevSupport.BASE_DATA_OBJECT_TYPE);
|
||||||
|
webDevType.setDispatcherClass("com.arsdigita.webdevsupport.Dispatcher");
|
||||||
|
webDevType.setDescription("WebDeveloper Support application");
|
||||||
|
webDevType.save();
|
||||||
|
|
||||||
|
Application webDev = Application.createApplication(webDevType,
|
||||||
|
"ds",
|
||||||
|
"WebDeveloper Support",
|
||||||
|
null);
|
||||||
|
webDev.setDescription("The default WEB developer service instance.");
|
||||||
|
webDev.save();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Application loadAdminApp() {
|
private Application loadAdminApp() {
|
||||||
|
|
@ -511,11 +543,6 @@ public class CoreLoader extends PackageLoader {
|
||||||
* Load core's basic portal infrastructure.
|
* Load core's basic portal infrastructure.
|
||||||
*/
|
*/
|
||||||
private void loadPortal() {
|
private void loadPortal() {
|
||||||
/* Portal now legacy free. To be deleted when transistion is completed.
|
|
||||||
s_log.info("Adding package type: portal");
|
|
||||||
PackageType packageType = PackageType.create
|
|
||||||
("portal", "Portal", "Portals", "http://arsdigita.com/portal");
|
|
||||||
*/
|
|
||||||
s_log.info("Adding resource type: portal");
|
s_log.info("Adding resource type: portal");
|
||||||
// ResourceType manages the entries in table application_types and
|
// ResourceType manages the entries in table application_types and
|
||||||
// therefore actually creates a sort of new style legacy free
|
// therefore actually creates a sort of new style legacy free
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public class PermissionsDispatcher extends BebopMapDispatcher
|
||||||
Page index = buildIndexPage();
|
Page index = buildIndexPage();
|
||||||
Page single = buildItemPage();
|
Page single = buildItemPage();
|
||||||
|
|
||||||
|
// BebopMapDispatcher manages url - pages mapping
|
||||||
addPage("", index);
|
addPage("", index);
|
||||||
addPage("index", index);
|
addPage("index", index);
|
||||||
addPage("one", single);
|
addPage("one", single);
|
||||||
|
|
@ -61,6 +62,7 @@ public class PermissionsDispatcher extends BebopMapDispatcher
|
||||||
addPage("denied", buildDeniedPage());
|
addPage("denied", buildDeniedPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void preprocessRequest(HttpServletRequest req,
|
protected void preprocessRequest(HttpServletRequest req,
|
||||||
HttpServletResponse resp,
|
HttpServletResponse resp,
|
||||||
RequestContext ctx,
|
RequestContext ctx,
|
||||||
|
|
|
||||||
|
|
@ -155,13 +155,13 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
|
|
||||||
ActionLink enable = new ActionLink("Enable request logging") {
|
ActionLink enable = new ActionLink("Enable request logging") {
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
return !DeveloperSupport.containsListener(WebDevSupport.getInstance())
|
return !DeveloperSupport.containsListener(WebDevSupportListener.getInstance())
|
||||||
&& super.isVisible(state);
|
&& super.isVisible(state);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
enable.addActionListener(new ActionListener() {
|
enable.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
DeveloperSupport.addListener(WebDevSupport.getInstance());
|
DeveloperSupport.addListener(WebDevSupportListener.getInstance());
|
||||||
throw new RedirectSignal(URL.request(e.getPageState().getRequest(),
|
throw new RedirectSignal(URL.request(e.getPageState().getRequest(),
|
||||||
null), true);
|
null), true);
|
||||||
}
|
}
|
||||||
|
|
@ -172,14 +172,14 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
|
|
||||||
ActionLink disable = new ActionLink("Disable request logging") {
|
ActionLink disable = new ActionLink("Disable request logging") {
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
return DeveloperSupport.containsListener(WebDevSupport.getInstance())
|
return DeveloperSupport.containsListener(WebDevSupportListener.getInstance())
|
||||||
&& super.isVisible(state);
|
&& super.isVisible(state);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
disable.addActionListener(new ActionListener() {
|
disable.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
DeveloperSupport.removeListener(WebDevSupport.getInstance());
|
DeveloperSupport.removeListener(WebDevSupportListener.getInstance());
|
||||||
WebDevSupport.getInstance().clearRequestHistory();
|
WebDevSupportListener.getInstance().clearRequestHistory();
|
||||||
throw new RedirectSignal(URL.request(e.getPageState().getRequest(),
|
throw new RedirectSignal(URL.request(e.getPageState().getRequest(),
|
||||||
null), true);
|
null), true);
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
|
|
||||||
BoxPanel logs = new BoxPanel(BoxPanel.VERTICAL) {
|
BoxPanel logs = new BoxPanel(BoxPanel.VERTICAL) {
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
return DeveloperSupport.containsListener(WebDevSupport.getInstance())
|
return DeveloperSupport.containsListener(WebDevSupportListener.getInstance())
|
||||||
&& super.isVisible(state);
|
&& super.isVisible(state);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -196,7 +196,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
logs.add(new Label("") {
|
logs.add(new Label("") {
|
||||||
public String getLabel(PageState ps) {
|
public String getLabel(PageState ps) {
|
||||||
return "Currently storing the last " +
|
return "Currently storing the last " +
|
||||||
WebDevSupport.getInstance().getMaxRequests() + " requests";
|
WebDevSupportListener.getInstance().getMaxRequests() + " requests";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Label toggle = new Label("") {
|
Label toggle = new Label("") {
|
||||||
|
|
@ -298,7 +298,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
public TableModel makeModel(Table t, final PageState s) {
|
public TableModel makeModel(Table t, final PageState s) {
|
||||||
Integer request_id = (Integer)s.getValue(m_request_id);
|
Integer request_id = (Integer)s.getValue(m_request_id);
|
||||||
RequestInfo ri =
|
RequestInfo ri =
|
||||||
WebDevSupport.getInstance().getRequest(request_id.intValue());
|
WebDevSupportListener.getInstance().getRequest(request_id.intValue());
|
||||||
final Iterator iter = (ri == null) ? new ArrayList().iterator() :
|
final Iterator iter = (ri == null) ? new ArrayList().iterator() :
|
||||||
ri.getQueries();
|
ri.getQueries();
|
||||||
|
|
||||||
|
|
@ -483,7 +483,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
public TableModel makeModel(Table t, PageState s) {
|
public TableModel makeModel(Table t, PageState s) {
|
||||||
return new TableModel() {
|
return new TableModel() {
|
||||||
ListIterator iter =
|
ListIterator iter =
|
||||||
WebDevSupport.getInstance().getRequestsReverse();
|
WebDevSupportListener.getInstance().getRequestsReverse();
|
||||||
private RequestInfo current = null;
|
private RequestInfo current = null;
|
||||||
|
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
|
|
@ -568,7 +568,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
Integer request_id = (Integer)state.getValue(m_request_id);
|
Integer request_id = (Integer)state.getValue(m_request_id);
|
||||||
RequestInfo ri =
|
RequestInfo ri =
|
||||||
WebDevSupport.getInstance().getRequest(request_id.intValue());
|
WebDevSupportListener.getInstance().getRequest(request_id.intValue());
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
Container param_list;
|
Container param_list;
|
||||||
Container form_list;
|
Container form_list;
|
||||||
|
|
@ -679,7 +679,7 @@ public class Dispatcher extends BebopMapDispatcher {
|
||||||
Integer request_id = (Integer)state.getValue(m_query_request_id);
|
Integer request_id = (Integer)state.getValue(m_query_request_id);
|
||||||
Integer query_id = (Integer)state.getValue(m_query_id);
|
Integer query_id = (Integer)state.getValue(m_query_id);
|
||||||
RequestInfo ri =
|
RequestInfo ri =
|
||||||
WebDevSupport.getInstance().getRequest(request_id.intValue());
|
WebDevSupportListener.getInstance().getRequest(request_id.intValue());
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
QueryInfo qi = ri.getQuery(query_id.intValue());
|
QueryInfo qi = ri.getQuery(query_id.intValue());
|
||||||
if (qi != null) {
|
if (qi != null) {
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class QueryLog implements com.arsdigita.dispatcher.Dispatcher {
|
||||||
Integer request_id = (Integer)m_request_id.transformValue(req);
|
Integer request_id = (Integer)m_request_id.transformValue(req);
|
||||||
Integer query_id = (Integer)m_query_id.transformValue(req);
|
Integer query_id = (Integer)m_query_id.transformValue(req);
|
||||||
RequestInfo ri =
|
RequestInfo ri =
|
||||||
WebDevSupport.getInstance().getRequest(request_id.intValue());
|
WebDevSupportListener.getInstance().getRequest(request_id.intValue());
|
||||||
final Iterator iter = (ri == null) ? new ArrayList().iterator() :
|
final Iterator iter = (ri == null) ? new ArrayList().iterator() :
|
||||||
ri.getQueries();
|
ri.getQueries();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ class QueryPlanComponent extends com.arsdigita.bebop.SimpleContainer {
|
||||||
Integer request_id = (Integer) s.getValue(m_request_id);
|
Integer request_id = (Integer) s.getValue(m_request_id);
|
||||||
Integer query_id = (Integer) s.getValue(m_query_id);
|
Integer query_id = (Integer) s.getValue(m_query_id);
|
||||||
|
|
||||||
RequestInfo ri = WebDevSupport.getInstance().getRequest(
|
RequestInfo ri = WebDevSupportListener.getInstance().getRequest(
|
||||||
request_id.intValue()
|
request_id.intValue()
|
||||||
);
|
);
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
|
|
@ -277,7 +277,7 @@ class QueryPlanComponent extends com.arsdigita.bebop.SimpleContainer {
|
||||||
|
|
||||||
Integer request_id = (Integer) s.getValue(m_request_id);
|
Integer request_id = (Integer) s.getValue(m_request_id);
|
||||||
Integer query_id = (Integer) s.getValue(m_query_id);
|
Integer query_id = (Integer) s.getValue(m_query_id);
|
||||||
RequestInfo ri = WebDevSupport.getInstance().getRequest(
|
RequestInfo ri = WebDevSupportListener.getInstance().getRequest(
|
||||||
request_id.intValue()
|
request_id.intValue()
|
||||||
);
|
);
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
|
|
@ -294,7 +294,7 @@ class QueryPlanComponent extends com.arsdigita.bebop.SimpleContainer {
|
||||||
Integer request_id = (Integer) s.getValue(m_request_id);
|
Integer request_id = (Integer) s.getValue(m_request_id);
|
||||||
Integer query_id = (Integer) s.getValue(m_query_id);
|
Integer query_id = (Integer) s.getValue(m_query_id);
|
||||||
RequestInfo ri =
|
RequestInfo ri =
|
||||||
WebDevSupport.getInstance().getRequest(request_id.intValue());
|
WebDevSupportListener.getInstance().getRequest(request_id.intValue());
|
||||||
if (ri != null) {
|
if (ri != null) {
|
||||||
QueryInfo qi = ri.getQuery(query_id.intValue());
|
QueryInfo qi = ri.getQuery(query_id.intValue());
|
||||||
if (qi != null) {
|
if (qi != null) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
* Copyright (C) 2010 Peter Boy <pb@zes.uni-bremen.de> All Rights Reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
|
@ -16,224 +16,55 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.webdevsupport;
|
package com.arsdigita.webdevsupport;
|
||||||
|
|
||||||
import com.arsdigita.developersupport.DeveloperSupportListener;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.dispatcher.RequestEvent;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import java.util.ArrayList;
|
import com.arsdigita.persistence.OID;
|
||||||
import java.util.HashMap;
|
import com.arsdigita.web.Application;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebDevSupport
|
* Site wide Web Developer Support application domain base class simply provides
|
||||||
* DeveloperSupportListener for Web Development Support package.
|
* the infrastructure to load the application type and application instance.
|
||||||
* <p>
|
|
||||||
*
|
*
|
||||||
* </p>
|
* Currently a trivial subclass of com.arsdigita.web.Application
|
||||||
* @author Joseph A. Bank (jbank@alum.mit.edu)
|
* @see com.arsdigita.web.Application
|
||||||
* @version 1.0
|
*
|
||||||
**/
|
* @author pb
|
||||||
public class WebDevSupport extends DeveloperSupportListener {
|
* @version $Id: WebDevSupport.java $
|
||||||
public static final String versionId = "$Id: WebDevSupport.java 1460 2007-03-02 14:36:38Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
|
||||||
|
|
||||||
private static final Logger s_log =
|
|
||||||
Logger.getLogger( WebDevSupport.class );
|
|
||||||
|
|
||||||
private static WebDevSupport s_instance;
|
|
||||||
public static synchronized WebDevSupport getInstance() {
|
|
||||||
if (s_instance == null) {
|
|
||||||
s_instance = new WebDevSupport();
|
|
||||||
}
|
|
||||||
return s_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WebDevSupport() {
|
|
||||||
//empty for now
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int s_max_requests = 100;
|
|
||||||
public void setMaxRequests(int max_requests) {
|
|
||||||
s_max_requests = max_requests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxRequests() {
|
|
||||||
return s_max_requests;
|
|
||||||
}
|
|
||||||
|
|
||||||
//We store a HashTable that maps Threads to their most recent
|
|
||||||
//request object. This gets cleaned up when requests end
|
|
||||||
private HashMap m_threadRequestMap = new HashMap();
|
|
||||||
private ArrayList m_requests = new ArrayList();
|
|
||||||
|
|
||||||
private synchronized void registerNewRequest(RequestInfo ri) {
|
|
||||||
m_threadRequestMap.put(Thread.currentThread(), ri);
|
|
||||||
m_requests.add(ri);
|
|
||||||
if (s_max_requests != -1) {
|
|
||||||
int to_remove = m_requests.size() - s_max_requests;
|
|
||||||
//this is kindof expensive, but usually just one at a time
|
|
||||||
for (int i = 0; i<to_remove; i++) {
|
|
||||||
m_requests.remove(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized void clearRequestHistory() {
|
|
||||||
m_requests.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private RequestInfo getCurrentRequest() {
|
|
||||||
return (RequestInfo)m_threadRequestMap.get(Thread.currentThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void unRegisterRequest() {
|
|
||||||
m_threadRequestMap.remove(Thread.currentThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListIterator getRequestsReverse() {
|
|
||||||
//need to copy the requests to allow the iterator
|
|
||||||
//to work in spite of concurrent modifications
|
|
||||||
ArrayList lst = (ArrayList)m_requests.clone();
|
|
||||||
return lst.listIterator(lst.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListIterator getRequests() {
|
|
||||||
//need to copy the requests to allow the iterator
|
|
||||||
//to work in spite of concurrent modifications
|
|
||||||
ArrayList lst = (ArrayList)m_requests.clone();
|
|
||||||
return lst.listIterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
public RequestInfo getRequest(int id) {
|
|
||||||
Iterator iter = m_requests.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
RequestInfo ri = (RequestInfo)iter.next();
|
|
||||||
if (ri.getID() == id) {
|
|
||||||
return ri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* requestStart
|
|
||||||
* Callback indicating a new request has started.
|
|
||||||
* Request is an opaque pointer for now for linkage purposes (don't want
|
|
||||||
* to have dependencies on the dispatcher here) and for making this
|
|
||||||
* infrastructure more general.
|
|
||||||
*/
|
*/
|
||||||
public void requestStart(Object request) {
|
public class WebDevSupport extends Application {
|
||||||
if (request instanceof RequestEvent && getCurrentRequest() == null) {
|
|
||||||
registerNewRequest(new RequestInfo((RequestEvent)request));
|
/** Private logger instance to faciliate debugging procedures */
|
||||||
|
private static final Logger s_log = Logger.getLogger(WebDevSupport.class);
|
||||||
|
|
||||||
|
|
||||||
|
// pdl stuff (constants)
|
||||||
|
/** */
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
|
"com.arsdigita.webdevsupport.WebDevSupport";
|
||||||
|
|
||||||
|
public WebDevSupport(DataObject obj) {
|
||||||
|
super(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebDevSupport(OID oid)
|
||||||
|
throws DataObjectNotFoundException {
|
||||||
|
|
||||||
|
super(oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requestAddProperty
|
* Getter to retrieve the base database object type name
|
||||||
* Add a new property about this request.
|
*
|
||||||
|
* @return base data aoject type as String
|
||||||
*/
|
*/
|
||||||
public void requestAddProperty(Object request, String property, Object value) {
|
@Override
|
||||||
RequestInfo ri = getCurrentRequest();
|
protected String getBaseDataObjectType() {
|
||||||
if (ri != null) {
|
return BASE_DATA_OBJECT_TYPE;
|
||||||
ri.addProperty(property, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* requestEnd
|
|
||||||
* Callback indicating the request ended
|
|
||||||
*/
|
|
||||||
public void requestEnd(Object request) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
ri.finish();
|
|
||||||
}
|
|
||||||
unRegisterRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logQuery
|
|
||||||
* Callback logging a database query
|
|
||||||
*/
|
|
||||||
public void logQuery(String connection_id,
|
|
||||||
String type,
|
|
||||||
String query,
|
|
||||||
HashMap bindvars,
|
|
||||||
long time,
|
|
||||||
java.sql.SQLException sqle) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
ri.logQuery(new QueryInfo(ri.numQueries()+1,
|
|
||||||
connection_id,
|
|
||||||
type,
|
|
||||||
query,
|
|
||||||
bindvars,
|
|
||||||
time,
|
|
||||||
sqle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logQuery
|
|
||||||
* Callback logging a database query
|
|
||||||
*/
|
|
||||||
public void logQueryCompletion(String connection_id,
|
|
||||||
String type,
|
|
||||||
String query,
|
|
||||||
HashMap bindvars,
|
|
||||||
long time,
|
|
||||||
long totaltime,
|
|
||||||
java.sql.SQLException sqle) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
QueryInfo qi = ri.findQuery(connection_id, type, query, bindvars, time);
|
|
||||||
if (qi == null) {
|
|
||||||
s_log.warn("Could not find query: " + query + "\nBinds: " + bindvars);
|
|
||||||
} else {
|
|
||||||
qi.setCompletion(totaltime, sqle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* logComment
|
|
||||||
* Log a generic comment
|
|
||||||
*/
|
|
||||||
public void logComment(String comment) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
ri.logComment(comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* startStage
|
|
||||||
* Callback indicating a new stage has started.
|
|
||||||
* Stages can be used to log help mark the time
|
|
||||||
* taken to perform various parts of requests.
|
|
||||||
*/
|
|
||||||
public void startStage(String stagename) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
ri.startStage(stagename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* endStage
|
|
||||||
* Callback indicating a stage has ended.
|
|
||||||
* Stages can be used to log help mark the time
|
|
||||||
* taken to perform various parts of requests.
|
|
||||||
*/
|
|
||||||
public void endStage(String stagename) {
|
|
||||||
RequestInfo ri = getCurrentRequest();
|
|
||||||
if (ri != null) {
|
|
||||||
ri.endStage(stagename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,247 @@
|
||||||
|
/*
|
||||||
|
* 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.webdevsupport;
|
||||||
|
|
||||||
|
import com.arsdigita.developersupport.DeveloperSupportListener;
|
||||||
|
import com.arsdigita.dispatcher.RequestEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebDevSupportListener
|
||||||
|
* DeveloperSupportListener for Web Development Support package.
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
* @author Joseph A. Bank (jbank@alum.mit.edu)
|
||||||
|
* @version 1.0
|
||||||
|
* @version $Id: WebDevSupportListener.java 1460 2007-03-02 14:36:38Z sskracic $
|
||||||
|
*/
|
||||||
|
public class WebDevSupportListener extends DeveloperSupportListener {
|
||||||
|
|
||||||
|
private static final Logger s_log =
|
||||||
|
Logger.getLogger( WebDevSupportListener.class );
|
||||||
|
|
||||||
|
private static WebDevSupportListener s_instance;
|
||||||
|
public static synchronized WebDevSupportListener getInstance() {
|
||||||
|
if (s_instance == null) {
|
||||||
|
s_instance = new WebDevSupportListener();
|
||||||
|
}
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private WebDevSupportListener() {
|
||||||
|
//empty for now
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int s_max_requests = 100;
|
||||||
|
public void setMaxRequests(int max_requests) {
|
||||||
|
s_max_requests = max_requests;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxRequests() {
|
||||||
|
return s_max_requests;
|
||||||
|
}
|
||||||
|
|
||||||
|
//We store a HashTable that maps Threads to their most recent
|
||||||
|
//request object. This gets cleaned up when requests end
|
||||||
|
private HashMap m_threadRequestMap = new HashMap();
|
||||||
|
private ArrayList m_requests = new ArrayList();
|
||||||
|
|
||||||
|
private synchronized void registerNewRequest(RequestInfo ri) {
|
||||||
|
m_threadRequestMap.put(Thread.currentThread(), ri);
|
||||||
|
m_requests.add(ri);
|
||||||
|
if (s_max_requests != -1) {
|
||||||
|
int to_remove = m_requests.size() - s_max_requests;
|
||||||
|
//this is kindof expensive, but usually just one at a time
|
||||||
|
for (int i = 0; i<to_remove; i++) {
|
||||||
|
m_requests.remove(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized void clearRequestHistory() {
|
||||||
|
m_requests.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private RequestInfo getCurrentRequest() {
|
||||||
|
return (RequestInfo)m_threadRequestMap.get(Thread.currentThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void unRegisterRequest() {
|
||||||
|
m_threadRequestMap.remove(Thread.currentThread());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListIterator getRequestsReverse() {
|
||||||
|
//need to copy the requests to allow the iterator
|
||||||
|
//to work in spite of concurrent modifications
|
||||||
|
ArrayList lst = (ArrayList)m_requests.clone();
|
||||||
|
return lst.listIterator(lst.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public ListIterator getRequests() {
|
||||||
|
//need to copy the requests to allow the iterator
|
||||||
|
//to work in spite of concurrent modifications
|
||||||
|
ArrayList lst = (ArrayList)m_requests.clone();
|
||||||
|
return lst.listIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestInfo getRequest(int id) {
|
||||||
|
Iterator iter = m_requests.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
RequestInfo ri = (RequestInfo)iter.next();
|
||||||
|
if (ri.getID() == id) {
|
||||||
|
return ri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requestStart
|
||||||
|
* Callback indicating a new request has started.
|
||||||
|
* Request is an opaque pointer for now for linkage purposes (don't want
|
||||||
|
* to have dependencies on the dispatcher here) and for making this
|
||||||
|
* infrastructure more general.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void requestStart(Object request) {
|
||||||
|
if (request instanceof RequestEvent && getCurrentRequest() == null) {
|
||||||
|
registerNewRequest(new RequestInfo((RequestEvent)request));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requestAddProperty
|
||||||
|
* Add a new property about this request.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void requestAddProperty(Object request, String property, Object value) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.addProperty(property, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* requestEnd
|
||||||
|
* Callback indicating the request ended
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void requestEnd(Object request) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.finish();
|
||||||
|
}
|
||||||
|
unRegisterRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logQuery
|
||||||
|
* Callback logging a database query
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void logQuery(String connection_id,
|
||||||
|
String type,
|
||||||
|
String query,
|
||||||
|
HashMap bindvars,
|
||||||
|
long time,
|
||||||
|
java.sql.SQLException sqle) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.logQuery(new QueryInfo(ri.numQueries()+1,
|
||||||
|
connection_id,
|
||||||
|
type,
|
||||||
|
query,
|
||||||
|
bindvars,
|
||||||
|
time,
|
||||||
|
sqle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logQuery
|
||||||
|
* Callback logging a database query
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void logQueryCompletion(String connection_id,
|
||||||
|
String type,
|
||||||
|
String query,
|
||||||
|
HashMap bindvars,
|
||||||
|
long time,
|
||||||
|
long totaltime,
|
||||||
|
java.sql.SQLException sqle) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
QueryInfo qi = ri.findQuery(connection_id, type, query, bindvars, time);
|
||||||
|
if (qi == null) {
|
||||||
|
s_log.warn("Could not find query: " + query + "\nBinds: " + bindvars);
|
||||||
|
} else {
|
||||||
|
qi.setCompletion(totaltime, sqle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logComment
|
||||||
|
* Log a generic comment
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void logComment(String comment) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.logComment(comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* startStage
|
||||||
|
* Callback indicating a new stage has started.
|
||||||
|
* Stages can be used to log help mark the time
|
||||||
|
* taken to perform various parts of requests.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void startStage(String stagename) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.startStage(stagename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* endStage
|
||||||
|
* Callback indicating a stage has ended.
|
||||||
|
* Stages can be used to log help mark the time
|
||||||
|
* taken to perform various parts of requests.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void endStage(String stagename) {
|
||||||
|
RequestInfo ri = getCurrentRequest();
|
||||||
|
if (ri != null) {
|
||||||
|
ri.endStage(stagename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -19,23 +19,11 @@
|
||||||
package com.arsdigita.docrepo;
|
package com.arsdigita.docrepo;
|
||||||
|
|
||||||
|
|
||||||
//import com.arsdigita.web.Web;
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
//import com.arsdigita.domain.DomainObjectFactory;
|
|
||||||
import com.arsdigita.domain.DomainObject;
|
import com.arsdigita.domain.DomainObject;
|
||||||
//import com.arsdigita.kernel.Kernel;
|
|
||||||
import com.arsdigita.db.Sequences;
|
import com.arsdigita.db.Sequences;
|
||||||
//import com.arsdigita.kernel.KernelExcursion;
|
|
||||||
//import com.arsdigita.persistence.DataCollection;
|
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
//import com.arsdigita.persistence.DataOperation;
|
|
||||||
//import com.arsdigita.persistence.DataQuery;
|
|
||||||
//import com.arsdigita.persistence.Filter;
|
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
//import com.arsdigita.persistence.PersistenceException;
|
|
||||||
//import com.arsdigita.persistence.Session;
|
|
||||||
//import com.arsdigita.persistence.SessionManager;
|
|
||||||
//import com.arsdigita.persistence.metadata.ObjectType;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,34 @@
|
||||||
|
|
||||||
package com.arsdigita.docrepo;
|
package com.arsdigita.docrepo;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.TabbedPane;
|
||||||
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.page.BebopApplicationServlet;
|
import com.arsdigita.bebop.page.BebopApplicationServlet;
|
||||||
|
import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||||
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.dispatcher.RequestContext;
|
||||||
|
import com.arsdigita.docrepo.File;
|
||||||
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.web.Web;
|
||||||
|
import com.arsdigita.persistence.Session;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
import org.apache.log4j.Category;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,4 +58,30 @@ public class RepositoryServlet extends BebopApplicationServlet {
|
||||||
/** Private logger instance to faciliate debugging procedures */
|
/** Private logger instance to faciliate debugging procedures */
|
||||||
private static final Logger s_log = Logger.getLogger(RepositoryServlet.class);
|
private static final Logger s_log = Logger.getLogger(RepositoryServlet.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Servlet Initialisation, builds the UI elements (various panes)
|
||||||
|
* @throws ServletException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init() throws ServletException {
|
||||||
|
super.init();
|
||||||
|
s_log.debug("creating DocRepo page");
|
||||||
|
|
||||||
|
|
||||||
|
// Page index = buildIndexPage();
|
||||||
|
// Page admin = buildAdminIndexPage();
|
||||||
|
|
||||||
|
// put("/", index);
|
||||||
|
// put("/index.jsp", index);
|
||||||
|
// put("/one.jsp", index);
|
||||||
|
|
||||||
|
// put("admin", admin);
|
||||||
|
// put("admin/index.jsp", admin);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
xmlns:docs="http://www.redhat.com/docs/1.0"
|
xmlns:docs="http://www.redhat.com/docs/1.0"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
<xsl:import href="../../content-section/xsl/cms.xsl"/>
|
<xsl:import href="../../cms/xsl/cms.xsl"/>
|
||||||
<xsl:import href="../../acs-admin/xsl/admin_en.xsl"/>
|
<xsl:import href="../../acs-admin/xsl/admin_en.xsl"/>
|
||||||
<xsl:import href="../../categorization/xsl/categorization.xsl"/>
|
<xsl:import href="../../categorization/xsl/categorization.xsl"/>
|
||||||
<xsl:import href="../../bebop/xsl/DimensionalNavbar.xsl"/>
|
<xsl:import href="../../bebop/xsl/DimensionalNavbar.xsl"/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue