ruper2/src/java/core/org/krysalis/ruper/protocols ProtocolOperationsManager.java,1.7,1.8

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/protocols
In directory sc8-pr-cvs1:/tmp/cvs-serv17841/src/java/core/org/krysalis/ruper/protocols

Modified Files:
	ProtocolOperationsManager.java 
Log Message:
Protocol mgr made as a handler mgr to manage the provider selection through 
the selectors.

And tested the full cycle for FileUpdater working

Index: ProtocolOperationsManager.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/protocols/ProtocolOperationsManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ProtocolOperationsManager.java	9 Sep 2003 18:37:03 -0000	1.7
--- ProtocolOperationsManager.java	18 Sep 2003 20:15:40 -0000	1.8
***************
*** 16,20 ****
--- 16,31 ----
  import org.krysalis.ruper.impl.ResourceUpdaterContext;
  import org.krysalis.ruper.log.Logger;
+ import org.krysalis.ruper.protocols.select.DestinationProtocolProviderSelector;
+ import org
+ 	.krysalis
+ 	.ruper
+ 	.protocols
+ 	.select
+ 	.SourceDestinationProtocolProviderSelector;
+ import org.krysalis.ruper.protocols.select.SourceProtocolProviderSelector;
+ import org.krysalis.ruper.util.RuperConstants;
+ import org.krysalis.ruper.util.chainprocess.HandlerManager;
  import org.krysalis.ruper.util.select.Selector;
+ import org.krysalis.ruper.util.select.SelectorHandlerChain;
  import org.krysalis.version.util.debug.DebugUtils;
  import org.krysalis.version.util.debug.Dumpable;
***************
*** 23,27 ****
   * @author ajack
   */
! public class ProtocolOperationsManager implements Dumpable {
  	private ResourceUpdaterContext m_context = null;
  	private List m_providers = new ArrayList();
--- 34,40 ----
   * @author ajack
   */
! public class ProtocolOperationsManager
! 	extends HandlerManager
! 	implements Dumpable {
  	private ResourceUpdaterContext m_context = null;
  	private List m_providers = new ArrayList();
***************
*** 32,35 ****
--- 45,59 ----
  	ProtocolOperationsManager(ResourceUpdaterContext context) {
  		m_context = context;
+ 		configureSelectors();
+ 	}
+ 
+ 	private void configureSelectors() {
+ 
+ 		// create the selector handler chain and 
+ 		// add it to the list of handler chains
+ 		SelectorHandlerChain selectors =
+ 			new SelectorHandlerChain(RuperConstants.SELECTOR);
+ 		// add the selectors chain to the handler manager
+ 		this.addHandlerChain(selectors);
  	}
  
***************
*** 101,106 ****
  		Selector selector)
  		throws Exception {
  		Logger.getLog().debug("Perform List " + container);
! 		return determineProviderFor(container).list(container, selector);
  	}
  
--- 125,141 ----
  		Selector selector)
  		throws Exception {
+ 		return performList(
+ 			container,
+ 			determineProviderFor(container),
+ 			selector);
+ 	}
+ 
+ 	public List performList(
+ 		VirtualResourceLocator container,
+ 		ProtocolOperationsProvider provider,
+ 		Selector selector)
+ 		throws Exception {
  		Logger.getLog().debug("Perform List " + container);
! 		return provider.list(container, selector);
  	}
  
***************
*** 114,118 ****
  	public boolean checkExists(VirtualResourceLocator container)
  		throws Exception {
! 		Logger.getLog().debug("Check Exists " + container);
  		return determineProviderFor(container).exists(container);
  	}
--- 149,154 ----
  	public boolean checkExists(VirtualResourceLocator container)
  		throws Exception {
! 
! 		Logger.getLog().debug("Check if resource provider exists " + container);
  		return determineProviderFor(container).exists(container);
  	}
***************
*** 130,136 ****
  		Selector selector)
  		throws Exception {
! 			
  		Logger.getLog().debug("Perform Copy " + from + " -> " + to);
! 			
  		determineProviderFor(from, to).copy(from, to, selector);
  	}
--- 166,172 ----
  		Selector selector)
  		throws Exception {
! 
  		Logger.getLog().debug("Perform Copy " + from + " -> " + to);
! 
  		determineProviderFor(from, to).copy(from, to, selector);
  	}
***************
*** 142,160 ****
  		// Locate a Provider that handles both address
  		// types (e.g. protocols)
- 		List sourceList =
- 			determineProviders(m_sourceProtocolMap, source.getProtocol());
- 
- 		if (null == sourceList)
- 			throw new RuperException(
- 				"No providers for source protocol : " + source.getProtocol());
  
! 		List destinationList =
! 			determineProviders(m_sourceProtocolMap, destination.getProtocol());
! 
! 		if (null == destinationList)
! 			throw new RuperException(
! 				"No providers for destination protocol : " + destination.getProtocol());
! 
! 		List providers = join(sourceList, destinationList);
  
  		if (0 == providers.size())
--- 178,186 ----
  		// Locate a Provider that handles both address
  		// types (e.g. protocols)
  
! 		List providers =
! 			determineSourceDestinationProviders(
! 				source.getProtocol(),
! 				destination.getProtocol());
  
  		if (0 == providers.size())
***************
*** 179,184 ****
  		// Locate a Provider that handles both address
  		// types (e.g. protocols)
! 		List providers =
! 			determineProviders(m_sourceProtocolMap, source.getProtocol());
  
  		if (null == providers)
--- 205,209 ----
  		// Locate a Provider that handles both address
  		// types (e.g. protocols)
! 		List providers = determineSourceProviders(source.getProtocol());
  
  		if (null == providers)
***************
*** 196,201 ****
  	}
  
! 	private List determineProviders(Map map, String protocol) {
! 		return (List) map.get(protocol);
  	}
  
--- 221,268 ----
  	}
  
! 	private List determineSourceProviders(String protocol)
! 		throws RuperException {
! 		List listOfProviders = null;
! 		// set the selector and then pass the providers through the process chain
! 		SourceProtocolProviderSelector sourceProtocolSelector =
! 			new SourceProtocolProviderSelector(protocol);
! 
! 		return processProviderList(sourceProtocolSelector);
! 	}
! 
! 	private List determineDestinationProviders(String protocol)
! 		throws RuperException {
! 		List listOfProviders = null;
! 		// set the selector and then pass the providers through the process chain
! 		DestinationProtocolProviderSelector destinationProtocolSelector =
! 			new DestinationProtocolProviderSelector(protocol);
! 
! 		return processProviderList(destinationProtocolSelector);
! 	}
! 
! 	private List determineSourceDestinationProviders(
! 		String srcProtocol,
! 		String destProtocol)
! 		throws RuperException {
! 		List listOfProviders = null;
! 		// set the selector and then pass the providers through the process chain
! 		SourceDestinationProtocolProviderSelector srcDestProtocolSelector =
! 			new SourceDestinationProtocolProviderSelector(
! 				srcProtocol,
! 				destProtocol);
! 
! 		return processProviderList(srcDestProtocolSelector);
! 	}
! 
! 	private List processProviderList(Selector selector) throws RuperException {
! 
! 		List listOfProviders = null;
! 		List selectorList = new ArrayList();
! 		selectorList.add(selector);
! 
! 		setHandlers(RuperConstants.SELECTOR, selectorList);
! 
! 		listOfProviders = process(m_providers);
! 		return listOfProviders;
  	}
  




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.