Java Code Examples for org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem#setDataHandler()
The following examples show how to use
org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem#setDataHandler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeviceAnalyticsArtifactUploaderAdminServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
private UploadedFileItem[] loadCappFromFileSystem(String deviceType) throws IOException { File directory = new File(CAR_FILE_LOCATION + File.separator + deviceType); File[] carFiles = directory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".car"); } }); List<UploadedFileItem> uploadedFileItemLis = new ArrayList<>(); if (carFiles != null) { for (File carFile : carFiles) { UploadedFileItem uploadedFileItem = new UploadedFileItem(); DataHandler param = new DataHandler(carFile.toURI().toURL()); uploadedFileItem.setDataHandler(param); uploadedFileItem.setFileName(carFile.getName()); uploadedFileItem.setFileType("jar"); uploadedFileItemLis.add(uploadedFileItem); } } UploadedFileItem[] fileItems = new UploadedFileItem[uploadedFileItemLis.size()]; fileItems = uploadedFileItemLis.toArray(fileItems); return fileItems; }
Example 2
Source File: DeviceAnalyticsArtifactUploaderAdminServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
private UploadedFileItem[] loadCappFromFileSystem(String deviceType) throws IOException { File directory = new File(CAR_FILE_LOCATION + File.separator + deviceType); File[] carFiles = directory.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".car"); } }); List<UploadedFileItem> uploadedFileItemLis = new ArrayList<>(); if (carFiles != null) { for (File carFile : carFiles) { UploadedFileItem uploadedFileItem = new UploadedFileItem(); DataHandler param = new DataHandler(carFile.toURI().toURL()); uploadedFileItem.setDataHandler(param); uploadedFileItem.setFileName(carFile.getName()); uploadedFileItem.setFileType("jar"); uploadedFileItemLis.add(uploadedFileItem); } } UploadedFileItem[] fileItems = new UploadedFileItem[uploadedFileItemLis.size()]; fileItems = uploadedFileItemLis.toArray(fileItems); return fileItems; }
Example 3
Source File: CarbonAppUploaderClient.java From carbon-commons with Apache License 2.0 | 5 votes |
public void addUploadedFileItem(DataHandler dataHandler, String fileName, String fileType) { UploadedFileItem uploadedFileItem = new UploadedFileItem(); uploadedFileItem.setDataHandler(dataHandler); uploadedFileItem.setFileName(fileName); uploadedFileItem.setFileType(fileType); uploadServiceTypeList.add(uploadedFileItem); }
Example 4
Source File: CarbonAppUploaderClient.java From product-es with Apache License 2.0 | 5 votes |
public void uploadCarbonAppArtifact(String fileName, DataHandler dh) throws RemoteException { UploadedFileItem[] carbonAppArray = new UploadedFileItem[1]; UploadedFileItem carbonApp = new UploadedFileItem(); carbonApp.setFileName(fileName); carbonApp.setDataHandler(dh); carbonApp.setFileType("jar"); carbonAppArray[0] = carbonApp; carbonAppUploaderStub.uploadApp(carbonAppArray); }