vgritsenko 2004/06/18 07:28:56
Modified:
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components
PipelineAuthenticator.java
src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation
ConfigurationGenerator.java
src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components
PortalManagerImpl.java
src/blocks/session-fw/java/org/apache/cocoon/webapps/session/components
DefaultSessionManager.java
src/java/org/apache/cocoon/components/source SourceUtil.java
src/java/org/apache/cocoon/transformation
AbstractSAXTransformer.java
src/java/org/apache/cocoon/xml/dom DocumentWrapper.java
Log:
Use serializeNode(Node node)
Revision Changes Path
1.15 +24 -25
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/PipelineAuthenticator.java
Index: PipelineAuthenticator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/components/PipelineAuthenticator.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- PipelineAuthenticator.java 17 Mar 2004 12:09:52 -0000 1.14
+++ PipelineAuthenticator.java 18 Jun 2004 14:28:55 -0000 1.15
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,25 +48,25 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @version CVS $Id$
*/
-public class PipelineAuthenticator
+public class PipelineAuthenticator
extends AbstractLogEnabled
implements Serviceable, ThreadSafe, Disposable, Authenticator {
-
+
/** The service manager */
protected ServiceManager manager;
-
+
/** The source resolver */
protected SourceResolver resolver;
-
+
/**
* Check the fragment if it is valid
*/
- private boolean isValidAuthenticationFragment(Document
authenticationFragment)
+ private boolean isValidAuthenticationFragment(Document
authenticationFragment)
throws ProcessingException {
// calling method is synced
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN isValidAuthenticationFragment
fragment="
- +
XMLUtils.serializeNode(authenticationFragment,
XMLUtils.createPropertiesForXML(false)));
+ if (getLogger().isDebugEnabled() ) {
+ getLogger().debug("BEGIN isValidAuthenticationFragment
fragment=" +
+
XMLUtils.serializeNode(authenticationFragment));
}
boolean isValid = false;
@@ -136,12 +136,12 @@
Document doc = null;
String exceptionMsg = null;
-
+
// invoke the source
try {
Source source = null;
try {
- source = SourceUtil.getSource(authenticationResourceName,
null,
+ source = SourceUtil.getSource(authenticationResourceName,
null,
parameters, this.resolver);
doc = SourceUtil.toDOM(source);
} catch (SAXException se) {
@@ -169,7 +169,7 @@
this.getLogger().info("Authenticator: User authenticated
using handler '"
+ configuration.getName() + "'");
}
-
+
MediaManager mediaManager = null;
String mediaType;
try {
@@ -204,7 +204,7 @@
} // end sync
}
}
-
+
if ( !isValid ) {
if (this.getLogger().isInfoEnabled() ) {
this.getLogger().info("Authenticator: Failed authentication
using handler '"
@@ -245,20 +245,20 @@
} else {
root.appendChild(doc.importNode(data, true));
}
-
+
result = new AuthenticationResult(false, doc);
}
-
+
if (this.getLogger().isDebugEnabled() ) {
this.getLogger().debug("end authenticator");
}
return result;
}
-
-
+
+
/* (non-Javadoc)
- * @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+ * @see
org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
*/
public void service(ServiceManager manager) throws ServiceException {
this.manager = manager;
@@ -277,18 +277,18 @@
}
/* (non-Javadoc)
- * @see
org.apache.cocoon.webapps.authentication.components.Authenticator#logout(org.apache.cocoon.webapps.authentication.user.UserHandler)
+ * @see
org.apache.cocoon.webapps.authentication.components.Authenticator#logout(UserHandler)
*/
public void logout(UserHandler handler) {
if (this.getLogger().isDebugEnabled() ) {
this.getLogger().debug("logout using handler " +
handler.getHandlerName());
}
-
+
final HandlerConfiguration configuration =
handler.getHandlerConfiguration();
final String logoutResourceName = configuration.getLogoutResource();
if (logoutResourceName != null) {
final SourceParameters parameters =
configuration.getAuthenticationResourceParameters();
-
+
// invoke the source
Source source = null;
try {
@@ -303,5 +303,4 @@
}
}
}
-
}
1.10 +31 -30
cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ConfigurationGenerator.java
Index: ConfigurationGenerator.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/ConfigurationGenerator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ConfigurationGenerator.java 19 Mar 2004 13:59:22 -0000 1.9
+++ ConfigurationGenerator.java 18 Jun 2004 14:28:55 -0000 1.10
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -70,7 +70,7 @@
/** The XPath Processor */
protected XPathProcessor xpathProcessor;
-
+
/* (non-Javadoc)
* @see org.apache.avalon.framework.activity.Disposable#dispose()
*/
@@ -101,15 +101,15 @@
try {
authManager =
(AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
state = authManager.getState();
-
+
} catch (Exception ignore) {
}
-
+
this.xmlConsumer.startDocument();
if ( state != null ) {
try {
UserHandler userhandler = state.getHandler();
-
+
Configuration conf =
state.getModuleConfiguration("single-role-user-management");
if (conf == null) {
throw new ProcessingException("Module configuration
'single-role-user-management' for authentication user management generator not
found.");
@@ -117,7 +117,7 @@
UserManagementHandler handler = new
UserManagementHandler(conf,
state.getApplicationName());
this.showConfiguration(this.xmlConsumer, this.source,
handler, userhandler.getContext());
-
+
} catch (ConfigurationException ex) {
throw new ProcessingException("ConfigurationException: " +
ex, ex);
}
@@ -147,7 +147,7 @@
Request request = ObjectModelHelper.getRequest(this.objectModel);
Response response = ObjectModelHelper.getResponse(this.objectModel);
Session session = request.getSession();
-
+
boolean isAdmin = (src == null || src.equals("admin"));
// now start producing xml:
@@ -180,7 +180,7 @@
}
- synchronized (session) {
+ synchronized (session) {
String state = request.getParameter(REQ_PARAMETER_STATE);
if (state == null) {
@@ -462,8 +462,8 @@
}
- if (this.getLogger().isDebugEnabled() == true) {
- this.getLogger().debug("END getUsers fragment="+(frag == null ?
"null" : XMLUtils.serializeNode(frag, XMLUtils.createPropertiesForXML(false))));
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("END getUsers fragment=" + (frag == null?
"null": XMLUtils.serializeNode(frag)));
}
return frag;
}
@@ -482,21 +482,22 @@
if (this.getLogger().isDebugEnabled() == true) {
this.getLogger().debug("BEGIN getRoles");
}
- Document frag = null;
+ Document frag = null;
if (handler.getLoadRolesResource() != null) {
final String loadRolesResource = handler.getLoadRolesResource();
final SourceParameters loadParameters =
handler.getLoadRolesResourceParameters();
SourceParameters parameters = (loadParameters == null) ? new
SourceParameters()
:
(SourceParameters)loadParameters.clone();
- if (handler.getApplicationName() != null)
+ if (handler.getApplicationName() != null) {
parameters.setSingleParameterValue("application",
handler.getApplicationName());
+ }
parameters.setSingleParameterValue("type", "roles");
frag = this.loadResource(loadRolesResource, parameters);
}
- if (this.getLogger().isDebugEnabled() == true) {
- this.getLogger().debug("END getRoles fragment="+frag);
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("END getRoles fragment=" + frag);
}
return frag;
}
@@ -671,18 +672,18 @@
throws IOException, ProcessingException, SAXException {
Source source = null;
try {
- source = SourceUtil.getSource(resource,
- null,
- parameters,
+ source = SourceUtil.getSource(resource,
+ null,
+ parameters,
this.resolver);
- SourceUtil.parse(this.manager, source, new DefaultHandler());
+ SourceUtil.parse(this.manager, source, new DefaultHandler());
} catch (SourceException se) {
throw SourceUtil.handle(se);
} finally {
this.resolver.release(source);
}
}
-
+
/**
* Load XML resource
*/
@@ -691,9 +692,9 @@
throws IOException, ProcessingException, SAXException {
Source source = null;
try {
- source = SourceUtil.getSource(resource,
- null,
- parameters,
+ source = SourceUtil.getSource(resource,
+ null,
+ parameters,
this.resolver);
return SourceUtil.toDOM(source);
} catch (SourceException se) {
@@ -708,11 +709,11 @@
/** The name of the current application */
private String applicationName;
-
+
/** The load-users resource */
private String loadUsersResource;
private SourceParameters loadUsersResourceParameters;
-
+
/** The load-roles resource */
private String loadRolesResource;
private SourceParameters loadRolesResourceParameters;
@@ -744,9 +745,9 @@
String appName)
throws ConfigurationException {
Configuration child;
-
+
this.applicationName = appName;
-
+
// get load-users resource (optional)
child = conf.getChild("load-users", false);
if (child != null) {
@@ -801,7 +802,7 @@
* Get the name of the current application
*/
public String getApplicationName() { return this.applicationName; }
-
+
/**
* Get the load users resource
*/
1.9 +99 -96
cocoon-2.1/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManagerImpl.java
Index: PortalManagerImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal-fw/java/org/apache/cocoon/webapps/portal/components/PortalManagerImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PortalManagerImpl.java 26 May 2004 08:39:49 -0000 1.8
+++ PortalManagerImpl.java 18 Jun 2004 14:28:55 -0000 1.9
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -91,16 +91,16 @@
/** The media manager */
private MediaManager mediaManager;
-
+
/** The XPath Processor */
private XPathProcessor xpathProcessor;
/** The session manager */
private SessionManager sessionManager;
-
+
/** The Context manager */
private ContextManager contextManager;
-
+
/** The transaction manager */
private TransactionManager transactionManager;
@@ -112,10 +112,10 @@
/** The context */
protected Context componentContext;
-
+
/** Are we already setup for this request? */
protected boolean initialized = false;
-
+
/* (non-Javadoc)
* @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
*/
@@ -144,7 +144,7 @@
AuthenticationManager authManager = null;
try {
authManager =
(AuthenticationManager)this.manager.lookup(AuthenticationManager.ROLE);
- return authManager.getState();
+ return authManager.getState();
} catch (ServiceException ce) {
// ignore this here
return null;
@@ -156,7 +156,7 @@
/* (non-Javadoc)
* @see
org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
*/
- public void service(ServiceManager manager)
+ public void service(ServiceManager manager)
throws ServiceException {
this.manager = manager;
this.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
@@ -233,23 +233,23 @@
protected void setup()
throws ProcessingException {
if ( !this.initialized ) {
-
+
final Request request =
ContextHelper.getRequest(this.componentContext);
-
+
if ( request.getAttribute(PortalManager.ROLE) == null ) {
-
+
request.setAttribute(PortalManager.ROLE, Boolean.TRUE);
-
+
// Get and ignore the configuration
this.getConfiguration();
-
+
try {
this.changeProfile();
} catch (SAXException se) {
throw new ProcessingException(se);
}
}
-
+
this.initialized = true;
}
}
@@ -258,14 +258,14 @@
* @see
org.apache.cocoon.webapps.portal.components.PortalManager#configurationTest()
*/
public void configurationTest()
- throws ProcessingException {
+ throws ProcessingException {
// no sync required
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("BEGIN configurationTest");
}
this.setup();
-
+
// Ignore result
this.getConfiguration();
@@ -298,7 +298,7 @@
if (context == null && create) {
// create new context
-
+
context =
this.getAuthenticationManager().createApplicationContext(attrName, null, null);
}
@@ -323,7 +323,7 @@
// synchronized not req.
this.setup();
Response response = ContextHelper.getResponse(this.componentContext);
-
+
XMLUtils.startElement(consumer,
PortalConstants.ELEMENT_CONFIGURATION);
// set the portal-page uri:
@@ -537,13 +537,13 @@
if (saveResource == null) {
throw new ProcessingException("portal: No save
resource defined for type coplet-base.");
- }
-
- SourceUtil.writeDOM(saveResource,
- null,
- pars,
- copletsFragment,
- this.resolver,
+ }
+
+ SourceUtil.writeDOM(saveResource,
+ null,
+ pars,
+ copletsFragment,
+ this.resolver,
"xml");
// now the hardest part, clean up the whole cache
@@ -686,9 +686,9 @@
if (res == null) {
throw new ProcessingException("No configuration for
portal-coplet base profile found.");
}
- copletsFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ copletsFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
context.setAttribute(ATTRIBUTE_ADMIN_COPLETS,
copletsFragment);
}
@@ -741,14 +741,15 @@
}
}
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END getStatusProfile
statusProfile="+(statusProfile == null ? "null" :
XMLUtils.serializeNode(statusProfile, XMLUtils.createPropertiesForXML(false))));
+ if (getLogger().isDebugEnabled() ) {
+ getLogger().debug("END getStatusProfile statusProfile=" +
+ (statusProfile == null? "null":
XMLUtils.serializeNode(statusProfile)));
}
return statusProfile;
}
/* (non-Javadoc)
- * @see
org.apache.cocoon.webapps.portal.components.PortalManager#showPortal(org.apache.cocoon.xml.XMLConsumer,
boolean, boolean)
+ * @see
org.apache.cocoon.webapps.portal.components.PortalManager#showPortal(XMLConsumer,
boolean, boolean)
*/
public void showPortal(XMLConsumer consumer,
boolean configMode,
@@ -760,7 +761,7 @@
configMode+", adminProfile="+adminProfile);
}
this.setup();
-
+
SessionContext context = this.getContext(true);
String profileID = null;
Map storedProfile = null;
@@ -1598,7 +1599,7 @@
public String getProfileID(String type,
String role,
String id,
- boolean adminProfile)
+ boolean adminProfile)
throws ProcessingException {
// No sync required
this.setup();
@@ -1639,7 +1640,7 @@
int pos = profileID.indexOf('_');
if (pos == -1) {
return null;
- }
+ }
String lastPart = profileID.substring(pos+1);
pos = lastPart.indexOf('_');
if (pos == -1) return null;
@@ -2621,9 +2622,9 @@
// each attribute of first must be in second with the same value
while (i < l && ok) {
value = attr1.item(i).getNodeName();
- if (!value.equals("formtype")
- && !value.equals("formpath")
- && !value.equals("formdescription")
+ if (!value.equals("formtype")
+ && !value.equals("formpath")
+ && !value.equals("formdescription")
&& !value.startsWith("xmlns:")) {
ok = false;
m = 0;
@@ -2844,7 +2845,7 @@
if (children != null && children.getLength() > 0) {
int l = children.getLength();
for(int i = 0; i < l; i++) {
- if (!children.item(i).getNodeName().equals("status")
+ if (!children.item(i).getNodeName().equals("status")
&& children.item(i).getNodeType() ==
Node.ELEMENT_NODE) {
IncludeXMLConsumer.includeNode(children.item(i),
consumer, consumer);
}
@@ -2917,18 +2918,18 @@
/* (non-Javadoc)
* @see
org.apache.cocoon.webapps.portal.components.PortalManager#getMediaType()
*/
- public String getMediaType()
+ public String getMediaType()
throws ProcessingException {
this.setup();
return this.getMediaManager().getMediaType();
}
-
+
/**
* Get the coplet with the id
*/
private Element getCopletConfiguration(String copletID,
Map defaultCoplets,
- Map mediaCoplets)
+ Map mediaCoplets)
throws ProcessingException {
// calling method is synced
String media = this.getMediaManager().getMediaType();
@@ -3491,9 +3492,9 @@
if (this.getLogger().isInfoEnabled()) {
this.getLogger().info("Building portal profile: " +
resource);
}
- SourceUtil.readDOM(resource,
- null,
- pars,
+ SourceUtil.readDOM(resource,
+ null,
+ pars,
this.resolver);
} else {
this.buildProfile(type, role, id, adminProfile);
@@ -3538,9 +3539,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("Loading coplet base profile");
}
- copletsFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ copletsFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
@@ -3554,9 +3555,9 @@
this.getLogger().debug("loading layout base profile");
}
pars.setSingleParameterValue("profile", "layout-base");
- layoutFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ layoutFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
@@ -3584,9 +3585,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading type base profile");
}
- typeFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ typeFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
profileRoot.appendChild(profileDoc.importNode(DOMUtil.selectSingleNode(typeFragment,
"type-profile", this.xpathProcessor), true));
@@ -3627,9 +3628,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading global profile");
}
- globalFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ globalFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("global profile loaded");
@@ -3646,9 +3647,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading global type profile");
}
- globalFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ globalFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("global type profile loaded");
@@ -3684,9 +3685,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading role profile");
}
- roleFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ roleFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("role profile loaded");
@@ -3704,9 +3705,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading role type profile");
}
- roleFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ roleFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("role type profile loaded");
@@ -3740,9 +3741,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading user profile");
}
- userFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ userFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("user profile loaded");
@@ -3760,9 +3761,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading user type profile");
}
- userFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ userFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("user type profile loaded");
@@ -3801,9 +3802,9 @@
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("loading user status profile");
}
- userFragment = SourceUtil.readDOM(res,
- null,
- pars,
+ userFragment = SourceUtil.readDOM(res,
+ null,
+ pars,
this.resolver);
if (this.getLogger().isDebugEnabled()) {
this.getLogger().debug("user status profile loaded");
@@ -3863,11 +3864,11 @@
pars.setSingleParameterValue("handler",
reqstate.getHandlerName());
pars.setSingleParameterValue("profile", "user-status");
- SourceUtil.writeDOM(res,
- null,
+ SourceUtil.writeDOM(res,
+ null,
pars,
- userFragment,
- this.resolver,
+ userFragment,
+ this.resolver,
"xml");
} finally {
@@ -4050,11 +4051,11 @@
if (role != null)
pars.setSingleParameterValue("role", role);
pars.setSingleParameterValue("application",
reqstate.getApplicationName());
pars.setSingleParameterValue("handler",
reqstate.getHandlerName());
- SourceUtil.writeDOM(saveResource,
- null,
+ SourceUtil.writeDOM(saveResource,
+ null,
pars,
- delta,
- this.resolver,
+ delta,
+ this.resolver,
"xml");
if (delta.getParentNode() != null)
delta.getParentNode().removeChild(delta);
@@ -4192,28 +4193,30 @@
if (child != null) {
String loadUsersResource = child.getAttribute("uri", null);
SourceParameters loadUsersResourceParameters =
SourceParameters.create(child);
-
+
if (loadUsersResource != null) {
SourceParameters parameters =
(loadUsersResourceParameters == null) ? new SourceParameters()
-
: loadUsersResourceParameters;
- if (reqstate.getApplicationName() != null)
+ if (reqstate.getApplicationName() != null) {
parameters.setSingleParameterValue("application",
reqstate.getApplicationName());
+ }
if (ID != null) {
parameters.setSingleParameterValue("type", "user");
parameters.setSingleParameterValue("ID", ID);
} else {
parameters.setSingleParameterValue("type", "users");
}
- if (role != null)
parameters.setSingleParameterValue("role", role);
+ if (role != null) {
+ parameters.setSingleParameterValue("role", role);
+ }
frag = this.loadResource(loadUsersResource, parameters);
-
}
}
}
-
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("END getUsers fragment="+(frag == null ?
"null" : XMLUtils.serializeNode(frag, XMLUtils.createPropertiesForXML(false))));
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("END getUsers fragment=" +
+ (frag == null? "null":
XMLUtils.serializeNode(frag)));
}
return frag;
}
@@ -4269,9 +4272,9 @@
throws IOException, ProcessingException, SAXException {
Source source = null;
try {
- source = SourceUtil.getSource(resource,
- null,
- parameters,
+ source = SourceUtil.getSource(resource,
+ null,
+ parameters,
this.resolver);
return SourceUtil.toDOM(source);
} catch (SourceException se) {
1.7 +22 -19
cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/components/DefaultSessionManager.java
Index: DefaultSessionManager.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/components/DefaultSessionManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultSessionManager.java 17 Mar 2004 12:09:51 -0000 1.6
+++ DefaultSessionManager.java 18 Jun 2004 14:28:56 -0000 1.7
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -54,17 +54,17 @@
/** The context */
private Context context;
-
+
/** The <code>ServiceManager</code> */
private ServiceManager manager;
/** The context manager */
private ContextManager contextManager;
-
+
/**
* Avalon Serviceable Interface
*/
- public void service(ServiceManager manager)
+ public void service(ServiceManager manager)
throws ServiceException {
this.manager = manager;
this.contextManager =
(ContextManager)this.manager.lookup(ContextManager.ROLE);
@@ -127,7 +127,7 @@
* it is set to false, the session is only terminated
* if no session context is available.
*/
- public void terminateSession(boolean force)
+ public void terminateSession(boolean force)
throws ProcessingException {
// synchronized
if (this.getLogger().isDebugEnabled() ) {
@@ -181,8 +181,9 @@
DocumentFragment frag;
frag = context.getXML(path);
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("END getContextFragment
documentFragment=" + (frag == null ? "null" : XMLUtils.serializeNode(frag,
XMLUtils.createPropertiesForXML(false))));
+ if (getLogger().isDebugEnabled() ) {
+ getLogger().debug("END getContextFragment documentFragment=" +
+ (frag == null? "null":
XMLUtils.serializeNode(frag)));
}
return frag;
}
@@ -246,9 +247,10 @@
throws ProcessingException {
// synchronized via context
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("BEGIN setContextFragment name=" +
contextName + ", path=" + path +
- ", fragment=" + (fragment == null ? "null" :
XMLUtils.serializeNode(fragment, XMLUtils.createPropertiesForXML(false))));
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("BEGIN setContextFragment name=" + contextName
+
+ ", path=" + path +
+ ", fragment=" + (fragment == null? "null":
XMLUtils.serializeNode(fragment)));
}
// test arguments
if (contextName == null) {
@@ -291,10 +293,10 @@
DocumentFragment fragment)
throws ProcessingException {
// synchronized via context
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN appendContextFragment name=" +
contextName +
+ if (getLogger().isDebugEnabled() ) {
+ getLogger().debug("BEGIN appendContextFragment name=" +
contextName +
", path=" + path +
- ", fragment=" + (fragment == null ? "null" :
XMLUtils.serializeNode(fragment, XMLUtils.createPropertiesForXML(false))));
+ ", fragment=" + (fragment == null? "null":
XMLUtils.serializeNode(fragment)));
}
// test arguments
if (contextName == null) {
@@ -337,9 +339,10 @@
DocumentFragment fragment)
throws ProcessingException {
// synchronized via context
- if (this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("BEGIN mergeContextFragment name=" +
contextName + ", path=" + path +
- ", fragment=" + (fragment == null ? "null" :
XMLUtils.serializeNode(fragment, XMLUtils.createPropertiesForXML(false))));
+ if (getLogger().isDebugEnabled() ) {
+ getLogger().debug("BEGIN mergeContextFragment name=" +
contextName +
+ ", path=" + path +
+ ", fragment=" + (fragment == null? "null":
XMLUtils.serializeNode(fragment)));
}
// test arguments
1.21 +5 -8
cocoon-2.1/src/java/org/apache/cocoon/components/source/SourceUtil.java
Index: SourceUtil.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/SourceUtil.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- SourceUtil.java 11 Jun 2004 20:32:20 -0000 1.20
+++ SourceUtil.java 18 Jun 2004 14:28:56 -0000 1.21
@@ -507,8 +507,7 @@
frag.normalize();
- if ( null != serializerName) {
-
+ if (null != serializerName) {
ServiceManager manager =
EnvironmentHelper.getSitemapServiceManager();
ServiceSelector selector = null;
Serializer serializer = null;
@@ -549,8 +548,7 @@
}
} else {
String content;
- if ( null != serializerName) {
-
+ if (null != serializerName) {
ServiceManager manager =
EnvironmentHelper.getSitemapServiceManager();
ServiceSelector selector = null;
Serializer serializer = null;
@@ -585,12 +583,13 @@
content = XMLUtils.serializeNode(frag, props);
}
- if (parameters==null) {
+ if (parameters == null) {
parameters = new SourceParameters();
} else {
parameters = (SourceParameters) parameters.clone();
}
parameters.setSingleParameterValue("content", content);
+
source = SourceUtil.getSource(location, typeParameters,
parameters, resolver);
SourceUtil.toSAX(source, new DefaultHandler());
@@ -601,8 +600,6 @@
throw new ProcessingException(ce);
} catch (SAXException ce) {
throw new ProcessingException(ce);
- // } catch (ComponentException ce) {
- // throw new ProcessingException("Exception during lookup of
component.", ce);
} finally {
resolver.release(source);
}
1.13 +2 -2
cocoon-2.1/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
Index: AbstractSAXTransformer.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractSAXTransformer.java 18 Jun 2004 13:54:00 -0000 1.12
+++ AbstractSAXTransformer.java 18 Jun 2004 14:28:56 -0000 1.13
@@ -473,7 +473,7 @@
if (getLogger().isDebugEnabled()) {
getLogger().debug("Start serialized XML recording. Format=" +
format);
}
- this.stack.push((format == null?
XMLUtils.createPropertiesForXML(false): format));
+ this.stack.push(format == null?
XMLUtils.createPropertiesForXML(false): format);
startRecording();
}
1.7 +49 -49
cocoon-2.1/src/java/org/apache/cocoon/xml/dom/DocumentWrapper.java
Index: DocumentWrapper.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/xml/dom/DocumentWrapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DocumentWrapper.java 11 Jun 2004 11:34:32 -0000 1.6
+++ DocumentWrapper.java 18 Jun 2004 14:28:56 -0000 1.7
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -48,7 +48,7 @@
public class DocumentWrapper implements org.w3c.dom.Document, XMLizable {
Document document = null;
-
+
/** Creates a new instance of DocmentWrapper */
public DocumentWrapper(Document doc) {
this.document = doc;
@@ -65,13 +65,13 @@
public void toSAX(org.xml.sax.ContentHandler handler) throws
SAXException {
DOMStreamer ds = new DOMStreamer(handler);
- ds.stream(this.document.getDocumentElement());
- }
+ ds.stream(this.document.getDocumentElement());
+ }
public String toString() {
try {
- return XMLUtils.serializeNode(this.document,
XMLUtils.createPropertiesForXML(false));
+ return XMLUtils.serializeNode(this.document);
} catch (ProcessingException e) {
}
return "";
@@ -99,7 +99,7 @@
public Node appendChild(Node newChild) throws DOMException {
return this.document.appendChild(newChild);
}
-
+
/** Returns a duplicate of this node, i.e., serves as a generic copy
* constructor for nodes. The duplicate node has no parent; (
* <code>parentNode</code> is <code>null</code>.).
@@ -127,7 +127,7 @@
public Node cloneNode(boolean deep) {
return this.document.cloneNode(deep);
}
-
+
/** Creates an <code>Attr</code> of the given name. Note that the
* <code>Attr</code> instance can then be set on an <code>Element</code>
* using the <code>setAttributeNode</code> method.
@@ -146,7 +146,7 @@
public Attr createAttribute(String name) throws DOMException {
return this.document.createAttribute(name);
}
-
+
/** Creates an attribute of the given qualified name and namespace URI.
* @param namespaceURI The namespace URI of the attribute to create.
* @param qualifiedName The qualified name of the attribute to
@@ -212,7 +212,7 @@
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
throws DOMException {
return this.document.createAttributeNS(namespaceURI, qualifiedName);
}
-
+
/** Creates a <code>CDATASection</code> node whose value is the specified
* string.
* @param data The data for the <code>CDATASection</code> contents.
@@ -224,7 +224,7 @@
public CDATASection createCDATASection(String data) throws DOMException {
return this.document.createCDATASection(data);
}
-
+
/** Creates a <code>Comment</code> node given the specified string.
* @param data The data for the node.
* @return The new <code>Comment</code> object.
@@ -233,7 +233,7 @@
public Comment createComment(String data) {
return this.document.createComment(data);
}
-
+
/** Creates an empty <code>DocumentFragment</code> object.
* @return A new <code>DocumentFragment</code>.
*
@@ -241,7 +241,7 @@
public DocumentFragment createDocumentFragment() {
return this.document.createDocumentFragment();
}
-
+
/** Creates an element of the type specified. Note that the instance
* returned implements the <code>Element</code> interface, so attributes
* can be specified directly on the returned object.
@@ -266,7 +266,7 @@
public Element createElement(String tagName) throws DOMException {
return this.document.createElement(tagName);
}
-
+
/** Creates an element of the given qualified name and namespace URI.
* @param namespaceURI The namespace URI of the element to create.
* @param qualifiedName The qualified name of the element type to
@@ -324,7 +324,7 @@
public Element createElementNS(String namespaceURI, String
qualifiedName) throws DOMException {
return this.document.createElementNS(namespaceURI, qualifiedName);
}
-
+
/** Creates an <code>EntityReference</code> object. In addition, if the
* referenced entity is known, the child list of the
* <code>EntityReference</code> node is made the same as that of the
@@ -345,7 +345,7 @@
public EntityReference createEntityReference(String name) throws
DOMException {
return this.document.createEntityReference(name);
}
-
+
/** Creates a <code>ProcessingInstruction</code> node given the specified
* name and data strings.
* @param target The target part of the processing instruction.
@@ -360,7 +360,7 @@
public ProcessingInstruction createProcessingInstruction(String target,
String data) throws DOMException {
return this.document.createProcessingInstruction(target, data);
}
-
+
/** Creates a <code>Text</code> node given the specified string.
* @param data The data for the node.
* @return The new <code>Text</code> object.
@@ -369,7 +369,7 @@
public Text createTextNode(String data) {
return this.document.createTextNode(data);
}
-
+
/** A <code>NamedNodeMap</code> containing the attributes of this node
(if
* it is an <code>Element</code>) or <code>null</code> otherwise.
*
@@ -377,7 +377,7 @@
public NamedNodeMap getAttributes() {
return this.document.getAttributes();
}
-
+
/** A <code>NodeList</code> that contains all children of this node. If
* there are no children, this is a <code>NodeList</code> containing no
* nodes.
@@ -386,7 +386,7 @@
public NodeList getChildNodes() {
return this.document.getChildNodes();
}
-
+
/** The Document Type Declaration (see <code>DocumentType</code>)
* associated with this document. For HTML documents as well as XML
* documents without a document type declaration this returns
@@ -400,7 +400,7 @@
public DocumentType getDoctype() {
return this.document.getDoctype();
}
-
+
/** This is a convenience attribute that allows direct access to the
child
* node that is the root element of the document. For HTML documents,
* this is the element with the tagName "HTML".
@@ -409,7 +409,7 @@
public Element getDocumentElement() {
return this.document.getDocumentElement();
}
-
+
/** Returns the <code>Element</code> whose <code>ID</code> is given by
* <code>elementId</code>. If no such element exists, returns
* <code>null</code>. Behavior is not defined if more than one element
@@ -426,7 +426,7 @@
public Element getElementById(String elementId) {
return this.document.getElementById(elementId);
}
-
+
/** Returns a <code>NodeList</code> of all the <code>Elements</code>
with a
* given tag name in the order in which they are encountered in a
* preorder traversal of the <code>Document</code> tree.
@@ -439,7 +439,7 @@
public NodeList getElementsByTagName(String tagname) {
return this.document.getElementsByTagName(tagname);
}
-
+
/** Returns a <code>NodeList</code> of all the <code>Elements</code>
with a
* given local name and namespace URI in the order in which they are
* encountered in a preorder traversal of the <code>Document</code> tree.
@@ -455,7 +455,7 @@
public NodeList getElementsByTagNameNS(String namespaceURI, String
localName) {
return this.document.getElementsByTagNameNS(namespaceURI, localName);
}
-
+
/** The first child of this node. If there is no such node, this returns
* <code>null</code>.
*
@@ -463,7 +463,7 @@
public Node getFirstChild() {
return this.document.getFirstChild();
}
-
+
/** The <code>DOMImplementation</code> object that handles this
document. A
* DOM application may use objects from multiple implementations.
*
@@ -471,7 +471,7 @@
public DOMImplementation getImplementation() {
return this.document.getImplementation();
}
-
+
/** The last child of this node. If there is no such node, this returns
* <code>null</code>.
*
@@ -479,7 +479,7 @@
public Node getLastChild() {
return this.document.getLastChild();
}
-
+
/** Returns the local part of the qualified name of this node.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
@@ -491,7 +491,7 @@
public String getLocalName() {
return this.document.getLocalName();
}
-
+
/** The namespace URI of this node, or <code>null</code> if it is
* unspecified.
* <br>This is not a computed value that is the result of a namespace
@@ -510,7 +510,7 @@
public String getNamespaceURI() {
return this.document.getNamespaceURI();
}
-
+
/** The node immediately following this node. If there is no such node,
* this returns <code>null</code>.
*
@@ -518,21 +518,21 @@
public Node getNextSibling() {
return this.document.getNextSibling();
}
-
+
/** The name of this node, depending on its type; see the table above.
*
*/
public String getNodeName() {
return this.document.getNodeName();
}
-
+
/** A code representing the type of the underlying object, as defined
above.
*
*/
public short getNodeType() {
return this.document.getNodeType();
}
-
+
/** The value of this node, depending on its type; see the table above.
* When it is defined to be <code>null</code>, setting it has no effect.
* @exception DOMException
@@ -545,7 +545,7 @@
public String getNodeValue() throws DOMException {
return this.document.getNodeValue();
}
-
+
/** The <code>Document</code> object associated with this node. This is
* also the <code>Document</code> object used to create new nodes. When
* this node is a <code>Document</code> or a <code>DocumentType</code>
@@ -557,7 +557,7 @@
public Document getOwnerDocument() {
return this.document.getOwnerDocument();
}
-
+
/** The parent of this node. All nodes, except <code>Attr</code>,
* <code>Document</code>, <code>DocumentFragment</code>,
* <code>Entity</code>, and <code>Notation</code> may have a parent.
@@ -569,7 +569,7 @@
public Node getParentNode() {
return this.document.getParentNode();
}
-
+
/** The namespace prefix of this node, or <code>null</code> if it is
* unspecified.
* <br>Note that setting this attribute, when permitted, changes the
@@ -604,7 +604,7 @@
public String getPrefix() {
return this.document.getPrefix();
}
-
+
/** The node immediately preceding this node. If there is no such node,
* this returns <code>null</code>.
*
@@ -612,7 +612,7 @@
public Node getPreviousSibling() {
return this.document.getPreviousSibling();
}
-
+
/** Returns whether this node (if it is an element) has any attributes.
* @return <code>true</code> if this node has any attributes,
* <code>false</code> otherwise.
@@ -622,7 +622,7 @@
public boolean hasAttributes() {
return this.document.hasAttributes();
}
-
+
/** Returns whether this node has any children.
* @return <code>true</code> if this node has any children,
* <code>false</code> otherwise.
@@ -631,7 +631,7 @@
public boolean hasChildNodes() {
return this.document.hasChildNodes();
}
-
+
/** Imports a node from another document to this document. The returned
* node has no parent; (<code>parentNode</code> is <code>null</code>).
* The source node is not altered or removed from the original document;
@@ -733,7 +733,7 @@
public Node importNode(Node importedNode, boolean deep) throws
DOMException {
return this.document.importNode(importedNode, deep);
}
-
+
/** Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>. If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
@@ -761,7 +761,7 @@
public Node insertBefore(Node newChild, Node refChild) throws
DOMException {
return this.document.insertBefore(newChild, refChild);
}
-
+
/** Tests whether the DOM implementation implements a specific feature
and
* that feature is supported by this node.
* @param feature The name of the feature to test. This is the same name
@@ -779,7 +779,7 @@
public boolean isSupported(String feature, String version) {
return this.document.isSupported(feature, version);
}
-
+
/** Puts all <code>Text</code> nodes in the full depth of the sub-tree
* underneath this <code>Node</code>, including attribute nodes, into a
* "normal" form where only structure (e.g., elements, comments,
@@ -799,7 +799,7 @@
public void normalize() {
this.document.normalize();
}
-
+
/** Removes the child node indicated by <code>oldChild</code> from the
list
* of children, and returns it.
* @param oldChild The node being removed.
@@ -847,7 +847,7 @@
public Node replaceChild(Node newChild, Node oldChild) throws
DOMException {
return this.document.replaceChild(newChild, oldChild);
}
-
+
/** The value of this node, depending on its type; see the table above.
* When it is defined to be <code>null</code>, setting it has no effect.
* @exception DOMException
@@ -860,7 +860,7 @@
public void setNodeValue(String nodeValue) throws DOMException {
this.document.setNodeValue(nodeValue);
}
-
+
/** The namespace prefix of this node, or <code>null</code> if it is
* unspecified.
* <br>Note that setting this attribute, when permitted, changes the
@@ -895,5 +895,5 @@
public void setPrefix(String prefix) throws DOMException {
this.document.setPrefix(prefix);
}
-
+
}