In case you mean programatically, then I don’t really see why you need the BAR file?
You can always get a hold of an AppDeploymentBuilder or DeploymentBuilder and add the bytes (XML) manually. With the Process DeploymentBuilder you can even add a BpmnModel (the process Java representation) manually.