You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ja...@apache.org on 2004/08/02 13:50:35 UTC

cvs commit: ws-fx/sandesha/src/org/apache/sandesha/server InQueue.java

jaliya      2004/08/02 04:50:35

  Added:       sandesha/src/org/apache/sandesha/server InQueue.java
  Log:
  Queue to store the messages in the server side - not completed  but no harm to the existing code
  
  Revision  Changes    Path
  1.1                  ws-fx/sandesha/src/org/apache/sandesha/server/InQueue.java
  
  Index: InQueue.java
  ===================================================================
  /*
   * Copyright  1999-2004 The Apache Software Foundation.
   *
   *  Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  package org.apache.sandesha.server;
  
  import java.util.HashMap;
  
  import org.apache.sandesha.RMException;
  import org.apache.sandesha.RMSequenceContext;
  
  /**
   * @author JEkanayake
   *
  */
  
  public class InQueue {
  	private static InQueue inqueue = null;
  	private HashMap sequenceMap;
  
  	private InQueue() {
  		this.sequenceMap = new HashMap();
  	}
  
  	public static InQueue getInstance() {
  		if (inqueue != null)
  			return inqueue;
  		else
  			return new InQueue();
  	}
  
  	public void addRMSequenceContext(RMSequenceContext rmSequenceContext)
  		throws RMException {
  		System.out.println(
  			"Inserting to the Queue................................");
  		if (rmSequenceContext.getSequenceID() != null)
  			sequenceMap.put(
  				rmSequenceContext.getSequenceID(),
  				rmSequenceContext);
  		else
  			throw new RMException("SequenceID is not set");
  	}
  
  	public RMSequenceContext getRMSequenceContext(String sequenceID) {
  		System.out.println("getRMSequenceContext ------ "+sequenceID);
  		if (sequenceMap.get(sequenceID) != null){
  			System.out.println(" ------ ****************"+sequenceMap.get(sequenceID));
  			return (RMSequenceContext) sequenceMap.get(sequenceID);
  		}
  		else
  			return null;
  	}
  
  	/**
  	 * @return
  	 */
  	public HashMap getSequenceMap() {
  		return sequenceMap;
  	}
  
  }