@@ -1,23 +1,42 @@ |
<?xml version="1.0" encoding="UTF-8"?> |
<!-- |
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
- Licensed to the Apache Software Foundation (ASF) under one |
- or more contributor license agreements. See the NOTICE file |
- distributed with this work for additional information |
- regarding copyright ownership. The ASF licenses this file |
- to you 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 |
+Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved. |
|
- http://www.apache.org/licenses/LICENSE-2.0 |
+Oracle and Java are registered trademarks of Oracle and/or its affiliates. |
+Other names may be trademarks of their respective owners. |
|
- 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. |
+The contents of this file are subject to the terms of either the GNU |
+General Public License Version 2 only ("GPL") or the Common |
+Development and Distribution License("CDDL") (collectively, the |
+"License"). You may not use this file except in compliance with the |
+License. You can obtain a copy of the License at |
+http://www.netbeans.org/cddl-gplv2.html |
+or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
+specific language governing permissions and limitations under the |
+License. When distributing the software, include this License Header |
+Notice in each file and include the License file at |
+nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this |
+particular file as subject to the "Classpath" exception as provided |
+by Oracle in the GPL Version 2 section of the License file that |
+accompanied this code. If applicable, add the following below the |
+License Header, with the fields enclosed by brackets [] replaced by |
+your own identifying information: |
+"Portions Copyrighted [year] [name of copyright owner]" |
|
+If you wish your version of this file to be governed by only the CDDL |
+or only the GPL Version 2, indicate your decision by adding |
+"[Contributor] elects to include this software in this distribution |
+under the [CDDL or GPL Version 2] license." If you do not indicate a |
+single choice of license, a recipient has the option to distribute |
+your version of this file under either the CDDL, the GPL Version 2 or |
+to extend the choice of license to its licensees as provided above. |
+However, if you add GPL Version 2 code and therefore, elected the GPL |
+Version 2 license, then the option applies only if the new code is |
+made subject to such option by the copyright holder. |
+ |
+Contributor(s): |
--> |
<project default="-deploy-ant" basedir="."> |
<target name="-init" if="deploy.ant.enabled"> |
@@ -40,30 +59,18 @@ |
</target> |
<target name="-deploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials"> |
<echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/> |
- <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"> |
- <classpath> |
- <pathelement path="${tomcat.home}/lib/catalina-ant.jar"/> |
- <pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/> |
- <pathelement path="${tomcat.home}/lib/tomcat-util.jar"/> |
- <pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/> |
- </classpath> |
- </taskdef> |
- <deploy url="${tomcat.url}/manager/text" username="${tomcat.username}" |
+ <taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" |
+ classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> |
+ <deploy url="${tomcat.url}/manager" username="${tomcat.username}" |
password="${tomcat.password}" path="${Context(path)}" |
war="${deploy.ant.archive}"/> |
<property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/> |
</target> |
<target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials"> |
<echo message="Undeploying ${Context(path)}"/> |
- <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"> |
- <classpath> |
- <pathelement path="${tomcat.home}/lib/catalina-ant.jar"/> |
- <pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/> |
- <pathelement path="${tomcat.home}/lib/tomcat-util.jar"/> |
- <pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/> |
- </classpath> |
- </taskdef> |
- <undeploy url="${tomcat.url}/manager/text" username="${tomcat.username}" |
+ <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" |
+ classpath="${tomcat.home}/server/lib/catalina-ant.jar"/> |
+ <undeploy url="${tomcat.url}/manager" username="${tomcat.username}" |
password="${tomcat.password}" path="${Context(path)}"/> |
</target> |
</project> |
@@ -215,20 +215,45 @@ |
SignificantSoil tSoil = new SignificantSoil(); |
tSoil.demResult.intersectionUsed = aoiShape; |
tSoil.area = area; |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", tSoil); |
+ try { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", tSoil); |
+ if (!tSoil.demResult.callInfo.message.isEmpty()) { |
+ throw new ServiceException("No valid Soils found initially and no valid DEM Slope could be calculated for this AoI."); |
+ } |
+ } catch (Exception exec) { |
+ throw new ServiceException("No valid soils found initially and DEM slope service failed with an exception. ", ex); |
+ } |
|
- findAdjacentSoils(tSoil, gisDb, soilsDb); |
+ try { |
+ findAdjacentSoils(tSoil, gisDb, soilsDb); |
+ } catch (Exception exec) { |
+ throw new ServiceException("No valid soils found: Initial location " |
+ + "returned results: [" + ex.getMessage() + "]. An attempt was " |
+ + "made to find adjacent soil information which also failed: ", exec); |
+ } |
ranAdjacentOnce = true; |
|
} else { |
- throw ex; |
+ throw new ServiceException("Exception encounted trying to find initial soils data.", ex); |
} |
} |
|
if (!topThree.isEmpty()) { |
- if (usedSoilsCount <= 0) { |
+ // We have some valid soils identified, attempt to run the slopes and models. |
+ if (usedSoilsCount <= 0) { // Did we already try to find surrounding soils? |
if (0 != mupolygonkey) { |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(0)); |
+ SignificantSoil tempSoil = topThree.get(0); |
+ if (tempSoil.demResult.callInfo.finished && (tempSoil.demResult.slope != NO_DEM_SLOPE_CALCULATED)) { |
+ try { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(0)); |
+ if (!tempSoil.demResult.callInfo.message.isEmpty()) { |
+ throw new ServiceException("" + ((ranAdjacentOnce) ? " XXXX " : " YYYY ") |
+ + "and no valid DEM Slope could be calculated for a dominant soil intersection."); |
+ } |
+ } catch (Exception ex) { |
+ throw new ServiceException("No valid soils found initially and DEM slope service failed with an exception. ", ex); |
+ } |
+ } |
for (SignificantSoil tSoil : topThree) { |
tSoil.demResult.slope = topThree.get(0).demResult.slope; |
tSoil.demResult.callInfo = topThree.get(0).demResult.callInfo; |
@@ -248,6 +273,7 @@ |
} |
} |
} else { |
+ // Tried to find surrounding soils once already, do not do it again. |
useSurroundingSoils = false; |
} |
} |
@@ -258,7 +284,14 @@ |
SignificantSoil tSoil = new SignificantSoil(); |
tSoil.demResult.intersectionUsed = aoiShape; |
tSoil.area = area; |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", tSoil); |
+ try { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", tSoil); |
+ if (!tSoil.demResult.callInfo.message.isEmpty()) { |
+ throw new ServiceException("No valid soils found initially and No valid DEM Slope could be calculated for this AoI for checking adjacent soils."); |
+ } |
+ } catch (Exception ex) { |
+ throw new ServiceException("No valid soils found initially and DEM slope service failed with an exception. ", ex); |
+ } |
|
findAdjacentSoils(tSoil, gisDb, soilsDb); |
} |
@@ -385,13 +418,14 @@ |
testCount++; |
} catch (Exception ex) { |
if (!ex.getMessage().contains(BAD_MAPUNIT_DATA) && !ex.getMessage().contains(NO_VALID_COMPONENTS)) { |
- throw ex; |
+ throw new ServiceException("Exception while trying to find adjacent soils:", ex); |
} |
testCount++; |
} |
} |
|
if (usedSoilsCount <= 0) { |
+ //TODO: Need to collect and store all the model error messages for packaging here... |
throw new ServiceException("No valid soils could be found inside, nor " |
+ "adjacent to, the AoI shape provided. Adjacent soils were tested within a radius of " |
+ testRadius |
@@ -680,10 +714,10 @@ |
} |
|
if (tSoil.demResult.intersectionUsed == null) { // should not happen |
- throw new ServiceException("Missing intersection."); |
+ throw new ServiceException("Missing intersection for soil: " + tSoil.component.cokey() + "."); |
} |
if (!tSoil.hasGoodArea()) { |
- metainfo().setWarning("One or more of the soil intersection polygons was less than the minimum acre threshold, " + MIN_ACRES + "."); |
+ metainfo().setWarning("One or more of the soil intersection polygons was less than the minimum acre threshold, " + MIN_ACRES + ", for soil: ." + tSoil.component.cokey() + "."); |
soilIntersectionsNotLargeEnough = true; |
} |
topThree.add(tSoil); |
@@ -700,16 +734,29 @@ |
// DEM slope |
Parallel.run(serialDEMSLOPE, |
() -> { |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(0)); |
+ // Did we do this already for this one? [Could be done already during findAdjacentSoils calls...] |
+ if (topThree.get(0).demResult.slope == NO_DEM_SLOPE_CALCULATED |
+ && topThree.get(0).demResult.callInfo.message.isEmpty() |
+ && !topThree.get(0).demResult.callInfo.finished()) { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(0)); |
+ } |
}, |
() -> { |
if (topThree.size() > 1) { |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(1)); |
+ if (topThree.get(1).demResult.slope == NO_DEM_SLOPE_CALCULATED |
+ && topThree.get(1).demResult.callInfo.message.isEmpty() |
+ && !topThree.get(1).demResult.callInfo.finished()) { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(1)); |
+ } |
} |
}, |
() -> { |
if (topThree.size() > 2) { |
- getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(2)); |
+ if (topThree.get(2).demResult.slope == NO_DEM_SLOPE_CALCULATED |
+ && topThree.get(2).demResult.callInfo.message.isEmpty() |
+ && !topThree.get(2).demResult.callInfo.finished()) { |
+ getDEMSlope(CRP1_DEMSLOPE_URL, "4.0", topThree.get(2)); |
+ } |
} |
} |
); |