ccm-core und ccm-cms benötigen nun keinen old initializer mehr.

git-svn-id: https://svn.libreccm.org/ccm/trunk@755 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-02-19 08:52:32 +00:00
parent 9647f5a384
commit 9f4d276692
13 changed files with 341 additions and 101 deletions

View File

@ -30,17 +30,17 @@ import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.formbuilder.FormItem; import com.arsdigita.cms.formbuilder.FormItem;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.formbuilder.PersistentForm;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
public class FormProperties extends SimpleEditStep { public class FormProperties extends SimpleEditStep {

View File

@ -170,7 +170,7 @@ public class Initializer extends CompoundInitializer {
// Old type initializer "com.arsdigita.formbuilder.installer.Initializer" // Old type initializer "com.arsdigita.formbuilder.installer.Initializer"
// Used to initialize CMS forms using the forms in ccm-core // Used to initialize CMS forms using the forms in ccm-core
// Can be replaced in ccm after ccm-core is migrated to new initializer. // Can be replaced in ccm after ccm-core is migrated to new initializer.
add(new LegacyInitializer("com/arsdigita/cms/enterprise.init")); // add(new LegacyInitializer("com/arsdigita/cms/enterprise.init"));
s_log.debug("CMS.Initializer.(Constructor) completed"); s_log.debug("CMS.Initializer.(Constructor) completed");
} }

View File

@ -34,6 +34,7 @@ import com.arsdigita.domain.DomainObject;
// import com.arsdigita.domain.DomainObjectFactory; // import com.arsdigita.domain.DomainObjectFactory;
// import com.arsdigita.domain.DomainObjectInstantiator; // import com.arsdigita.domain.DomainObjectInstantiator;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.formbuilder.util.FormbuilderSetup;
import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
@ -223,6 +224,12 @@ public class Loader extends PackageLoader {
//ContentSectionsPortlet.loadPortletType(); //ContentSectionsPortlet.loadPortletType();
TaskPortlet.loadPortletType(); TaskPortlet.loadPortletType();
// Loading forms widget into database
FormbuilderSetup fbs = new FormbuilderSetup();
fbs.setup(s_conf.getWidgetTypes(),
s_conf.getProcessListenerTypes(),
s_conf.getDataQueries());
} }
}.run(); }.run();

View File

