📄 clientsyncdocument.java
字号:
/**
* @(#)$RCSfile: ClientSyncDocument.java,v $ $Revision: 1.2 $
*
* ====================================================================
* Copyright 2001, Reaxion Corp.,
* 11418 105th PL NE, Kirkland, WA, 98033, USA
* All rights reserved.
* ====================================================================
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Tequila SyncML.
*
* The Initial Developer of the Original Code is Reaxion Corp.
* All Rights Reserved.
*/
package com.reaxion.tequila.client.syncml.sync.doc;
import java.util.*;
import com.reaxion.tequila.syncml.*;
import com.reaxion.tequila.syncml.sync.*;
import com.reaxion.tequila.syncml.sync.doc.*;
import com.reaxion.tequila.syncml.util.*;
import com.reaxion.tequila.client.syncml.sync.*;
/**
* This class represents a XML document synchronization on client side.
* The instance of this class leaves only through the session of synchronization.
* It should be created before starting the synchronization
* and removed after finishing the process of synchronization.
*
* @version $1.0$
* @author Oleg A. Oksyuk
*/
public abstract class ClientSyncDocument extends SyncDocument
{
public abstract Enumeration startSync();
protected abstract void checkIfSyncFinished();
protected IXMLSyncClientDocument document;
private boolean needToChangeScenario = false;
public ClientSyncDocument(IXMLSyncClientDocument aDocument, short aScenario)
{
super(aDocument, aScenario);
document = aDocument;
}
public IXMLSyncClientDocument getDocument()
{
return document;
}
/**
* creates Alert command for this document
* The Alert command should be send on server.
*/
protected SyncAlert createAlert()
{
return new SyncAlert(scenario, new SyncTarget(new SyncLocUri(document.getDbName())));
}
//SyncDocument abstract methods implementations
protected void performAlert(SyncAlert alert)
{
throw new ChangeSyncScenarioException(alert);
}
protected Enumeration getEndPackageCommands()
{
return null;
}
protected void performNonOKStatus(SyncStatus status)
{
if (SyncCommandNames.ALERT.equals(status.getCmd().getCmd()))
{
if (SyncStatuses.REFRESH_REQ == status.getCode())
{
needToChangeScenario = true;
}
else
{
throw new WrongStatusSyncException("Server send non-OK and non-RefreshReq Status on Alert");
}
}
else
{
throw new WrongStatusSyncException("Server send non-OK Status");
}
}
protected Enumeration getSyncCommands()
{
return document.getCommandsTillDate(syncDate);
}
public void endSync()
{
log("endSync");
checkIfSyncFinished();
document.deleteCommandsTillDate(syncDate);
}
}
/* -----------------------------------------------------------------------------
* Change log:
* -----------------------------------------------------------------------------
* $Log: ClientSyncDocument.java,v $
* Revision 1.2 2001/10/17 15:27:41 OlegO
* changed comments for better javadoc
*
* Revision 1.1.1.1 2001/10/11 13:13:32 OlegO
* no message
*
* Revision 1.2 2001/07/27 07:37:16 OlegO
* no message
*
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -