starting #22385
This commit is contained in:
parent
8d4b6d6c3f
commit
3039279092
|
@ -77,7 +77,7 @@ public class UriResolverManager {
|
|||
return usingReader;
|
||||
}
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(UriResolverManager.class);
|
||||
public static final Logger LOG = LoggerFactory.getLogger(UriResolverManager.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new uri resolver manager. Precondition: set the scope into
|
||||
|
@ -94,7 +94,7 @@ public class UriResolverManager {
|
|||
try {
|
||||
|
||||
String scope = ScopeProvider.instance.get();
|
||||
logger.info("UriResolverManager is using scope: " + scope + ", read from ScopeProvider");
|
||||
LOG.info("UriResolverManager is using scope: " + scope + ", read from ScopeProvider");
|
||||
|
||||
if (scope == null)
|
||||
throw new UriResolverMapException("Scope is null, set scope into ScopeProvider!");
|
||||
|
@ -103,10 +103,10 @@ public class UriResolverManager {
|
|||
this.applicationTypes = uriResolverMapReader.getApplicationTypes();
|
||||
// this.setTimerUriResolverReader(RESET_DELAY, RESET_TIME);
|
||||
} catch (UriResolverMapException e) {
|
||||
logger.error("UriResolverMapException: ", e);
|
||||
LOG.error("UriResolverMapException: ", e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("UriResolverManager: ", e);
|
||||
LOG.error("UriResolverManager: ", e);
|
||||
throw new UriResolverMapException("Map Application Type - Resources not found in IS");
|
||||
}
|
||||
}
|
||||
|
@ -184,16 +184,16 @@ public class UriResolverManager {
|
|||
// lockReader();
|
||||
|
||||
if (reader == null) {
|
||||
logger.info("Runtime Resource Reader is null, istancing...");
|
||||
LOG.info("Runtime Resource Reader is null, istancing...");
|
||||
reader = new RuntimeResourceReader(resolver.getResourceName());
|
||||
}
|
||||
|
||||
if (resolver.getEntryName() == null || resolver.getEntryName().isEmpty()) {
|
||||
logger.warn("The entryname to " + resolver.getResourceName()
|
||||
LOG.warn("The entryname to " + resolver.getResourceName()
|
||||
+ " is null or empty, reading first Access Point!!");
|
||||
serviceAccessPoint = reader.getServiceAccessPoints().get(0);
|
||||
} else {
|
||||
logger.warn("Reading Access Point for Entry Name: " + resolver.getEntryName());
|
||||
LOG.warn("Reading Access Point for Entry Name: " + resolver.getEntryName());
|
||||
serviceAccessPoint = reader.getServiceAccessPointForEntryName(resolver.getEntryName());
|
||||
if (serviceAccessPoint == null)
|
||||
throw new UriResolverMapException("Entry Name " + resolver.getEntryName()
|
||||
|
@ -217,7 +217,7 @@ public class UriResolverManager {
|
|||
try {
|
||||
return resolver.getLink(baseURI, parameters);
|
||||
} catch (NotImplementedException e) {
|
||||
logger.info("Get Link not implemented, going to default implementation by GET Request");
|
||||
LOG.info("Get Link not implemented, going to default implementation by GET Request");
|
||||
}
|
||||
|
||||
// Encoding only the query string
|
||||
|
@ -229,46 +229,46 @@ public class UriResolverManager {
|
|||
// parameters encoded
|
||||
queryString = UrlEncoderUtil.encodeQuery(parameters);
|
||||
String toReturn = String.format("%s?%s", baseURI, queryString);
|
||||
logger.info("returning link with encoded parameters in the query string: " + toReturn);
|
||||
LOG.info("returning link with encoded parameters in the query string: " + toReturn);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
queryString = UrlEncoderUtil.toQueryString(parameters);
|
||||
linkDecoded = String.format("%s?%s", baseURI, queryString);
|
||||
link = linkDecoded;
|
||||
logger.info("Created HTTP URI request (link): " + link);
|
||||
LOG.info("Created HTTP URI request (link): " + link);
|
||||
if (shortLink) {
|
||||
try {
|
||||
String queryStringEncoded = UrlEncoderUtil.encodeString(queryString);
|
||||
link = String.format("%s?%s", baseURI, queryStringEncoded);
|
||||
logger.info("Encoded link is: " + link);
|
||||
logger.info("Shortner start..");
|
||||
LOG.info("Encoded link is: " + link);
|
||||
LOG.info("Shortner start..");
|
||||
UrlShortener shortener = new UrlShortener();
|
||||
String shortedLink = shortener.shorten(link);
|
||||
logger.info("Shorted link is: " + shortedLink);
|
||||
LOG.info("Shorted link is: " + shortedLink);
|
||||
if (shortedLink != null && shortedLink.equals(link)) {
|
||||
// here the short link and the input link are identical
|
||||
// so the shortening did not work
|
||||
// I'm returning the decoded link because it is directly consumable via browser
|
||||
logger.debug("Shorted link is equal to input link, returning decoded link: " + linkDecoded);
|
||||
LOG.debug("Shorted link is equal to input link, returning decoded link: " + linkDecoded);
|
||||
link = linkDecoded;
|
||||
} else {
|
||||
// here the link is really shorted
|
||||
logger.debug("The link is really shorted, returning it");
|
||||
LOG.debug("The link is really shorted, returning it");
|
||||
link = shortedLink;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.warn("An error occurred during link shortening: ", e);
|
||||
LOG.warn("An error occurred during link shortening: ", e);
|
||||
// here I'm returning the decoded link in case of error on shortening it
|
||||
link = linkDecoded;
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
logger.error("Uri Resolver IllegalArgumentException: ", e);
|
||||
LOG.error("Uri Resolver IllegalArgumentException: ", e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
logger.error("Uri Resolver Exception: ", e);
|
||||
LOG.error("Uri Resolver Exception: ", e);
|
||||
throw new UriResolverMapException("Uri Resolver error: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class UriResolverManager {
|
|||
try {
|
||||
|
||||
String scope = ScopeProvider.instance.get();
|
||||
logger.info("SiscoveryServiceParameters is using scope: " + scope + ", read from ScopeProvider");
|
||||
LOG.info("SiscoveryServiceParameters is using scope: " + scope + ", read from ScopeProvider");
|
||||
|
||||
if (scope == null)
|
||||
throw new UriResolverMapException("Scope is null, set scope into ScopeProvider!");
|
||||
|
@ -309,11 +309,11 @@ public class UriResolverManager {
|
|||
|
||||
ServiceAccessPoint serviceAccessPoint = null;
|
||||
if (resolver.getEntryName() == null || resolver.getEntryName().isEmpty()) {
|
||||
logger.warn("The entryname to " + resolver.getResourceName()
|
||||
LOG.warn("The entryname to " + resolver.getResourceName()
|
||||
+ " is null or empty, reading first Access Point!!");
|
||||
serviceAccessPoint = reader.getServiceAccessPoints().get(0);
|
||||
} else {
|
||||
logger.info("Reading Access Point for entryname: " + resolver.getEntryName());
|
||||
LOG.info("Reading Access Point for entryname: " + resolver.getEntryName());
|
||||
serviceAccessPoint = reader.getServiceAccessPointForEntryName(resolver.getEntryName());
|
||||
if (serviceAccessPoint == null)
|
||||
throw new UriResolverMapException("Entry Name " + resolver.getEntryName()
|
||||
|
@ -322,7 +322,7 @@ public class UriResolverManager {
|
|||
|
||||
return serviceAccessPoint.getServiceParameters();
|
||||
} catch (Exception e) {
|
||||
logger.error("Uri Resolver error: ", e);
|
||||
LOG.error("Uri Resolver error: ", e);
|
||||
throw new UriResolverMapException("Uri Resolver error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -361,13 +361,13 @@ public class UriResolverManager {
|
|||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("Timer Reset Runtime Resource running..");
|
||||
LOG.info("Timer Reset Runtime Resource running..");
|
||||
int counters = countReaders();
|
||||
if (counters == 0) {
|
||||
logger.info("Reader not locked, resetting");
|
||||
LOG.info("Reader not locked, resetting");
|
||||
reader = null;
|
||||
} else
|
||||
logger.info("Reader locked, counters is/are:" + counters + ", skipping");
|
||||
LOG.info("Reader locked, counters is/are:" + counters + ", skipping");
|
||||
|
||||
}
|
||||
}, delay, period);
|
||||
|
|
|
@ -36,7 +36,7 @@ public class UriResolverMapReader {
|
|||
public static final String URIRESOLVERMAP_SECONDARY_TYPE = "UriResolverMap";
|
||||
public static final String URI_RESOLVER_MAP_RESOURCE_NAME = "Uri-Resolver-Map";
|
||||
|
||||
// private Logger logger = LoggerFactory.getLogger(UriResolverMapReader.class);
|
||||
// private Logger LOG = LoggerFactory.getLogger(UriResolverMapReader.class);
|
||||
// TODO TEMP SOLUTION IN ORDER TO PRINT USING ALSO LOG4J INTO GEOEXPLORER
|
||||
// PORTLET
|
||||
private Logger logger = LoggerFactory.getLogger(UriResolverMapReader.class);
|
||||
|
|
|
@ -54,7 +54,7 @@ public class HttpRequestUtil {
|
|||
}else
|
||||
logger.warn("status code is "+code+" - on url connection: "+urlConn);
|
||||
|
||||
// logger.trace("result: "+result);
|
||||
// LOG.trace("result: "+result);
|
||||
|
||||
} else {
|
||||
logger.error("error - not a http request!");
|
||||
|
|
Loading…
Reference in New Issue