cziegeler 02/01/10 07:01:52 Modified: src/java/org/apache/cocoon/components/deli DeliImpl.java Log: Making Deli Implementation Parameterizable instead of Configurable Revision Changes Path 1.2 +27 -28 xml-cocoon2/src/java/org/apache/cocoon/components/deli/DeliImpl.java Index: DeliImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/deli/DeliImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DeliImpl.java 9 Jan 2002 22:20:42 -0000 1.1 +++ DeliImpl.java 10 Jan 2002 15:01:52 -0000 1.2 @@ -10,14 +10,12 @@ import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.Composable; -import org.apache.avalon.framework.configuration.Configurable; -import org.apache.avalon.framework.configuration.Configuration; -import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.avalon.framework.parameters.Parameters; +import org.apache.avalon.framework.parameters.Parameterizable; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; @@ -60,18 +58,20 @@ import com.hp.hpl.deli.Workspace; /** - * Allows the use of <a href="http://www-uk.hpl.hp.com/people/marbut/">DELI</a> - * to provide <a href="http://www.w3.org/Mobile/CCPP/">CC/PP</a> or + * Allows the use of <a href="http://www-uk.hpl.hp.com/people/marbut/">DELI</a> + * to provide <a href="http://www.w3.org/Mobile/CCPP/">CC/PP</a> or * <a href="http://www1.wapforum.org/tech/terms.asp?doc=WAP-248-UAProf-20010530-p.pdf">UAProf</a> * support. For more details of DELI see the Technical Report - * <a href="http://www-uk.hpl.hp.com/people/marbut/DeliUserGuideWEB.htm">DELI: + * <a href="http://www-uk.hpl.hp.com/people/marbut/DeliUserGuideWEB.htm">DELI: * A Delivery Context Library for CC/PP and UAProf</a>. - * + * * @author <a href="mailto:[EMAIL PROTECTED]">Mark H. Butler</a> - * @version CVS $ $ $Date: 2002/01/09 22:20:42 $ + * @version CVS $ $ $Date: 2002/01/10 15:01:52 $ */ -public class DeliImpl extends AbstractLoggable implements Configurable, Component, Deli, +public class DeliImpl +extends AbstractLoggable +implements Parameterizable, Component, Deli, Composable, Disposable, ThreadSafe, Contextualizable { /** The path to the Cocoon configuration files */ @@ -92,19 +92,19 @@ /** A context, used to retrieve the path to the configuration file */ protected Context context; - /** This flag indicates whether DELI has been enabled in sitemap.xmap */ + /** This flag indicates whether DELI has been enabled in sitemap.xmap */ boolean useDeli = false; /** Contextualize this class */ - public void contextualize(Context context) throws ContextException + public void contextualize(Context context) throws ContextException { this.context = context; - org.apache.cocoon.environment.Context envContext = + org.apache.cocoon.environment.Context envContext = (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); try { this.defaultPath = envContext.getRealPath("/"); - } + } catch (Exception e) { getLogger().error("DELI: Could not retrieve directory for configuration files", e); @@ -112,16 +112,15 @@ } /** Compose this class */ - public void compose(ComponentManager manager) throws ComponentException + public void compose(ComponentManager manager) throws ComponentException { this.manager = manager; parser = (Parser)this.manager.lookup(Parser.ROLE); } /** Configure this class */ - public final void configure(Configuration conf) throws ConfigurationException + public final void parameterize(Parameters params) { - Parameters params = Parameters.fromConfiguration(conf); this.deliConfig = params.getParameter("deli-config-file", this.deliConfig); this.useDeli = params.getParameterAsBoolean("use-deli", this.useDeli); if (this.useDeli) @@ -131,16 +130,16 @@ } /** Dispose of this class */ - public void dispose() + public void dispose() { if(parser != null) this.manager.release((Component)parser); } /** Process a HttpServletRequest and either extract - * CC/PP or UAProf information from it and use this information + * CC/PP or UAProf information from it and use this information * to resolve a profile or examine the user agent string, match * this using the DELI legacy device database, and use this - * information to retrieve the appropriate CC/PP profile. + * information to retrieve the appropriate CC/PP profile. * *@param theRequest The Request. *@return The profile as a vector of profile attributes. @@ -174,7 +173,7 @@ document.appendChild(rootElement); Iterator profileIter = theProfile.iterator(); - while (profileIter.hasNext()) + while (profileIter.hasNext()) { ProfileAttribute p = (ProfileAttribute) profileIter.next(); attributeNode = document.createElementNS(null, p.getAttribute()); @@ -186,19 +185,19 @@ // Simple attribute String value = (String) complexValueIter.next(); text = document.createTextNode(value); - attributeNode.appendChild(text); + attributeNode.appendChild(text); } else { // Complex attribute e.g. Seq or Bag while (complexValueIter.hasNext()) { - String value = (String) complexValueIter.next(); + String value = (String) complexValueIter.next(); complexAttributeNode = document.createElementNS(null, "li"); attributeNode.appendChild(complexAttributeNode); text = document.createTextNode(value); complexAttributeNode.appendChild(text); - } + } } } return document; @@ -207,11 +206,11 @@ /** * Stub implementation of HttpServletRequest */ - public class CocoonServletRequest implements HttpServletRequest + public class CocoonServletRequest implements HttpServletRequest { Request request; - public CocoonServletRequest(Request request) + public CocoonServletRequest(Request request) { this.request = request; } @@ -254,10 +253,10 @@ public void setCharacterEncoding(String s) { } public Principal getUserPrincipal(){ return request.getUserPrincipal(); } public Locale getLocale(){ return request.getLocale(); } - public Enumeration getLocales(){ return request.getLocales(); } + public Enumeration getLocales(){ return request.getLocales(); } public String getRealPath(String s){ return null; } - public Cookie[] getCookies(){ return null; } + public Cookie[] getCookies(){ return null; } public RequestDispatcher getRequestDispatcher(String s){ return null; } public BufferedReader getReader() throws IOException{ return null; } public ServletInputStream getInputStream() throws IOException{ return null; } @@ -265,7 +264,7 @@ public HttpSession getSession(){ return null; } public boolean isRequestedSessionIdFromURL(){ return false; } public boolean isRequestedSessionIdFromUrl(){ return false; } - public int getIntHeader(String s){ return 0; } + public int getIntHeader(String s){ return 0; } } }
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]