package smart_gs.network;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import smart_gs.SmartGS;

import jp.ac.nii.hcp.client.core.HCPController;
import jp.ac.nii.hcp.client.core.ProjectEditor;
import jp.ac.nii.hcp.client.net.AuthenticationCache;
import jp.ac.nii.hcp.client.net.UnauthorizedException;
import jp.ac.nii.hcp.client.shared.ClientConfiguration;
import jp.ac.nii.hcp.client.shared.HCPClientException;
import jp.ac.nii.hcp.shared.model.HCPMaterial;
import jp.ac.nii.hcp.shared.model.HCPProject;


//This class is made for testing HCP SDK. 
 
public class NetVersionTest {
	
	public static void main(String[] args) {
//		String source = "";
//		FileReader in;
//		try {
//			in = new FileReader("C:/users/minao kukita/desktop/spread.xml");
//			BufferedReader br = new BufferedReader(in);
//			String line;
//			while ((line = br.readLine()) != null) {
//				source += line;
//			}
//			br.close();
//			in.close();
//		} catch (IOException e) {
			// TODO Auto-generated catch block
//			e.printStackTrace();
		}
//		System.out.println("source: " + source);
//		
//		ClientConfiguration config = new ClientConfiguration();		
//		config.repositoryAPIURL("https://hcp.nii.ac.jp/repository/api");
//		config.authURL("https://hcp.nii.ac.jp/repository/auth");
//		config.imageServerURL("https://hcp.nii.ac.jp/imageServer");
//		HCPController hcp = HCPController.get("D:\\SMART-GS\\workspace", config);

		//		try {
//			AuthenticationCache auth = hcp.login("minao.kukita@gmail.com", "mkukita31");
//			try {
//				hcp.deleteProject("ProjectBB");
//			} catch (UnauthorizedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}

//		try {
//			hcp.createProject("project2");
//		} catch (HCPClientException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
/*		ProjectEditor editor;
		try {
			String source = "";
			editor = hcp.openProject("project2");
			editor.addDocument("spreadTree/test", source, "test");
*/
//			System.out.println(editor.getDocument("spreadTree/test").source);
//			editor.addMaterial("image/01_0001", "00000004/01_0001.jpg", "test image");
//			ProjectLoader loader = new ProjectLoader(editor);
//			loader.loadSpreadTreeDocument("spreadTree/test");
//			File file = new File("C:/users/minao kukita/desktop/spread.xml");
//			loader.loadSpreadTreeDocument(file);
//		} catch (HCPClientException e) {
			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (ParserConfigurationException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (SAXException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} catch (IOException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}

//	}
//}
}