apim_4xx_support_multiple_analytics_publishers APIM manage workflow with multiple roles APIM 3.0.0 per API based subscription workflow Logging internal HTTP requests Log APIM analytics events to a file Monetization and sample with WSO2 API Manager 2.6.0 Share application and subscription among a set of specific groups or roles WSO2 APIM Correlating analytics event with correlationID APIM analytics distinguish production and sandbox traffic APIM 2.x.x analytics internal and analytics tuneup Configure APIM(Next release) Key Manager User stores APIM(Next release) working with key manager DAS 3.x Parse system variables to Spark Context Revoke OAuth application In APIM 2.1.0 Next WSO2 APIM powered by WSO2 Ballerina Configure WSO2 APIM Analytics on Cluster environment Configure WSO2 DAS 3.1.0 for WSO2 APIM 2.0.0 Analytics WSO2 APIM publishing custom statistics WSO2 APIM Error codes Working with WSO2 message tracer Use DAS admin service to query using Spark SQL Configure WSO2 APIM Analytics using XML WSO2 APIM Generating and Retrieving Custom Statistics Understanding WSO2 APIM Statistics Model Publishing WSO2 APIM 1.10.x Runtime Statistics to DAS with RDBMS Publishing_APIM_1100_Runtime_Statistics_to_DAS Aggregate functions with WSO2 DAS REST API Create a cApp for WSO2 DAS Debugging WSO2 Products using OSGI console. Publishing APIM Runtime Statistics to DAS Deploy cApp on WSO2 DAS How to configure and start the Accumulo minicluster How to setup DNS server on Ubuntu and Ubuntu server How to use Java Reflection how to install apache web server on ubuntu and ubuntu server How to install Mail server on Ubuntu and Ubuntu server How to install squirrelmail webmail client on Ubuntu and Ubuntu Server Pass and return String value to JNI method Pass and return numeric value to JNI method Calling a C Function from the Java Programming Language using JNI AXIS 2 Sample web service Client with maven and eclipse How to setup AXIS 2 with Apache Tomcat AXIS 2 Sample web service with maven and eclipse Robot framework Sample with Selenium Robot framework Custom Library Sample Behaviour-Driven Development with JBehave and Eclipse Play Audio with Netbeans and linking with LibVLC Implement LibVLC based player with QT-part2 Simple Audio playing sample with LibVLC How to install LibVLC on Ubuntu Implement LibVLC based player with QT-part1
Deploy cApp on WSO2 DAS
  1. Deploy using WSO2 DAS admin dashboard.
    • Login to the DAS admin console via https://localhost:9443/carbon
    • Click on the Add button under the Carbon Applications menu which is in Manage Section
    • Then point to the Capp file which has .car extension
  2. Using Java Client
    • Create a Maven project
    • Add the related admin service Stub to the pom.xml
    	<dependency>
    		<groupId>org.wso2.carbon.commons</groupId>
    		<artifactId>org.wso2.carbon.application.mgt.stub</artifactId>
    		<version>4.4.7</version>
    	</dependency>
    			
    • Then add the below java class and run it
    	import java.io.File;
    	import java.io.IOException;
    	import java.rmi.RemoteException;
    
    	import javax.activation.DataHandler;
    
    	import org.apache.axis2.AxisFault;
    	import org.apache.axis2.client.Options;
    	import org.apache.axis2.client.ServiceClient;
    	import org.apache.axis2.transport.http.HttpTransportProperties.Authenticator;
    	import org.apache.commons.io.FileUtils;
    	import org.wso2.carbon.application.mgt.stub.upload.CarbonAppUploaderStub;
    	import org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem;
    
    	public class CarbonAppUploaderClient {
    
    		private CarbonAppUploaderStub st;
    
    		public static void main(String[] args) {
    			System.setProperty("javax.net.ssl.trustStore",
    					"/home/rukshan/apim_home/repository/resources/security/wso2carbon.jks");
    			System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
    
    			String path = "/home/rukshan/apim/capp/WSO2-APIM_DAS_Analytics_CApp/API_Manager_Analytics.car";
    
    			CarbonAppUploaderClient client = new CarbonAppUploaderClient();
    			client.init();
    			client.deploy(path);
    
    		}
    
    		private void init() {
    			// TODO Auto-generated method stub
    
    			try {
    				st = new CarbonAppUploaderStub(
    						"https://localhost:9445/services/CarbonAppUploader");
    			} catch (AxisFault e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    				return;
    			}
    			ServiceClient client = st._getServiceClient();
    			Options client_options = client.getOptions();
    			Authenticator authenticator = new Authenticator();
    			authenticator.setUsername("admin");
    			authenticator.setPassword("admin");
    			authenticator.setPreemptiveAuthentication(true);
    			client_options.setProperty(
    					org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
    					authenticator);
    			client.setOptions(client_options);
    		}
    
    		private void deploy(String path) {
    			// TODO Auto-generated method stub
    			File file = new File(path);
    
    			byte[] byteArray;
    			try {
    				byteArray = FileUtils.readFileToByteArray(file);
    			} catch (IOException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    				return;
    			}
    			DataHandler dataHandler = new javax.activation.DataHandler(byteArray,
    					"application/octet-stream");
    
    			UploadedFileItem i = new UploadedFileItem();
    
    			i.setDataHandler(dataHandler);
    			i.setFileName("API_Manager_Analytics.car");
    			i.setFileType("jar");
    
    			UploadedFileItem[] ii = new UploadedFileItem[1];
    			ii[0] = i;
    			try {
    				st.uploadApp(ii);
    			} catch (RemoteException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    				return;
    			}
    		}
    
    	}
    
    			
    • Check whether the operation is successful
  3. Deploy using Jaggery Client
    • It is similar to the Java but needs to use jaggery pattern
    • here the jaggery code
    	var cAppPath = ‘path/to/your/capp';
    	var cAppName = 'API_Manager_Analytics.car';
    	
    	cAppPath = cAppPath + '/' + cAppName;
    	var file = new java.io.File(cAppPath);
    	
    	var byteArray = org.apache.commons.io.FileUtils.readFileToByteArray(file);
    	var dataHandler = new javax.activation.DataHandler(byteArray, "application/octet-stream");
    	
    	var stub = new org.wso2.carbon.application.mgt.stub.upload.CarbonAppUploaderStub(configData.
    		   eventAnalyserURL + '/services/CarbonAppUploader');
    	var client = stub._getServiceClient();
    	var options = client.getOptions();
    	var authenticator = new org.apache.axis2.transport.http.HttpTransportProperties.Authenticator();
    	authenticator.setUsername(configData.eventAnalyserUsername);
    	authenticator.setPassword(configData.eventAnalyserPassword);
    	authenticator.setPreemptiveAuthentication(true);
    	options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, authenticator);
    	client.setOptions(options);
    	
    	log.info("Deploying DAS cApp '" + cAppName + "'...");
    	var fileItem = new org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem();
    	
    	fileItem.setDataHandler(dataHandler);
    	fileItem.setFileName(cAppName);
    	fileItem.setFileType("jar");
    	
    	stub.uploadApp([fileItem]);
    	log.info("DAS cApp '" + cAppName + "' deployed");
    
    		

Add Comment

* Required information
1000
Powered by Commentics

Comments (0)

No comments yet. Be the first!