@ -276,6 +276,110 @@ public final class LoaderConfig extends AbstractConfig {
new String[] {"/WEB-INF/resources/article-categories.xml", new String[] {"/WEB-INF/resources/article-categories.xml",
"/WEB-INF/resources/navigation-categories.xml"} ); "/WEB-INF/resources/navigation-categories.xml"} );
// private final Parameter
// m_widgetTypes = new StringArrayParameter(
// "com.arsdigita.cms.loader.widget_types",
// Parameter.REQUIRED,
// new String[] {"/WEB-INF/resources/article-categories.xml",
// "/WEB-INF/resources/navigation-categories.xml"} );
/** List of widgets used in applications forms. Each widget is described by
application indicator, widget name (singular & plural), model class name
and model ui class name. These are really not user or administrator
configurabel and therefore not implemented as ccm parameter. */
private static List widgetTypes = Arrays.asList(
Arrays.asList("forms-cms", "Checkbox group", "Checkbox groups",
"com.arsdigita.formbuilder.PersistentCheckboxGroup",
"com.arsdigita.formbuilder.ui.editors.CheckboxGroupEditor"),
Arrays.asList("forms-cms", "Date field", "Date fields",
"com.arsdigita.formbuilder.PersistentDate",
"com.arsdigita.formbuilder.ui.editors.DateForm"),
Arrays.asList("forms-cms", "Hidden field", "Hidden fields",
"com.arsdigita.formbuilder.PersistentHidden",
"com.arsdigita.formbuilder.ui.editors.HiddenForm"),
Arrays.asList( "forms-cms", "Hidden ID Generator field",
"Hidden ID Generator fields",
"com.arsdigita.formbuilder.HiddenIDGenerator",
"com.arsdigita.formbuilder.ui.editors.HiddenIDGeneratorForm"),
Arrays.asList("forms-cms", "Multiple select box",
"Multiple select boxes",
"com.arsdigita.formbuilder.PersistentMultipleSelect",
"com.arsdigita.formbuilder.ui.editors.MultipleSelectEditor"),
Arrays.asList("forms-cms", "Password field", "Password fields",
"com.arsdigita.formbuilder.PersistentPassword",
"com.arsdigita.formbuilder.ui.editors.PasswordForm"),
Arrays.asList("forms-cms", "Radio group", "Radio groups",
"com.arsdigita.formbuilder.PersistentRadioGroup",
"com.arsdigita.formbuilder.ui.editors.RadioGroupEditor"),
Arrays.asList("forms-cms", "Single select box",
"Single select boxes",
"com.arsdigita.formbuilder.PersistentSingleSelect",
"com.arsdigita.formbuilder.ui.editors.SingleSelectEditor"),
Arrays.asList("forms-cms", "Submit button", "Submit buttons",
"com.arsdigita.formbuilder.PersistentSubmit",
"com.arsdigita.formbuilder.ui.editors.SubmitForm"),
Arrays.asList("forms-cms", "Text area", "Text areas",
"com.arsdigita.formbuilder.PersistentTextArea",
"com.arsdigita.formbuilder.ui.editors.TextAreaForm"),
Arrays.asList("forms-cms", "Text field", "Text fields",
"com.arsdigita.formbuilder.PersistentTextField",
"com.arsdigita.formbuilder.ui.editors.TextFieldForm"),
Arrays.asList("forms-cms", "Data Driven Select Box",
"Data Driven Select Boxes",
"com.arsdigita.formbuilder.DataDrivenSelect",
"com.arsdigita.formbuilder.ui.editors.DataDrivenSelectForm"),
Arrays.asList("forms-cms", "Text Description","Text Descriptions",
"com.arsdigita.formbuilder.PersistentText",
"com.arsdigita.formbuilder.ui.editors.TextForm"),
Arrays.asList("forms-cms", "Text Heading", "Text Headings",
"com.arsdigita.formbuilder.PersistentHeading",
"com.arsdigita.formbuilder.ui.editors.HeadingForm"),
Arrays.asList("forms-cms", "Section Break", "Section Break",
"com.arsdigita.formbuilder.PersistentHorizontalRule",
"com.arsdigita.formbuilder.ui.editors.HorizontalRuleForm"),
Arrays.asList("forms-cms", "User Email Field","User Email Fields",
"com.arsdigita.formbuilder.PersistentEmailField",
"com.arsdigita.formbuilder.ui.editors.EmailFieldForm")
);
/** List of process listeners used in applications forms. Each listener is
described by application indicator, process name (singular & plural),
action class name and action ui class name. These are really not user
or administrator configurabel and therefore not implemented as ccm
parameter. */
private static List processListenerTypes = Arrays.asList(
Arrays.asList("forms-cms", "Confirmation email",
"Confirmation emails",
"com.arsdigita.formbuilder.actions.ConfirmEmailListener",
"com.arsdigita.formbuilder.ui.editors.ConfirmEmailForm"),
Arrays.asList("forms-cms", "URL redirect", "URL redirects",
"com.arsdigita.formbuilder.actions.ConfirmRedirectListener",
"com.arsdigita.formbuilder.ui.editors.ConfirmRedirectForm"),
Arrays.asList("forms-cms", "Simple email", "Simple emails",
"com.arsdigita.formbuilder.actions.SimpleEmailListener",
"com.arsdigita.formbuilder.ui.editors.SimpleEmailForm"),
Arrays.asList("forms-cms", "Templated email", "Templated emails",
"com.arsdigita.formbuilder.actions.TemplateEmailListener",
"com.arsdigita.formbuilder.ui.editors.TemplateEmailForm"),
Arrays.asList( "forms-cms", "Remote Server POST",
"Remote Server POSTs",
"com.arsdigita.formbuilder.actions.RemoteServerPostListener",
"com.arsdigita.formbuilder.ui.editors.RemoteServerPostForm" ),
Arrays.asList( "forms-cms", "XML email", "XML emails",
"com.arsdigita.formbuilder.actions.XMLEmailListener",
"com.arsdigita.formbuilder.ui.editors.XMLEmailForm" )
);
private static List dataQueries = Arrays.asList(
Arrays.asList("forms-cms",
"com.arsdigita.formbuilder.DataQueryUsers",
"List of all registered users"),
Arrays.asList("forms-cms",
"com.arsdigita.formbuilder.DataQueryPackages",
"List of all installed packages")
);
// Currently not a Loader task. There is no way to persist tasks preferences // Currently not a Loader task. There is no way to persist tasks preferences
// on a per section base. // on a per section base.
@ -549,6 +653,17 @@ public final class LoaderConfig extends AbstractConfig {
return Arrays.asList(catFiles); return Arrays.asList(catFiles);
} }
public List getWidgetTypes() {
return widgetTypes;
}
public List getProcessListenerTypes() {
return processListenerTypes;
}
public List getDataQueries() {
return dataQueries;
}
/** /**
* Retrieve the * Retrieve the
*/ */

