pier 2004/05/03 13:42:02
Added: src/kernel/org/apache/cocoon/kernel CoreWirings.java Log: Expose the "Wirings" interface through the deployer to externally access resources and components provided by blocks. Revision Changes Path 1.1 cocoon-2.2/src/kernel/org/apache/cocoon/kernel/CoreWirings.java Index: CoreWirings.java =================================================================== /* ========================================================================== * * Copyright (C) 1996-2004 VNU Business Publications LTD. All rights reserved * * ========================================================================== */ package org.apache.cocoon.kernel; import org.apache.cocoon.kernel.composition.Wire; import org.apache.cocoon.kernel.composition.WiringException; import org.apache.cocoon.kernel.composition.Wirings; import org.apache.cocoon.kernel.resolution.Resource; /** * <p></p> * * @version CVS $Revision: 1.1 $ * @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a> * @author Copyright © 1996-2004 <a href="http://www.vnunet.com/">VNU * Business Publications LTD.</a> All rights reserved */ public class CoreWirings implements Wirings { KernelDeployer deployer = null; /** * <p>Create a new [EMAIL PROTECTED] CoreWirings} instance associated with a specified * [EMAIL PROTECTED] KernelDeployer}.</p> * * @param deployer a <b>non null</b> [EMAIL PROTECTED] KernelDeployer} instance. * @throws NullPointerException if the specified deployer was <b>null</b>. */ public CoreWirings(KernelDeployer deployer) { super(); if (deployer == null) throw new NullPointerException("Null deployer"); this.deployer = deployer; } public Wire lookup(Class role, String name) throws WiringException { /* Fail if either name or role are null */ if (name == null) throw new WiringException("No name specified"); if (role == null) throw new WiringException("No role specified"); /* Look in our component wirings for the key matching the name */ DeployedWirings target = this.deployer.lookup(name); if (target != null) return(target.newWire(role, target.getResolver())); /* Wrong wiring name specified */ throw new WiringException("Unknown wiring \"" + name + "\""); } public Resource resolve(String name) { return null; } }
