anthony.moreno 7 роки тому
батько
коміт
642a130434
15 змінених файлів з 252 додано та 219 видалено
  1. 0 3
      GabonTelMobicashMobileAppHelper/WebContent/META-INF/MANIFEST.MF
  2. BIN
      GabonTelMobicashMobileAppHelper/WebContent/WEB-INF/lib/Common.UssdInterface.jar
  3. 49 78
      GabonTelMobicashMobileAppHelper/pom.xml
  4. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/EulaTransaction.java
  5. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetMobileAppExternalData.java
  6. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetMobileAppMsisdnDetails.java
  7. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetOcsPackages.java
  8. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetSatconPackages.java
  9. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/MsisdnDetails.java
  10. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/OcsPackages.java
  11. 0 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/SatconPackages.java
  12. 74 0
      GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/thirdparty/helper/InitializerBean.java
  13. 21 28
      GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/thirdparty/helper/JsonResponse.java
  14. 72 110
      GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/thirdparty/helper/MobileAppThirdPartyHelper.java
  15. 36 0
      GabonTelMobicashMobileAppHelper/src/main/resources/wildfly-config.xml

+ 0 - 3
GabonTelMobicashMobileAppHelper/WebContent/META-INF/MANIFEST.MF

@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path: 
-

BIN
GabonTelMobicashMobileAppHelper/WebContent/WEB-INF/lib/Common.UssdInterface.jar


+ 49 - 78
GabonTelMobicashMobileAppHelper/pom.xml

