Hi,

I was trying to deploy carbon-app (.car file) using java client. For that i
used the *CarbonAppUploader *service.

Below the code i used to deploy the capp and it is worked fine.


File file = new File(cAppPath);


//get the byte array of file

byte[] byteArray = FileUtils.readFileToByteArray(file);

DataHandler dataHandler = new DataHandler(byteArray,

APIUsageStatisticsClientConstants.APPLICATION_OCTET_STREAM);


//create the stub to deploy artifacts

CarbonAppUploaderStub stub = new CarbonAppUploaderStub(url +
"/services/CarbonAppUploader");

ServiceClient client = stub._getServiceClient();

Options options = client.getOptions();

//set the security

HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();

authenticator.setUsername(user);

authenticator.setPassword(pass);

authenticator.setPreemptiveAuthentication(true);

options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
authenticator);

client.setOptions(options);

log.info("Deploying DAS cApp '" + cAppName + "'...");


//create UploadedFileItem array and 1st element contain the deploy artifact

UploadedFileItem[] fileItem = new UploadedFileItem[1];

fileItem[0] = new UploadedFileItem();

fileItem[0].setDataHandler(dataHandler);

fileItem[0].setFileName(cAppName);

*fileItem[0].setFileType("jar");*


//upload the artifacts

stub.uploadApp(fileItem);


But for the capp file type i always have to set "jar". I tried with the
"car" but gave me an error.
So do we have any other correct way to deploy Capp. Or is this behavior is
a bug?

Thanks and Regards.

Rukshan Chathuranga.
Software Engineer.
WSO2, Inc.
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to