* * Licensed under the Apache License, Version 2.0 (the "License");\r
* * you may not use this file except in compliance with the License.\r
* * You may obtain a copy of the License at\r
- * * \r
+ * *\r
* * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
+ * *\r
* * Unless required by applicable law or agreed to in writing, software\r
* * distributed under the License is distributed on an "AS IS" BASIS,\r
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $\r
*/\r
public class URLUtilities {\r
- /**\r
- * Generate the URL used to access a feed.\r
- * @param feedid the feed id\r
- * @return the URL\r
- */\r
- public static String generateFeedURL(int feedid) {\r
- return "https://" + BaseServlet.prov_name + "/feed/" + feedid;\r
- }\r
- /**\r
- * Generate the URL used to publish to a feed.\r
- * @param feedid the feed id\r
- * @return the URL\r
- */\r
- public static String generatePublishURL(int feedid) {\r
- return "https://" + BaseServlet.prov_name + "/publish/" + feedid;\r
- }\r
- /**\r
- * Generate the URL used to subscribe to a feed.\r
- * @param feedid the feed id\r
- * @return the URL\r
- */\r
- public static String generateSubscribeURL(int feedid) {\r
- return "https://" + BaseServlet.prov_name + "/subscribe/" + feedid;\r
- }\r
- /**\r
- * Generate the URL used to access a feed's logs.\r
- * @param feedid the feed id\r
- * @return the URL\r
- */\r
- public static String generateFeedLogURL(int feedid) {\r
- return "https://" + BaseServlet.prov_name + "/feedlog/" + feedid;\r
- }\r
- /**\r
- * Generate the URL used to access a subscription.\r
- * @param subid the subscription id\r
- * @return the URL\r
- */\r
- public static String generateSubscriptionURL(int subid) {\r
- return "https://" + BaseServlet.prov_name + "/subs/" + subid;\r
- }\r
- /**\r
- * Generate the URL used to access a subscription's logs.\r
- * @param subid the subscription id\r
- * @return the URL\r
- */\r
- public static String generateSubLogURL(int subid) {\r
- return "https://" + BaseServlet.prov_name + "/sublog/" + subid;\r
- }\r
- /**\r
- * Generate the URL used to access the provisioning data on the peer POD.\r
- * @return the URL\r
- */\r
- public static String generatePeerProvURL() {\r
- return "https://" + getPeerPodName() + "/internal/prov";\r
- }\r
- /**\r
- * Generate the URL used to access the logfile data on the peer POD.\r
- * @return the URL\r
- */\r
- public static String generatePeerLogsURL() {\r
- //Fixes for Itrack ticket - DATARTR-4#Fixing if only one Prov is configured, not to give exception to fill logs.\r
- String peerPodUrl = getPeerPodName();\r
- if(peerPodUrl.equals("") || peerPodUrl.equals(null)){\r
- return "";\r
- }\r
- \r
- return "https://" + peerPodUrl + "/internal/drlogs/";\r
- }\r
- /**\r
- * Return the real (non CNAME) version of the peer POD's DNS name.\r
- * @return the name\r
- */\r
- public static String getPeerPodName() {\r
- if (other_pod == null) {\r
- String this_pod = "";\r
- try {\r
- this_pod = InetAddress.getLocalHost().getHostName();\r
- System.out.println("this_pod: "+this_pod);\r
- } catch (UnknownHostException e) {\r
- this_pod = "";\r
- }\r
- System.out.println("ALL PODS: "+Arrays.asList(BaseServlet.getPods()));\r
- for (String pod : BaseServlet.getPods()) {\r
- if (!pod.equals(this_pod))\r
- other_pod = pod;\r
- }\r
- }\r
- return other_pod;\r
- }\r
- private static String other_pod;\r
+ /**\r
+ * Generate the URL used to access a feed.\r
+ *\r
+ * @param feedid the feed id\r
+ * @return the URL\r
+ */\r
+ public static String generateFeedURL(int feedid) {\r
+ return "https://" + BaseServlet.prov_name + "/feed/" + feedid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to publish to a feed.\r
+ *\r
+ * @param feedid the feed id\r
+ * @return the URL\r
+ */\r
+ public static String generatePublishURL(int feedid) {\r
+ return "https://" + BaseServlet.prov_name + "/publish/" + feedid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to subscribe to a feed.\r
+ *\r
+ * @param feedid the feed id\r
+ * @return the URL\r
+ */\r
+ public static String generateSubscribeURL(int feedid) {\r
+ return "https://" + BaseServlet.prov_name + "/subscribe/" + feedid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to access a feed's logs.\r
+ *\r
+ * @param feedid the feed id\r
+ * @return the URL\r
+ */\r
+ public static String generateFeedLogURL(int feedid) {\r
+ return "https://" + BaseServlet.prov_name + "/feedlog/" + feedid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to access a subscription.\r
+ *\r
+ * @param subid the subscription id\r
+ * @return the URL\r
+ */\r
+ public static String generateSubscriptionURL(int subid) {\r
+ return "https://" + BaseServlet.prov_name + "/subs/" + subid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to access a subscription's logs.\r
+ *\r
+ * @param subid the subscription id\r
+ * @return the URL\r
+ */\r
+ public static String generateSubLogURL(int subid) {\r
+ return "https://" + BaseServlet.prov_name + "/sublog/" + subid;\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to access the provisioning data on the peer POD.\r
+ *\r
+ * @return the URL\r
+ */\r
+ public static String generatePeerProvURL() {\r
+ return "https://" + getPeerPodName() + "/internal/prov";\r
+ }\r
+\r
+ /**\r
+ * Generate the URL used to access the logfile data on the peer POD.\r
+ *\r
+ * @return the URL\r
+ */\r
+ public static String generatePeerLogsURL() {\r
+ //Fixes for Itrack ticket - DATARTR-4#Fixing if only one Prov is configured, not to give exception to fill logs.\r
+ String peerPodUrl = getPeerPodName();\r
+ if (peerPodUrl.equals("") || peerPodUrl.equals(null)) {\r
+ return "";\r
+ }\r
+\r
+ return "https://" + peerPodUrl + "/internal/drlogs/";\r
+ }\r
+\r
+ /**\r
+ * Return the real (non CNAME) version of the peer POD's DNS name.\r
+ *\r
+ * @return the name\r
+ */\r
+ public static String getPeerPodName() {\r
+ if (other_pod == null) {\r
+ String this_pod = "";\r
+ try {\r
+ this_pod = InetAddress.getLocalHost().getHostName();\r
+ System.out.println("this_pod: " + this_pod);\r
+ } catch (UnknownHostException e) {\r
+ this_pod = "";\r
+ }\r
+ System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));\r
+ for (String pod : BaseServlet.getPods()) {\r
+ if (!pod.equals(this_pod))\r
+ other_pod = pod;\r
+ }\r
+ }\r
+ return other_pod;\r
+ }\r
+\r
+ private static String other_pod;\r
}\r