@@ -1,79 +1,50 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>com.psi.common</groupId>
-		<artifactId>common-libs</artifactId>
-		<version>1.0.0</version>
-	</parent>
-	
-	
-
-
-	<groupId>GabonTelMobicashMobileAppHelper</groupId>
-	<artifactId>GabonTelMobicashMobileAppHelper</artifactId>
-	<version>0.0.1-SNAPSHOT</version>
-	<packaging>war</packaging>
-
-	<properties>
-
-		<checkstyle.skip>true</checkstyle.skip>
-
-	</properties>
-
-	<build>
-		<sourceDirectory>src</sourceDirectory>
-		<plugins>
-			<plugin>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>3.7.0</version>
-				<configuration>
-					<source>1.8</source>
-					<target>1.8</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-war-plugin</artifactId>
-				<version>3.0.0</version>
-				<configuration>
-					<warSourceDirectory>WebContent</warSourceDirectory>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-		<dependency>
-			<groupId>com.psi.common</groupId>
-			<artifactId>transactions</artifactId>
-			<version>${project.parent.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.jboss.spec.javax.ejb</groupId>
-			<artifactId>jboss-ejb-api_3.2_spec</artifactId>
-			<scope>provided</scope>
-		</dependency>
-
-		<dependency>
-			<groupId>com.googlecode.json-simple</groupId>
-			<artifactId>json-simple</artifactId>
-			<version>1.1.1</version>
-		</dependency>
-
-		<dependency>
-			<groupId>org.jboss.resteasy</groupId>
-			<artifactId>resteasy-client</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		
-		<dependency>
-			<groupId>com.psi.ussd</groupId>
-			<artifactId>ussd-interfaces</artifactId>
-			<scope>provided</scope>
-			<version>1.0.1</version>
-		</dependency>
-
-
-
-	</dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>com.psi.common</groupId>
+		<artifactId>common-libs</artifactId>
+		<version>1.0.1</version>
+	</parent>
+	<groupId>GabonTelMobicashMobileAppHelper</groupId>
+	<artifactId>GabonTelMobicashMobileAppHelper</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>war</packaging>
+	<properties>
+		<checkstyle.skip>true</checkstyle.skip>
+	</properties>
+	<build>
+        <finalName>Test_210_GabonTelMobicashMobileAppHelper</finalName>
+    </build>
+	<dependencies>
+		<dependency>
+			<groupId>com.psi.common</groupId>
+			<artifactId>transactions</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.spec.javax.ejb</groupId>
+			<artifactId>jboss-ejb-api_3.2_spec</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.googlecode.json-simple</groupId>
+			<artifactId>json-simple</artifactId>
+			<version>1.1.1</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jboss.resteasy</groupId>
+			<artifactId>resteasy-client</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		
+		<dependency>
+			<groupId>com.psi.ussd</groupId>
+			<artifactId>ussd-interfaces</artifactId>
+			<version>1.0.1</version>
+		</dependency>
+	</dependencies>
 </project>

GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/EulaTransaction.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/EulaTransaction.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/GetMobileAppExternalData.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetMobileAppExternalData.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/GetMobileAppMsisdnDetails.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetMobileAppMsisdnDetails.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/GetOcsPackages.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetOcsPackages.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/GetSatconPackages.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/GetSatconPackages.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/objects/MsisdnDetails.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/MsisdnDetails.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/objects/OcsPackages.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/OcsPackages.java


GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/helper/objects/SatconPackages.java → GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/helper/objects/SatconPackages.java


+ 74 - 0
GabonTelMobicashMobileAppHelper/src/main/java/com/psi/gabontel/mobileapp/thirdparty/helper/InitializerBean.java

@@ -0,0 +1,74 @@
+package com.psi.gabontel.mobileapp.thirdparty.helper;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+
+import com.psi.common.db.DataRow;
+import com.psi.common.db.DataRowCollection;
+import com.psi.common.db.DbWrapper;
+import com.psi.common.util.StringUtil;
+import com.psi.ussd.interfaces.UssdReceiverFunction;
+
+@Startup
+@Singleton
+public class InitializerBean {
+    private static final Logger log = Logger.getLogger(InitializerBean.class);
+    private static final Hashtable<String,String> ussdgwmenuejb = new Hashtable<String,String>();
+    private static Context context;
+    @PostConstruct
+    public void initialize() {
+        DbWrapper db = new DbWrapper("java:jboss/datasources/UssdDbClient");
+        DataRowCollection rows = db.QueryDataRows("SELECT PARAMNAME,EJBNAME FROM TBLUSSDGWMENUEJB WHERE STATUS = 1");
+        Iterator<DataRow> iterator = rows.iterator();
+        
+        while(iterator.hasNext()) {
+            DataRow row = iterator.next();
+            
+            String paramname = row.getString("PARAMNAME");
+            String ejbname = row.getString("EJBNAME").replace("java:jboss/exported", "ejb:");
+            ussdgwmenuejb.put(paramname, ejbname);
+        }
+        db = DbWrapper.getInstance();
+        DataRow row = db.QueryDataRow("SELECT * FROM TBLAPICONFIG WHERE APINAME = ? AND STATUS = 1", "ussdejbname");
+        String name = row.getString("APINAME");
+        String url = row.getString("URL");
+        String extra = row.getString("PARAMS");
+        Map<String, String> extraparam = StringUtil.json2Map(extra);
+        
+        final Hashtable<String, String> jndiProperties = new Hashtable<>();
+        //jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
+        jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
+        jndiProperties.put(Context.PROVIDER_URL, url);
+        try {
+            context = new InitialContext(jndiProperties);
+        } catch (NamingException e) {
+            log.error(e,e);
+        }
+    }
+    
+    public static String getUssdgwmenuejb(String key){
+        return ussdgwmenuejb.get(key);
+    }
+    public static boolean containsKey(String key) {
+        return ussdgwmenuejb.containsKey(key);
+    }
+    public static UssdReceiverFunction getInterface(String jndi) {
+        try {
+            UssdReceiverFunction ussdplugin = (UssdReceiverFunction) context.lookup(jndi);
+            return ussdplugin;
+        } catch (NamingException e) {
+            log.error(e,e);
+        }
+        return null;
+    }
+}

+ 21 - 28
GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/thirdparty/helper/JsonResponse.java

@@ -1,28 +1,21 @@
-package com.psi.gabontel.mobileapp.thirdparty.helper;
-
-import org.json.simple.JSONObject;
-
-public class JsonResponse {
-	
-	public int code = 99;
-	public String message ="System is busy";
-	
-	public JsonResponse(int code,String message) {
-		this.code = code;
-		this.message= message;
-	}
-	
-	public String toString() {
-		
-		
-		JSONObject obj = new JSONObject();
-		
-		obj.put("Code", code);
-		obj.put("Message",message);
-		
-		return obj.toJSONString();
-	}
-	
-	
-	
-}
+package com.psi.gabontel.mobileapp.thirdparty.helper;
+
+import org.json.simple.JSONObject;
+
+public class JsonResponse {
+	
+	public int code = 99;
+	public String message ="System is busy";
+	
+	public JsonResponse(int code,String message) {
+		this.code = code;
+		this.message= message;
+	}
+	
+	public String toString() {
+		JSONObject obj = new JSONObject();
+		obj.put("Code", code);
+		obj.put("Message",message);
+		return obj.toJSONString();
+	}
+}

+ 72 - 110
GabonTelMobicashMobileAppHelper/src/com/psi/gabontel/mobileapp/thirdparty/helper/MobileAppThirdPartyHelper.java

@@ -1,110 +1,72 @@
-package com.psi.gabontel.mobileapp.thirdparty.helper;
-
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.EJB;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-import javax.lang.model.element.ModuleElement.UsesDirective;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.jboss.logging.Logger;
-
-import com.psi.applicationmanager.AppManagerFunction;
-import com.psi.applicationmanager.AppMessage;
-import com.psi.common.db.DataRow;
-import com.psi.common.db.DataRowCollection;
-import com.psi.common.db.DbWrapper;
-import com.psi.common.transactions.Message;
-import com.psi.common.transactions.MessageId;
-import com.psi.common.transactions.Messanger;
-import com.psi.gabontel.mobileapp.helper.GetMobileAppExternalData;
-import com.psi.ussd.interfaces.UssdReceiverFunction;
-
-@Stateless
-@Remote(AppManagerFunction.class)
-public class MobileAppThirdPartyHelper  implements AppManagerFunction {
-	private static final Logger log = Logger.getLogger(MobileAppThirdPartyHelper.class);
-	private static Hashtable<String,String> ussdgwmenuejb = new Hashtable<String,String>();
-	
-	static {
-		
-		DbWrapper db = new DbWrapper("java:jboss/datasources/UssdDbClient");
-		DbWrapper.setInstance(db);
-		
-		// LOAD EJB
-		
-		DataRowCollection rows = db.QueryDataRows("SELECT PARAMNAME,EJBNAME FROM TBLUSSDGWMENUEJB WHERE STATUS = 1");
-		Iterator iterator = rows.iterator();
-		
-		while(iterator.hasNext()) {
-			DataRow row = (DataRow) iterator.next();
-			
-			String paramname = row.getString("PARAMNAME");
-			String ejbname = row.getString("EJBNAME");
-			
-			ussdgwmenuejb.put(paramname, ejbname);
-		
-		}
-		
-	}
-	
-
-
-	@Override
-	public String processTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
-		return manageTransaction(refid, msisdn, message, syntax).getMessage();
-	}
-	
-	@Override
-	public AppMessage manageTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
-		// TODO Auto-generated method stub
-		
-		try {
-		String method  =  syntax.get("method");
-	
-		
-		UssdReceiverFunction clazz = null;
-		
-		
-		if(ussdgwmenuejb.containsKey(method)) {
-			
-			Object obj = InitialContext.doLookup(ussdgwmenuejb.get(method));
-			clazz  = (UssdReceiverFunction)obj;
-			
-			String[] paramarr = syntax.get("param").split("\\|");
-			List<String> listarr = Arrays.asList(paramarr);
-			
-			//SPECIAL CASE
-			if(method.equals("postpaidinvoices")){
-				
-				String arisreturn = clazz.requestFunc(listarr);
-				
-			    obj = InitialContext.doLookup(ussdgwmenuejb.get("displayinvoices"));
-				clazz  = (UssdReceiverFunction)obj;
-				
-				listarr =  Arrays.asList(arisreturn);
-				clazz.requestFunc(listarr);
-				
-				return new Message(0,0,new JsonResponse(0,clazz.requestFunc(listarr)).toString());
-					
-			}
-			
-			return new Message(0,0,new JsonResponse(0,clazz.requestFunc(listarr)).toString());
-			
-		}else {
-			return new Message(99,0,new JsonResponse(99,"System is busy").toString());
-		}
-		
-		}catch(Exception e) {
-			log.error("Error: Refid:"+refid+"|" ,e);
-		}
-		return new Message(99,0,new JsonResponse(99,"System is busy").toString());
-		
-	}
-}
+package com.psi.gabontel.mobileapp.thirdparty.helper;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+
+import com.psi.applicationmanager.AppManagerFunction;
+import com.psi.applicationmanager.AppMessage;
+import com.psi.common.transactions.Message;
+import com.psi.ussd.interfaces.UssdReceiverFunction;
+
+@Stateless
+@Remote(AppManagerFunction.class)
+public class MobileAppThirdPartyHelper  implements AppManagerFunction {
+	private static final Logger log = Logger.getLogger(MobileAppThirdPartyHelper.class);
+
+
+	@Override
+	public String processTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
+		return manageTransaction(refid, msisdn, message, syntax).getMessage();
+	}
+	
+	@Override
+	public AppMessage manageTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
+		// TODO Auto-generated method stub
+		
+		try {
+		String method  =  syntax.get("method");
+		
+		UssdReceiverFunction clazz = null;
+		
+		
+		if(InitializerBean.containsKey(method)) {
+			
+		    clazz = InitializerBean.getInterface(InitializerBean.getUssdgwmenuejb(method));
+			
+			String[] paramarr = syntax.get("param").split("\\|");
+			List<String> listarr = Arrays.asList(paramarr);
+			
+			//SPECIAL CASE
+			if(method.equals("postpaidinvoices")){
+				
+				String arisreturn = clazz.requestFunc(listarr);
+				
+			    clazz = InitializerBean.getInterface(InitializerBean.getUssdgwmenuejb("displayinvoices"));
+				
+				listarr =  Arrays.asList(arisreturn);
+				clazz.requestFunc(listarr);
+				
+				return new Message(0,0,new JsonResponse(0,clazz.requestFunc(listarr)).toString());
+					
+			}
+			
+			return new Message(0,0,new JsonResponse(0,clazz.requestFunc(listarr)).toString());
+			
+		}else {
+			return new Message(99,0,new JsonResponse(99,"System is busy").toString());
+		}
+		
+		}catch(Exception e) {
+			log.error("Error: Refid:"+refid+"|" ,e);
+		}
+		return new Message(99,0,new JsonResponse(99,"System is busy").toString());
+		
+	}
+}

+ 36 - 0
GabonTelMobicashMobileAppHelper/src/main/resources/wildfly-config.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    JBoss, Home of Professional Open Source
+    Copyright 2017, Red Hat, Inc. and/or its affiliates, and individual
+    contributors by the @authors tag. See the copyright.txt in the
+    distribution for a full listing of individual contributors.
+
+    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.
+-->
+<configuration>
+    <authentication-client xmlns="urn:elytron:1.0">
+        <authentication-rules>
+            <rule use-configuration="default-config"/>
+        </authentication-rules>
+        <authentication-configurations>
+            <configuration name="default-config">
+                <set-user-name name="ejbuser"/>
+                <credentials>
+                    <clear-password password="ejbuser123!"/>
+                </credentials>
+                <sasl-mechanism-selector selector="DIGEST-MD5"/>
+                <providers>
+                    <use-service-loader />
+                </providers>
+            </configuration>
+        </authentication-configurations>
+    </authentication-client>
+</configuration>