/* * Reference ETL Parser for Java * Copyright (c) 2000-2009 Constantine A Plotnikov * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package net.sf.etl.parsers.internal.term_parser.states; import net.sf.etl.parsers.TermContext; // NOTE POST 0.2: implement some reference integrity check. /** * This class is used in context to refer to activation factories from other * grammars. It provides necessary redirection level that allows independent * serialization and deserialization of compiled grammars. * * @author const */ public class ActivationFactoryProxy implements ActivationFactory { /** system identifier of peer factory */ private final TermContext context; /** a name of activation */ private final String activationName; /** * an activation that is referenced by this proxy, the reference is lost * after serialization/deserialization. So it has to be restored later. */ private transient ActivationFactoryImpl refrerredActivation; /** * A constructor * * @param context * a context of this activation * @param activationName * a name of referred activation */ public ActivationFactoryProxy(TermContext context, String activationName) { super(); this.context = context; this.activationName = activationName; } /** * @return the referred activation. */ public ActivationFactoryImpl getRefrerredActivation() { return refrerredActivation; } /** * Set activation. This method is usually called during peer construction * and deserialization postprocessing. * * @param refrerredActivation * the referred activation to set. */ public void setRefrerredActivation(ActivationFactoryImpl refrerredActivation) { this.refrerredActivation = refrerredActivation; } /** * @return Returns the activationName. */ public String activationName() { return activationName; } /** * {@inheritDoc} */ public TermContext context() { return context; } /** * {@inheritDoc} */ public Activation startWithPrimaryEntry(Activation previous) { return refrerredActivation.startWithPrimaryEntry(previous); } /** * {@inheritDoc} */ public Activation startWithAlternateEntry(Activation previous) { return refrerredActivation.startWithAlternateEntry(previous); } }