String depPolicy, String size, boolean remoOnTermination, boolean persistanceMapping,
boolean enableCommits)
throws CommandException {
DefaultHttpClient httpClient = new DefaultHttpClient();
CartridgeInfoBean cartridgeInfoBean = new CartridgeInfoBean();
cartridgeInfoBean.setCartridgeType(null);
cartridgeInfoBean.setAlias(null);
cartridgeInfoBean.setRepoURL(null);
cartridgeInfoBean.setPrivateRepo(false);
cartridgeInfoBean.setRepoUsername(null);
cartridgeInfoBean.setRepoPassword(null);
cartridgeInfoBean.setAutoscalePolicy(null);
cartridgeInfoBean.setDeploymentPolicy(null);
cartridgeInfoBean.setSize(size);
cartridgeInfoBean.setRemoveOnTermination(remoOnTermination);
cartridgeInfoBean.setPersistanceRequired(persistanceMapping);
cartridgeInfoBean.setCommitsEnabled(enableCommits);
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
String jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
try {
cartridgeInfoBean.setCartridgeType(cartridgeType);
cartridgeInfoBean.setAlias(alias);
cartridgeInfoBean.setRepoURL(externalRepoURL);
cartridgeInfoBean.setPrivateRepo(privateRepo);
cartridgeInfoBean.setRepoUsername(username);
cartridgeInfoBean.setRepoPassword(password);
cartridgeInfoBean.setAutoscalePolicy(asPolicy);
cartridgeInfoBean.setDeploymentPolicy(depPolicy);
cartridgeInfoBean.setSize(size);
cartridgeInfoBean.setRemoveOnTermination(remoOnTermination);
cartridgeInfoBean.setPersistanceRequired(persistanceMapping);
cartridgeInfoBean.setCommitsEnabled(enableCommits);
jsonSubscribeString = gson.toJson(cartridgeInfoBean, CartridgeInfoBean.class);
HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL() + subscribCartridgeRestEndpoint,
jsonSubscribeString);