View File

@ -106,7 +106,7 @@ public class Initializer extends CompoundInitializer {
public final void init(final DomainInitEvent e) { public final void init(final DomainInitEvent e) {
super.init(e); super.init(e);
s_log.error("Running core init(DomainInitEvent) ..."); s_log.debug("Running core init(DomainInitEvent) ...");
FactoriesSetup.setupFactories(); FactoriesSetup.setupFactories();

View File

@ -34,6 +34,15 @@ import java.util.List;
import com.arsdigita.formbuilder.PersistentDataQuery; import com.arsdigita.formbuilder.PersistentDataQuery;
import com.arsdigita.formbuilder.PersistentComponent; import com.arsdigita.formbuilder.PersistentComponent;
// /////////////////////////////////////////////////////////////////
//
// REPLACED by formbuilder.util.FormbuilderSetup
// Not a initializer tast bud a loader task
//
// /////////////////////////////////////////////////////////////////
/** /**
* Initializer * Initializer
* *
@ -141,6 +150,7 @@ public class Initializer extends BaseInitializer {
throws InitializationException { throws InitializationException {
// If the objects list is not null, load the object list into the database // If the objects list is not null, load the object list into the database
// pboy: Obviously, this is a Loader task.
if (objects != null) { if (objects != null) {
// XXX we don't yet delete types which are no longer in the list // XXX we don't yet delete types which are no longer in the list

View File

@ -19,29 +19,19 @@
package com.arsdigita.formbuilder.util; package com.arsdigita.formbuilder.util;
import com.arsdigita.formbuilder.util.GlobalizationUtil ; // import com.arsdigita.formbuilder.util.GlobalizationUtil ;
import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.formbuilder.PersistentWidget; import com.arsdigita.formbuilder.PersistentWidget;
import com.arsdigita.formbuilder.parameters.PersistentParameterListener; import com.arsdigita.formbuilder.parameters.PersistentParameterListener;
import com.arsdigita.util.UncheckedWrapperException;
import java.util.Iterator; import java.util.Iterator;
// Classes needed when when retrieving a Component DataObject
import com.arsdigita.util.UncheckedWrapperException;
// ACS 5 uses Log4J for logging
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -85,55 +75,9 @@ public class FormBuilderUtil {
form.add(new TextArea(name)); form.add(new TextArea(name));
} }
/*
/**
* Return true if testClass implements the interfaceClass interface, false otherwise.
public static boolean classImplementsInterface(Class testClass, Class interfaceClass) {
Class[] classInterfaces = testClass.getInterfaces(); public static Object invokeMethod(java.lang.reflect.Method method,
for (int i = 0; i < classInterfaces.length; ++i) { Object object, Object[] argumentList) {
if (interfaceClass.getName().equals(classInterfaces[i].getName())) {
return true;
}
}
return false;
}
public static PersistentComponentFactory instantiateFactory(BigDecimal componentID) {
Session session = SessionManager.getSession();
String factoryClassName = null;
// Retrieve the component DataObject
OID oid = new OID("com.arsdigita.formbuilder.Component", componentID);
DataObject componentObject = session.retrieve(oid);
if (componentObject == null) {
throw new RuntimeException("could not retrieve DataObject with id " + oid.toString());
}
// Get the class name of the PersistentComponentFactory from the DataObject
factoryClassName = (String)componentObject.get("defaultDomainClass");
return (PersistentComponentFactory)instantiateObjectOneArg(factoryClassName, componentID);
}
public static ACSObject instantiateObject(BigDecimal id) {
s_log.info("instantiate object with id " + id);
OID oid = new OID(ACSObject.BASE_DATA_OBJECT_TYPE, id);
Session s = SessionManager.getSession();
DataObject o = s.retrieve(oid);
ACSObject obj =
(ACSObject)FormBuilderUtil.instantiateObject((String)o.get(ACSObject.DEFAULT_DOMAIN_CLASS),
new Class[] { BigDecimal.class },
new Object[] { id });
return obj;
}
*/
public static Object invokeMethod(java.lang.reflect.Method method, Object object, Object[] argumentList) {
try { try {
return method.invoke(object, argumentList); return method.invoke(object, argumentList);
@ -206,8 +150,8 @@ public class FormBuilderUtil {
} }
/** /**
* Check if an integer argument is in range. The limits are inclusive so that an argument * Check if an integer argument is in range. The limits are inclusive
* on the limit is allowed * so that an argument on the limit is allowed
*/ */
public static void assertArgumentInRange(int argument, public static void assertArgumentInRange(int argument,
int lowerLimit, int lowerLimit,

View File

@ -0,0 +1,170 @@
/*
* Copyright (C) 2010 pboy (pboy@barkhof.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.formbuilder.util;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.formbuilder.BebopObjectType;
import com.arsdigita.formbuilder.MetaObject;
import com.arsdigita.formbuilder.PersistentProcessListener;
import com.arsdigita.formbuilder.PersistentDataQuery;
import com.arsdigita.formbuilder.PersistentComponent;
//__import com.arsdigita.kernel.BaseInitializer;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.TransactionContext;
import com.arsdigita.runtime.ConfigError;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class FormbuilderSetup {
/** A logger instance. */
private static final Logger s_log = Logger.getLogger(FormbuilderSetup.class);
/**
* Used by package loader of an application which uses formbuilder
* infrastructure to load its set of widget descriptions, process listeners,
* and dataqueries into database.
*/
public void setup(List widgets,
List processListeners,
List dataQueries) {
// No transaction permitted here, handled by parent class!
// (usually PackageLoader or a child thereof)
loadMetaObjects(widgets, PersistentComponent.class);
loadMetaObjects(processListeners, PersistentProcessListener.class);
loadDataQueries(dataQueries);
}
public BebopObjectType getObjectType(String name,
Class type) {
BebopObjectType objectType = null;
try {
objectType = BebopObjectType.findByClass(name, type);
} catch (DataObjectNotFoundException ex) {
objectType = BebopObjectType.create(name, type);
objectType.save();
}
return objectType;
}
protected void loadMetaObjects(List objects, Class type)
throws ConfigError {
// If the objects list is not null, load the object list into the database
// pboy: Obviously, this is a Loader task.
if (objects != null) {
// XXX we don't yet delete types which are no longer in the list
Iterator objects_i = objects.iterator();
while (objects_i.hasNext()) {
List object = (List) objects_i.next();
String appName = (String) object.get(0);
String prettyName = (String) object.get(1);
String prettyPlural = (String) object.get(2);
String className = (String) object.get(3);
String propertiesForm = (String) object.get(4);
try {
Class.forName(className);
} catch (ClassNotFoundException ex) {
throw new ConfigError("cannot find class " + className);
}
try {
Class.forName(propertiesForm);
} catch (ClassNotFoundException ex) {
throw new ConfigError("cannot find class " + propertiesForm);
}
try {
MetaObject mo = MetaObject.findByClassName(
getObjectType(appName, type),
className);
mo.setPrettyName(prettyName);
mo.setPrettyPlural(prettyPlural);
mo.setWidgetClassName(className);
mo.setPropertiesFormName(propertiesForm);
mo.save();
} catch (DataObjectNotFoundException ex) {
MetaObject mo = MetaObject.create(getObjectType(appName,
type),
prettyName,
prettyPlural,
className,
propertiesForm);
mo.save();
}
}
}
}
protected void loadDataQueries(List objects)
throws ConfigError {
// If the objects list is not null, load the object list into the database
if (objects != null) {
// XXX we don't yet delete types which are no longer in the list
Iterator objects_i = objects.iterator();
while (objects_i.hasNext()) {
List object = (List) objects_i.next();
String appName = (String) object.get(0);
String name = (String) object.get(1);
String description = (String) object.get(2);
try {
PersistentDataQuery q =
PersistentDataQuery.findByName(
getObjectType(appName,
PersistentDataQuery.class),
name);
q.setName(name);
q.setDescription(description);
q.save();
} catch (DataObjectNotFoundException ex) {
PersistentDataQuery q =
PersistentDataQuery.create(
getObjectType(appName,
PersistentDataQuery.class),
description, name);
q.save();
}
}
}
}
}

View File

@ -20,15 +20,9 @@
package com.arsdigita.globalization; package com.arsdigita.globalization;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.parameter.StringParameter; import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.util.parameter.StringArrayParameter;
import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.Parameter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;

View File

@ -145,12 +145,12 @@ public class Initializer extends GenericInitializer {
// .getTransactionContext(); // .getTransactionContext();
//txn.beginTxn(); //txn.beginTxn();
s_log.error("c.ad.kernel.Initializer: Initializing privilege descriptors..."); s_log.debug("c.ad.kernel.Initializer: Initializing privilege descriptors...");
// Initialize privilege descriptors used in permissions service // Initialize privilege descriptors used in permissions service
// Recurring task, reads from database and stores in an internal Map // Recurring task, reads from database and stores in an internal Map
// field. // field.
PrivilegeDescriptor.initialize(); PrivilegeDescriptor.initialize();
s_log.error("Done."); s_log.debug("Done.");
//txn.commitTxn(); //txn.commitTxn();

View File

@ -253,34 +253,34 @@ public class CoreLoader extends PackageLoader {
} }
public void run(final ScriptContext ctx) { public void run(final ScriptContext ctx) {
s_log.error("CoreLoader run method started."); s_log.debug("CoreLoader run method started.");
new KernelExcursion() { new KernelExcursion() {
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
s_log.error("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.error("CoreLoader: Going to execute loadHost()."); s_log.debug("CoreLoader: Going to execute loadHost().");
loadHost(); loadHost();
s_log.error("CoreLoader: Going to execute loadSubsite()."); s_log.debug("CoreLoader: Going to execute loadSubsite().");
loadSubsite(loadKernel()); loadSubsite(loadKernel());
s_log.error("CoreLoader: Going to execute loadBebop()."); s_log.debug("CoreLoader: Going to execute loadBebop().");
loadBebop(); loadBebop();
s_log.error("CoreLoader: Going to execute loadWebDev()."); s_log.debug("CoreLoader: Going to execute loadWebDev().");
loadWebDev(); loadWebDev();
s_log.error("CoreLoader: Going to execute loadSiteMapAdminApp()."); s_log.debug("CoreLoader: Going to execute loadSiteMapAdminApp().");
loadSiteMapAdminApp(loadAdminApp()); loadSiteMapAdminApp(loadAdminApp());
s_log.error("CoreLoader: Going to execute loadPermissionsSiteNode()."); s_log.debug("CoreLoader: Going to execute loadPermissionsSiteNode().");
loadPermissionsSiteNode(); loadPermissionsSiteNode();
s_log.error("CoreLoader: Going to execute loadPortal()."); s_log.debug("CoreLoader: Going to execute loadPortal().");
loadPortal(); loadPortal();
s_log.error("CoreLoader: Going to execute loadMimeTypes()."); s_log.debug("CoreLoader: Going to execute loadMimeTypes().");
loadMimeTypes(); loadMimeTypes();
s_log.error("CoreLoader: Going to execute loadGlobalization()."); s_log.debug("CoreLoader: Going to execute loadGlobalization().");
loadGlobalization(); loadGlobalization();
} }
}.run(); }.run();
s_log.error("CoreLoader run method completed."); s_log.debug("CoreLoader run method completed.");
} }
/** /**
@ -320,24 +320,24 @@ public class CoreLoader extends PackageLoader {
*/ */
private SiteNode loadKernel() { private SiteNode loadKernel() {
// Create Root Site Node // Create Root Site Node
s_log.error("CoreLoader: Going to execute method loadKernel()."); s_log.debug("CoreLoader: Going to execute method loadKernel().");
final SiteNode rootNode = SiteNode.createSiteNode(null, null); final SiteNode rootNode = SiteNode.createSiteNode(null, null);
s_log.error("loadKernel: creating system administrator."); s_log.debug("loadKernel: creating system administrator.");
createSystemAdministrator(); createSystemAdministrator();
// Create Package Types and Instances // Create Package Types and Instances
s_log.error("loadKernel: creating Package Types and Instances."); s_log.debug("loadKernel: creating Package Types and Instances.");
PackageType subsite = PackageType.create PackageType subsite = PackageType.create
("acs-subsite", "ACS Subsite", "ACS Subsites", ("acs-subsite", "ACS Subsite", "ACS Subsites",
"http://arsdigita.com/acs-subsite/"); "http://arsdigita.com/acs-subsite/");
PackageInstance subsiteInstance = subsite.createInstance("Main Site"); PackageInstance subsiteInstance = subsite.createInstance("Main Site");
// Mount instances. // Mount instances.
s_log.error("loadKernel: mount Instances."); s_log.debug("loadKernel: mount Instances.");
rootNode.mountPackage(subsiteInstance); rootNode.mountPackage(subsiteInstance);
s_log.error("CoreLoader: Going to complete method loadKernel()."); s_log.debug("CoreLoader: Going to complete method loadKernel().");
return rootNode; return rootNode;
} }
@ -345,7 +345,7 @@ public class CoreLoader extends PackageLoader {
// exists after installation. // exists after installation.
private void createSystemAdministrator() { private void createSystemAdministrator() {
s_log.error("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*";
String emailAddress = getEmail(); String emailAddress = getEmail();
@ -355,7 +355,7 @@ public class CoreLoader extends PackageLoader {
String password = getPassword(); String password = getPassword();
String passwordQuestion = getQuestion(); String passwordQuestion = getQuestion();
String passwordAnswer = getAnswer(); String passwordAnswer = getAnswer();
s_log.error("createSystemAdministrator: EmailAddr: " + emailAddress + s_log.debug("createSystemAdministrator: EmailAddr: " + emailAddress +
"\n screenName: " + screenName + "\n screenName: " + screenName +
"\n givenName: " + givenName ); "\n givenName: " + givenName );
@ -375,7 +375,7 @@ public class CoreLoader extends PackageLoader {
// Create the system administrator user. // Create the system administrator user.
s_log.error("createSystemAdministrator(): going to create new User."); s_log.debug("createSystemAdministrator(): going to create new User.");
User sa = new User(); User sa = new User();
sa.setPrimaryEmail(new EmailAddress(emailAddress)); sa.setPrimaryEmail(new EmailAddress(emailAddress));
if (screenName != null && if (screenName != null &&
@ -386,7 +386,7 @@ public class CoreLoader extends PackageLoader {
sa.getPersonName().setFamilyName(familyName); sa.getPersonName().setFamilyName(familyName);
// Save the system administrator's authentication credentials. // Save the system administrator's authentication credentials.
s_log.error("createSystemAdministrator(): going to save credentials."); s_log.debug("createSystemAdministrator(): going to save credentials.");
UserAuthentication auth = UserAuthentication.createForUser(sa); UserAuthentication auth = UserAuthentication.createForUser(sa);
auth.setPassword(password); auth.setPassword(password);
auth.setPasswordQuestion(passwordQuestion); auth.setPasswordQuestion(passwordQuestion);
@ -394,19 +394,19 @@ public class CoreLoader extends PackageLoader {
// Grant the system administrator universal "admin" permission. // Grant the system administrator universal "admin" permission.
s_log.error("createSystemAdministrator(): going to grant admin perms."); s_log.debug("createSystemAdministrator(): going to grant admin perms.");
PermissionService.grantPermission PermissionService.grantPermission
(new UniversalPermissionDescriptor (new UniversalPermissionDescriptor
(PrivilegeDescriptor.ADMIN, sa)); (PrivilegeDescriptor.ADMIN, sa));
s_log.error("Adding administrator: \"" + givenName + " " + s_log.debug("Adding administrator: \"" + givenName + " " +
familyName + "\" <" + emailAddress + ">"); familyName + "\" <" + emailAddress + ">");
s_log.error("CoreLoader: method createSystemAdministrator() completed."); s_log.debug("CoreLoader: method createSystemAdministrator() completed.");
} }
private void loadSubsite(SiteNode rootNode) { private void loadSubsite(SiteNode rootNode) {
s_log.error("CoreLoader: Going to execute method loadSubsite()."); s_log.debug("CoreLoader: Going to execute method loadSubsite().");
String sDispatcher = ""; String sDispatcher = "";
PackageInstance packageInstance = rootNode.getPackageInstance(); PackageInstance packageInstance = rootNode.getPackageInstance();