+++ /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.client.test;\r
-\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.PrintStream;\r
-import java.net.URI;\r
-import java.util.Properties;\r
-\r
-import org.onap.aaf.cadi.Access;\r
-import org.onap.aaf.cadi.Locator;\r
-import org.onap.aaf.cadi.Access.Level;\r
-import org.onap.aaf.cadi.Locator.Item;\r
-import org.onap.aaf.cadi.dme2.DME2Locator;\r
-\r
-import com.att.aft.dme2.api.DME2Manager;\r
-\r
-public class JU_PaulUzee {\r
- public static void main(String[] args) {\r
- try {\r
- // You'll want to put this on Command line "-D" probably\r
- Properties props = System.getProperties();\r
- props.put("AFT_LATITUDE","32.780140");\r
- props.put("AFT_LONGITUDE","-96.800451");\r
- props.put("AFT_ENVIRONMENT","AFTPRD");\r
-\r
- //\r
- // Use an "Access" class to hook up logging, properties, etc.\r
- // Make one that ties into your code's logging, property mechanism, etc.\r
- //\r
- Access access = new PaulAccess();\r
- \r
- DME2Manager dm = new DME2Manager("Paul Uzee's Test",props);\r
- Locator loc = new DME2Locator(access ,dm,"com.att.authz.AuthorizationService","2.0","PROD","DEFAULT");\r
-\r
- \r
- for(Item item = loc.first(); item!=null; item=loc.next(item)) {\r
- URI location = (URI) loc.get(item);\r
- access.log(Level.INFO,location);\r
- access.log(Level.INFO,location.getScheme());\r
- access.log(Level.INFO,location.getHost());\r
- access.log(Level.INFO, location.getPort());\r
- }\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- }\r
- \r
- }\r
-\r
- private static class PaulAccess implements Access {\r
- private Level willWrite = Level.INFO;\r
-\r
- @Override\r
- public ClassLoader classLoader() {\r
- return getClass().getClassLoader();\r
- }\r
-\r
- @Override\r
- public String decrypt(String data, boolean def) throws IOException {\r
- return data;\r
- }\r
-\r
- @Override\r
- public String getProperty(String tag, String def) {\r
- return System.getProperty(tag, def);\r
- }\r
-\r
- @Override\r
- public void load(InputStream is) throws IOException {\r
- System.getProperties().load(is);\r
- }\r
-\r
- @Override\r
- public void log(Level level, Object... obj) {\r
- if(level.compareTo(willWrite)<0) return;\r
- PrintStream ps;\r
- switch(level) {\r
- case DEBUG:\r
- case AUDIT:\r
- case ERROR:\r
- case WARN:\r
- ps = System.err;\r
- break;\r
- case INFO:\r
- case INIT:\r
- default:\r
- ps = System.out;\r
- }\r
- boolean first = true;\r
- for(Object o : obj) {\r
- if(first)first=false;\r
- else ps.print(' ');\r
- ps.print(o.toString());\r
- }\r
- ps.println();\r
- }\r
-\r
- @Override\r
- public void log(Exception e, Object... obj) {\r
- Object[] objs = new Object[obj.length+1];\r
- objs[0]=e.getMessage();\r
- System.arraycopy(objs, 1, obj, 0, obj.length);\r
- log(Level.ERROR,e,objs);\r
- }\r
-\r
- @Override\r
- public void setLogLevel(Level l) {\r
- willWrite = l;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see com.att.cadi.Access#willLog(com.att.cadi.Access.Level)\r
- */\r
- @Override\r
- public boolean willLog(Level level) {\r
- return true;\r
- }\r
-\r
- @Override\r
- public void printf(Level level, String fmt, Object... elements) {\r
- // TODO Auto-generated method stub\r
- \r
- }\r
- };\r
-}\r