synchronization.java
来自「CmisJavaApi」· Java 代码 · 共 144 行
JAVA
144 行
/* * The contents of this file are subject to the Dyade Public License, * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * 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 terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA. * All Rights Reserved. *//* Copyright 1996-2000 by Institut National de Recherche en Informatique * et en Automatique (INRIA) * All rights reserved. See COPYRIGHT in top-level directory. * * Authors: Laurent Andrey, Eric Dillon, Olivier Festor */// CVS Info//---------------------------------------------------------------------------////// $Id: Synchronization.java,v 1.2 2000/09/05 13:31:02 festor Exp $// $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/api/types/Synchronization.java,v $//---------------------------------------------------------------------------//// Todo//---------------------------------------------------------------------------//// Remove SYNC_NO_VALUE_CODE, it seems to be an ISM specific stuffpackage fr.dyade.cmis.api.types;import java.io.ObjectStreamException;/** * Type for confirmation mode parameter. * In X710 some operations (set, action, delete) can be "synchronization". * This selection is an indication to the agent on how the whole operation must be operated. * There are two possibilities: * <ol> * <li> <i>best effort</i>: The simplest way: agent does the operation until completion or error. * <li> <i>atomic</i> * </ol> * * We defined constant object that might be instantiated as shown below:<br> * <code>Synchronization mySync = Synchronization.BEST_EFFORT</code> * <p> * As a consequence, this class provides only static public constructors.<br> * <i>Notice that this implementation directly follows the Open Master fmk-c-api * <code>ISMc_synchronization</code> implementation.</i> * @see fr.dyade.cmis.api.types.Scope * @see fr.dyade.cmis.api.types.Mode * @version cvs $Id: Synchronization.java,v 1.2 2000/09/05 13:31:02 festor Exp $ */public class Synchronization extends CMISType { // Synchronization codes (tags) private static final short BEST_EFFORT_CODE = 0; private static final short ATOMIC_CODE = 1; private static final short SYNC_NO_VALUE_CODE = 2; //LA: to remove ? /** * Private contructor for constant, unmutable instances. * the user can only use the built-in Synchronization "singletons" */ private Synchronization( short pCode ) { fSynchronizationCode=pCode; } /** * To compare two synchronizations. * @return true when both <code>Synchronization</code> objects have the same code. */ public boolean equals( Object obj ) { if (obj instanceof Synchronization) { return ((Synchronization)obj).fSynchronizationCode==this.fSynchronizationCode; } else { return false; } } private static String toString( short pCode ) { switch (pCode) { case BEST_EFFORT_CODE: return "best effort"; case ATOMIC_CODE: return "atomic"; case SYNC_NO_VALUE_CODE: return "no value"; default: return "Bad synchronization code"; } } /** * To get a String representation of the Synchronization * @return the <code>String</code> representation of the current <code>Synchronization</code> instance. */ public String toString() { return Synchronization.toString(fSynchronizationCode); } // Three (LA two indeed) kinds of synchronization may appear... /** * Synchronization BEST_EFFORT "singleton". */ public static final Synchronization BEST_EFFORT = new Synchronization(BEST_EFFORT_CODE); /** * Synchronization ATOMIC "singleton". */ public static final Synchronization ATOMIC = new Synchronization(ATOMIC_CODE); /** * Synchronization NO_VALUE singleton. * <p> * Note: this value does not come for X710 recommendation. It rather an Bull Open Master * special case. */ public static final Synchronization NO_VALUE = new Synchronization(SYNC_NO_VALUE_CODE); // by default... private short fSynchronizationCode = BEST_EFFORT_CODE; // init. not useful indeed /** Filtering instance created after deserialization. * <a HREF="http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/input.doc6.html"> * Read javasof doc</a> about this method. We are exactly is the example shown here: * "The readResolve method would be implemented to determine if that symbol was already defined * and substitute the preexisting equivalent Symbol object to maintain the identity constraint...", * where Symbol objects are the 3 Synchronization constant object references . */ public Object readResolve() throws ObjectStreamException { switch(fSynchronizationCode){ case BEST_EFFORT_CODE: return BEST_EFFORT; case ATOMIC_CODE: return ATOMIC; case SYNC_NO_VALUE_CODE: return NO_VALUE; default: System.err.println(getClass().getName()+".readResolve: bad fSynchronizationCode"); return this; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?