The best we can do is execute a Checkout command and parse the data returned.
The best we can do is execute a Checkout command and parse the data returned.
public class CvsResourceServer extends ResourceServerBasics { private void updateCvsData() throws IOException { openConversation(); if (root != null) { sendUnchanged((CvsCategory)root); } outstream.println("Directory ."); outstream.println(cvsRepositoryPath); outstream.println("Argument -A"); outstream.println("Argument " + rootPath); outstream.println("co"); while (true) { String line = instream.readln(); if (line.startsWith("Clear-sticky ")) { . . . } if (line.startsWith("Created ") || line.startsWith("Updated ")) { . . . } if (line.startsWith("Removed ")) { . . . } if (line.startsWith("E ") || line.startsWith("M ")) { . . . } break; } closeComm(); } } |
Entries Repository Root
|
|
|
To avoid having to do a Checkout of all the files in a repository every time Kahuna starts up, we serialize this data structure on shutdown and read it back on startup.
public class CvsResourceServer extends ResourceServerBasics { private void serializeCvsData() throws IOException { FileOutputStream fos = new FileOutputStream("cvsdata.serialized"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(root); oos.flush(); oos.close(); } private void deserializeCvsData() { try { FileInputStream fis = new FileInputStream("cvsdata.serialized"); ObjectInputStream ois = new ObjectInputStream(fis); root = (CvsCategory)ois.readObject(); ois.close(); ((CvsCategory)root).setServer(this); } catch (Exception e) { root = null; } } } |
public class CvsResourceServer extends ResourceServerBasics { private void sendUnchanged(CvsCategory category) throws IOException { String repository = category.getRepository(); String directory = getDirectory(repository); outstream.println("Directory ." + directory); outstream.println(repository); Resource[] resources = category.getResources(); for (int i = 0; i < resources.length; i++) { CvsResource resource = (CvsResource)resources[i]; outstream.println("Entry " + resource.getEntry()); outstream.println("Unchanged " + resource.getName()); } Category[] categories = category.getSubCategories(); for (int i = 0; i < categories.length; i++) { CvsCategory subCategory = (CvsCategory)categories[i]; sendUnchanged(subCategory); } } } |