View Javadoc

1   /*
2    * Copyright (c) 2005, The K-Wf Grid Consortium
3    * Fraunhofer Institute for Computer Architecture and Software Technology
4    * See http://www.kwfgrid.eu and http://www.first.fraunhofer.de for more details.
5    */
6   package net.kwfgrid.gworkflowdl.protocol;
7   
8   /***
9      Global settings for the protocol. The protocol is configured using the file <code>protocol.properties</code> which must be 
10     located in the root directory of the classpath.
11     FIXME: TODO!
12   */
13  public class Protocol {
14      /*** Identifier for a Modification command. */
15      public static final String IDENTIFIER_MODIFICATION = "MODIFICATION";
16      /*** Identifier for a Full-Update command. */
17      public static final String IDENTIFIER_FULLUPDATE = "FULLUPDATE";
18  
19      private static IMethodCallStrategy _defaultstrategy;
20      private static IMethodCallStrategy _protocolstrategy;
21      private static IModificationHandler _modificationhandler;
22      private static IMethodCallEncoder _methodcallencoder;
23  
24      static {
25  	// configure. FIXME TODO
26  	_defaultstrategy = new DefaultMethodCallStrategy();
27      }
28  
29      private Protocol() {
30  	//
31      }
32  
33      public static void setDefaultMethodCallStrategy(IMethodCallStrategy strategy) {
34  	_defaultstrategy = strategy;
35      }
36  
37      public static void setProtocolMethodCallStrategy(IMethodCallStrategy strategy) {
38  	_protocolstrategy = strategy;
39      }
40  
41      public static void setModificationHandler(IModificationHandler handler) {
42  	_modificationhandler = handler;
43      }
44  
45      public static void setMethodCallEncoder(IMethodCallEncoder encoder) {
46  	_methodcallencoder = encoder;
47      }
48  
49      /***
50         Get the default method-call-strategy of the protocol structure.
51         This method-call-strategy is being used in situations where no client/server communication is desired.
52         One such situation is when child objects of the object structure are being created independently of
53         a root object. (See <code>NullParent</code>).
54         @return The default method-call-strategy.
55       */
56      public static IMethodCallStrategy getDefaultMethodCallStrategy() {
57  	return _defaultstrategy;
58      }
59  
60      /***
61         Get the protocol method-call-strategy of the protocol structure.
62         This method-call-strategy is being used in situations where client/server communication is desired.
63         @return The protocol method-call-strategy.
64       */
65      public static IMethodCallStrategy getProtocolMethodCallStrategy() {
66  	return _protocolstrategy;
67      }
68  
69      /***
70         Get the handler for modifications of the structures.
71       */
72      public static IModificationHandler getModificationHandler() {
73  	return _modificationhandler;
74      }
75  
76      /***
77         Get the encoder to encode method calls into modifications.
78       */
79      public static IMethodCallEncoder getMethodCallEncoder() {
80  	return _methodcallencoder;
81      }
82  }