@Override
 public String getCiSvnPath() throws PhrescoException {
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(configuration.getServerPath() + FrameworkConstants.REST_CI_SVN_PATH);
   return resource.accept(MediaType.TEXT_PLAIN).get(String.class);
 }
  private void initCache() throws PhrescoException {
    if (debugEnabled) {
      S_LOGGER.debug("Entering Method ServiceManagerImpl.initCache()");
    }
    List<ApplicationType> apptypes = null;
    List<VideoInfo> videoInfos = null;
    List<SettingsTemplate> settingsTemplate = null;
    List<Environment> enveInfo = null;

    if (PhrescoFrameworkFactory.getFrameworkConfig().isCacheEnabled()) {
      apptypes = loadAppTypesFromFile();
      videoInfos = loadVideosFromFile();
      settingsTemplate = loadSettingsTemplateFromFile();
    }

    // Load AppTypes into Cache
    if (apptypes == null) {
      apptypes = getApplicationTypesFromServer();
    }

    // Load Videos into Cache
    if (videoInfos == null) {
      videoInfos = loadVideosFromService();
    }

    // Load Settings into Cache
    if (settingsTemplate == null) {
      settingsTemplate = loadSettingsTemplateFromService();
    }

    if (enveInfo == null) {
      enveInfo = getEnvInfoFromService();
    }

    if (PhrescoFrameworkFactory.getFrameworkConfig().isCacheEnabled()) {
      writeToFile(VIDEOS_FILE, videoInfos);
      writeToFile(APPTYPES_FILE, apptypes);
      writeToFile(SETTINGS_FILE, settingsTemplate);
    }

    cache.add(APPTYPES_FILE, apptypes);
    cache.add(VIDEOS_FILE, videoInfos);
    cache.add(SETTINGS_FILE, settingsTemplate);
  }
 private List<ApplicationType> getApplicationTypesFromServer() throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.getApplicationTypesFromServer()");
   }
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   Client client = ClientHelper.createClient();
   WebResource resource = client.resource(configuration.getServerPath() + REST_APPS_PATH);
   Builder builder = resource.accept(MediaType.APPLICATION_JSON_TYPE);
   GenericType<List<ApplicationType>> genericType = new GenericType<List<ApplicationType>>() {};
   return builder.get(genericType);
 }
 @Override
 public List<Reports> getReports(String techId) throws PhrescoException {
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(
           configuration.getServerPath() + FrameworkConstants.REST_REPORTS + "/" + techId);
   Builder builder = resource.accept(MediaType.APPLICATION_JSON);
   GenericType<List<Reports>> genericType = new GenericType<List<Reports>>() {};
   List<Reports> reportList = builder.get(genericType);
   return reportList;
 }
  public List<Environment> getEnvInfoFromService() throws PhrescoException {
    if (debugEnabled) {
      S_LOGGER.debug("Entering Method ServiceManagerImpl.getEnvFromService()");
    }
    Client client = ClientHelper.createClient();
    FrameworkConfiguration frameworkConfig = PhrescoFrameworkFactory.getFrameworkConfig();
    WebResource resource = client.resource(frameworkConfig.getServerPath() + REST_ENVE_PATH);
    Builder builder = resource.accept(MediaType.APPLICATION_JSON_TYPE);

    GenericType<List<Environment>> genericType = new GenericType<List<Environment>>() {};
    return builder.get(genericType);
  }
  public ClientResponse getEmailExtPlugin() throws PhrescoException {
    if (debugEnabled) {
      S_LOGGER.debug("Entering Method ServiceManagerImpl.getEmailExtPlugin");
    }

    Client client = ClientHelper.createClient();
    FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
    WebResource resource =
        client.resource(configuration.getServerPath() + FrameworkConstants.REST_CI_MAIL_PLUGIN);
    resource.accept(MediaType.APPLICATION_OCTET_STREAM);
    ClientResponse response = resource.get(ClientResponse.class);
    return response;
  }
 @Override
 public ClientResponse sendReport(LogInfo loginfo) throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.sendReport(LogInfo loginfo)");
   }
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(configuration.getServerPath() + FrameworkConstants.REST_LOG_PATH);
   ClientResponse response =
       resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, loginfo);
   return response;
 }
  public InputStream getMailerXml() throws PhrescoException {
    if (debugEnabled) {
      S_LOGGER.debug("Entering Method ServiceManagerImpl.getMailerXml");
    }

    Client client = ClientHelper.createClient();
    FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
    WebResource resource =
        client.resource(configuration.getServerPath() + FrameworkConstants.REST_CI_MAILER_HOME);
    resource.accept(MediaType.APPLICATION_XML);
    ClientResponse response = resource.type(MediaType.APPLICATION_XML).get(ClientResponse.class);
    InputStream is = response.getEntityInputStream();
    return is;
  }
 @Override
 public List<AdminConfigInfo> getAdminConfig() throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.getAdminConfig()");
   }
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(configuration.getServerPath() + FrameworkConstants.REST_ADMIN_CONFIG_PATH);
   resource.accept(MediaType.APPLICATION_JSON_TYPE);
   ClientResponse clientResponse =
       resource.type(MediaType.APPLICATION_JSON_TYPE).get(ClientResponse.class);
   GenericType<List<AdminConfigInfo>> genericType = new GenericType<List<AdminConfigInfo>>() {};
   return clientResponse.getEntity(genericType);
 }
 public User doLogin(Credentials credentials) throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.doLogin(Credentials credentials)");
   }
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(configuration.getServerPath() + FrameworkConstants.REST_LOGIN_PATH);
   resource.accept(MediaType.APPLICATION_JSON_TYPE);
   ClientResponse response =
       resource.type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class, credentials);
   GenericType<User> genericType = new GenericType<User>() {};
   User userInfo = response.getEntity(genericType);
   return userInfo;
 }
 public List<DownloadInfo> getDownloadsFromService(DownloadPropertyInfo downloadPropertyInfo)
     throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.loadVideosFromService()");
   }
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   Client client = ClientHelper.createClient();
   WebResource resource = client.resource(configuration.getServerPath() + REST_DOWNLOADS_PATH);
   ClientResponse response =
       resource
           .type(MediaType.APPLICATION_JSON_TYPE)
           .post(ClientResponse.class, downloadPropertyInfo);
   GenericType<List<DownloadInfo>> genericType = new GenericType<List<DownloadInfo>>() {};
   List<DownloadInfo> downloadInfo = response.getEntity(genericType);
   return downloadInfo;
 }
 public ClientResponse updateDocumentProject(ProjectInfo info) throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.updateProject(ProjectInfo info)");
   }
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(
           configuration.getServerPath() + FrameworkConstants.REST_APPS_UPDATEDOC_PATH);
   resource.accept(MediaType.APPLICATION_OCTET_STREAM);
   if (debugEnabled) {
     S_LOGGER.debug("updateDocumentProject() ProjectName = " + info.getName());
   }
   ClientResponse response =
       resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, info);
   return response;
 }
 public ClientResponse createProject(ProjectInfo info, User userInfo) throws PhrescoException {
   if (debugEnabled) {
     S_LOGGER.debug("Entering Method ServiceManagerImpl.createProject(ProjectInfo info)");
   }
   Client client = ClientHelper.createClient();
   FrameworkConfiguration configuration = PhrescoFrameworkFactory.getFrameworkConfig();
   WebResource resource =
       client.resource(configuration.getServerPath() + FrameworkConstants.REST_APPS_PATH);
   resource.accept(MediaType.APPLICATION_OCTET_STREAM);
   if (debugEnabled) {
     S_LOGGER.debug("createProject() ProjectName = " + info.getName());
   }
   ClientResponse response =
       resource
           .header(Constants.AUTH_TOKEN, userInfo.getToken())
           .type(MediaType.APPLICATION_JSON)
           .post(ClientResponse.class, info);
   //        reSetCacheAppTypes();
   return response;
 }