package com.dbxml.db.enterprise.sync;
/*
* dbXML - Native XML Database
* Copyright (c) 1999-2006 The dbXML Group, L.L.C.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*
* $Id: SyncManagerClient.java,v 1.5 2006/02/02 19:04:15 bradford Exp $
*/
import com.dbxml.db.client.dbXMLClient;
import com.dbxml.db.client.xmlrpc.ConnectionManager;
import com.dbxml.util.dbXMLException;
import com.dbxml.xml.dom.DOMHelper;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* SyncManagerClient
*/
public final class SyncManagerClient extends ConnectionManager {
private static final String PATH = "/system/syncmanager";
public SyncManagerClient(dbXMLClient dbxmlClient) {
super(dbxmlClient);
setClientPath(PATH);
}
public String getMachineID() throws dbXMLException {
return executeString("getMachineID", null);
}
public void addGroup(String group) throws dbXMLException {
execute("addGroup", new Object[]{group});
}
public void removeGroup(String group) throws dbXMLException {
execute("removeGroup", new Object[]{group});
}
public String[] listGroups() throws dbXMLException {
return executeList("listGroups", null);
}
public void addCollection(String group, String collection) throws dbXMLException {
execute("addCollection", new Object[]{group, collection});
}
public void removeCollection(String group, String collection) throws dbXMLException {
execute("removeCollection", new Object[]{group, collection});
}
public String[] listCollections(String group) throws dbXMLException {
return executeList("listCollections", new Object[]{group});
}
public void addGroupToContent(String path, String group) throws dbXMLException {
execute("addGroupToContent", new Object[]{path, group});
}
public void removeGroupFromContent(String path, String group) throws dbXMLException {
execute("removeGroupFromContent", new Object[]{path, group});
}
public String[] listContentGroups(String path) throws dbXMLException {
return executeList("listContentGroups", new Object[]{path});
}
public String[] listGroupContents(String group) throws dbXMLException {
return executeList("listGroupContents", new Object[]{group});
}
public Manifest listGroupChanges(Date date, String[] groups) throws dbXMLException {
try {
List groupList = new ArrayList(groups.length);
for ( int i = 0; i < groups.length; i++ )
groupList.add(groups[i]);
String doc = executeString("listGroupChanges", new Object[]{date, groupList});
return new Manifest(DOMHelper.parseText(doc));
}
catch ( dbXMLException e ) {
throw e;
}
catch ( Exception e ) {
throw new dbXMLException(e);
}
}
public Manifest listAllChanges(Date date) throws dbXMLException {
try {
String doc = executeString("listAllChanges", new Object[]{date});
return new Manifest(DOMHelper.parseText(doc));
}
catch ( dbXMLException e ) {
throw e;
}
catch ( Exception e ) {
throw new dbXMLException(e);
}
}
}