CCM NG: Today's result of getting Bebop running in a full Java EE environement
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3842 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
4527595438
commit
c21ab1e5d7
|
|
@ -0,0 +1,65 @@
|
|||
# -*- text -*-
|
||||
# This file locates stylesheets, if you are using the
|
||||
# "PatternStylesheetResolver". Please read the Javadoc for that file for
|
||||
# the full story.
|
||||
|
||||
# Currently the "resource" part is actually "short-circuited", see
|
||||
# Templating#transformURL(url). As long as we store and synchronize all theme
|
||||
# files in each server's local file system, we use the direct file apprach to
|
||||
# avoid unnecessary http request and traffic between client (user) and server!
|
||||
# Additionally all modules are installed into one webapp context, so the
|
||||
# webapp tag is redundant, but sort of required by some part of the code.
|
||||
|
||||
|
||||
# Theme with single entry point (e.g Mandalay) managed by themedirector
|
||||
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/start.xsl
|
||||
http://::host::/::webapp::/themes/::themedir::/::theme::/start.xsl
|
||||
|
||||
# Theme with single entry point (e.g Mandalay) unmanaged default
|
||||
#http://::host::/resource/::webapp::/themes/mandalay/start.xsl
|
||||
#http://::host::/::webapp::/themes/mandalay/start.xsl
|
||||
|
||||
# Theme with single entry point (e.g Mandalay) unmanaged default
|
||||
#http://::host::/resource/::webapp::/themes/mandalay/start.xsl
|
||||
http://::host::/::webapp::/themes/foundry-base/start.xsl
|
||||
|
||||
|
||||
|
||||
|
||||
# ==============================================================================
|
||||
# The following is for multi-entry themes, not used in ScientificCMS
|
||||
# ==============================================================================
|
||||
|
||||
# Output type is for things such as text/javascript
|
||||
# NOT used by ScientificCMS, uses Mandalay only!
|
||||
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::outputtype::-::locale::.xsl
|
||||
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::outputtype::.xsl
|
||||
|
||||
# Grabs custom item xsl for CMS
|
||||
# NOT used by ScientificCMS, uses Mandalay only!
|
||||
#http://::host::/themes/servlet/content-item/index.xsl?oid=::item_template_oid::&delegated=::item_delegated_url::
|
||||
|
||||
# Theme, with optional locale & prefix
|
||||
# NOT used by ScientificCMS, uses Mandalay only!
|
||||
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::prefix::-::locale::.xsl
|
||||
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::prefix::.xsl
|
||||
|
||||
# Theme, with optional locale
|
||||
# NOT used by ScientificCMS, uses Mandalay only!
|
||||
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::-::locale::.xsl
|
||||
#http://::host::/resource/::webapp::/themes/::themedir::/::theme::/::application::-::url::.xsl
|
||||
|
||||
# APLAWS generic default, with locale and prefix
|
||||
# XXX change ROOT -> ccm-ldn-aplaws
|
||||
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::prefix::-::locale::.xsl
|
||||
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::prefix::.xsl
|
||||
|
||||
# APLAWS generic default, with locale
|
||||
# XXX change ROOT -> ccm-ldn-aplaws
|
||||
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::-::locale::.xsl
|
||||
# http://::host::/resource/ROOT/themes/static/aplaws-generic/::application::-::url::.xsl
|
||||
|
||||
# Global default, from application's own web app
|
||||
# NOT used by ScientificCMS
|
||||
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::-::locale::.xsl
|
||||
#http://::host::/resource/::webapp::/themes/heirloom/apps/::application::/xsl/::url::.xsl
|
||||
|
|
@ -399,8 +399,8 @@ public class PatternStylesheetResolver implements StylesheetResolver {
|
|||
try {
|
||||
// Read the source file.
|
||||
ClassLoader cload = Thread.currentThread().getContextClassLoader();
|
||||
InputStream stream = cload.getResourceAsStream(path.substring(1));
|
||||
s_log.debug("got stream using path " + path.substring(1));
|
||||
InputStream stream = cload.getResourceAsStream(path.substring(0));
|
||||
s_log.debug("got stream using path " + path.substring(0));
|
||||
s_log.debug("stream.available is " + stream.available());
|
||||
m_paths = new ArrayList();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,20 +31,21 @@ import com.arsdigita.web.LoginSignal;
|
|||
import com.arsdigita.xml.Document;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.security.PermissionChecker;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.enterprise.inject.spi.CDI;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import
|
||||
|
||||
javax.servlet.http.HttpServletResponse;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
||||
|
|
@ -111,7 +112,8 @@ public class AdminServlet
|
|||
// /////// Some preparational steps ///////////////
|
||||
/* Determine access privilege: only logged in users may access */
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
// final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Subject subject = CDI.current().select(Subject.class).get();
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import com.arsdigita.bebop.parameters.URLParameter;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import static com.arsdigita.ui.login.LoginConstants.*;
|
||||
|
||||
|
|
@ -52,6 +53,12 @@ import com.arsdigita.web.ParameterMap;
|
|||
import com.arsdigita.web.RedirectSignal;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import javax.enterprise.context.spi.CreationalContext;
|
||||
import javax.enterprise.inject.spi.Bean;
|
||||
import javax.enterprise.inject.spi.BeanManager;
|
||||
import javax.enterprise.inject.spi.CDI;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
|
@ -61,6 +68,7 @@ import org.apache.shiro.authc.UsernamePasswordToken;
|
|||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
|
||||
/**
|
||||
* A Bebop form that accepts login and password from the user and attempts to
|
||||
|
|
@ -128,14 +136,34 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
final boolean autoRegistrationOn) {
|
||||
super(FORM_NAME, panel);
|
||||
|
||||
securityConfig = SecurityConfig.getConfig();
|
||||
|
||||
// final ConfigurationManager confManager = CDI.current().select(
|
||||
// ConfigurationManager.class).get();
|
||||
final BeanManager beanManager = CDI.current().getBeanManager();
|
||||
final Set<Bean<?>> beans = beanManager.getBeans(
|
||||
ConfigurationManager.class);
|
||||
final Iterator<Bean<?>> iterator = beans.iterator();
|
||||
final ConfigurationManager confManager;
|
||||
if (iterator.hasNext()) {
|
||||
final Bean<ConfigurationManager> bean = (Bean<ConfigurationManager>) iterator.
|
||||
next();
|
||||
final CreationalContext<ConfigurationManager> ctx = beanManager.
|
||||
createCreationalContext(bean);
|
||||
|
||||
confManager = (ConfigurationManager) beanManager.getReference(
|
||||
bean, ConfigurationManager.class, ctx);
|
||||
} else {
|
||||
throw new UncheckedWrapperException(
|
||||
"Failed to lookup ConfigurationManager");
|
||||
}
|
||||
securityConfig = confManager.findConfiguration(SecurityConfig.class);
|
||||
|
||||
setMethod(Form.POST);
|
||||
addInitListener(this);
|
||||
addValidationListener(this);
|
||||
addProcessListener(this);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
|
||||
m_autoRegistrationOn = autoRegistrationOn;
|
||||
|
||||
|
|
@ -143,14 +171,14 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
add(m_timestamp);
|
||||
|
||||
m_returnURL = new Hidden(new URLParameter(
|
||||
LoginHelper.RETURN_URL_PARAM_NAME));
|
||||
LoginHelper.RETURN_URL_PARAM_NAME));
|
||||
m_returnURL.setPassIn(true);
|
||||
add(m_returnURL);
|
||||
|
||||
setupLogin();
|
||||
|
||||
add(new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.password")));
|
||||
"login.userRegistrationForm.password")));
|
||||
m_password = new Password(new StringParameter(FORM_PASSWORD));
|
||||
// Since new users should not enter a password, allow null.
|
||||
//m_password.addValidationListener(new NotNullValidationListener());
|
||||
|
|
@ -159,7 +187,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
SimpleContainer cookiePanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||
m_isPersistent = new CheckboxGroup(FORM_PERSISTENT_LOGIN_P);
|
||||
Label optLabel = new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.cookieOption"));
|
||||
"login.userRegistrationForm.cookieOption"));
|
||||
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
|
||||
m_isPersistent.addOption(opt);
|
||||
if (kernelConfig.isRememberLoginEnabled()) {
|
||||
|
|
@ -168,8 +196,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
cookiePanel.add(m_isPersistent);
|
||||
|
||||
cookiePanel.add(new DynamicLink(
|
||||
"login.userRegistrationForm.explainCookieLink",
|
||||
LoginServlet.getCookiesExplainPageURL()));
|
||||
"login.userRegistrationForm.explainCookieLink",
|
||||
LoginServlet.getCookiesExplainPageURL()));
|
||||
add(cookiePanel);
|
||||
|
||||
add(new Submit(SUBMIT), ColumnPanel.CENTER | ColumnPanel.FULL_WIDTH);
|
||||
|
|
@ -193,8 +221,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*/
|
||||
private void setupLogin() {
|
||||
SimpleContainer loginMessage = new SimpleContainer(
|
||||
"subsite:loginPromptMsg",
|
||||
LoginServlet.SUBSITE_NS_URI);
|
||||
"subsite:loginPromptMsg",
|
||||
LoginServlet.SUBSITE_NS_URI);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
||||
|
|
@ -208,17 +236,17 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
|
||||
if (kernelConfig.emailIsPrimaryIdentifier()) {
|
||||
add(new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.email")));
|
||||
"login.userRegistrationForm.email")));
|
||||
m_loginName = new TextField(new EmailParameter(FORM_LOGIN));
|
||||
addInitListener(new EmailInitListener((EmailParameter) m_loginName.
|
||||
getParameterModel()));
|
||||
getParameterModel()));
|
||||
} else {
|
||||
add(new Label(LoginHelper.getMessage(
|
||||
"login.userRegistrationForm.screenName")));
|
||||
"login.userRegistrationForm.screenName")));
|
||||
m_loginName = new TextField(new StringParameter(FORM_LOGIN));
|
||||
addInitListener(new ScreenNameInitListener(
|
||||
(StringParameter) m_loginName.
|
||||
getParameterModel()));
|
||||
(StringParameter) m_loginName.
|
||||
getParameterModel()));
|
||||
}
|
||||
m_loginName.addValidationListener(new NotNullValidationListener());
|
||||
add(m_loginName);
|
||||
|
|
@ -232,7 +260,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*/
|
||||
@Override
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
s_log.info("In init");
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
|
|
@ -242,7 +270,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
s_log.info("trying SSO");
|
||||
// try {
|
||||
throw new UnsupportedOperationException(
|
||||
"SSO currently not supported");
|
||||
"SSO currently not supported");
|
||||
// Web.getUserContext().loginSSO();
|
||||
// s_log.info("loginSSO ok, now processing redirect_url");
|
||||
// process(event);
|
||||
|
|
@ -273,7 +301,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*/
|
||||
@Override
|
||||
public void validate(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
|
||||
s_log.debug("In validate");
|
||||
|
||||
|
|
@ -312,7 +340,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*/
|
||||
@Override
|
||||
public void process(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
s_log.debug("In process");
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
|
@ -338,15 +366,15 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*
|
||||
*/
|
||||
protected void loginUser(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
|
||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||
(String) m_loginName.getValue(state),
|
||||
(String) m_password.getValue(state)
|
||||
(String) m_loginName.getValue(state),
|
||||
(String) m_password.getValue(state)
|
||||
);
|
||||
token.setRememberMe(getPersistentLoginValue(state, false));
|
||||
try {
|
||||
|
|
@ -365,7 +393,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*
|
||||
*/
|
||||
protected void onLoginSuccess(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
|
@ -394,7 +422,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*/
|
||||
protected void onLoginFail(final FormSectionEvent event,
|
||||
final AuthenticationException ex)
|
||||
throws FormProcessException {
|
||||
throws FormProcessException {
|
||||
s_log.debug("Login fail");
|
||||
event.getFormData().addError(ERROR_LOGIN_FAIL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,40 +19,45 @@
|
|||
package com.arsdigita.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Provides the system name of the CCM Spin off (eg aplaws or ScientificCMS) and the version number.
|
||||
* It's primary use is to provide the theme engine with that information for display. The data
|
||||
* displayed is stored in the /WEB-INF/systeminformation.properties, which is usually provided by
|
||||
* the bundle. The ccm-sci-bundle for example provides this file, which can be found in
|
||||
* {@code ccm-sci-bundle/web/WEB-INF} directory. At the moment it is necessary to update this
|
||||
* (these) file(s) manually.
|
||||
*
|
||||
* A {@code systeminformations.properties} should contain at least these three properties:
|
||||
* Provides the system name of the CCM Spin off (eg aplaws or ScientificCMS) and
|
||||
* the version number. It's primary use is to provide the theme engine with that
|
||||
* information for display. The data displayed is stored in the
|
||||
* /WEB-INF/systeminformation.properties, which is usually provided by the
|
||||
* bundle. The ccm-sci-bundle for example provides this file, which can be found
|
||||
* in {@code ccm-sci-bundle/web/WEB-INF} directory. At the moment it is
|
||||
* necessary to update this (these) file(s) manually.
|
||||
*
|
||||
* A {@code systeminformations.properties} should contain at least these three
|
||||
* properties:
|
||||
* <dl>
|
||||
* <dt>version</dt>
|
||||
* <dd>The version of the specific CCM distribution.</dd>
|
||||
* <dt>appname</dt>
|
||||
* <dd>The name of the CCM distribution, for example <strong>ScientificCMS</strong>
|
||||
* <dt>apphomepage</dt>
|
||||
* <dd>
|
||||
The URL of the website of the CCM distribution, for example
|
||||
* {@code http://www.scientificcms.org}
|
||||
* </dd>
|
||||
* <dt>version</dt>
|
||||
* <dd>The version of the specific CCM distribution.</dd>
|
||||
* <dt>appname</dt>
|
||||
* <dd>The name of the CCM distribution, for example
|
||||
* <strong>ScientificCMS</strong>
|
||||
* <dt>apphomepage</dt>
|
||||
* <dd>
|
||||
* The URL of the website of the CCM distribution, for example
|
||||
* {@code http://www.scientificcms.org}
|
||||
* </dd>
|
||||
* </dl>
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SystemInformation {
|
||||
public class SystemInformation {
|
||||
|
||||
/**
|
||||
* Map containing all informations provided by the {@code systeminformation.properties} file.
|
||||
* Map containing all informations provided by the
|
||||
* {@code systeminformation.properties} file.
|
||||
*/
|
||||
private final Map<String, String> sysInfo = new HashMap<String, String>();
|
||||
/**
|
||||
|
|
@ -61,18 +66,28 @@ public class SystemInformation {
|
|||
private final static SystemInformation INSTANCE = new SystemInformation();
|
||||
|
||||
/**
|
||||
* The constructor takes care of loading the data from the properties file and placing them into
|
||||
* {@code HashMap}.
|
||||
* The constructor takes care of loading the data from the properties file
|
||||
* and placing them into {@code HashMap}.
|
||||
*/
|
||||
public SystemInformation() {
|
||||
|
||||
final Properties properties = new Properties();
|
||||
try {
|
||||
properties.load(getClass().getResourceAsStream(
|
||||
"/WEB-INF/systeminformation.properties"));
|
||||
final InputStream stream = getClass().getResourceAsStream(
|
||||
"WEB-INF/systeminformation.properties");
|
||||
if (stream == null) {
|
||||
properties.put("version", "");
|
||||
properties.put("appname", "LibreCCM");
|
||||
properties.put("apphomepage", "http://www.libreccm.org");
|
||||
} else {
|
||||
properties.load(stream);
|
||||
}
|
||||
// properties.load(getClass().getResourceAsStream(
|
||||
// "WEB-INF/systeminformation.properties"));
|
||||
} catch (IOException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
for (String key : properties.stringPropertyNames()) {
|
||||
sysInfo.put(key, properties.getProperty(key));
|
||||
}
|
||||
|
|
@ -97,7 +112,8 @@ public class SystemInformation {
|
|||
*/
|
||||
final public String get(final String key) throws IllegalArgumentException {
|
||||
if (key == null || key.isEmpty()) {
|
||||
throw new IllegalArgumentException("Parameter key must not be null or empty.");
|
||||
throw new IllegalArgumentException(
|
||||
"Parameter key must not be null or empty.");
|
||||
}
|
||||
return sysInfo.get(key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue