use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.
the class ServerManagerConnection method isAlive.
public boolean isAlive() throws APIException {
JSONObject status = null;
Object jsonResponse = getJSONAPI(getIsAliveAPI());
if (jsonResponse instanceof JSONObject) {
status = (JSONObject) jsonResponse;
} else {
// $NON-NLS-1$
throw new APIException(getIsAliveAPI(), "Unable to connect to server manager.");
}
if (isSuccess(status)) {
return true;
}
return false;
}
use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.
the class ServerManagerConnection method getLiferayPlugins.
public List<String> getLiferayPlugins() {
List<String> retval = new ArrayList<String>();
Object response = null;
try {
response = getJSONAPI(getPluginsAPI());
} catch (APIException e1) {
LiferayServerCore.logError(e1);
}
if (response instanceof JSONObject) {
JSONObject json = (JSONObject) response;
try {
if (isSuccess(json)) {
JSONArray jsonPlugins = getJSONOutput(json);
for (int i = 0; i < jsonPlugins.length(); i++) {
retval.add(jsonPlugins.get(i).toString());
}
}
} catch (Exception e) {
LiferayServerCore.logError(e);
}
}
return retval;
}
use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.
the class PortalConnection method getStructureTemplates.
public JSONArray getStructureTemplates(long groupId, long structureId) throws APIException {
JSONArray structureTemplates = null;
// $NON-NLS-1$ //$NON-NLS-2$
Object jsonResponse = getJSONAPI(GET_STRUCTURE_TEMPLATES_API, "groupId", groupId, "structureId", structureId);
if (jsonResponse instanceof JSONArray) {
structureTemplates = (JSONArray) jsonResponse;
} else {
// $NON-NLS-1$
throw new APIException(GET_STRUCTURE_TEMPLATES_API, "Unable to get JSONArray");
}
return structureTemplates;
}
use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.
the class PortalConnection method getCompanyIdByVirtualHost.
public JSONObject getCompanyIdByVirtualHost() throws APIException {
JSONObject company = null;
// $NON-NLS-1$
Object jsonResponse = getJSONAPI(GET_COMPANY_BY_VIRTUAL_HOST_API, "virtualHost", getHost());
if (jsonResponse instanceof JSONObject) {
company = (JSONObject) jsonResponse;
} else {
// $NON-NLS-1$
throw new APIException(GET_COMPANY_BY_VIRTUAL_HOST_API, "Unable to get JSONObject");
}
return company;
}
Aggregations