associationendpointimpl.java
来自「CmisJavaApi」· Java 代码 · 共 220 行
JAVA
220 行
/* * 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 */// $Id: AssociationEndPointImpl.java,v 1.2 2000/09/05 14:42:56 festor Exp $// $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/rmi/AssociationEndPointImpl.java,v $////---------------------------------------------------------------------------//// Todo//---------------------------------------------------------------------------//// send synchronization ???????package fr.dyade.cmis.rmi;import java.rmi.Naming;import java.rmi.RemoteException;import java.rmi.server.UnicastRemoteObject;import fr.dyade.cmis.api.CMISException;import fr.dyade.cmis.api.operation.*;import fr.dyade.cmis.api.operation.event.*;import fr.dyade.cmis.impl.CMISEventQueue;import fr.dyade.cmis.impl.operation.CMISRequestImpl;import fr.dyade.cmis.api.types.InvokeId;import fr.dyade.cmis.util.TraceManager;public class AssociationEndPointImpl extends UnicastRemoteObject implements AssociationEndPoint { protected AssociationEndPointImpl( RMIStack pStack ) throws RemoteException { super(); fStack=pStack; } public void pushIndication( CMISIndication ind ) throws RemoteException { switch(ind.getType()) { case CMISIndication.ACTION: fStack.getEventQueue().postEvent(new ActionEvent(fStack, (ActionIndication)ind)); break; case CMISIndication.CANCEL_GET: fStack.getEventQueue().postEvent(new CancelGetEvent(fStack, (CancelGetIndication)ind)); break; case CMISIndication.CREATE: fStack.getEventQueue().postEvent(new CreateEvent(fStack, (CreateIndication)ind)); break; case CMISIndication.DELETE: fStack.getEventQueue().postEvent(new DeleteEvent(fStack, (DeleteIndication)ind)); break; case CMISIndication.EVENT_REPORT: fStack.getEventQueue().postEvent(new EventReportEvent(fStack, (EventReportIndication)ind)); break; case CMISIndication.GET: fStack.getEventQueue().postEvent(new GetEvent(fStack, (GetIndication)ind)); break; case CMISIndication.SET: fStack.getEventQueue().postEvent(new SetEvent(fStack, (SetIndication)ind)); break; default: fStack.getEventQueue().postUrgentEvent(new InternalErrorEvent(fStack, new RMIInternalErrorException(getClass().getName()+ ": pushIndication: bad indication type"))); } } public void pushConfirmation( CMISConfirmation conf ) throws RemoteException { CMISEventQueue lEventQueue=fStack.getEventQueue(); InvokeId lInitialInvokeId; boolean lIsCompleted=true; try { if (conf instanceof CMISLinkedConfirmation) { InvokeId lLinkedId=((CMISLinkedConfirmation)conf).getLinkedId(); if (lLinkedId!=null) { lInitialInvokeId=lLinkedId; lIsCompleted= lInitialInvokeId.equals(conf.getInvokeId()); } else { lInitialInvokeId=conf.getInvokeId(); } } else { lInitialInvokeId=conf.getInvokeId(); } CMISRequestImpl lReq=fStack.getPendingRequest(lInitialInvokeId.getInvokeId()); /* at this stage lReq != null, or and CMISRequestNotFoundException has been thrown. */ switch(conf.getType()) { case CMISConfirmation.ACTION: if (lReq instanceof ActionRequest) { lEventQueue.postEvent(new ActionConfirmationEvent((ActionRequest)lReq, (ActionConfirmation)conf)); if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new ActionCompletionEvent((ActionRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate an action conf to a " + lReq.getClass().getName()); } break; case CMISConfirmation.CANCEL_GET: if (lReq instanceof CancelGetRequest) { lEventQueue.postEvent(new CancelGetConfirmationEvent((CancelGetRequest)lReq, (CancelGetConfirmation)conf)); // always true indeed... if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new CancelGetCompletionEvent((CancelGetRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a cancel get confirmation to a " + lReq.getClass().getName()); } break; case CMISConfirmation.CREATE: if (lReq instanceof CreateRequest) { lEventQueue.postEvent(new CreateConfirmationEvent((CreateRequest)lReq, (CreateConfirmation)conf)); // always true indeed if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new CreateCompletionEvent((CreateRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a create confirmation to a " + lReq.getClass().getName()); } break; case CMISConfirmation.DELETE: if (lReq instanceof DeleteRequest) { lEventQueue.postEvent(new DeleteConfirmationEvent((DeleteRequest)lReq, (DeleteConfirmation)conf)); if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new DeleteCompletionEvent((DeleteRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a Delete confirmation to a " + lReq.getClass().getName()); } break; case CMISConfirmation.EVENT_REPORT: if (lReq instanceof EventReportRequest) { lEventQueue.postEvent(new EventReportConfirmationEvent((EventReportRequest)lReq, (EventReportConfirmation)conf)); // always true indeed if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new EventReportCompletionEvent((EventReportRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a event report confirmation to a " + lReq.getClass().getName()); } break; case CMISConfirmation.GET: if (lReq instanceof GetRequest) { lEventQueue.postEvent(new GetConfirmationEvent((GetRequest)lReq, (GetConfirmation)conf)); if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new GetCompletionEvent((GetRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a get confirmation to a " + lReq.getClass().getName()); } break; case CMISConfirmation.SET: if (lReq instanceof SetRequest) { lEventQueue.postEvent(new SetConfirmationEvent((SetRequest)lReq, (SetConfirmation)conf)); if (lIsCompleted) { fStack.removePendingRequest(lReq); lEventQueue.postEvent(new SetCompletionEvent((SetRequest)lReq)); } } else { throw new RMIInternalErrorException(getClass().getName()+ ": try to correlate a set confirmation to a " + lReq.getClass().getName()); } break; default: TraceManager.println(1, getClass().getName()+".pushConfirmation: bad confirmation type"); break; } } catch (CMISException ce) { lEventQueue.postUrgentEvent(new InternalErrorEvent(fStack, ce)); } } public void close() throws RemoteException { fStack.terminate(); fStack=null; } public void pushString( String pString ) throws RemoteException { System.out.println("Assoc: "+pString); } protected RMIStack fStack; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?