fixed javadoc for java8

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@148711 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-05-16 10:57:46 +00:00
parent 60e7a89063
commit bb18ce0fb9
15 changed files with 482 additions and 73 deletions

View File

@ -22,6 +22,7 @@
<distroDirectory>distro</distroDirectory> <distroDirectory>distro</distroDirectory>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<!-- <additionalparam>-Xdoclint:none</additionalparam> -->
</properties> </properties>
<dependencies> <dependencies>

View File

@ -6,10 +6,12 @@ package org.gcube.datatransfer.resolver.applicationprofile;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class ScopeUtil.
* @Oct 13, 2014
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class ScopeUtil { public class ScopeUtil {
@ -17,6 +19,13 @@ public class ScopeUtil {
public static final Logger logger = LoggerFactory.getLogger(ScopeUtil.class); public static final Logger logger = LoggerFactory.getLogger(ScopeUtil.class);
/**
* Gets the infrastructure name from scope.
*
* @param scope the scope
* @return the infrastructure name from scope
* @throws Exception the exception
*/
public static String getInfrastructureNameFromScope(String scope) throws Exception{ public static String getInfrastructureNameFromScope(String scope) throws Exception{
if(scope==null || scope.isEmpty()){ if(scope==null || scope.isEmpty()){

View File

@ -23,10 +23,12 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
/** /**
* The Class GetCkanPorltet. * The Class CkanPorltetApplicationProfile.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Dec 2, 2016 * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class CkanPorltetApplicationProfile { public class CkanPorltetApplicationProfile {
@ -37,7 +39,7 @@ public class CkanPorltetApplicationProfile {
* Gets the portlet url from infrastrucure. * Gets the portlet url from infrastrucure.
* *
* @return the portlet url from infrastrucure * @return the portlet url from infrastrucure
* @throws Exception * @throws Exception the exception
*/ */
public static String getPortletUrlFromInfrastrucure() throws Exception { public static String getPortletUrlFromInfrastrucure() throws Exception {

View File

@ -21,10 +21,12 @@ import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class GeoRuntimeReader.
* @Oct 7, 2014
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class GeoRuntimeReader { public class GeoRuntimeReader {
@ -32,10 +34,24 @@ public class GeoRuntimeReader {
public static final String GEONETWORK_RESOURCE_NAME = "GeoNetwork"; public static final String GEONETWORK_RESOURCE_NAME = "GeoNetwork";
public static final String WORKSPACES_PROPERTY_NAME = "workspaces"; public static final String WORKSPACES_PROPERTY_NAME = "workspaces";
/**
* The Enum GEO_SERVICE.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/
public static enum GEO_SERVICE{GEOSERVER, GEONETWORK}; public static enum GEO_SERVICE{GEOSERVER, GEONETWORK};
public static final Logger logger = LoggerFactory.getLogger(GeoRuntimeReader.class); public static final Logger logger = LoggerFactory.getLogger(GeoRuntimeReader.class);
/**
* Gets the parameters.
*
* @param scope the scope
* @param geoservice the geoservice
* @return the parameters
* @throws Exception the exception
*/
private ServerParameters getParameters(String scope, GEO_SERVICE geoservice) throws Exception{ private ServerParameters getParameters(String scope, GEO_SERVICE geoservice) throws Exception{
String originalScope = ScopeProvider.instance.get(); String originalScope = ScopeProvider.instance.get();
ServerParameters parameters = new ServerParameters(); ServerParameters parameters = new ServerParameters();
@ -101,6 +117,14 @@ public class GeoRuntimeReader {
return parameters; return parameters;
} }
/**
* Retrieve gis parameters.
*
* @param scope the scope
* @param geoservice the geoservice
* @return the server parameters
* @throws Exception the exception
*/
public ServerParameters retrieveGisParameters(String scope, GEO_SERVICE geoservice) throws Exception public ServerParameters retrieveGisParameters(String scope, GEO_SERVICE geoservice) throws Exception
{ {
if(geoservice==null) if(geoservice==null)

View File

@ -16,11 +16,12 @@ import org.slf4j.LoggerFactory;
/** /**
* The Class GeonetworkInstance. * The Class GeonetworkInstance.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 9, 2016 * May 16, 2017
*/ */
public class GeonetworkInstance { public class GeonetworkInstance {
@ -53,7 +54,6 @@ public class GeonetworkInstance {
* *
* @param authenticate the authenticate * @param authenticate the authenticate
* @param level the level * @param level the level
* @param type the type
* @throws Exception the exception * @throws Exception the exception
*/ */
public GeonetworkInstance(boolean authenticate, LoginLevel level) throws Exception { public GeonetworkInstance(boolean authenticate, LoginLevel level) throws Exception {
@ -112,7 +112,6 @@ public class GeonetworkInstance {
* *
* @param authenticate the authenticate * @param authenticate the authenticate
* @param level the level * @param level the level
* @param type the type
* @throws Exception the exception * @throws Exception the exception
*/ */
private void createInstanceGeonetworkPublisher(boolean authenticate, LoginLevel level) throws Exception { private void createInstanceGeonetworkPublisher(boolean authenticate, LoginLevel level) throws Exception {
@ -163,6 +162,8 @@ public class GeonetworkInstance {
} }
/** /**
* Gets the account.
*
* @return the account * @return the account
*/ */
public Account getAccount() { public Account getAccount() {

View File

@ -9,7 +9,6 @@ import org.gcube.datatransfer.resolver.gis.GeonetworkAccessParameter.GeonetworkL
* The Interface GeonetworkServiceInterface. * The Interface GeonetworkServiceInterface.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Oct 7, 2014
*/ */
public interface GeonetworkServiceInterface { public interface GeonetworkServiceInterface {

View File

@ -1,21 +1,22 @@
/** /**
* *
*/ */
package org.gcube.datatransfer.resolver.gis.entity; package org.gcube.datatransfer.resolver.gis.entity;
import java.io.Serializable; import java.io.Serializable;
/** /**
* The Class GeoserverBaseUri. * The Class GeoserverBaseUri.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 13, 2016 * May 16, 2017
*/ */
public class GeoserverBaseUri implements Serializable{ public class GeoserverBaseUri implements Serializable{
/** /**
* *
*/ */
private static final long serialVersionUID = -3321571622161066198L; private static final long serialVersionUID = -3321571622161066198L;
private String baseUrl = ""; private String baseUrl = "";

View File

@ -1,15 +1,17 @@
/** /**
* *
*/ */
package org.gcube.datatransfer.resolver.gis.entity; package org.gcube.datatransfer.resolver.gis.entity;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class GisLayerItem.
* @Oct 7, 2014
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class GisLayerItem { public class GisLayerItem {
@ -29,19 +31,20 @@ public class GisLayerItem {
private String setCrsWMS; private String setCrsWMS;
/** /**
* @param uuid * Instantiates a new gis layer item.
* @param citationTitle *
* @param layerName * @param uuid the uuid
* @param topicCategory * @param citationTitle the citation title
* @param publicationDate * @param layerName the layer name
* @param scopeCode * @param topicCategory the topic category
* @param geoserverBaseUrlOnlineResource * @param publicationDate the publication date
* @param baseWmsServiceUrl * @param scopeCode the scope code
* @param fullWmsUrlRequest * @param geoserverBaseUrlOnlineResource the geoserver base url online resource
* @param b * @param baseWmsServiceUrl the base wms service url
* @param styles * @param fullWmsUrlRequest the full wms url request
* @param metaAbstract * @param styles the styles
* @param listKeywords * @param metaAbstract the meta abstract
* @param listKeywords the list keywords
*/ */
public GisLayerItem(String uuid, String citationTitle, String layerName, public GisLayerItem(String uuid, String citationTitle, String layerName,
String topicCategory, Date publicationDate, String scopeCode, String topicCategory, Date publicationDate, String scopeCode,
@ -63,129 +66,271 @@ public class GisLayerItem {
} }
/** /**
* @param versionWms * Sets the version wms.
*
* @param versionWms the new version wms
*/ */
public void setVersionWMS(String versionWms) { public void setVersionWMS(String versionWms) {
this.versionWMS = versionWms; this.versionWMS = versionWms;
} }
/** /**
* @param crs * Sets the crs wms.
*
* @param crs the new crs wms
*/ */
public void setCrsWMS(String crs) { public void setCrsWMS(String crs) {
this.setCrsWMS =crs; this.setCrsWMS =crs;
} }
/**
* Gets the uuid.
*
* @return the uuid
*/
public String getUuid() { public String getUuid() {
return uuid; return uuid;
} }
/**
* Gets the citation title.
*
* @return the citation title
*/
public String getCitationTitle() { public String getCitationTitle() {
return citationTitle; return citationTitle;
} }
/**
* Gets the layer name.
*
* @return the layer name
*/
public String getLayerName() { public String getLayerName() {
return layerName; return layerName;
} }
/**
* Gets the topic category.
*
* @return the topic category
*/
public String getTopicCategory() { public String getTopicCategory() {
return topicCategory; return topicCategory;
} }
/**
* Gets the publication date.
*
* @return the publication date
*/
public Date getPublicationDate() { public Date getPublicationDate() {
return publicationDate; return publicationDate;
} }
/**
* Gets the scope code.
*
* @return the scope code
*/
public String getScopeCode() { public String getScopeCode() {
return scopeCode; return scopeCode;
} }
/**
* Gets the geoserver base url on line resource.
*
* @return the geoserver base url on line resource
*/
public String getGeoserverBaseUrlOnLineResource() { public String getGeoserverBaseUrlOnLineResource() {
return geoserverBaseUrlOnLineResource; return geoserverBaseUrlOnLineResource;
} }
/**
* Gets the base wms service url.
*
* @return the base wms service url
*/
public String getBaseWmsServiceUrl() { public String getBaseWmsServiceUrl() {
return baseWmsServiceUrl; return baseWmsServiceUrl;
} }
/**
* Gets the full wms url request.
*
* @return the full wms url request
*/
public String getFullWmsUrlRequest() { public String getFullWmsUrlRequest() {
return fullWmsUrlRequest; return fullWmsUrlRequest;
} }
/**
* Gets the styles.
*
* @return the styles
*/
public List<String> getStyles() { public List<String> getStyles() {
return styles; return styles;
} }
/**
* Gets the meta abstract.
*
* @return the meta abstract
*/
public String getMetaAbstract() { public String getMetaAbstract() {
return metaAbstract; return metaAbstract;
} }
/**
* Gets the list keywords.
*
* @return the list keywords
*/
public List<String> getListKeywords() { public List<String> getListKeywords() {
return listKeywords; return listKeywords;
} }
/**
* Sets the uuid.
*
* @param uuid the new uuid
*/
public void setUuid(String uuid) { public void setUuid(String uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
/**
* Sets the citation title.
*
* @param citationTitle the new citation title
*/
public void setCitationTitle(String citationTitle) { public void setCitationTitle(String citationTitle) {
this.citationTitle = citationTitle; this.citationTitle = citationTitle;
} }
/**
* Sets the layer name.
*
* @param layerName the new layer name
*/
public void setLayerName(String layerName) { public void setLayerName(String layerName) {
this.layerName = layerName; this.layerName = layerName;
} }
/**
* Sets the topic category.
*
* @param topicCategory the new topic category
*/
public void setTopicCategory(String topicCategory) { public void setTopicCategory(String topicCategory) {
this.topicCategory = topicCategory; this.topicCategory = topicCategory;
} }
/**
* Sets the publication date.
*
* @param publicationDate the new publication date
*/
public void setPublicationDate(Date publicationDate) { public void setPublicationDate(Date publicationDate) {
this.publicationDate = publicationDate; this.publicationDate = publicationDate;
} }
/**
* Sets the scope code.
*
* @param scopeCode the new scope code
*/
public void setScopeCode(String scopeCode) { public void setScopeCode(String scopeCode) {
this.scopeCode = scopeCode; this.scopeCode = scopeCode;
} }
/**
* Sets the geoserver base url on line resource.
*
* @param geoserverBaseUrlOnLineResource the new geoserver base url on line resource
*/
public void setGeoserverBaseUrlOnLineResource( public void setGeoserverBaseUrlOnLineResource(
String geoserverBaseUrlOnLineResource) { String geoserverBaseUrlOnLineResource) {
this.geoserverBaseUrlOnLineResource = geoserverBaseUrlOnLineResource; this.geoserverBaseUrlOnLineResource = geoserverBaseUrlOnLineResource;
} }
/**
* Sets the base wms service url.
*
* @param baseWmsServiceUrl the new base wms service url
*/
public void setBaseWmsServiceUrl(String baseWmsServiceUrl) { public void setBaseWmsServiceUrl(String baseWmsServiceUrl) {
this.baseWmsServiceUrl = baseWmsServiceUrl; this.baseWmsServiceUrl = baseWmsServiceUrl;
} }
/**
* Sets the full wms url request.
*
* @param fullWmsUrlRequest the new full wms url request
*/
public void setFullWmsUrlRequest(String fullWmsUrlRequest) { public void setFullWmsUrlRequest(String fullWmsUrlRequest) {
this.fullWmsUrlRequest = fullWmsUrlRequest; this.fullWmsUrlRequest = fullWmsUrlRequest;
} }
/**
* Sets the styles.
*
* @param styles the new styles
*/
public void setStyles(List<String> styles) { public void setStyles(List<String> styles) {
this.styles = styles; this.styles = styles;
} }
/**
* Sets the meta abstract.
*
* @param metaAbstract the new meta abstract
*/
public void setMetaAbstract(String metaAbstract) { public void setMetaAbstract(String metaAbstract) {
this.metaAbstract = metaAbstract; this.metaAbstract = metaAbstract;
} }
/**
* Sets the list keywords.
*
* @param listKeywords the new list keywords
*/
public void setListKeywords(List<String> listKeywords) { public void setListKeywords(List<String> listKeywords) {
this.listKeywords = listKeywords; this.listKeywords = listKeywords;
} }
/**
* Gets the version wms.
*
* @return the version wms
*/
public String getVersionWMS() { public String getVersionWMS() {
return versionWMS; return versionWMS;
} }
/**
* Gets the sets the crs wms.
*
* @return the sets the crs wms
*/
public String getSetCrsWMS() { public String getSetCrsWMS() {
return setCrsWMS; return setCrsWMS;
} }
/**
* Sets the sets the crs wms.
*
* @param setCrsWMS the new sets the crs wms
*/
public void setSetCrsWMS(String setCrsWMS) { public void setSetCrsWMS(String setCrsWMS) {
this.setCrsWMS = setCrsWMS; this.setCrsWMS = setCrsWMS;
} }
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -220,7 +365,7 @@ public class GisLayerItem {
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

@ -2,29 +2,35 @@ package org.gcube.datatransfer.resolver.gis.entity;
import java.io.Serializable; import java.io.Serializable;
/** /**
* * The Class ServerParameters.
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Oct 7, 2014
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class ServerParameters implements Serializable{ public class ServerParameters implements Serializable{
/** /**
* *
*/ */
private static final long serialVersionUID = 2459971193655529274L; private static final long serialVersionUID = 2459971193655529274L;
protected String url; protected String url;
protected String user; protected String user;
protected String password; protected String password;
public ServerParameters(){}
/** /**
* @param url * Instantiates a new server parameters.
* @param user */
* @param password public ServerParameters(){}
/**
* Instantiates a new server parameters.
*
* @param url the url
* @param user the user
* @param password the password
*/ */
public ServerParameters(String url, String user, String password) { public ServerParameters(String url, String user, String password) {
this.url = url; this.url = url;
@ -33,6 +39,8 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Gets the url.
*
* @return the url * @return the url
*/ */
public String getUrl() { public String getUrl() {
@ -40,6 +48,8 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Sets the url.
*
* @param url the url to set * @param url the url to set
*/ */
public void setUrl(String url) { public void setUrl(String url) {
@ -47,6 +57,8 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Gets the user.
*
* @return the user * @return the user
*/ */
public String getUser() { public String getUser() {
@ -54,6 +66,8 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Sets the user.
*
* @param user the user to set * @param user the user to set
*/ */
public void setUser(String user) { public void setUser(String user) {
@ -61,6 +75,8 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Gets the password.
*
* @return the password * @return the password
*/ */
public String getPassword() { public String getPassword() {
@ -68,12 +84,17 @@ public class ServerParameters implements Serializable{
} }
/** /**
* Sets the password.
*
* @param password the password to set * @param password the password to set
*/ */
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();

View File

@ -6,11 +6,12 @@ package org.gcube.datatransfer.resolver.gis.exception;
import org.gcube.spatial.data.geonetwork.model.faults.AuthorizationException; import org.gcube.spatial.data.geonetwork.model.faults.AuthorizationException;
/** /**
* The Class GeonetworkInstanceException. * The Class GeonetworkInstanceException.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jan 13, 2016 * May 16, 2017
*/ */
public class GeonetworkInstanceException extends Exception { public class GeonetworkInstanceException extends Exception {

View File

@ -1,28 +1,35 @@
/** /**
* *
*/ */
package org.gcube.datatransfer.resolver.gis.exception; package org.gcube.datatransfer.resolver.gis.exception;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class IllegalArgumentException.
* @Oct 14, 2014
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class IllegalArgumentException extends Exception { public class IllegalArgumentException extends Exception {
/** /**
* *
*/ */
private static final long serialVersionUID = 8589705350737964325L; private static final long serialVersionUID = 8589705350737964325L;
/** /**
* * Instantiates a new illegal argument exception.
*/ */
public IllegalArgumentException() { public IllegalArgumentException() {
super(); super();
} }
/**
* Instantiates a new illegal argument exception.
*
* @param message the message
*/
public IllegalArgumentException(String message) { public IllegalArgumentException(String message) {
super(message); super(message);
} }

View File

@ -11,11 +11,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The Class GNAuthentication. * The Class GNAuthentication.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Apr 4, 2016 * May 16, 2017
*/ */
public class GNAuthentication { public class GNAuthentication {
@ -24,9 +25,9 @@ public class GNAuthentication {
private static final String SRV_EN_XML_USER_LOGIN = "/srv/en/xml.user.login"; private static final String SRV_EN_XML_USER_LOGIN = "/srv/en/xml.user.login";
/** /**
* Perform a GN login.<br/> * Perform a GN login.<br>
* GN auth is carried out via a JSESSIONID cookie returned by a successful login * GN auth is carried out via a JSESSIONID cookie returned by a successful login
* call.<br/> * call.<br>
* *
* <ul> * <ul>
* <li>Url: <tt>http://<i>server</i>:<i>port</i>/geonetwork/srv/en/xml.user.login</tt></li> * <li>Url: <tt>http://<i>server</i>:<i>port</i>/geonetwork/srv/en/xml.user.login</tt></li>

View File

@ -13,10 +13,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class HttpRequestUtil.
* @Apr 26, 2013
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/ */
public class HttpRequestUtil { public class HttpRequestUtil {
@ -25,6 +27,14 @@ public class HttpRequestUtil {
private static final int CONNECTION_TIMEOUT = 1000; private static final int CONNECTION_TIMEOUT = 1000;
public static Logger logger = LoggerFactory.getLogger(HttpRequestUtil.class); public static Logger logger = LoggerFactory.getLogger(HttpRequestUtil.class);
/**
* Url exists.
*
* @param urlConn the url conn
* @param verifyIsWmsGeoserver the verify is wms geoserver
* @return true, if successful
* @throws Exception the exception
*/
public static boolean urlExists(String urlConn, boolean verifyIsWmsGeoserver) throws Exception { public static boolean urlExists(String urlConn, boolean verifyIsWmsGeoserver) throws Exception {
URL url; URL url;
@ -34,26 +44,26 @@ public class HttpRequestUtil {
URLConnection connection = url.openConnection(); URLConnection connection = url.openConnection();
connection.setConnectTimeout(CONNECTION_TIMEOUT); connection.setConnectTimeout(CONNECTION_TIMEOUT);
connection.setReadTimeout(CONNECTION_TIMEOUT+CONNECTION_TIMEOUT); connection.setReadTimeout(CONNECTION_TIMEOUT+CONNECTION_TIMEOUT);
logger.trace("open connection on: " + url); logger.trace("open connection on: " + url);
// Cast to a HttpURLConnection // Cast to a HttpURLConnection
if (connection instanceof HttpURLConnection) { if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) connection; HttpURLConnection httpConnection = (HttpURLConnection) connection;
httpConnection.setRequestMethod("GET"); httpConnection.setRequestMethod("GET");
int code = httpConnection.getResponseCode(); int code = httpConnection.getResponseCode();
if(verifyIsWmsGeoserver) if(verifyIsWmsGeoserver)
return isGeoserver(httpConnection); return isGeoserver(httpConnection);
httpConnection.disconnect(); httpConnection.disconnect();
if (code == 200) { if (code == 200) {
return true; return true;
} }
// logger.trace("result: "+result); // logger.trace("result: "+result);
} else { } else {
@ -76,16 +86,23 @@ public class HttpRequestUtil {
throw new Exception("Error Exception"); throw new Exception("Error Exception");
} }
} }
/**
* Checks if is geoserver.
*
* @param httpConnection the http connection
* @return true, if is geoserver
* @throws IOException Signals that an I/O exception has occurred.
*/
private static boolean isGeoserver(HttpURLConnection httpConnection) throws IOException{ private static boolean isGeoserver(HttpURLConnection httpConnection) throws IOException{
BufferedReader rd = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); BufferedReader rd = new BufferedReader(new InputStreamReader(httpConnection.getInputStream()));
String line; String line;
String result = ""; String result = "";
int code = httpConnection.getResponseCode(); int code = httpConnection.getResponseCode();
if (code == 200) { if (code == 200) {
while ((line = rd.readLine()) != null) { while ((line = rd.readLine()) != null) {
result += line; result += line;
@ -101,9 +118,15 @@ public class HttpRequestUtil {
} }
rd.close(); rd.close();
return false; return false;
} }
/**
* The main method.
*
* @param args the arguments
* @throws Exception the exception
*/
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.out.println(HttpRequestUtil.urlExists("http://geoserver2.d4science.research-infrastructures.eu/geoserver/wms", true)); System.out.println(HttpRequestUtil.urlExists("http://geoserver2.d4science.research-infrastructures.eu/geoserver/wms", true));
} }

View File

@ -15,7 +15,7 @@ import javax.xml.namespace.NamespaceContext;
* The Class NamespaceCsw. * The Class NamespaceCsw.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 16, 2016 * May 16, 2017
*/ */
public class NamespaceCsw extends NamespaceISO19139 implements NamespaceContext { public class NamespaceCsw extends NamespaceISO19139 implements NamespaceContext {

View File

@ -4,6 +4,13 @@
package org.gcube.datatransfer.resolver.gis.util; package org.gcube.datatransfer.resolver.gis.util;
/**
* The Class NamespaceISO19139.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* May 16, 2017
*/
public abstract class NamespaceISO19139 { public abstract class NamespaceISO19139 {
@ -40,87 +47,254 @@ public abstract class NamespaceISO19139 {
private final String prefixWMS = "wms"; private final String prefixWMS = "wms";
/**
* Gets the namespace csw.
*
* @return the namespace csw
*/
public String getNamespaceCSW() { public String getNamespaceCSW() {
return namespaceCSW; return namespaceCSW;
} }
/**
* Gets the namespace dc.
*
* @return the namespace dc
*/
public String getNamespaceDC() { public String getNamespaceDC() {
return namespaceDC; return namespaceDC;
} }
/**
* Gets the namespace ows.
*
* @return the namespace ows
*/
public String getNamespaceOWS() { public String getNamespaceOWS() {
return namespaceOWS; return namespaceOWS;
} }
/**
* Gets the namespace gmd.
*
* @return the namespace gmd
*/
public String getNamespaceGMD() { public String getNamespaceGMD() {
return namespaceGMD; return namespaceGMD;
} }
/**
* Gets the namespace gco.
*
* @return the namespace gco
*/
public String getNamespaceGCO() { public String getNamespaceGCO() {
return namespaceGCO; return namespaceGCO;
} }
/**
* Gets the namespace xlink.
*
* @return the namespace xlink
*/
public String getNamespaceXLINK() { public String getNamespaceXLINK() {
return namespaceXLINK; return namespaceXLINK;
} }
/**
* Gets the namespace srv.
*
* @return the namespace srv
*/
public String getNamespaceSRV() { public String getNamespaceSRV() {
return namespaceSRV; return namespaceSRV;
} }
/**
* Gets the namespace xsi.
*
* @return the namespace xsi
*/
public String getNamespaceXSI() { public String getNamespaceXSI() {
return namespaceXSI; return namespaceXSI;
} }
/**
* Gets the namespace gml.
*
* @return the namespace gml
*/
public String getNamespaceGML() { public String getNamespaceGML() {
return namespaceGML; return namespaceGML;
} }
/**
* Gets the namespace gts.
*
* @return the namespace gts
*/
public String getNamespaceGTS() { public String getNamespaceGTS() {
return namespaceGTS; return namespaceGTS;
} }
/**
* Gets the namespace geonet.
*
* @return the namespace geonet
*/
public String getNamespaceGEONET() { public String getNamespaceGEONET() {
return namespaceGEONET; return namespaceGEONET;
} }
/**
* Gets the prefix csw.
*
* @return the prefix csw
*/
public String getPrefixCSW() { public String getPrefixCSW() {
return prefixCSW; return prefixCSW;
} }
/**
* Gets the prefix gmd.
*
* @return the prefix gmd
*/
public String getPrefixGMD() { public String getPrefixGMD() {
return prefixGMD; return prefixGMD;
} }
/**
* Gets the prefix ows.
*
* @return the prefix ows
*/
public String getPrefixOWS() { public String getPrefixOWS() {
return prefixOWS; return prefixOWS;
} }
/**
* Gets the prefix dc.
*
* @return the prefix dc
*/
public String getPrefixDC() { public String getPrefixDC() {
return prefixDC; return prefixDC;
} }
/**
* Gets the prefix gco.
*
* @return the prefix gco
*/
public String getPrefixGCO() { public String getPrefixGCO() {
return prefixGCO; return prefixGCO;
} }
/**
* Gets the prefix xlink.
*
* @return the prefix xlink
*/
public String getPrefixXLINK() { public String getPrefixXLINK() {
return prefixXLINK; return prefixXLINK;
} }
/**
* Gets the prefix srv.
*
* @return the prefix srv
*/
public String getPrefixSRV() { public String getPrefixSRV() {
return prefixSRV; return prefixSRV;
} }
/**
* Gets the prefix gml.
*
* @return the prefix gml
*/
public String getPrefixGML() { public String getPrefixGML() {
return prefixGML; return prefixGML;
} }
/**
* Gets the prefix gts.
*
* @return the prefix gts
*/
public String getPrefixGTS() { public String getPrefixGTS() {
return prefixGTS; return prefixGTS;
} }
/**
* Gets the prefix geonet.
*
* @return the prefix geonet
*/
public String getPrefixGEONET() { public String getPrefixGEONET() {
return prefixGEONET; return prefixGEONET;
} }
/**
* Gets the prefix xsi.
*
* @return the prefix xsi
*/
public String getPrefixXSI() { public String getPrefixXSI() {
return prefixXSI; return prefixXSI;
} }
/**
* Gets the prefix gmx.
*
* @return the prefix gmx
*/
public String getPrefixGMX() { public String getPrefixGMX() {
return prefixGMX; return prefixGMX;
} }
/**
* Gets the namespace gmx.
*
* @return the namespace gmx
*/
public String getNamespaceGMX() { public String getNamespaceGMX() {
return namespaceGMX; return namespaceGMX;
} }
/**
* Gets the prefix wms.
*
* @return the prefix wms
*/
public String getPrefixWMS() { public String getPrefixWMS() {
return prefixWMS; return prefixWMS;
} }
/**
* Gets the namespace wms.
*
* @return the namespace wms
*/
public String getNamespaceWMS() { public String getNamespaceWMS() {
return namespaceWMS; return namespaceWMS;
} }
/**
* Gets the namespace dct.
*
* @return the namespace dct
*/
public String getNamespaceDCT() { public String getNamespaceDCT() {
return namespaceDCT; return namespaceDCT;
} }
/**
* Gets the prefix dct.
*
* @return the prefix dct
*/
public String getPrefixDCT() { public String getPrefixDCT() {
return prefixDCT; return prefixDCT;
} }