Modified API Util

getComment method is added to the APIUtil file.
merge-requests/7/head
nishadi 7 years ago
parent b9bb6830f4
commit dbd9ad77ae

@ -22,14 +22,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse; import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.common.services.*;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationReleaseManager;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
import org.wso2.carbon.device.application.mgt.common.services.CategoryManager;
import org.wso2.carbon.device.application.mgt.common.services.LifecycleStateManager;
import org.wso2.carbon.device.application.mgt.common.services.PlatformManager;
import org.wso2.carbon.device.application.mgt.common.services.PlatformStorageManager;
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@ -49,6 +42,7 @@ public class APIUtil {
private static SubscriptionManager subscriptionManager; private static SubscriptionManager subscriptionManager;
private static PlatformStorageManager platformStorageManager; private static PlatformStorageManager platformStorageManager;
private static CategoryManager categoryManager; private static CategoryManager categoryManager;
private static CommentsManager commentsManager;
public static ApplicationManager getApplicationManager() { public static ApplicationManager getApplicationManager() {
if (applicationManager == null) { if (applicationManager == null) {
@ -232,4 +226,22 @@ public class APIUtil {
return subscriptionManager; return subscriptionManager;
} }
public static CommentsManager getCommentsManager() {
if (commentsManager == null) {
synchronized (APIUtil.class) {
if (commentsManager == null) {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
commentsManager =
(CommentsManager) ctx.getOSGiService(CommentsManager.class, null);
if (commentsManager == null) {
String msg = "Comments Manager service has not initialized.";
log.error(msg);
throw new IllegalStateException(msg);
}
}
}
}
return commentsManager;
}
} }

Loading…
Cancel
Save