Project

General

Profile

« Previous | Next » 

Revision 4247

use "local" services when none are provided in the properties file

View differences:

src/edu/ucsb/nceas/metacat/dataquery/ConfigurableAuthenticatedEcogridEndPoint.java
51 51
	private String sessionId = null;
52 52
	
53 53
	public ConfigurableAuthenticatedEcogridEndPoint() {
54
		
55
		try {
56
			metacatAuthenticatedEcogridEndPoint = PropertyService.getProperty("datamanager.endpoint.authenticatedquery");
57
		} catch (PropertyNotFoundException e) {
58
			e.printStackTrace();
54
		super();
55
		if (!loadProperties()) {
56
			metacatAuthenticatedEcogridEndPoint = baseURL + "AuthenticatedQueryService";
59 57
		}
60
		
61 58
	}
62 59
	
63 60
	public ConfigurableAuthenticatedEcogridEndPoint(String sessionId) {
......
65 62
		this.sessionId = sessionId;
66 63
	}
67 64
	
65
	private boolean loadProperties() {
66
		try {
67
			metacatAuthenticatedEcogridEndPoint = PropertyService.getProperty("datamanager.endpoint.authenticatedquery");
68
		} catch (PropertyNotFoundException e) {
69
			//e.printStackTrace();
70
			return false;
71
		}
72
		if (metacatAuthenticatedEcogridEndPoint == null || metacatAuthenticatedEcogridEndPoint.length() == 0) {
73
			return false;
74
		}
75
		return true;
76
	}
77
	
68 78
	 /**
69 79
	    * Gets the end point which Metacat implements authenticated ecogrid interface.
70 80
	    * This end point will be used to handle ecogrid protocol
src/edu/ucsb/nceas/metacat/dataquery/ConfigurableEcogridEndPoint.java
53 53
	private String srbEcogridEndPoint = null;
54 54
	private String srbMachineName = null;
55 55
	
56
	protected String baseURL = null;
57
	
56 58
	public ConfigurableEcogridEndPoint() {
57
		
59
		if (!loadProperties()) {
60
			try {
61
				//use values from server where deployed
62
				baseURL = 
63
					"http://"
64
					+ PropertyService.getProperty("server.name")
65
					+ ":"
66
					+ PropertyService.getProperty("server.httpPort")
67
					+ "/"
68
					+ PropertyService.getProperty("application.context")
69
					+ "/services/";
70
				metacatEcogridEndPoint = baseURL + "QueryService";
71
				metacatEcogridAuthEndPoint = baseURL + "AuthenticationService";
72
				metacatEcogridPutEndPoint = baseURL + "PutService";
73
				metacatEcogridIdentifierEndPoint = baseURL + "IdentificationService";
74
			} catch (PropertyNotFoundException e) {
75
				//we are SOL now
76
				e.printStackTrace();
77
			}
78
		}	
79
	}
80
	
81
	private boolean loadProperties() {
58 82
		try {
59 83
			metacatEcogridEndPoint 				= PropertyService.getProperty("datamanager.endpoint.query");
60 84
			metacatEcogridAuthEndPoint 			= PropertyService.getProperty("datamanager.endpoint.authentication");
......
63 87
			srbEcogridEndPoint 					= PropertyService.getProperty("datamanager.srb.endpoint");
64 88
			srbMachineName 						= PropertyService.getProperty("datamanager.srb.machinename");
65 89
		} catch (PropertyNotFoundException e) {
66
			e.printStackTrace();
90
			//e.printStackTrace();
91
			return false;
67 92
		}
68
		
93
		if (metacatEcogridEndPoint == null || metacatEcogridEndPoint.length() == 0) {
94
			return false;
95
		}
96
		return true;
69 97
	}
70
	
71 98
	 /**
72 99
	    * Gets the end point which Metacat implements ecogrid interface.
73 100
	    * This end point will be used to handle ecogrid protocol

Also available in: Unified diff