Subversion Repositories XServices

Rev

Rev 169 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 169 Rev 170
Line 27... Line 27...
27
import java.util.HashMap;
27
import java.util.HashMap;
28
import java.util.List;
28
import java.util.List;
29
import java.util.Map;
29
import java.util.Map;
Line 30... Line 30...
30
 
30
 
-
 
31
import javax.xml.stream.XMLStreamException;
31
import javax.xml.stream.XMLStreamException;
32
 
-
 
33
import net.brutex.emitter.util.EmitterUtil;
32
import net.brutex.emitter.util.EmitterUtil;
34
import net.brutex.emitter.util.PasswordEncrypter;
33
import net.brutex.sbm.sbmappservices72.AEWebservicesFaultFault;
35
import net.brutex.sbm.sbmappservices72.AEWebservicesFaultFault;
34
import net.brutex.sbm.sbmappservices72.Sbmappservices72PortType;
36
import net.brutex.sbm.sbmappservices72.Sbmappservices72PortType;
35
import net.brutex.sbm.sbmappservices72.api.Auth;
37
import net.brutex.sbm.sbmappservices72.api.Auth;
36
import net.brutex.sbm.sbmappservices72.api.MultipleResponseItemOptions;
38
import net.brutex.sbm.sbmappservices72.api.MultipleResponseItemOptions;
Line 96... Line 98...
96
	private static final String OPTION_EVENTTEMPLATE = "eventtemplate";
98
	private static final String OPTION_EVENTTEMPLATE = "eventtemplate";
97
	private static final String OPTION_EVENTNAMESPACE = "eventnamespace";
99
	private static final String OPTION_EVENTNAMESPACE = "eventnamespace";
98
	private static final String OPTION_EVENTMANAGER_URL = "eventmanager";
100
	private static final String OPTION_EVENTMANAGER_URL = "eventmanager";
99
	private static final String OPTION_EVENTMANAGER_USER = "eventmanager.user";
101
	private static final String OPTION_EVENTMANAGER_USER = "eventmanager.user";
100
	private static final String OPTION_EVENTMANAGER_PASSWORD = "eventmanager.password";
102
	private static final String OPTION_EVENTMANAGER_PASSWORD = "eventmanager.password";
-
 
103
	private static final String OPTION_EVENTMANAGER_ENCRYPTED = "eventmanager.encrypted";
Line 101... Line 104...
101
	
104
	
102
	private static final String OPTION_SBM_ENDPOINT = "sbmappservices72";
105
	private static final String OPTION_SBM_ENDPOINT = "sbmappservices72";
103
	private static final String OPTION_SBM_USER = "sbmuser";
106
	private static final String OPTION_SBM_USER = "sbmuser";
-
 
107
	private static final String OPTION_SBM_PASSWORD = "sbmpassword";
104
	private static final String OPTION_SBM_PASSWORD = "sbmpassword";
108
	private static final String OPTION_SBM_ENCRYPTED = "sbmencrypted";
105
	private static final String OPTION_SBM_TABLE = "querytable";
109
	private static final String OPTION_SBM_TABLE = "querytable";
Line 106... Line 110...
106
	private static final String OPTION_SBM_QUERY = "query";
110
	private static final String OPTION_SBM_QUERY = "query";
107
 
111
 
Line 130... Line 134...
130
	private static final String PARAM_TXN = "txn";
134
	private static final String PARAM_TXN = "txn";
131
	private static final String PARAM_REV = "rev";
135
	private static final String PARAM_REV = "rev";
132
	private static final String PARAM_CONFIG = "conf";
136
	private static final String PARAM_CONFIG = "conf";
Line 133... Line 137...
133
	
137
	
134
	//
-
 
135
	//
-
 
136
	//
-
 
137
	private static final String CACHE_SBMPORT = "sbmappservices72";
-
 
138
	
-
 
139
	//
138
	//
140
	// Member variables
139
	// Member variables
141
	//
140
	//
142
	private final String repos;
141
	private final String repos;
143
	private final String txn;
