Remove Code from cadi, it is now in authz
[aaf/cadi.git] / client / src / main / java / org / onap / aaf / cadi / client / EnvAccess.java
diff --git a/client/src/main/java/org/onap/aaf/cadi/client/EnvAccess.java b/client/src/main/java/org/onap/aaf/cadi/client/EnvAccess.java
deleted file mode 100644 (file)
index bcf41f8..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************\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.client;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.Map.Entry;\r
-\r
-import org.onap.aaf.cadi.Access;\r
-import org.onap.aaf.cadi.Symm;\r
-\r
-import java.util.Properties;\r
-\r
-import org.onap.aaf.inno.env.Decryptor;\r
-import org.onap.aaf.inno.env.Env;\r
-import org.onap.aaf.inno.env.impl.BasicEnv;\r
-\r
-public class EnvAccess implements Access {\r
-       private Env env;\r
-\r
-       /**\r
-        * String Property tag for files/resources that may contain properties.  Can be null.\r
-        * Resources of ClassLoader will be checked first, if exist. Can be null.\r
-        * @param env\r
-        * @param tag\r
-        * @param cl\r
-        * @throws IOException\r
-        */\r
-       public EnvAccess(BasicEnv env, ClassLoader cl) throws IOException {\r
-               this.env = env;\r
-               final Symm s = Symm.obtain(this);\r
-               env.set(new Decryptor() {\r
-                               private Symm symm = s;\r
-                               @Override\r
-                               public String decrypt(String encrypted) {\r
-                                       try {\r
-                                               return (encrypted!=null && (encrypted.startsWith(Symm.ENC)))\r
-                                                               ? symm.depass(encrypted)\r
-                                                               : encrypted;\r
-                                       } catch (IOException e) {\r
-                                               return "";\r
-                                       }\r
-                               }\r
-                       }\r
-               );\r
-       }\r
-\r
-       \r
-       /**\r
-        * Construct with the Classloader of Env and CADI_PROP_FILES, if possible\r
-        * \r
-        * @param env\r
-        * @throws IOException\r
-        */\r
-       public EnvAccess(BasicEnv env) throws IOException {\r
-               this(env, env.getClass().getClassLoader());\r
-       }\r
-       \r
-       @Override\r
-       public void log(Level level, Object... elements) {\r
-               switch(level) {\r
-                       case AUDIT:\r
-                               env.audit().log(elements);\r
-                               break;\r
-                       case DEBUG:\r
-                               env.debug().log(elements);\r
-                               break;\r
-                       case ERROR:\r
-                               env.error().log(elements);\r
-                               break;\r
-                       case INFO:\r
-                               env.info().log(elements);\r
-                               break;\r
-                       case INIT:\r
-                               env.init().log(elements);\r
-                               break;\r
-                       case WARN:\r
-                               env.warn().log(elements);\r
-                               break;\r
-                       default:\r
-                               break;\r
-               }\r
-               \r
-       }\r
-\r
-       @Override\r
-       public void log(Exception e, Object... elements) {\r
-               env.error().log(e,elements);\r
-       }\r
-\r
-       @Override\r
-       public void printf(Level level, String fmt, Object... elements) {\r
-               if(willLog(level)) {\r
-                       log(level,String.format(fmt, elements));\r
-               }\r
-       }\r
-\r
-\r
-       @Override\r
-       public boolean willLog(Level level) {\r
-               switch(level) {\r
-                       case AUDIT:\r
-                               return env.audit().isLoggable();\r
-                       case DEBUG:\r
-                               return env.debug().isLoggable();\r
-                       case ERROR:\r
-                               return env.error().isLoggable();\r
-                       case INFO:\r
-                               return env.info().isLoggable();\r
-                       case INIT:\r
-                               return env.init().isLoggable();\r
-                       case WARN:\r
-                               return env.warn().isLoggable();\r
-                       default:\r
-                               return false;\r
-               }\r
-       }\r
-\r
-\r
-       @Override\r
-       public void setLogLevel(Level level) {\r
-               // unused\r
-       }\r
-\r
-       @Override\r
-       public ClassLoader classLoader() {\r
-               return env.getClass().getClassLoader();\r
-       }\r
-\r
-       @Override\r
-       public String getProperty(String string, String def) {\r
-               return env.getProperty(string, def);\r
-       }\r
-       \r
-       @Override\r
-       public void load(InputStream is) throws IOException {\r
-               Properties props = new Properties();\r
-               props.load(is);\r
-               for(Entry<Object, Object> es :props.entrySet()) {\r
-                       env.setProperty(es.getKey().toString(), es.getValue().toString());\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public String decrypt(String encrypted, boolean anytext) throws IOException {\r
-               return env.decryptor().decrypt(encrypted);\r
-       }\r
-\r
-}\r