/* $$ Clover has instrumented this file $$ */// Copyright 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.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.tapestry.services.impl;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.hivemind.ErrorHandler;
import org.apache.hivemind.order.Orderer;
import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.util.DelegatingPropertySource;
/**
* Orders a list of {@link org.apache.tapestry.services.impl.PropertySourceContribution}s
* and get property values from them (the first non-null result being returned).
*
* @author Howard Lewis Ship
* @since 3.1
*/
public class PropertySourceImpl implements IPropertySource
{public static com.cortexeb.tools.clover.d __CLOVER_328_0 = com.cortexeb.tools.clover.aq.getRecorder(new char[] {67,58,92,119,111,114,107,115,112,97,99,101,92,106,97,107,97,114,116,97,45,116,97,112,101,115,116,114,121,92,102,114,97,109,101,119,111,114,107,92,116,97,114,103,101,116,92,99,108,111,118,101,114,45,100,98},1096998272901L);
private List _contributions;
private IPropertySource _delegate;
private ErrorHandler _errorHandler;
private Log _log;
public void initializeService()
{try { __CLOVER_328_0.M[1604]++;
__CLOVER_328_0.S[7462]++;Orderer orderer = new Orderer(_log, _errorHandler, "property source");
__CLOVER_328_0.S[7463]++;Iterator i = _contributions.iterator();
__CLOVER_328_0.S[7464]++;while ((((i.hasNext()) && (++__CLOVER_328_0.CT[1292] != 0)) || (++__CLOVER_328_0.CF[1292] == 0))){
{
__CLOVER_328_0.S[7465]++;PropertySourceContribution c = (PropertySourceContribution) i.next();
__CLOVER_328_0.S[7466]++;orderer.add(c, c.getName(), c.getAfter(), c.getBefore());
}}
__CLOVER_328_0.S[7467]++;List ordered = orderer.getOrderedObjects();
__CLOVER_328_0.S[7468]++;DelegatingPropertySource delegate = new DelegatingPropertySource();
__CLOVER_328_0.S[7469]++;i = ordered.iterator();
__CLOVER_328_0.S[7470]++;while ((((i.hasNext()) && (++__CLOVER_328_0.CT[1293] != 0)) || (++__CLOVER_328_0.CF[1293] == 0))){
{
__CLOVER_328_0.S[7471]++;PropertySourceContribution c = (PropertySourceContribution) i.next();
__CLOVER_328_0.S[7472]++;delegate.addSource(c.getSource());
}}
__CLOVER_328_0.S[7473]++;_delegate = delegate;
} finally { }}
public String getPropertyValue(String propertyName)
{try { __CLOVER_328_0.M[1605]++;
__CLOVER_328_0.S[7474]++;return _delegate.getPropertyValue(propertyName);
} finally { }}
public void setContributions(List list)
{try { __CLOVER_328_0.M[1606]++;
__CLOVER_328_0.S[7475]++;_contributions = list;
} finally { }}
public void setErrorHandler(ErrorHandler handler)
{try { __CLOVER_328_0.M[1607]++;
__CLOVER_328_0.S[7476]++;_errorHandler = handler;
} finally { }}
public void setLog(Log log)
{try { __CLOVER_328_0.M[1608]++;
__CLOVER_328_0.S[7477]++;_log = log;
} finally { }}
}