Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/portal
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23857/portal
Added Files:
GeoPresenter.java
Log Message:
--- NEW FILE: GeoPresenter.java ---
/*
* Copyright (c) 2006 Cobricks Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted under the terms of the Cobricks Software
* License, either version 1.0 of the License, or (at your option) any
* later version (see www.cobricks.de).
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*/
package org.cobricks.portal;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.cobricks.core.CoreManager;
import org.cobricks.core.ComponentDirectory;
import org.cobricks.core.ComponentPresenterInterface;
import org.cobricks.core.util.DateUtil;
import org.cobricks.core.util.GeoUtil;
import org.cobricks.core.util.LogUtil;
/**
* Class with methods for including geo functionality in the user
* interface of Cobricks sites
*
* @author mic...@co...
* @version $Date: 2006/10/18 16:49:22 $
*/
public class GeoPresenter
implements ComponentPresenterInterface
{
static Logger logger = Logger.getLogger(GeoPresenter.class);
CoreManager coreManager;
/**
*
*/
public GeoPresenter()
{
}
/**
* @see org.cobricks.core.ComponentPresenterInterface#init(
* java.lang.String, java.util.Properties, org.cobricks.core.CoreManager)
*/
public void init(String presenterId, Properties properties,
CoreManager coreManager)
throws Exception
{
logger.info("Initializing geo presenter.");
this.coreManager = coreManager;
}
/**
*
*/
public String doGeocode(String address)
{
try {
double[] result = GeoUtil.geocode(address, coreManager);
if (result == null)
return "";
return result[0]+", "+result[1];
} catch (Exception e) {
logger.error(LogUtil.ex("failed", e));
}
return "";
}
}
|