+++ /dev/null
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * 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
- * * http://www.apache.org/licenses/LICENSE-2.0\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
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.http;\r
-\r
-import java.net.HttpURLConnection;\r
-import java.net.URI;\r
-import java.net.URISyntaxException;\r
-\r
-import org.onap.aaf.cadi.CadiException;\r
-import org.onap.aaf.cadi.LocatorException;\r
-import org.onap.aaf.cadi.SecuritySetter;\r
-import org.onap.aaf.cadi.Locator.Item;\r
-import org.onap.aaf.cadi.client.EClient;\r
-import org.onap.aaf.cadi.client.Rcli;\r
-\r
-import com.att.aft.dme2.api.DME2Exception;\r
-import org.onap.aaf.inno.env.APIException;\r
-import org.onap.aaf.inno.env.Data.TYPE;\r
-\r
-/**\r
- * DME2 Rosetta Client\r
- * \r
- * JAXB defined JSON or XML over DME2 middleware\r
- * \r
- *\r
- * @param <T>\r
- */\r
-public class HRcli extends Rcli<HttpURLConnection> {\r
- private HMangr hman;\r
- private Item item;\r
- private SecuritySetter<HttpURLConnection> ss;\r
-\r
- public HRcli(HMangr hman, Item locItem, SecuritySetter<HttpURLConnection> secSet) throws URISyntaxException, LocatorException {\r
- item=locItem;\r
- uri=hman.loc.get(locItem);\r
- this.hman = hman;\r
- ss=secSet;\r
- type = TYPE.JSON;\r
- apiVersion = hman.apiVersion();\r
- }\r
-\r
- public HRcli(HMangr hman, URI uri, Item locItem, SecuritySetter<HttpURLConnection> secSet) {\r
- locItem=item;\r
- this.uri = uri;\r
- this.hman = hman;\r
- ss=secSet;\r
- type = TYPE.JSON;\r
- apiVersion = hman.apiVersion();\r
- }\r
-\r
- @Override\r
- protected HRcli clone(URI uri, SecuritySetter<HttpURLConnection> ss) {\r
- return new HRcli(hman,uri,item,ss);\r
- }\r
-\r
-\r
-\r
- /**\r
- * Note from Thaniga on 11/5. DME2Client is not expected to be reused... need a fresh one\r
- * on each transaction, which is expected to cover the Async aspects.\r
- * \r
- * @return\r
- * @throws APIException \r
- * @throws DME2Exception \r
- */\r
- protected EClient<HttpURLConnection> client() throws CadiException {\r
- try {\r
- if(uri==null) {\r
- Item item = hman.loc.best();\r
- if(item==null) {\r
- throw new CadiException("No service available for " + hman.loc.toString());\r
- }\r
- uri = hman.loc.get(item);\r
- }\r
- return new HClient(ss,uri,connectionTimeout);\r
- } catch (Exception e) {\r
- throw new CadiException(e);\r
- }\r
- }\r
- \r
- /* (non-Javadoc)\r
- * @see com.att.cadi.client.Rcli#setSecuritySetter(com.att.cadi.SecuritySetter)\r
- */\r
- @Override\r
- public void setSecuritySetter(SecuritySetter<HttpURLConnection> ss) {\r
- this.ss = ss;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see com.att.cadi.client.Rcli#getSecuritySetter()\r
- */\r
- @Override\r
- public SecuritySetter<HttpURLConnection> getSecuritySetter() {\r
- return ss;\r
- }\r
-\r
- public void invalidate() throws CadiException {\r
- try {\r
- hman.loc.invalidate(item);\r
- } catch (Exception e) {\r
- throw new CadiException(e);\r
- }\r
- }\r
- \r
- public HRcli setManager(HMangr hman) {\r
- this.hman = hman;\r
- return this;\r
- }\r
-\r
- public String toString() {\r
- return uri.toString();\r
- }\r
- \r
-}\r