Example usage for javax.activation DataHandler getName

List of usage examples for javax.activation DataHandler getName

Introduction

In this page you can find the example usage for javax.activation DataHandler getName.

Prototype

public String getName() 

Source Link

Document

Return the name of the data object.

Usage

From source file:org.openehealth.ipf.commons.ihe.ws.cxf.NonReadingAttachmentMarshaller.java

@Override
public String addSwaRefAttachment(DataHandler data) {
    return attachmentDescription(data.getName(), null, data.getContentType());
}

From source file:org.openehealth.ipf.commons.ihe.ws.cxf.NonReadingAttachmentMarshaller.java

@Override
public String addMtomAttachment(DataHandler data, String elementNamespace, String elementLocalName) {
    return attachmentDescription(data.getName(), null, data.getContentType());
}

From source file:org.wso2.carbon.greg.artifacts.migration.client.ResourceAdminServiceClient.java

public void addWSDLResource(String description, DataHandler dh)
        throws RemoteException, ResourceAdminServiceExceptionException {
    String fileName = dh.getName().substring(dh.getName().lastIndexOf("/") + 1);
    this.stub.addResource("/" + fileName, MEDIA_TYPE_WSDL, description, dh, null, null);
}

From source file:org.wso2.carbon.attachment.mgt.ui.fileupload.AttachmentUploadClient.java

public void addUploadedFileItem(FileItemData fileItemData) throws AttachmentMgtException, RemoteException {
    DataHandler handler = fileItemData.getDataHandler();
    TAttachment attachment = new TAttachment();
    attachment.setName(handler.getName());
    attachment.setContentType(handler.getContentType());

    attachment.setCreatedBy("DummyUser"); //TODO: Remove this hard-coded value
    attachment.setContent(fileItemData.getDataHandler());
    String attachmentID = stub.add(attachment);
    log.info("Attachment was uploaded with id:" + attachmentID);
}

From source file:org.wso2.carbon.humantask.ui.fileupload.AttachmentUploadClient.java

/**
 * Upload the attachment and return the attachment id
 * @param fileItemData wrapper for the attachment
 * @return attachment id for the uploaded attachment
 * @throws AttachmentMgtException If an error occurred in the back-end component
 * @throws RemoteException if an error during the communication
 *///from ww  w  .j  a v a 2s  .c  o m
public String addUploadedFileItem(FileItemData fileItemData)
        throws AttachmentMgtException, RemoteException, ExceptionException {
    DataHandler handler = fileItemData.getDataHandler();
    TAttachment attachment = new TAttachment();
    attachment.setName(handler.getName());
    attachment.setContentType(handler.getContentType());
    attachment.setCreatedBy(getUserName());

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());
    attachment.setCreatedTime(calendar);
    attachment.setContent(handler);
    String attachmentID = stub.add(attachment);
    log.info("Attachment was uploaded with id:" + attachmentID);
    return attachmentID;
}

From source file:org.wso2.dss.integration.common.clients.DataServiceFileUploaderClient.java

public boolean uploadDataServiceFile(String fileName, DataHandler dh)
        throws ExceptionException, RemoteException {

    if (log.isDebugEnabled()) {
        log.debug("path to file :" + dh.getName());
    }/*from  w w  w  .j a  v  a2 s  . c om*/
    String response = dataServiceFileUploaderStub.uploadService(fileName, "", dh);
    if ("successful".equalsIgnoreCase(response)) {
        log.info("Artifact Uploaded");
        return true;
    } else {
        log.info(response);
        return false;
    }

}

From source file:org.wso2.dss.integration.common.clients.DataServiceFileUploaderClient.java

public boolean uploadDataServiceFile(String fileName, String serviceHierarchy, DataHandler dh)
        throws ExceptionException, RemoteException {

    if (log.isDebugEnabled()) {
        log.debug("path to file :" + dh.getName());
    }//w  ww  . ja v a2  s.  co  m
    String response = dataServiceFileUploaderStub.uploadService(fileName, serviceHierarchy, dh);
    if ("successful".equalsIgnoreCase(response)) {
        log.info("Artifact Uploaded");
        return true;
    } else {
        log.info(response);
        return false;
    }

}

From source file:org.wso2.appserver.integration.common.clients.ModuleAdminServiceClient.java

public void uploadModule(DataHandler dh) throws RemoteException {
    ModuleUploadData moduleUploadData = new ModuleUploadData();
    moduleUploadData.setFileName(dh.getName().substring(dh.getName().lastIndexOf('/') + 1));
    moduleUploadData.setDataHandler(dh);
    log.info((moduleAdminServiceStub.uploadModule(new ModuleUploadData[] { moduleUploadData })));
}

From source file:org.wso2.carbon.admin.service.AdminServiceModuleAdminService.java

public void uploadModule(String sessionCookie, DataHandler dh) throws RemoteException, Exception {

    new AuthenticateStub().authenticateStub(sessionCookie, moduleAdminServiceStub);
    ModuleUploadData moduleUploadData = new ModuleUploadData();
    moduleUploadData.setFileName(dh.getName().substring(dh.getName().lastIndexOf('/') + 1));
    moduleUploadData.setDataHandler(dh);
    log.info((moduleAdminServiceStub.uploadModule(new ModuleUploadData[] { moduleUploadData })));
    try {//from  w ww  .j av  a  2 s  . com
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }
    adminServiceCarbonServerAdmin.restartGracefully(sessionCookie);
    try {
        Thread.sleep(40000);
    } catch (InterruptedException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

}

From source file:org.wso2.carbon.bpel.core.ode.integration.axis2.receivers.BPELMessageReceiver.java

private TAttachment createAttachmentDTO(DataHandler attachmentHandler) {
    TAttachment attachment = new TAttachment();

    String attachmentName = attachmentHandler.getName();
    attachment.setName(attachmentName);// ww w  .  j av  a  2 s . c o m

    log.warn("Couldn't determine the name of BPEL client. So the owner of the attachment:" + attachmentName
            + " " + "will be the default bpel client"
            + org.wso2.carbon.bpel.core.BPELConstants.DAFAULT_BPEL_CLIENT);
    attachment.setCreatedBy(org.wso2.carbon.bpel.core.BPELConstants.DAFAULT_BPEL_CLIENT);

    attachment.setContentType(attachmentHandler.getContentType());
    //As well there are some other parameters to be set.
    attachment.setContent(attachmentHandler);

    return attachment;
}