当前位置: 首页>>代码示例>>Java>>正文


Java UploadedFileItem类代码示例

本文整理汇总了Java中org.wso2.carbon.application.upload.xsd.UploadedFileItem的典型用法代码示例。如果您正苦于以下问题:Java UploadedFileItem类的具体用法?Java UploadedFileItem怎么用?Java UploadedFileItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UploadedFileItem类属于org.wso2.carbon.application.upload.xsd包,在下文中一共展示了UploadedFileItem类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deploy

import org.wso2.carbon.application.upload.xsd.UploadedFileItem; //导入依赖的package包/类
public void deploy(CarbonApplication deployable) throws WSO2AdminServicesException
{
    logUpload(deployable.getFile());
    try
    {
        CarbonAppUploaderStub carbonAppUploaderStub =
            new CarbonAppUploaderStub(new URL(getUrl() + SERVICES_CARBON_APP_UPLOADER).toString());
        prepareStub(carbonAppUploaderStub);

        UploadedFileItem[] carbonAppArray = new UploadedFileItem[1];
        UploadedFileItem carbonApp = new UploadedFileItem();
        DataHandler dh = new DataHandler(new File(deployable.getFile()).toURI().toURL());
        carbonApp.setFileName(new File(deployable.getFile()).getName());
        carbonApp.setDataHandler(dh);
        carbonApp.setFileType("jar");
        carbonAppArray[0] = carbonApp;
        carbonAppUploaderStub.uploadApp(carbonAppArray);
    }
    catch (Exception e)
    {
        throw new WSO2AdminServicesException("error uploading carbon application", e);
    }
}
 
开发者ID:hschott,项目名称:cargo-wso2-container,代码行数:24,代码来源:WSO2Carbon4xCarbonApplicationAdminService.java

示例2: uploadCAR

import org.wso2.carbon.application.upload.xsd.UploadedFileItem; //导入依赖的package包/类
/**
    * Upload carbon abb artifact to WSO2 ESB or other WSO2 Server via WSO2 SOAP
    * service
    * 
    * @param appType
    * @param artifactFileName
    *            Filename for CAR artifact to upload to WSO2 Server
    * @return true, if upload is OK
    */
   public boolean uploadCAR ( File artifact, String targetFileName, String appType ) {
log.info( "[WSO2 CAR Deployer] Start CAR upload" );
boolean result = true;
try {
    InputStream fin = new FileInputStream( artifact );

    UploadedFileItem fileItem = new UploadedFileItem();

    org.wso2.carbon.application.upload.xsd.ObjectFactory fieldFactory = new org.wso2.carbon.application.upload.xsd.ObjectFactory();
    // byte[] fileContent = readFile( fin );
    final byte fileContent[] = readFully( fin );
    final int cnt = fileContent.length;
    log.info( "[WSO2 CAR Deployer] Read CAR with " + cnt + " bytes" );

    fileItem.setDataHandler( fieldFactory.createUploadedFileItemDataHandler( fileContent ) );
    fileItem.setFileName( fieldFactory.createUploadedFileItemFileName( targetFileName ) );
    fileItem.setFileType( fieldFactory.createUploadedFileItemFileType( appType ) );

    UploadApp req = new UploadApp();
    req.getFileItems().add( fileItem );

    log.info( "[WSO2 CAR Deployer] Invoking uploadService for " + targetFileName + " ..." );
    uploadSvc.uploadApp( req );

} catch ( Exception e ) {
    if ( e.getMessage().indexOf( "uploadAppResponse was not recognized" ) > 0 ) {
	// TODO: Why is the response empty in WSDL?
	log.info( "[WSO2 CAR Deployer] WARNING: response ignored ;-)" );
    } else {
	log.error( "[WSO2 CAR Deployer] ERROR: " + e.getMessage() );
	result = false;
	log.error( e );
    }
}

return result;
   }
 
开发者ID:ma-ha,项目名称:WSO2-Deployer-Maven-Plugin,代码行数:47,代码来源:Wso2CarDeployer.java

示例3: uploadCAR

import org.wso2.carbon.application.upload.xsd.UploadedFileItem; //导入依赖的package包/类
/**
 * Upload carbon abb artifact to WSO2 ESB or other WSO2 Server via WSO2 SOAP service
 * @param appType 
 * @param artifactFileName Filename for CAR artifact to upload to WSO2 Server
 * @return true, if upload is OK
 */
public boolean uploadCAR(  InputStream fin, String targetFileName, String appType ) {
	boolean result = true;
	try {
		
        UploadedFileItem fileItem = new UploadedFileItem();
        
        org.wso2.carbon.application.upload.xsd.ObjectFactory fieldFactory = new org.wso2.carbon.application.upload.xsd.ObjectFactory();
        //byte[] fileContent = readFile( fin );
        final byte fileContent[] = readFully(fin);
        final int cnt = fileContent.length;
        listener.getLogger().println( "[WSO2 CAR Deployer] Read CAR with "+cnt+" bytes" );

        fileItem.setDataHandler( fieldFactory.createUploadedFileItemDataHandler( fileContent ) );
        fileItem.setFileName( fieldFactory.createUploadedFileItemFileName( targetFileName ) );
        fileItem.setFileType( fieldFactory.createUploadedFileItemFileType( appType ) );

        UploadApp req = new UploadApp();
        req.getFileItems().add( fileItem );
		
        listener.getLogger().println( "[WSO2 CAR Deployer] Invoking uploadService for "+targetFileName+" ...");
		uploadSvc.uploadApp( req );
		
	} catch ( Exception e) {
		if ( e.getMessage().indexOf("uploadAppResponse was not recognized") > 0 ) {
			// TODO: Why is the response empty in WSDL?
			listener.getLogger().println( "[WSO2 CAR Deployer] WARNING: response ignored ;-)" );	
		} else {
			listener.getLogger().println( "[WSO2 CAR Deployer] ERROR: "+e.getMessage() );
			result = false;
			e.printStackTrace();
		}
	}
	
	return result ;
}
 
开发者ID:ma-ha,项目名称:Jenkins-WSO2-CAR-Deployer,代码行数:42,代码来源:Wso2CarDeployClient.java

示例4: getFileItems

import org.wso2.carbon.application.upload.xsd.UploadedFileItem; //导入依赖的package包/类
/**
 * Gets the value of the fileItems property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the fileItems property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getFileItems().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link UploadedFileItem }
 * 
 * 
 */
public List<UploadedFileItem> getFileItems() {
    if (fileItems == null) {
        fileItems = new ArrayList<UploadedFileItem>();
    }
    return this.fileItems;
}
 
开发者ID:ma-ha,项目名称:WSO2-Deployer-Maven-Plugin,代码行数:29,代码来源:UploadApp.java


注:本文中的org.wso2.carbon.application.upload.xsd.UploadedFileItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。