/*
* Copyright 2001-2006 C:1 Financial Services GmbH
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License Version 2.1, as published by the Free Software Foundation.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*/
package de.finix.contelligent;
import de.finix.contelligent.logging.LoggingService;
import de.finix.contelligent.search.Metainfo;
/**
* A simple base class for components.
*/
public abstract class AbstractComponent implements Component {
final static org.apache.log4j.Logger log = LoggingService.getLogger(AbstractComponent.class);
protected ComponentContext ctx;
public void setComponentContext(ComponentContext ctx) {
this.ctx = ctx;
}
public ComponentContext getComponentContext() {
return ctx;
}
public boolean isDynamic() {
return false;
}
public void postCreate() throws Exception {
}
/**
* returns the path of this component as string. (without a trailing
* separator!)
*/
final public String toString() {
if (ctx != null) {
return ctx.getPath().toString();
} else {
return "Component (name unknown)";
}
}
/**
* This is the implementation of {@link Component#getSearchMetainfo}.
* Overwrite that method for extension.
*
* @returns
*/
public void putSearchMetainfo(Metainfo metainfo, CallData callData) {
}
/**
* Answer true if the content of this component may be changed
*
* @return
*/
public boolean mayChangeContent() {
return true;
}
protected String renderComponent(Component component, CallData callData) {
return getComponentContext().getSystem().render(component, callData);
}
}
|