/**********************************************************************************
* $URL$
* $Id$
***********************************************************************************
*
* Copyright (c) 2005 The Regents of the University of Michigan, Trustees of Indiana University,
*                  Board of Trustees of the Leland Stanford, Jr., University, and The MIT Corporation
*
* Licensed under the Educational Community License Version 1.0 (the "License");
* By obtaining, using and/or copying this Original Work, you agree that you have read,
* understand, and will comply with the terms and conditions of the Educational Community License.
* You may obtain a copy of the License at:
*
*      http://cvs.sakaiproject.org/licenses/license_1_0.html
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**********************************************************************************/

package org.sakaiproject.tool.assessment.services.shared;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.sakaiproject.tool.assessment.services.PersistenceService;
import java.util.ResourceBundle;
import java.util.Properties;
import java.io.FileInputStream;

/**
 * The QuestionPoolService calls the service locator to reach the
 * manager on the back end.
 * @author Rachel Gollub <rgollub@stanford.edu>
 */
public class MediaService
{
    //private static final ResourceBundle mediaProperties =
    //ResourceBundle.getBundle("org.sakaiproject.tool.assessment.services.shared");
  private static Log log = LogFactory.getLog(MediaService.class);

  /**
   * Creates a new QuestionPoolService object.
   */
  public MediaService()  {
  }

  public void remove(String mediaId)
  {
     PersistenceService.getInstance().getAssessmentGradingFacadeQueries().
       removeMediaById(new Long(mediaId));
  }

    // determine value of SAVETODB
  public boolean saveToDB(){
    Properties mediaProperties = new Properties();
    try{
      mediaProperties.load(new FileInputStream("media.properties"));
    }
    catch(Exception e){
      log.warn(e.getMessage());
    } 
    String saveToDB = mediaProperties.getProperty("SAVETODB");
    if (("true").equals(saveToDB))
      return true;
    else
      return false;
  }

}

@@ -1526,102 +1526,9 @@
 ce;%0A
-import java.util.ResourceBundle;%0Aimport java.util.Properties;%0Aimport java.io.FileInputStream;
 %0A
+
 %0A/**
@@ -1706,152 +1706,8 @@
 e%0A%7B%0A
-    //private static final ResourceBundle mediaProperties =%0A    //ResourceBundle.getBundle(%22org.sakaiproject.tool.assessment.services.shared%22);%0A
   pr
@@ -1976,16 +1976,16 @@
 ries().%0A
+
        r
@@ -2028,419 +2028,6 @@
  %7D%0A%0A
-    // determine value of SAVETODB%0A  public boolean saveToDB()%7B%0A    Properties mediaProperties = new Properties();%0A    try%7B%0A      mediaProperties.load(new FileInputStream(%22media.properties%22));%0A    %7D%0A    catch(Exception e)%7B%0A      log.warn(e.getMessage());%0A    %7D %0A    String saveToDB = mediaProperties.getProperty(%22SAVETODB%22);%0A    if ((%22true%22).equals(saveToDB))%0A      return true;%0A    else%0A      return false;%0A  %7D%0A%0A
 %7D%0A

check in by mistake