142
	private final String txn;
Line 149... Line 148...
149
	private final long startTime;
148
	private final long startTime;
Line 150... Line 149...
150
	
149
	
151
	//Member for SBM endpoint configuration
150
	//Member for SBM endpoint configuration
152
	private final String endpoint;
151
	private final String endpoint;
153
	private final String sbm_user;
152
	private final String sbm_user;
154
	private final String sbm_pass;
153
	private String sbm_pass;
155
	private final String querytable;
154
	private final String querytable;
Line 156... Line 155...
156
	private final String query;
155
	private final String query;
Line 193... Line 192...
193
	 * Read a configuration parameter from the config file
192
	 * Read a configuration parameter from the config file
194
	 * Creates log messages according to parameters.
193
	 * Creates log messages according to parameters.
195
	 * 
194
	 * 
196
	 * @param key				property name
195
	 * @param key				property name
197
	 * @param defaultValue		default value or null
196
	 * @param defaultValue		default value or null
198
	 * @param isRequired		wether or not this is a required option
197
	 * @param isRequired		whether or not this is a required option
199
	 * @param logmessage		optional log message (or null)
198
	 * @param logmessage		optional log message (or null)
200
	 * @return					property value
199
	 * @return					property value
201
	 * @throws ConfigurationException
200
	 * @throws ConfigurationException
202
	 */
201
	 */
203
	private Object readConfProperty(String key, Object defaultValue, boolean isRequired, PropertyType type, String logmessage) throws ConfigurationException {
202
	private Object readConfProperty(String key, Object defaultValue, boolean isRequired, PropertyType type, String logmessage) throws ConfigurationException {
Line 326... Line 325...
326
			/*
325
			/*
327
			 * Verification phase
326
			 * Verification phase
328
			 */
327
			 */
329
			boolean isTrace = false;
328
			boolean isTrace = false;
330
			if(isWithVerification) {
329
			if(isWithVerification) {
-
 
330
				boolean isEncrypted;
-
 
331
				isEncrypted					=	readConfPropertyAsBoolean(OPTION_SBM_ENCRYPTED, false, false, null);
331
				sbm_user 					= 	readConfPropertyAsString(OPTION_SBM_USER, null, true, null);
332
				sbm_user 					= 	readConfPropertyAsString(OPTION_SBM_USER, null, true, null);
332
				sbm_pass 					= 	readConfPropertyAsString(OPTION_SBM_PASSWORD, null, false, null);
333
				sbm_pass 					= 	readConfPropertyAsString(OPTION_SBM_PASSWORD, null, false, null);
-
 
334
				if(isEncrypted) sbm_pass = PasswordEncrypter.decrypt(sbm_pass);
333
				endpoint					= 	readConfPropertyAsString(OPTION_SBM_ENDPOINT, "http://localhost/gsoap/gsoap_ssl.dll?sbmappservices72", true, null);
335
				endpoint					= 	readConfPropertyAsString(OPTION_SBM_ENDPOINT, "http://localhost/gsoap/gsoap_ssl.dll?sbmappservices72", true, null);
334
				querytable					= 	readConfPropertyAsString(OPTION_SBM_TABLE, null, true, null);
336
				querytable					= 	readConfPropertyAsString(OPTION_SBM_TABLE, null, true, null);
335
				query						= 	readConfPropertyAsString(OPTION_SBM_QUERY, null, false, null);
337
				query						= 	readConfPropertyAsString(OPTION_SBM_QUERY, null, false, null);
336
				isTrace						=	readConfPropertyAsBoolean(OPTION_IS_WSTRACE, false, true, null);
338
				isTrace						=	readConfPropertyAsBoolean(OPTION_IS_WSTRACE, false, true, null);
Line 468... Line 470...
468
			}
470
			}
469
		}
471
		}
Line 470... Line 472...
470
	
472
	
