[Dive4elements-commits] [PATCH 7 of 7] Merged
Wald Commits
scm-commit at wald.intevation.org
Wed Nov 7 09:42:50 CET 2012
# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1352278064 -3600
# Node ID e8a4d2fd25ccdf7f553ce8d9e9dd2a86e408f8ee
# Parent 83fe6eeba83a701b63e072725d5c6add4b2c2d17
# Parent 6e01499bfbdfd5a0d685e80f931bb96ee94ab5ae
Merged.
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/doc/conf/meta-data.xml
--- a/flys-artifacts/doc/conf/meta-data.xml Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/doc/conf/meta-data.xml Wed Nov 07 09:47:44 2012 +0100
@@ -666,7 +666,7 @@
<dc:call-macro name="mainvalues"/>
</dc:if>
<dc:if test="dc:contains($artifact-outs, 'reference_curve')">
- <dc:call-macro name="annotations"/>
+ <!--dc:call-macro name="annotations"/-->
<dc:call-macro name="mainvalues"/>
</dc:if>
<dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')">
@@ -730,8 +730,9 @@
</dc:if>
<dc:if test="dc:contains($artifact-outs, 'reference_curve')">
- <dc:call-macro name="annotations"/>
+ <!--dc:call-macro name="annotations"/-->>
<!--dc:call-macro name="basedata_0"/-->
+ <dc:call-macro name="mainvalues"/>
<dc:call-macro name="basedata_1_additionals-relative_point"/>
<dc:comment comment=" FIXATIONS ---------------------------"/>
<dc:call-macro name="basedata_2_fixations_relative_point"/>
@@ -752,6 +753,9 @@
<dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
<dc:call-macro name="annotations"/>
</dc:if>
+ <dc:if test="dc:contains($artifact-outs, 'flow_velocity')">
+ <dc:call-macro name="annotations"/>
+ </dc:if>
<dc:comment comment="--- non-recommendations---"/>
</dc:otherwise>
</dc:choose>
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/doc/conf/themes.xml
--- a/flys-artifacts/doc/conf/themes.xml Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/doc/conf/themes.xml Wed Nov 07 09:47:44 2012 +0100
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE themes [
- <!ENTITY default-themes SYSTEM "conf/default-themes.xml">
- <!ENTITY second-themes SYSTEM "conf/second-themes.xml">
- <!ENTITY virtual-themes SYSTEM "conf/virtual-themes.xml">
+<!ENTITY default-themes SYSTEM "/local-vol1/felix/flys/trunk/built/server/conf/default-themes.xml">
+ <!ENTITY second-themes SYSTEM "/local-vol1/felix/flys/trunk/built/server/conf/second-themes.xml">
+ <!ENTITY virtual-themes SYSTEM "/local-vol1/felix/flys/trunk/built/server/conf/virtual-themes.xml">
]>
<themes>
&default-themes;
@@ -256,7 +256,7 @@
<mapping from="fix_analysis_events_dwt" to="FixingDeltaWtAnalysis" />
<mapping from="fix_analysis_periods_dwt" to="FixingDeltaWtAnalysisPeriods" />
<mapping from="fix_reference_events_dwt" to="FixingReferenceEvents" />
- <mapping from="fix_reference_period_dwt" to="FixingReferencePeriod" />
+ <mapping from="fix_reference_period_dwt" to="FixingReferencePeriod" />
<mapping from="fix_sector_average_ls_deviation_0" to="FixingSectorDeviationLS0" />
<mapping from="fix_sector_average_ls_deviation_1" to="FixingSectorDeviationLS1" />
<mapping from="fix_sector_average_ls_deviation_2" to="FixingSectorDeviationLS2" />
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Wed Nov 07 09:47:44 2012 +0100
@@ -542,6 +542,7 @@
inBackground.setTextContent(message.getMessage());
}
+
/**
* Append output mode nodes to a document.
*/
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java Wed Nov 07 09:47:44 2012 +0100
@@ -130,6 +130,7 @@
DischargeZone zone = model.getDischargeZone();
String lo = zone.getLowerDischarge();
String hi = zone.getUpperDischarge();
+ // TODO make discharge available, should be shown in diagram.
if (lo.equals(hi)) {
data.setZone(lo);
@@ -141,7 +142,7 @@
protected CalculationResult buildCalculationResult(
- FlowVelocityAccess access,
+ FlowVelocityAccess access,
List<FlowVelocityModel> models
) {
double kmLo = access.getLowerKM();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Wed Nov 07 09:47:44 2012 +0100
@@ -83,6 +83,7 @@
*/
@Override
public Object getData(Artifact artifact, CallContext context) {
+ logger.debug("MainValuesWFacet.getData()");
MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact;
List<NamedDouble> ws = mvArtifact.getMainValuesW(isAtGauge);
@@ -102,6 +103,7 @@
context);
}
+ logger.debug("MainValuesWFacet: Will give " + ws.size() + " annotations.");
for (NamedDouble w: ws) {
StickyAxisAnnotation annotation =
new StickyAxisAnnotation(
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java Wed Nov 07 09:47:44 2012 +0100
@@ -245,12 +245,14 @@
continue;
}
+ // TODo add max and percent?
Curve curve = new Curve(
wqs[1], wqs[0],
function.getName(),
coeffs,
chiSqr[0]);
+ log.debug("iC Adding Curve at " + km);
curves.add(km, curve);
double [] values = range.getValues();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java Wed Nov 07 09:47:44 2012 +0100
@@ -76,8 +76,9 @@
protected Document buildDocument(Gauge gauge) {
Document result = XMLUtils.newDocument();
- List<DischargeTable> tables =gauge.getDischargeTables();
- Collections.sort(tables);
+ List<DischargeTable> tables = gauge.getDischargeTables();
+ //Collections.sort(tables);
+ //tables.sort();
Element all = result.createElement("discharges");
for (DischargeTable dt: tables) {
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java Wed Nov 07 09:47:44 2012 +0100
@@ -102,6 +102,8 @@
// TODO ADD PDF FACET
+ // TODO ADD FACETS FOR DISCHARGE AND MEASURED SPEED (point)
+
newFacets.add(csv);
logger.debug("Created " + newFacets.size() + " new Facets.");
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/QSectorSingleState.java Wed Nov 07 09:47:44 2012 +0100
@@ -55,7 +55,7 @@
QSectorFacet qfacet = new QSectorFacet(
0,
QSECTOR,
- Resources.getMsg(meta, "qsectors", "Q Sectors"));
+ Resources.getMsg(meta, QSECTOR, "Q Sectors"));
facets.add(qfacet);
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Wed Nov 07 09:47:44 2012 +0100
@@ -34,7 +34,7 @@
{
River river = FLYSUtils.getRiver((FLYSArtifact) artifact);
List<Gauge> gauges = river.getGauges();
- Collections.sort(gauges);
+ //Collections.sort(gauges);
int num = gauges != null ? gauges.size() : 0;
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelSelectState.java Wed Nov 07 09:47:44 2012 +0100
@@ -176,6 +176,7 @@
}
catch (NumberFormatException nfe) {
logger.error("Index is not a valid integer!", nfe);
+ // return false?
}
return true;
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java Wed Nov 07 09:47:44 2012 +0100
@@ -81,6 +81,7 @@
Facet facet,
String output
) {
+ log.debug("Registry:is active? " + output + "/" + facet.getName());
if (output.contains(FacetTypes.ChartType.FLSC.toString())) {
// Longitudinal section chart
String name = facet.getName();
@@ -91,14 +92,21 @@
|| name.contains(FacetTypes.FIX_REFERENCE_EVENTS_DWT)
|| name.contains(FacetTypes.FIX_REFERENCE_EVENTS_LS)
|| name.contains(FacetTypes.FIX_REFERENCE_EVENTS_WQ)
+ // Wrong palace! Go to AnnotationArtifact.
+ || name.contains(FacetTypes.LONGITUDINAL_ANNOTATION)
) {
return Boolean.FALSE;
}
}
- if (output.contains(FacetTypes.ChartType.FDWC.toString())
+ else if (output.contains(FacetTypes.ChartType.FDWC.toString())
&& facet.getName().contains(FacetTypes.FIX_SECTOR_AVERAGE_DWT)) {
return Boolean.FALSE;
}
+ else if (output.contains(FacetTypes.ChartType.LS.toString())
+ && facet.getName().contains(FacetTypes.LONGITUDINAL_ANNOTATION)) {
+
+ return Boolean.FALSE;
+ }
return Boolean.TRUE;
}
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Wed Nov 07 09:47:44 2012 +0100
@@ -211,6 +211,7 @@
boolean isActive = registry.isInitialActive(
flys.getName(), flys, newMF, outputName);
+ logger.debug("FacetActivityRegistry: " + flys.getName() + " out: " + outputName + " F: " + newMF.getName() + " c " + flys.getClass().toString() + " = " + isActive);
newMF.setActive(isActive ? 1 : 0);
}
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java Wed Nov 07 09:47:44 2012 +0100
@@ -200,6 +200,7 @@
int rendererIndex = 0;
if (annotation.atX()) {
+ logger.debug("ChartGenerator: Sticky at X.");
textAnnotation = new CollisionFreeXYTextAnnotation(
annotation.getText(), annotation.getPos(), area.ofGround(TEXT_OFF));
// OPTIMIZE externalize the calculation involving PI.
@@ -214,6 +215,7 @@
// There is one nasty case (duration curves, where annotations
// might stick to the second y-axis).
// FIXME: Remove dependency to XYChartGenerator here
+ logger.debug("ChartGenerator: Sticky at no-X.");
AxisDataset dataset = getAxisDataset(
new Integer(annotation.getAxisSymbol()));
if (dataset == null) {
@@ -434,6 +436,8 @@
return;
}
+ logger.debug("addAnnotationsToRenderer: " + annotations.size());
+
// OPTMIMIZE: Pre-calculate positions
ChartArea area = new ChartArea(
plot.getDomainAxis(0).getRange(),
@@ -441,7 +445,7 @@
// Walk over all Annotation sets.
for (FLYSAnnotation fa: annotations) {
-
+
// Access text styling, if any.
Document theme = fa.getTheme();
TextStyle textStyle = null;
@@ -1506,11 +1510,12 @@
XPathConstants.NODE,
ArtifactNamespaceContext.INSTANCE);
+ // unter -aft liegt eine XML java mit toString
+ System.err.println(XMLUtils.toString(request));
if (yrange == null) {
return null;
}
-
String uri = ArtifactNamespaceContext.NAMESPACE_URI;
String lower = yrange.getAttributeNS(uri, "from");
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/InfoGeneratorHelper.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/InfoGeneratorHelper.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/InfoGeneratorHelper.java Wed Nov 07 09:47:44 2012 +0100
@@ -69,6 +69,7 @@
Element chartinfo = cr.create("chartinfo");
+ // Debug me, issue842
chartinfo.appendChild(createAxesElements(cr, chart));
chartinfo.appendChild(createTransformationElements(cr, chart, info));
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/OutputHelper.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/OutputHelper.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/OutputHelper.java Wed Nov 07 09:47:44 2012 +0100
@@ -352,6 +352,8 @@
return dataProviders;
}
+
+
/**
* Returns a concrete Artifact of this collection specified by its uuid.
*
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Wed Nov 07 09:47:44 2012 +0100
@@ -82,6 +82,7 @@
return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
}
+
@Override
protected String getDefaultChartSubtitle() {
Object[] args = new Object[] {
@@ -115,6 +116,8 @@
return msg(getInCm(1) ? I18N_Y_AXIS_IN_CM : I18N_Y_AXIS_IN_M);
}
+
+ /** Probably to be overridden? */
protected String facetName() {
return REFERENCE_CURVE;
}
@@ -172,6 +175,8 @@
}
}
+
+ /** Probably also there to be overridden. */
protected boolean doNormalize() {
return false;
}
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Wed Nov 07 09:47:44 2012 +0100
@@ -273,6 +273,7 @@
protected void writeCSVData(CSVWriter writer) {
logger.info("WaterlevelExporter.writeData");
+ // avoid NPE here.
WQ_MODE mode = FLYSUtils.getWQMode((FLYSArtifact)master);
boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE;
boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE;
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Nov 07 09:47:44 2012 +0100
@@ -254,6 +254,8 @@
* axis could be inverted.
*/
protected double getLeftX() {
+ // TODO if the range null...
+ //return (Double)getDomainAxisRange().getLowerBound();
return (Double)getXBounds(0).getLower();
}
@@ -264,12 +266,27 @@
* axis could be inverted.
*/
protected double getRightX() {
- return (Double)getXBounds(0).getUpper();
+ return (Double)getXBounds(0).getLower();
+ //return (Double)getDomainAxisRange().getUpperBound();
}
+ protected double getBottomY() {
+ Range zoomedRange = getValueAxisRange();
+ return (zoomedRange != null)
+ ? zoomedRange.getLowerBound()
+ : (Double)getYBounds(0).getLower();
+ }
+
+ protected double getTopY() {
+ Range zoomedRange = getValueAxisRange();
+ return (zoomedRange != null)
+ ? zoomedRange.getUpperBound()
+ : (Double)getYBounds(0).getUpper();
+ }
/** Add a logo as background annotation to plot. */
protected void addLogo(XYPlot plot) {
+ // TODO getValue/DomainAxisRange, so that the current zoom level is respected
String logo = showLogo();
if (logo == null) {
logger.debug("No logo to show chosen");
@@ -299,7 +316,6 @@
}
imageIcon = new ImageIcon(imageURL);
-
double xPos = 0d, yPos = 0d;
String placeh = logoHPlace();
@@ -309,13 +325,13 @@
placev = "top";
}
if (placev.equals("top")) {
- yPos = (Double)getYBounds(0).getUpper();
+ yPos = getTopY();
}
else if (placev.equals("bottom")) {
- yPos = (Double)getYBounds(0).getLower();
+ yPos = getBottomY();
}
else if (placev.equals("center")) {
- yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d;
+ yPos = (getTopY() + getBottomY())/2d;
}
else {
logger.debug("Unknown place-v value: " + placev);
@@ -331,7 +347,9 @@
xPos = getRightX();
}
else if (placeh.equals("center")) {
+ // TODO: Hier noch
xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d;
+ // ->->-> (getDomainAxisRange().getUpperBound() + getDomainAxisRange().getLowerBound())/2d;
}
else {
logger.debug("Unknown place-h value: " + placeh);
@@ -685,6 +703,7 @@
}
+ /** Return range of domain axis. */
protected Range getDomainAxisRange() {
String[] ranges = getDomainAxisRangeFromRequest();
@@ -724,7 +743,9 @@
String[] ranges = getValueAxisRangeFromRequest();
if (ranges == null || ranges.length < 2) {
- logger.debug("No range specified. Lower and upper Y == 0");
+ logger.warn("No range (or not enogh) specified.");
+ if (ranges == null) logger.warn("ranges is null here");
+ else logger.warn("ranges has just one element.");
return null;
}
@@ -747,6 +768,7 @@
}
}
+ logger.warn("One of the range elements is zero length text.");
return null;
}
@@ -1034,6 +1056,5 @@
return hash;
}
-
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/extreme/ExtremeWQCurveGenerator.java Wed Nov 07 09:47:44 2012 +0100
@@ -151,6 +151,7 @@
@Override
protected String getDefaultChartSubtitle() {
+ // TODO resolve. We are in extreme wq world here (not fication).
FixAnalysisAccess access = new FixAnalysisAccess(artifact);
DateRange dateRange = access.getDateRange();
DateRange refRange = access.getReferencePeriod();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java Wed Nov 07 09:47:44 2012 +0100
@@ -88,6 +88,7 @@
int transparency = ThemeUtil.parseTransparency(theme);
if (transparency > 0) {
+ if (paint == null) paint = new Color(30,30,30);
paint = new Color(
paint.getRed(),
paint.getGreen(),
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Nov 07 09:47:44 2012 +0100
@@ -158,7 +158,8 @@
/** Call callback for every string split by colon.
- * Expected format FROM:TO:VALUE1,VALUE2,VALUE3*/
+ * Expected format FROM:TO:VALUE1,VALUE2,VALUE3
+ * from;to;value:from2;to2;value2:...*/
public static final void parseSegments(
String input,
SegmentCallback callback
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Nov 07 09:47:44 2012 +0100
@@ -730,6 +730,8 @@
String addWMS();
+ String printMapSettings();
+
String addWMSTooltip();
String adjustElevation();
@@ -798,6 +800,8 @@
String annotations();
+ String all_annotations();
+
String additionals();
String differences();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Nov 07 09:47:44 2012 +0100
@@ -372,6 +372,7 @@
getFeatureInfoTooltip = Information Tool
getFeatureInfoWindowTitle = Informations for Map Layers.
addWMS = images/add_map.png
+printMapSettings = images/print_map_settings.png
addWMSTooltip = Load layers from external WMS service.
adjustElevation = images/adjustElevation.png
measureLine = images/measure_line.png
@@ -407,6 +408,7 @@
columns = Columns
annotation = Annotations
annotations = Annotations
+all_annotations = All Annotations
additionals = Additional Longitudinal Section Curves
differences = Differences
kilometrage = Kilometrage
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Nov 07 09:47:44 2012 +0100
@@ -373,6 +373,7 @@
getFeatureInfoTooltip = Informationswerkzeug
getFeatureInfoWindowTitle = Informationen zu Kartenebenen
addWMS = images/add_map.png
+printMapSettings = images/print_map_settings.png
addWMSTooltip = Laden von Kartenebenen eines externen WMS Dienstes.
adjustElevation = images/adjustElevation.png
measureLine = images/measure_line.png
@@ -408,6 +409,7 @@
columns = Spalten
annotation = Streckenfavoriten
annotation = Streckenfavoriten - Typen
+all_annotations = Alle Streckenfavoriten
additionals = Zus\u00e4tzliche L\u00e4ngsschnitte
differences = Differenzen
kilometrage = Kilometrierung
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Nov 07 09:47:44 2012 +0100
@@ -373,6 +373,7 @@
getFeatureInfoTooltip = Information Tool
getFeatureInfoWindowTitle = Informations for Map Layers.
addWMS = images/add_map.png
+printMapSettings = images/print_map_settings.png
addWMSTooltip = Load layers from external WMS service.
adjustElevation = images/adjustElevation.png
measureLine = images/measure_line.png
@@ -408,6 +409,7 @@
columns = Columns
annotation = Annotations
annotations = Annotations
+all_annotations = All Annotations
additionals = Additional Longitudinal Section Curves
differences = Differences
kilometrage = Kilometrage
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java Wed Nov 07 09:47:44 2012 +0100
@@ -6,6 +6,7 @@
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -141,6 +142,7 @@
f.setColWidths("40%", "60%");
layout.addMember(f);
+ layout.addMember(new Label(facet.getTheme().getFacet()));
init();
initPanels();
}
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java Wed Nov 07 09:47:44 2012 +0100
@@ -1,16 +1,5 @@
package de.intevation.flys.client.client.ui.map;
-import org.gwtopenmaps.openlayers.client.Bounds;
-import org.gwtopenmaps.openlayers.client.Map;
-import org.gwtopenmaps.openlayers.client.control.DragPan;
-import org.gwtopenmaps.openlayers.client.control.SelectFeature;
-import org.gwtopenmaps.openlayers.client.control.SelectFeatureOptions;
-import org.gwtopenmaps.openlayers.client.control.ZoomBox;
-import org.gwtopenmaps.openlayers.client.event.MapZoomListener;
-import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
-import org.gwtopenmaps.openlayers.client.layer.Vector;
-import org.gwtopenmaps.openlayers.client.util.Attributes;
-
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.SelectionType;
@@ -30,8 +19,20 @@
import de.intevation.flys.client.shared.model.Collection;
import de.intevation.flys.client.shared.model.ThemeList;
+import org.gwtopenmaps.openlayers.client.Bounds;
+import org.gwtopenmaps.openlayers.client.Map;
+import org.gwtopenmaps.openlayers.client.control.DragPan;
+import org.gwtopenmaps.openlayers.client.control.SelectFeature;
+import org.gwtopenmaps.openlayers.client.control.SelectFeatureOptions;
+import org.gwtopenmaps.openlayers.client.control.ZoomBox;
+import org.gwtopenmaps.openlayers.client.event.MapZoomListener;
+import org.gwtopenmaps.openlayers.client.feature.VectorFeature;
+import org.gwtopenmaps.openlayers.client.layer.Vector;
+import org.gwtopenmaps.openlayers.client.util.Attributes;
+
/**
+ * Toolbar for the Map views.
* @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
*/
public class MapToolbar
@@ -60,6 +61,7 @@
protected ImgButton removeButton;
protected ImgButton elevationButton;
protected ImgLink printMapLink;
+ protected ImgButton printMapSettings;
protected Label epsgLabel;
@@ -123,6 +125,9 @@
printMapLink = createPrintMapLink();
addMember(printMapLink);
+
+ printMapSettings = createMapPrintSettingsControl();
+ addMember(printMapSettings);
}
addMember(zoomToMaxButton);
@@ -641,6 +646,17 @@
}
+ protected ImgButton createMapPrintSettingsControl() {
+ ImgButton btn = createButton(MSG.printMapSettings(), new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+
+ }
+ });
+ return btn;
+ }
+
+
protected ImgButton createWMSControl() {
final String srs = floodMap.getRiverProjection();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java Wed Nov 07 09:44:24 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-package de.intevation.flys.client.server;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.log4j.Logger;
-
-import de.intevation.flys.client.server.auth.Authentication;
-import de.intevation.flys.client.server.auth.AuthenticationException;
-import de.intevation.flys.client.server.auth.AuthenticationFactory;
-import de.intevation.flys.client.server.auth.User;
-import de.intevation.flys.client.server.features.Features;
-
-
-/** ServletFilter used for GGInA authentification and certain authorisation. */
-public class GGInAFilter implements Filter {
-
- /** Private logger. */
- private static Logger logger = Logger.getLogger(GGInAFilter.class);
-
- private boolean deactivate = false;
- private String authmethod;
- private String redirecturl;
- private ServletContext sc;
-
- public static final String LOGIN_JSP = "/login.jsp";
- public static final String LOGIN_SERVLET = "/flys/login";
- public static final String FLYS_CSS = "/FLYS.css";
-
-
- /**
- * Initialize.
- *
- * Read FilterConfig parameter deactivate
- */
- @Override
- public void init(FilterConfig config)
- throws ServletException
- {
- String deactivate = config.getInitParameter("deactivate");
- this.sc = config.getServletContext();
- logger.debug("GGInAFilter context " + this.sc.getContextPath());
- this.authmethod = sc.getInitParameter("authentication");
- this.redirecturl = sc.getInitParameter("redirect-url");
- if (deactivate != null && deactivate.equalsIgnoreCase("true")) {
- this.deactivate = true;
- }
-
- }
-
-
- /**
- * Called when filter in chain invoked.
- * @param req request to servlet
- * @param resp response of servlet
- * @param chain the filter chain
- */
- @Override
- public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
- throws IOException, ServletException
- {
- if (this.deactivate) {
- logger.debug("GGinAFilter is deactivated");
- chain.doFilter(req, resp);
- return;
- }
-
- HttpServletRequest sreq = (HttpServletRequest) req;
-
- String requesturi = sreq.getRequestURI();
- for (Enumeration e = req.getAttributeNames() ; e.hasMoreElements() ;) {
- logger.debug(e.nextElement());
- }
-
- logger.debug("Request for: " + requesturi);
-
- // Allow access to login pages
- // TODO Maybe replace with Filter <url-pattern>
- String path = this.sc.getContextPath();
- if (requesturi.equals(path + "/login.jsp") ||
- requesturi.equals(path + "/flys/login")
- || requesturi.equals(path + "/FLYS.css")) {
- logger.debug("Request for login " + requesturi);
- chain.doFilter(req, resp);
- return;
- }
-
- boolean redirect = false;
-
- HttpSession session = sreq.getSession();
-
- String uri = path + "/" + this.redirecturl;
-
- /* Redirect if uri is root or redirecturl */
- if (requesturi.equals(uri) || requesturi.equals(path + "/")) {
- redirect = true;
- }
-
- if (sreq.getQueryString() != null) {
- uri = uri + "?" + sreq.getQueryString();
- }
- session.setAttribute("requesturi", uri);
-
- User user = (User)session.getAttribute("user");
- if (user == null) {
- logger.debug("No user in session: " + requesturi);
- this.handleResponse(resp, redirect);
- return;
- }
- if (user.hasExpired()) {
- // try to re-authenticate the user
- logger.debug("User ticket has expired: " + requesturi);
- String encoding = sreq.getCharacterEncoding();
- try {
- Authentication auth = this.auth(user, encoding);
- if (auth == null || !auth.isSuccess()) {
- logger.debug("Re-athentication not successful");
- this.handleResponse(resp, redirect);
- }
- }
- catch(AuthenticationException e) {
- logger.error("Failure during re-authentication", e);
- this.handleResponse(resp, redirect);
- return;
- }
- }
-
- logger.debug("GGInAFilter.doFilter");
- chain.doFilter(req, resp);
- return;
- }
-
- private void redirect(ServletResponse resp) throws IOException {
- logger.debug("Redirect to login");
- ((HttpServletResponse) resp).sendRedirect(this.sc.getContextPath() +
- "/login.jsp");
- }
-
- private void sendNotAuthenticated(ServletResponse resp) throws IOException {
- logger.debug("Send not authenticated");
- ((HttpServletResponse)resp).sendError(HttpServletResponse.SC_FORBIDDEN, "User not authenticated");
- }
-
- private void handleResponse(ServletResponse resp, boolean redirect) throws IOException {
- if (redirect) {
- this.redirect(resp);
- }
- else {
- this.sendNotAuthenticated(resp);
- }
- }
-
-
- /**
- * Do nothing at destruction.
- */
- @Override
- public void destroy() {
- }
-
- private Authentication auth(User user, String encoding)
- throws AuthenticationException, IOException {
- Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
- return AuthenticationFactory.getInstance(this.authmethod).auth(
- user.getName(), user.getPassword(), encoding, features);
- }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Wed Nov 07 09:47:44 2012 +0100
@@ -1,22 +1,39 @@
package de.intevation.flys.client.server;
import de.intevation.artifacts.common.ArtifactNamespaceContext;
-
import de.intevation.artifacts.common.utils.ClientProtocolUtils;
import de.intevation.artifacts.common.utils.JSON;
import de.intevation.artifacts.common.utils.StringUtils;
import de.intevation.artifacts.common.utils.XMLUtils;
-
import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
-
import de.intevation.artifacts.httpclient.http.HttpClient;
import de.intevation.artifacts.httpclient.http.HttpClientImpl;
+import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
+import de.intevation.flys.client.shared.MapUtils;
+import de.intevation.flys.client.shared.model.MapConfig;
-import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
-import de.intevation.flys.client.shared.model.MapConfig;
-import de.intevation.flys.client.shared.MapUtils;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
/*
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -24,31 +41,6 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
*/
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-import java.net.URLEncoder;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-
-import org.apache.commons.httpclient.methods.GetMethod;
-
-import org.apache.log4j.Logger;
-
/* Used by direct API call. -> Enforce GPLv3
import org.mapfish.print.MapPrinter;
import org.mapfish.print.output.OutputFactory;
@@ -57,10 +49,6 @@
import org.mapfish.print.utils.PJsonObject;
*/
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
public class MapPrintServiceImpl
extends HttpServlet
{
@@ -371,6 +359,9 @@
new org.apache.commons.httpclient.HttpClient(
new MultiThreadedHttpConnectionManager());
+ // FIXME: The request is not authenticated.
+ // Currently this is not a problem because /flys/map-print
+ // is whitelisted in GGInAFilter.
GetMethod get = new GetMethod(url);
int result = client.executeMethod(get);
InputStream in = get.getResponseBodyAsStream();
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/server/RiverInfoServiceImpl.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RiverInfoServiceImpl.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/RiverInfoServiceImpl.java Wed Nov 07 09:47:44 2012 +0100
@@ -31,6 +31,8 @@
/**
+ * GWT Service to serve the gauge and measurement station info
+ *
* @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
*/
public class RiverInfoServiceImpl
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/filter/GGInAFilter.java Wed Nov 07 09:47:44 2012 +0100
@@ -0,0 +1,182 @@
+package de.intevation.flys.client.server.filter;
+
+import de.intevation.flys.client.server.auth.Authentication;
+import de.intevation.flys.client.server.auth.AuthenticationException;
+import de.intevation.flys.client.server.auth.AuthenticationFactory;
+import de.intevation.flys.client.server.auth.User;
+import de.intevation.flys.client.server.features.Features;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+
+
+/** ServletFilter used for GGInA authentification and certain authorisation. */
+public class GGInAFilter implements Filter {
+
+ /** Private logger. */
+ private static Logger logger = Logger.getLogger(GGInAFilter.class);
+
+ private boolean deactivate = false;
+ private String authmethod;
+ private String redirecturl;
+ private ServletContext sc;
+
+ public static final String LOGIN_JSP = "/login.jsp";
+ public static final String LOGIN_SERVLET = "/flys/login";
+ public static final String FLYS_CSS = "/FLYS.css";
+ public static final String MAP_PRINT = "/flys/map-print";
+ public static final String MAPFISH_PRINT = "/flys/mapfish-print/print.pdf";
+
+
+ /**
+ * Initialize.
+ *
+ * Read FilterConfig parameter deactivate
+ */
+ @Override
+ public void init(FilterConfig config)
+ throws ServletException
+ {
+ String deactivate = config.getInitParameter("deactivate");
+ this.sc = config.getServletContext();
+ logger.debug("GGInAFilter context " + this.sc.getContextPath());
+ this.authmethod = sc.getInitParameter("authentication");
+ this.redirecturl = sc.getInitParameter("redirect-url");
+ if (deactivate != null && deactivate.equalsIgnoreCase("true")) {
+ this.deactivate = true;
+ }
+
+ }
+
+
+ /**
+ * Called when filter in chain invoked.
+ * @param req request to servlet
+ * @param resp response of servlet
+ * @param chain the filter chain
+ */
+ @Override
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
+ throws IOException, ServletException
+ {
+ if (this.deactivate) {
+ logger.debug("GGinAFilter is deactivated");
+ chain.doFilter(req, resp);
+ return;
+ }
+
+ HttpServletRequest sreq = (HttpServletRequest) req;
+
+ String requesturi = sreq.getRequestURI();
+ for (Enumeration e = req.getAttributeNames() ; e.hasMoreElements() ;) {
+ logger.debug(e.nextElement());
+ }
+
+ logger.debug("Request for: " + requesturi);
+
+ // Allow access to login pages
+ // TODO Maybe replace with Filter <url-pattern>
+ String path = this.sc.getContextPath();
+ if (requesturi.equals(path + LOGIN_JSP)
+ || requesturi.equals(path + LOGIN_SERVLET)
+ || requesturi.equals(path + FLYS_CSS)
+ || requesturi.equals(path + MAP_PRINT)
+ || requesturi.equals(path + MAPFISH_PRINT)) {
+ logger.debug("Request for login " + requesturi);
+ chain.doFilter(req, resp);
+ return;
+ }
+
+ boolean redirect = false;
+
+ HttpSession session = sreq.getSession();
+
+ String uri = path + "/" + this.redirecturl;
+
+ /* Redirect if uri is root or redirecturl */
+ if (requesturi.equals(uri) || requesturi.equals(path + "/")) {
+ redirect = true;
+ }
+
+ if (sreq.getQueryString() != null) {
+ uri = uri + "?" + sreq.getQueryString();
+ }
+ session.setAttribute("requesturi", uri);
+
+ User user = (User)session.getAttribute("user");
+ if (user == null) {
+ logger.debug("No user in session: " + requesturi);
+ this.handleResponse(resp, redirect);
+ return;
+ }
+ if (user.hasExpired()) {
+ // try to re-authenticate the user
+ logger.debug("User ticket has expired: " + requesturi);
+ String encoding = sreq.getCharacterEncoding();
+ try {
+ Authentication auth = this.auth(user, encoding);
+ if (auth == null || !auth.isSuccess()) {
+ logger.debug("Re-athentication not successful");
+ this.handleResponse(resp, redirect);
+ }
+ }
+ catch(AuthenticationException e) {
+ logger.error("Failure during re-authentication", e);
+ this.handleResponse(resp, redirect);
+ return;
+ }
+ }
+
+ chain.doFilter(req, resp);
+ return;
+ }
+
+ private void redirect(ServletResponse resp) throws IOException {
+ logger.debug("Redirect to login");
+ ((HttpServletResponse) resp).sendRedirect(this.sc.getContextPath() +
+ "/login.jsp");
+ }
+
+ private void sendNotAuthenticated(ServletResponse resp) throws IOException {
+ logger.debug("Send not authenticated");
+ ((HttpServletResponse)resp).sendError(HttpServletResponse.SC_FORBIDDEN, "User not authenticated");
+ }
+
+ private void handleResponse(ServletResponse resp, boolean redirect) throws IOException {
+ if (redirect) {
+ this.redirect(resp);
+ }
+ else {
+ this.sendNotAuthenticated(resp);
+ }
+ }
+
+
+ /**
+ * Do nothing at destruction.
+ */
+ @Override
+ public void destroy() {
+ }
+
+ private Authentication auth(User user, String encoding)
+ throws AuthenticationException, IOException {
+ Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
+ return AuthenticationFactory.getInstance(this.authmethod).auth(
+ user.getName(), user.getPassword(), encoding, features);
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/server/filter/NoCacheFilter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/filter/NoCacheFilter.java Wed Nov 07 09:47:44 2012 +0100
@@ -0,0 +1,74 @@
+package de.intevation.flys.client.server.filter;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Date;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+/** ServletFilter to avoid caching for GWTs *.nocache.* files. */
+public class NoCacheFilter implements Filter {
+
+ private static final long DAY = 86400000L;
+
+ private static final String NO_CACHE = ".nocache.";
+
+ private static Logger log = Logger.getLogger(NoCacheFilter.class);
+
+ /**
+ * Initialize.
+ */
+ @Override
+ public void init(FilterConfig config)
+ throws ServletException
+ {
+ }
+
+
+ /**
+ * Called when filter in chain invoked.
+ * @param req request to servlet
+ * @param resp response of servlet
+ * @param chain the filter chain
+ */
+ @Override
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
+ throws IOException, ServletException
+ {
+ HttpServletRequest httpreq = (HttpServletRequest)req;
+ String uri = httpreq.getRequestURI();
+
+ if (uri.contains(NO_CACHE)) {
+ log.debug("Set no-cache for " + uri);
+
+ Date now = new Date();
+ HttpServletResponse httpresp = (HttpServletResponse)resp;
+ httpresp.setDateHeader("Date", now.getTime());
+ httpresp.setDateHeader("Expires", now.getTime() - DAY);
+ httpresp.setHeader("Pragma", "no-cache");
+ httpresp.setHeader("Cache-control",
+ "no-cache, no-store, must-revalidate");
+ }
+
+ chain.doFilter(req, resp);
+ }
+
+
+ /**
+ * Do nothing at destruction.
+ */
+ @Override
+ public void destroy() {
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ArtifactDescription.java Wed Nov 07 09:47:44 2012 +0100
@@ -4,7 +4,8 @@
/**
- * The artifact description describes a state of an artifact. There are
+ * The artifact description describes the current being of an artifact.
+ * There are
* operations defined that return former inserted data, possible input values
* and output targets that are available in the current state of the artifact.
*
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifact.java Wed Nov 07 09:47:44 2012 +0100
@@ -82,6 +82,7 @@
}
+ /** Get the description how it came from server. */
public ArtifactDescription getArtifactDescription() {
return artifactDescription;
}
diff -r 83fe6eeba83a -r e8a4d2fd25cc flys-client/src/main/webapp/WEB-INF/web.xml
--- a/flys-client/src/main/webapp/WEB-INF/web.xml Wed Nov 07 09:44:24 2012 +0100
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml Wed Nov 07 09:47:44 2012 +0100
@@ -18,7 +18,7 @@
<context-param>
<param-name>authentication</param-name>
- <param-value>GGInA</param-value>
+ <param-value>plain</param-value>
</context-param>
<context-param>
@@ -564,7 +564,7 @@
<filter>
<filter-name>GGInAFilter</filter-name>
- <filter-class>de.intevation.flys.client.server.GGInAFilter</filter-class>
+ <filter-class>de.intevation.flys.client.server.filter.GGInAFilter</filter-class>
<init-param>
<param-name>deactivate</param-name>
<param-value>false</param-value>
@@ -576,6 +576,17 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
+ <filter>
+ <filter-name>NoCacheFilter</filter-name>
+ <filter-class>de.intevation.flys.client.server.filter.NoCacheFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>NoCacheFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>FLYS.html</welcome-file>
More information about the Dive4elements-commits
mailing list