From 0e5efc61b657dba874aacc95ee21c76b95fb2028 Mon Sep 17 00:00:00 2001 From: sg481n Date: Fri, 25 Aug 2017 00:57:25 -0400 Subject: Update aaf client module Remove aaf submodules and update aaf client module. Issue-id: AAF-21 Change-Id: I750ec9e26596652a142b014db94aabd082880130 Signed-off-by: sg481n --- .../src/main/java/com/att/authz/fs/FileServer.java | 155 --------------------- 1 file changed, 155 deletions(-) delete mode 100644 authz-fs/src/main/java/com/att/authz/fs/FileServer.java (limited to 'authz-fs/src/main/java') diff --git a/authz-fs/src/main/java/com/att/authz/fs/FileServer.java b/authz-fs/src/main/java/com/att/authz/fs/FileServer.java deleted file mode 100644 index 30ac1a6b..00000000 --- a/authz-fs/src/main/java/com/att/authz/fs/FileServer.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START==================================================== - * * org.onap.aaf - * * =========================================================================== - * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * * =========================================================================== - * * Licensed under the Apache License, Version 2.0 (the "License"); - * * you may not use this file except in compliance with the License. - * * You may obtain a copy of the License at - * * - * * http://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, software - * * distributed under the License is distributed on an "AS IS" BASIS, - * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * * ============LICENSE_END==================================================== - * * - * * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * * - ******************************************************************************/ -package com.att.authz.fs; - -import static com.att.cssa.rserv.HttpMethods.GET; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; -import java.util.Properties; - -import com.att.aft.dme2.api.DME2Manager; -import com.att.aft.dme2.api.DME2Server; -import com.att.aft.dme2.api.DME2ServerProperties; -import com.att.aft.dme2.api.DME2ServiceHolder; -import com.att.aft.dme2.api.util.DME2FilterHolder; -import com.att.aft.dme2.api.util.DME2FilterHolder.RequestDispatcherType; -import com.att.aft.dme2.api.util.DME2ServletHolder; -import com.att.authz.env.AuthzEnv; -import com.att.authz.env.AuthzTrans; -import com.att.authz.env.AuthzTransOnlyFilter; -import com.att.cssa.rserv.CachingFileAccess; -import com.att.cssa.rserv.RServlet; -import com.att.inno.env.APIException; - - -public class FileServer extends RServlet { - public FileServer(final AuthzEnv env) throws APIException, IOException { - try { - /////////////////////// - // File Server - /////////////////////// - - CachingFileAccess cfa = new CachingFileAccess(env); - route(env,GET,"/:key", cfa); - route(env,GET,"/:key/:cmd", cfa); - /////////////////////// - - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void main(String[] args) { - try { - // Load Properties from authFramework.properties. Needed for DME2 and AuthzEnv - Properties props = new Properties(); - URL rsrc = ClassLoader.getSystemResource("FileServer.props"); - if(rsrc==null) { - System.err.println("Folder containing FileServer.props must be on Classpath"); - System.exit(1); - } - InputStream is = rsrc.openStream(); - try { - props.load(is); - } finally { - is.close(); - } - - // Load Properties into AuthzEnv - AuthzEnv env = new AuthzEnv(props); - env.setLog4JNames("log4j.properties","authz","fs","audit","init",null); - - // AFT Discovery Libraries only read System Props - env.loadToSystemPropsStartsWith("AFT_","DME2_"); - env.init().log("DME2 using " + env.getProperty("DMEServiceName","unknown") + " URI"); - - // Start DME2 (DME2 needs Properties form of props) - DME2Manager dme2 = new DME2Manager("RServDME2Manager",props); - - DME2ServiceHolder svcHolder; - List slist = new ArrayList(); - svcHolder = new DME2ServiceHolder(); - String serviceName = env.getProperty("DMEServiceName",null); - if(serviceName!=null) { - svcHolder.setServiceURI(serviceName); - svcHolder.setManager(dme2); - svcHolder.setContext("/"); - - FileServer fs = new FileServer(env); - DME2ServletHolder srvHolder = new DME2ServletHolder(fs); - srvHolder.setContextPath("/*"); - slist.add(srvHolder); - - EnumSet edlist = EnumSet.of( - RequestDispatcherType.REQUEST, - RequestDispatcherType.FORWARD, - RequestDispatcherType.ASYNC - ); - - /////////////////////// - // Apply Filters - /////////////////////// - List flist = new ArrayList(); - - // Need TransFilter - flist.add(new DME2FilterHolder(new AuthzTransOnlyFilter(env),"/*",edlist)); - svcHolder.setFilters(flist); - svcHolder.setServletHolders(slist); - - DME2Server dme2svr = dme2.getServer(); - DME2ServerProperties dsprops = dme2svr.getServerProperties(); - dsprops.setGracefulShutdownTimeMs(1000); - - env.init().log("Starting AAF FileServer with Jetty/DME2 server..."); - dme2svr.start(); - try { -// if(env.getProperty("NO_REGISTER",null)!=null) - dme2.bindService(svcHolder); - env.init().log("DME2 is available as HTTP"+(dsprops.isSslEnable()?"/S":""),"on port:",dsprops.getPort()); - - while(true) { // Per DME2 Examples... - Thread.sleep(5000); - } - } catch(InterruptedException e) { - env.init().log("AAF Jetty Server interrupted!"); - } catch(Exception e) { // Error binding service doesn't seem to stop DME2 or Process - env.init().log(e,"DME2 Initialization Error"); - dme2svr.stop(); - System.exit(1); - } - } else { - env.init().log("Properties must contain DMEServiceName"); - } - - } catch (Exception e) { - e.printStackTrace(System.err); - System.exit(1); - } - } -} -- cgit 1.2.3-korg