471
		private void addALFSecurity() throws ConfigurationException, JaxenException {
473
		private void addALFSecurity() throws ConfigurationException, JaxenException {
472
			final String eventmanager_user 	= 	readConfPropertyAsString(OPTION_EVENTMANAGER_USER, null, false, null);
474
			final String eventmanager_user 	= 	readConfPropertyAsString(OPTION_EVENTMANAGER_USER, null, false, null);
-
 
475
			String eventmanager_pass 	= 	readConfPropertyAsString(OPTION_EVENTMANAGER_PASSWORD, null, false, null);
-
 
476
			final boolean eventmanager_enc  =   readConfPropertyAsBoolean(OPTION_EVENTMANAGER_ENCRYPTED, false, false, null);
-
 
477
			if(eventmanager_enc) eventmanager_pass = PasswordEncrypter.decrypt(eventmanager_pass);
473
			final String eventmanager_pass 	= 	readConfPropertyAsString(OPTION_EVENTMANAGER_PASSWORD, null, false, null);
478
			
474
			AXIOMXPath path = new AXIOMXPath("//bru1:User");
479
			AXIOMXPath path = new AXIOMXPath("//bru1:User");
475
			OMNamespace ns = template.findNamespace(nss, null);
480
			OMNamespace ns = template.findNamespace(nss, null);
476
			path.addNamespace("bru1", nss);
481
			path.addNamespace("bru1", nss);
477
			OMElement n = (OMElement) path.selectSingleNode(template);
482
			OMElement n = (OMElement) path.selectSingleNode(template);
Line 559... Line 564...
559
		
564
		
560
		
565
		
561
		private TTItemList getTTItems(String issueid, boolean isTrace) throws MalformedURLException {
566
		private TTItemList getTTItems(String issueid, boolean isTrace) throws MalformedURLException {
562
			long startTime = System.currentTimeMillis();
-
 
563
			Sbmappservices72PortType port = null;
-
 
564
			//try {
-
 
565
			//	JCS cache = JCS.getInstance("FileCache");
-
 
566
 
-
 
567
				/* -- */
-
 
568
			//	port = (Sbmappservices72PortType)cache.get(CACHE_SBMPORT);
-
 
569
			/*
-
 
570
				if(port==null) {
-
 
571
					Sbmappservices72 ss = new Sbmappservices72(ClassLoader.getSystemResource("sbmappservices72.wsdl") );
-
 
572
					
-
 
573
					port = ss.getSbmappservices72();
-
 
574
 
-
 
575
					
-
 
576
					BindingProvider bindingProvider = (BindingProvider) port;
-
 
577
			        bindingProvider.getRequestContext().put(
-
 
578
			        BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
-
 
579
				}
567
			long startTime = System.currentTimeMillis();
580
				*/
568
			Sbmappservices72PortType port = null;
581
		    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
569
		    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
582
		    factory.setServiceClass(Sbmappservices72PortType.class);
570
		    factory.setServiceClass(Sbmappservices72PortType.class);
583
		    factory.setAddress(endpoint);
571
		    factory.setAddress(endpoint);
Line 584... Line 572...
584
		    port = (Sbmappservices72PortType) factory.create();
572
		    port = (Sbmappservices72PortType) factory.create();
585
		    logger.debug("Total execution of sbmappservices72 wsdl read took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
-
 
586
		 
-
 
587
			        
-
 
588
			//		cache.put(CACHE_SBMPORT, port);
-
 
589
			//		cache.dispose();
-
 
590
			//	} else {
-
 
591
			//		logger.debug("sbmappservices72 port was read from cache.");
-
 
592
			//	}
-
 
593
				
-
 
594
			//} catch (CacheException e1) {
-
 
595
			//	// TODO Auto-generated catch block
-
 
596
			//	e1.printStackTrace();
-
 
597
			//	this.exit(1);
573
		    logger.debug("Total execution of sbmappservices72 wsdl read took '"+(System.currentTimeMillis()-startTime)+"' milliseconds.");
598
			//}
574
		 
599
			
575
			        	
600
			if(isTrace) {
576
			if(isTrace) {
601
				Client client = ClientProxy.getClient(port);
577
				Client client = ClientProxy.getClient(port);