Winery client is deprecated?
nyuuyn opened this issue · 3 comments
nyuuyn commented
I tried to create a copy of a service template with the client but get exceptions which after a closer look are issues with HTTP content types between the client and the api.
Here is an example which just doesn't work:
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
IWineryRepositoryClient client = createClient();
QNameWithName uptimeTemplateId = findUPTIMETrainTemplate(client);
System.out.println(uptimeTemplateId.qname.toString());
QNameWithName copyId = copyServiceTemplate(client, uptimeTemplateId, new QName("https://bla.org", "testBla"));
}
private static IWineryRepositoryClient createClient() {
IWineryRepositoryClient client = WineryRepositoryClientFactory.getWineryRepositoryClient();
client.setPrimaryRepository("http://localhost:8080/winery");
return client;
}
private static QNameWithName findUPTIMETrainTemplate(IWineryRepositoryClient client) {
return findServiceTemplateId(client, "UPTIME_Train_Template");
}
private static QNameWithName findServiceTemplateId(IWineryRepositoryClient client, String localName) {
Collection<QNameWithName> ids = client.getListOfAllInstances(ServiceTemplateId.class);
for (QNameWithName id : ids) {
if (id.qname.getLocalPart().contains(localName)) {
return id;
}
}
return null;
}
private static QNameWithName copyServiceTemplate(IWineryRepositoryClient client,
QNameWithName serviceTemplateToCopy, QName nameOfCopy) throws Exception {
client.createComponent(nameOfCopy, ServiceTemplateId.class);
TTopologyTemplate topoloy = client.getTopologyTemplate(serviceTemplateToCopy.qname);
client.setTopologyTemplate(nameOfCopy, topoloy);
return findServiceTemplateId(client, nameOfCopy.getLocalPart());
}
So is there a plan to update the client?
lharzenetter commented
zimmerml commented
I don't use it.
miwurster commented
That doesn't seem to be an issue anymore.