Project

General

Profile

« Previous | Next » 

Revision 46923

Copying project to move to java 8

View differences:

modules/uoa-utils/trunk/deploy.info
1
{
2
  "type_source": "SVN", 
3
  "goal": "package -U -T 4C source:jar", 
4
  "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-utils/trunk", 
5
  "deploy_repository": "dnet4-snapshots", 
6
  "version": "4", 
7
  "mail": "antleb@di.uoa.gr, kiatrop@di.uoa.gr", 
8
  "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", 
9
  "name": "uoa-utils"
10
}
modules/uoa-utils/trunk/src/test/java/eu/dnetlib/utils/parser/text.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<result xmlns:dri="http://www.driver-repository.eu/namespace/dri" xmlns:oaf="http://namespace.openaire.eu/oaf" xmlns:dc="http://purl.org/dc/elements/1.1/" type="result">
3
   <field name="resultId" multiplicity="false" indexId="objIdentifier" label="Object id" value="WOS:000277866500014"/>
4
   <field name="title" indexId="resulttitle" multiplicity="true" label="Title" value="Analysis of cell viability in intervertebral disc: Effect of endplate permeability on cell population"/>
5
   <field name="subject" indexId="resultsubject" multiplicity="true" label="Subject(s)" value="Biophysics"/>
6
   <field name="subject" indexId="resultsubject" multiplicity="true" label="Subject(s)" value="Engineering, Biomedical"/>
7
   <field name="dateofacceptance" indexId="resultdateofacceptance" multiplicity="true" label="Date of acceptance" value="2010-01-01"/>
8
   <field name="description" indexId="resultdescription" multiplicity="true" label="Description" value="Responsible for making and maintaining the extracellular matrix, the cells of intervertebral discs are supplied with essential nutrients by diffusion from the blood supply through mainly the cartilaginous endplates (CEPs) and disc tissue. Decrease in transport rate and increase in cellular activity may adversely disturb the intricate supply-demand balance leading ultimately to cell death and disc degeneration. The present numerical study aimed to introduce for the first time cell viability criteria into nonlinear coupled nutrition transport equations thereby evaluating the dynamic nutritional processes governing viable cell population and concentrations of oxygen, glucose and lactic acid in the disc as CEP exchange area dropped from a fully permeable condition to an almost impermeable one. A uniaxial model of an in vitro cell culture analogue of the disc is first employed to examine and validate cell viability criteria. An axisymmetric model of the disc with four distinct regions was subsequently used to investigate the survival of cells at different CEP exchange areas. In agreement with measurements, predictions of the diffusion chamber model demonstrated substantial cell death as essential nutrient concentrations fell to levels too low to support cells. Cells died away from the nutrient supply and at higher cell densities. In the disc model, the nucleus region being farthest away from supply sources was most affected; cell death initiated first as CEP exchange area dropped below similar to 40% and continued exponentially thereafter to depletion as CEP calcified further. In cases with loss of endplate permeability and/or disruptions therein, as well as changes in geometry and fall in diffusivity associated with fluid outflow, the nutrient concentrations could fall to levels inadequate to maintain cellular activity or viability, resulting in cell death and disc degeneration. (C) 2010 Elsevier Ltd. All rights reserved."/>
9
   <field name="publisher" indexId="resultpublisher" multiplicity="true" label="Publisher(s)" value="ELSEVIER SCI LTD"/>
10
   <field name="typeclass" indexId="resulttypeclass" multiplicity="true" label="Type class" value="0001"/>
11
   <field name="language" indexId="resultlanguage" multiplicity="true" label="Language(s)" value="eng"/>
12
   <field name="rights" indexId="resultrights" multiplicity="true" label="Acces mode" value="Closed Access"/>
13
   <field name="type" indexId="resulttype" multiplicity="true" label="Type" value="Article"/>
14
   <field name="booleanValue" indexId="resulttype" multiplicity="true" label="Type" value="wrongvalue"/>
15
   <field name="compliancy" indexId="resulttype" multiplicity="true" label="Type" value="true"/>
16
   <field name="odnumberofitemsdate" indexId="datasourceodnumberofitemsdate" multiplicity="true" label="date" value="2012-10-30"/>
17
   <field name="author" indexId="" multiplicity="true">
18
      <field name="personId" indexId="relpersonid" multiplicity="false" label="Person id" value="WOS:000277866500014_A._Shirazi-Adl"/>
19
      <field name="fullname" indexId="relperson" multiplicity="false" label="Person fullname" value="A. Shirazi-Adl"/>
20
   </field>
21
   <field name="author" indexId="" multiplicity="true">
22
      <field name="personId" indexId="relpersonid" multiplicity="false" label="Person id" value="WOS:000277866500014_M._Taheri"/>
23
      <field name="fullname" indexId="relperson" multiplicity="false" label="Person fullname" value="M. Taheri"/>
24
   </field>
25
   <field name="author" indexId="" multiplicity="true">
26
      <field name="personId" indexId="relpersonid" multiplicity="false" label="Person id" value="WOS:000277866500014_J._P._G._Urban"/>
27
      <field name="fullname" indexId="relperson" multiplicity="false" label="Person fullname" value="J. P. G. Urban"/>
28
   </field>
29
   <field name="project" indexId="" multiplicity="true">
30
      <field name="project id" indexId="relprojectid" multiplicity="false" label="Project id" value="ec::201626"/>
31
      <field name="projectname" indexId="relprojectname" multiplicity="false" label="Project(s)" value="GENODISC"/>
32
      <field name="projectdescription" indexId="relprojectdescription" multiplicity="false" label="Project description" value="Disc-degeneration linked pathologies: novel biomarkers and diagnostics for targeting treatment and repair"/>
33
      <field name="projectcontracttypeclass" indexId="???" multiplicity="false" label="Project contract type class" value="CP"/>
34
      <field name="projectcontracttypescheme" indexId="???" multiplicity="false" label="Project contract type scheme" value="ec:FP7contractTypes"/>
35
   </field>
36
   <field name="project" indexId="" multiplicity="true">
37
		<field name="project id" indexId="objIdentifier" multiplicity="false" label="Project id" value="ec::216444"/>
38
		<field name="projectcode" indexId="projectcode" multiplicity="false" label="Project(s)" value="216444"/>
39
		<field name="projectacronym" indexId="projectacronym" multiplicity="false" label="Project(s)" value="PETAMEDIA"/>
40
		<field name="projecttitle" indexId="projecttitle" multiplicity="false" label="Project title" value="PEer-to-peer TAgged MEDIA"/>
41
		<field name="projectcontracttypeid" indexId="projectcontracttypeid" multiplicity="false" label="Project contract type id" value="NoE"/>
42
		<field name="projectcontracttypename" indexId="projectcontracttypename" multiplicity="false" label="Project contract type name" value="Network of Excellence"/>
43
	</field>
44
   <field name="repository" indexId="" multiplicity="true">
45
      <field name="instanceId" indexId="" multiplicity="false" value="WOS:000277866500014"/>
46
      <field name="datasource" indexId="" multiplicity="true">
47
         <field name="hostedby" indexId="resulthostingdatasourceid" multiplicity="false" value="openaire"/>
48
         <field name="collectedfrom" indexId="resultcollectedfromdatasourceid" multiplicity="false" value=""/>
49
      </field>
50
      <field name="identifier" indexId="resultidentifier" multiplicity="true" value="http://dx.doi.org/10.1016/j.jbiomech.2010.01.023"/>
51
   </field>
52
</result>
modules/uoa-utils/trunk/src/test/java/eu/dnetlib/utils/parser/ParserTest.java
1
package eu.dnetlib.utils.parser;
2

  
3
import static org.junit.Assert.assertEquals;
4
import static org.junit.Assert.assertNotNull;
5
import static org.junit.Assert.assertNull;
6

  
7
import javax.xml.xpath.XPathExpressionException;
8

  
9
import org.junit.Before;
10
import org.junit.Test;
11

  
12

  
13
public class ParserTest {
14

  
15
	private String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result xmlns:dri=\"http://www.driver-repository.eu/namespace/dri\" xmlns:oaf=\"http://namespace.openaire.eu/oaf\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" type=\"result\">   <field name=\"resultId\" multiplicity=\"false\" indexId=\"objIdentifier\" label=\"Object id\" value=\"WOS:000277866500014\"/>   <field name=\"title\" indexId=\"resulttitle\" multiplicity=\"true\" label=\"Title\" value=\"Analysis of cell viability in intervertebral disc: Effect of endplate permeability on cell population\"/>   <field name=\"subject\" indexId=\"resultsubject\" multiplicity=\"true\" label=\"Subject(s)\" value=\"Biophysics\"/>   <field name=\"subject\" indexId=\"resultsubject\" multiplicity=\"true\" label=\"Subject(s)\" value=\"Engineering, Biomedical\"/>   <field name=\"dateofacceptance\" indexId=\"resultdateofacceptance\" multiplicity=\"true\" label=\"Date of acceptance\" value=\"2010-01-01\"/>   <field name=\"description\" indexId=\"resultdescription\" multiplicity=\"true\" label=\"Description\" value=\"Responsible for making and maintaining the extracellular matrix, the cells of intervertebral discs are supplied with essential nutrients by diffusion from the blood supply through mainly the cartilaginous endplates (CEPs) and disc tissue. Decrease in transport rate and increase in cellular activity may adversely disturb the intricate supply-demand balance leading ultimately to cell death and disc degeneration. The present numerical study aimed to introduce for the first time cell viability criteria into nonlinear coupled nutrition transport equations thereby evaluating the dynamic nutritional processes governing viable cell population and concentrations of oxygen, glucose and lactic acid in the disc as CEP exchange area dropped from a fully permeable condition to an almost impermeable one. A uniaxial model of an in vitro cell culture analogue of the disc is first employed to examine and validate cell viability criteria. An axisymmetric model of the disc with four distinct regions was subsequently used to investigate the survival of cells at different CEP exchange areas. In agreement with measurements, predictions of the diffusion chamber model demonstrated substantial cell death as essential nutrient concentrations fell to levels too low to support cells. Cells died away from the nutrient supply and at higher cell densities. In the disc model, the nucleus region being farthest away from supply sources was most affected; cell death initiated first as CEP exchange area dropped below similar to 40% and continued exponentially thereafter to depletion as CEP calcified further. In cases with loss of endplate permeability and/or disruptions therein, as well as changes in geometry and fall in diffusivity associated with fluid outflow, the nutrient concentrations could fall to levels inadequate to maintain cellular activity or viability, resulting in cell death and disc degeneration. (C) 2010 Elsevier Ltd. All rights reserved.\"/>   <field name=\"publisher\" indexId=\"resultpublisher\" multiplicity=\"true\" label=\"Publisher(s)\" value=\"ELSEVIER SCI LTD\"/>   <field name=\"typeclass\" indexId=\"resulttypeclass\" multiplicity=\"true\" label=\"Type class\" value=\"0001\"/>   <field name=\"language\" indexId=\"resultlanguage\" multiplicity=\"true\" label=\"Language(s)\" value=\"eng\"/>   <field name=\"rights\" indexId=\"resultrights\" multiplicity=\"true\" label=\"Acces mode\" value=\"Closed Access\"/>   <field name=\"type\" indexId=\"resulttype\" multiplicity=\"true\" label=\"Type\" value=\"Article\"/>   " + 
16
	"<field name=\"author\" indexId=\"\" multiplicity=\"true\" value=\"WOS:000277866500014_A._Shirazi-Adl\">" +
17
		" <field name=\"personId\" indexId=\"relpersonid\" multiplicity=\"false\" label=\"Person id\" value=\"WOS:000277866500014_A._Shirazi-Adl\"/>" +
18
		" <field name=\"fullname\" indexId=\"relperson\" multiplicity=\"false\" label=\"Person fullname\" value=\"A. Shirazi-Adl\"/>  " +
19
	" </field> " +
20
	"<field name=\"author\" indexId=\"objIdentifier\" multiplicity=\"true\" value=\"WOS:000292086400014_Yuriy_I._Prostov\">" +
21
			"<field name=\"personId\" indexId=\"objIdentifier\" multiplicity=\"false\" label=\"Person id\" value=\"WOS:000292086400014_Yuriy_I._Prostov\"/>" +
22
			"<field name=\"role\" indexId=\"\" multiplicity=\"false\" label=\"role\" value=\"author\"/>" +
23
			"<field name=\"fullname\" indexId=\"personfullname\" multiplicity=\"false\" label=\"Person fullname\" value=\"Prostov, Yuriy I.\"/>" +
24
			"<field name=\"ranking\" indexId=\"\" multiplicity=\"false\" label=\"ranking\" value=\"3\"/>" +
25
	"</field>" +
26
	"<field name=\"author\" indexId=\"objIdentifier\" multiplicity=\"true\" value=\"WOS:000292086400014_Duc-Truong_Pham\">" +
27
		"<field name=\"personId\" indexId=\"objIdentifier\" multiplicity=\"false\" label=\"Person id\" value=\"WOS:000292086400014_Duc-Truong_Pham\"/>" +
28
		"<field name=\"role\" indexId=\"\" multiplicity=\"false\" label=\"role\" value=\"author\"/>" +
29
		"<field name=\"fullname\" indexId=\"personfullname\" multiplicity=\"false\" label=\"Person fullname\" value=\"Pham, Duc-Truong\"/>" +
30
		"<field name=\"ranking\" indexId=\"\" multiplicity=\"false\" label=\"ranking\" value=\"1\"/>" +
31
	"</field>" +
32
	"<field name=\"author\" indexId=\"objIdentifier\" multiplicity=\"true\" value=\"WOS:000292086400014_Maria_M._Suarez-Alvarez\">" +
33
		"<field name=\"personId\" indexId=\"objIdentifier\" multiplicity=\"false\" label=\"Person id\" value=\"WOS:000292086400014_Maria_M._Suarez-Alvarez\"/>" +
34
		"<field name=\"role\" indexId=\"\" multiplicity=\"false\" label=\"role\" value=\"author\"/>" +
35
		"<field name=\"fullname\" indexId=\"personfullname\" multiplicity=\"false\" label=\"Person fullname\" value=\"Suarez-Alvarez, Maria M.\"/>" +
36
		"<field name=\"ranking\" indexId=\"\" multiplicity=\"false\" label=\"ranking\" value=\"2\"/>"+
37
	"</field>" +	
38
	"<field name=\"project\" indexId=\"objIdentifier\" multiplicity=\"true\" value=\"ec::216444\">" +
39
		"<field name=\"projectid\" indexId=\"relprojectid\" multiplicity=\"false\" label=\"Project id\" value=\"ec::201626\"/>      " +
40
		"<field name=\"projectname\" indexId=\"relprojectname\" multiplicity=\"false\" label=\"Project(s)\" value=\"GENODISC\"/>      " +
41
		"<field name=\"projectdescription\" indexId=\"relprojectdescription\" multiplicity=\"false\" label=\"Project description\" value=\"Disc-degeneration linked pathologies: novel biomarkers and diagnostics for targeting treatment and repair\"/>      " +
42
		"<field name=\"projectcontracttypeclass\" indexId=\"???\" multiplicity=\"false\" label=\"Project contract type class\" value=\"CP\"/>      " +
43
		"<field name=\"projectcontracttypescheme\" indexId=\"???\" multiplicity=\"false\" label=\"Project contract type scheme\" value=\"ec:FP7contractTypes\"/>   " +
44
	"</field>   " +
45
	"<field name=\"project\" indexId=\"objIdentifier\" multiplicity=\"true\" value=\"ec::224853\">" +
46
		"<field name=\"projectid\" indexId=\"objIdentifier\" multiplicity=\"false\" label=\"Project id\" value=\"ec::216444\"/>" +
47
		"<field name=\"projectcode\" indexId=\"projectcode\" multiplicity=\"false\" label=\"Project(s)\" value=\"216444\"/>" +
48
		"<field name=\"projectacronym\" indexId=\"projectacronym\" multiplicity=\"false\" label=\"Project(s)\" value=\"PETAMEDIA\"/>" +
49
		"<field name=\"projecttitle\" indexId=\"projecttitle\" multiplicity=\"false\" label=\"Project title\" value=\"PEer-to-peer TAgged MEDIA\"/>" +
50
		"<field name=\"projectcontracttypeid\" indexId=\"projectcontracttypeid\" multiplicity=\"false\" label=\"Project contract type id\" value=\"NoE\"/>" +
51
		"<field name=\"projectcontracttypename\" indexId=\"projectcontracttypename\" multiplicity=\"false\" label=\"Project contract type name\" value=\"Network of Excellence\"/>" +
52
	"</field>" +
53
	
54
	"<field name=\"repository\" indexId=\"\" multiplicity=\"true\">      " +
55
		"<field name=\"instanceId\" indexId=\"\" multiplicity=\"false\" value=\"WOS:000277866500014\"/>      " +
56
			"<field name=\"datasource\" indexId=\"\" multiplicity=\"true\">         " +
57
			"<field name=\"hostedby\" indexId=\"resulthostingdatasourceid\" multiplicity=\"false\" value=\"\"/>         " +
58
			"<field name=\"collectedfrom\" indexId=\"resultcollectedfromdatasourceid\" multiplicity=\"false\" value=\"openaire\"/>     " +
59
		"</field>      " +
60
		"<field name=\"identifier\" indexId=\"resultidentifier\" multiplicity=\"true\" value=\"http://dx.doi.org/10.1016/j.jbiomech.2010.01.023\"/>   " +
61
	"</field>" +
62
	
63
	"<field name=\"booleanValue\" indexId=\"resulttype\" multiplicity=\"true\" label=\"Type\" value=\"wrongvalue\"/>" +
64
	"<field name=\"compliancy\" indexId=\"resulttype\" multiplicity=\"true\" label=\"Type\" value=\"true\"/>" +
65
	"<field name=\"odnumberofitemsdate\" indexId=\"datasourceodnumberofitemsdate\" multiplicity=\"true\" label=\"date\" value=\"2012-10-30\"/>" +
66
	"<field name=\"odnumberofitems\" indexId=\"datasourceodnumberofitems\" multiplicity=\"true\" label=\"number of items\" value=\"9767\"/>" +
67
	"<field name=\"numberofitems\" indexId=\"datasourceodnumberofitems\" multiplicity=\"true\" label=\"number of items\" value=\"\"/>" +		   
68
"</result>";
69
	
70
	private Parser parser = null;
71
	
72
	@Before
73
	public void setup() {
74
		parser = new Parser(xml);
75
	}
76
	
77
	@Test
78
	public void getValuesTest() throws XPathExpressionException{
79
		//String existing
80
		assertNotNull(parser.getValues("author.fullname"));
81
		assertEquals(4, parser.getValues("author.fullname").length);
82
		assertEquals("Prostov, Yuriy I.", parser.getValues("author.fullname")[1]);
83
		
84
		//String existing
85
		assertNotNull(parser.getValues("resultId"));
86
		assertEquals(1, parser.getValues("resultId").length);
87
		assertEquals("WOS:000277866500014", parser.getValue("resultId"));
88
		
89
		//String not existing
90
		assertNull(parser.getValue("foo"));
91
		assertNull(parser.getValues("foo"));
92
		
93
		assertEquals("openaire",parser.getValue("repository.datasource.collectedfrom"));		
94
		assertNull(parser.getValue("repository.foo.collectedfrom"));
95
		
96
		//String existing - wrong request		
97
		assertNull(parser.getValue("project", new String[]{"ec::216444"}));
98
		
99
		//String existing - right request
100
		assertEquals("PETAMEDIA", parser.getValue("project.projectacronym", new String[]{"ec::224853"}));
101
		
102
		//String existing - right request
103
		assertEquals("PETAMEDIA", parser.getValue("project.projectacronym",new String[]{"ec::224853"}));
104
		
105
		//String not existing - right request
106
		assertNull(parser.getValue("project.projectname", new String[]{"ec::224853"}));
107
		
108
		//Boolean check
109
		assertNotNull(parser.getBoolean("booleanValue"));
110
		assertEquals(Boolean.FALSE, parser.getBoolean("booleanValue"));
111
		
112
		assertNotNull(parser.getBoolean("compliancy"));
113
		assertEquals(Boolean.TRUE, parser.getBoolean("compliancy"));
114
		
115
		assertNull(parser.getBoolean("notexisting"));
116
		
117
		//Date check
118
		assertNull(parser.getDate("notexisting","wrong-format"));
119
		assertNull(parser.getDate("odnumberofitemsdate","wrong-format"));
120
		
121
		assertNotNull(parser.getDate("odnumberofitemsdate","yyyy-mm-dd"));
122
		
123
		//Integer check
124
		assertNull(parser.getInteger("repository.datasource.collectedfrom"));
125
		assertNotNull(parser.getInteger("odnumberofitems"));
126
		
127
		assertEquals(parser.getInteger("odnumberofitems"), new Integer(9767));
128
		assertNull(parser.getInteger("numberofitems"));
129

  
130
		for (String name :parser.getValues("author")) {
131
			System.out.println(parser.getValue("author.fullname", new String[]{name}));
132
		}
133
	}
134
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/RefreshingServiceLocator.java
1
package gr.uoa.di.driver.util;
2

  
3
import java.util.concurrent.ScheduledExecutorService;
4
import java.util.concurrent.TimeUnit;
5

  
6
import org.apache.log4j.Logger;
7

  
8
import eu.dnetlib.api.DriverService;
9

  
10
/**
11
 * An implementation of the service locator that keeps a cache of the service
12
 * and refreshes it periodically.
13
 * 
14
 * The actual task of service discovery is performed by a locator that is 
15
 * injected. 
16
 * 
17
 * @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
18
 *
19
 * @param <S> the service type
20
 */
21
public class RefreshingServiceLocator<S extends DriverService> implements
22
		ServiceLocator<S> {
23
	/** The locator used to discover the service */
24
	private ServiceLocator<S> locator = null;
25
	/** the cached instance of the service */
26
	private S service = null;
27
	/** the executor that runs the refresh tasks */
28
	private ScheduledExecutorService executor = null;
29
	/** the discovery period in milliseconds*/
30
	private long period = 0;
31

  
32
	@Override
33
	public synchronized S getService() {
34
		if (service == null)
35
			init();
36
		
37
		return service;
38
	}
39

  
40
	/** 
41
	 * Called to initialize the locator. Performs the first service lookup and
42
	 * also schedules the periodic refresh of the cache. 
43
	 * 
44
	 * */
45
	private void init() {
46
		this.service = locator.getService();
47

  
48
		executor.scheduleWithFixedDelay(new RefreshTask(), period, period,
49
				TimeUnit.MILLISECONDS);
50
	}
51

  
52
	/**
53
	 * A very simple runnable that refreshed the cache. No synchronization is
54
	 * needed during cache refresh: The old instance will be returned while the
55
	 * locator is working to refresh the cache.
56
	 * 
57
	 * @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
58
	 *
59
	 */
60
	private class RefreshTask implements Runnable {
61
		private Logger logger = Logger.getLogger(RefreshTask.class);
62

  
63
		@Override
64
		public void run() {
65
			try {
66
				logger.debug("Refreshing service cache");
67
				service = locator.getService();
68
			} catch (Exception e) {
69
				logger.info("Error refreshing service", e);
70
			}
71
		}
72
	}
73

  
74
	public ServiceLocator<S> getLocator() {
75
		return locator;
76
	}
77

  
78
	public void setLocator(ServiceLocator<S> locator) {
79
		this.locator = locator;
80
	}
81

  
82
	public ScheduledExecutorService getExecutor() {
83
		return executor;
84
	}
85

  
86
	public void setExecutor(ScheduledExecutorService executor) {
87
		this.executor = executor;
88
	}
89

  
90
	public long getPeriod() {
91
		return period;
92
	}
93

  
94
	public void setPeriod(long period) {
95
		this.period = period;
96
	}
97
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/FallBackServiceLocator.java
1
package gr.uoa.di.driver.util;
2

  
3
import eu.dnetlib.api.DriverService;
4

  
5
public class FallBackServiceLocator<S extends DriverService>
6
	implements ServiceLocator<S> {
7

  
8
	private ServiceLocator<S> mainLocator = null;
9
	private ServiceLocator<S> fallBackLocator = null;
10
	
11
	@Override
12
	public S getService() {
13
		S service = null;
14
		
15
		if (mainLocator != null)
16
			service = mainLocator.getService();
17
		
18
		if (service == null && fallBackLocator != null)
19
			service = fallBackLocator.getService();
20
		
21
		return service;
22
	}
23

  
24
	public FallBackServiceLocator(ServiceLocator<S> mainLocator,
25
			ServiceLocator<S> fallBackLocator) {
26
		this.mainLocator = mainLocator;
27
		this.fallBackLocator = fallBackLocator;
28
	}
29

  
30
	public void setMainLocator(ServiceLocator<S> mainLocator) {
31
		this.mainLocator = mainLocator;
32
	}
33

  
34
	public void setFallBackLocator(ServiceLocator<S> fallBackLocator) {
35
		this.fallBackLocator = fallBackLocator;
36
	}
37
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/ServiceLocator.java
1
package gr.uoa.di.driver.util;
2

  
3
import eu.dnetlib.api.DriverService;
4

  
5
public interface ServiceLocator<S extends DriverService> {
6
	
7
	public S getService();
8
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/ServiceNameResolverImpl.java
1
package gr.uoa.di.driver.util;
2

  
3
import java.util.HashMap;
4
import java.util.Map;
5

  
6
import eu.dnetlib.api.DriverService;
7
import eu.dnetlib.enabling.tools.registration.ServiceNameResolver;
8

  
9
public class ServiceNameResolverImpl implements ServiceNameResolver {
10
	private Map<Class<?>, String> override = new HashMap<Class<?>, String>();
11

  
12
	@Override
13
	public String getName(Object service) {
14
		return getName(service.getClass());
15
	}
16

  
17
	@Override
18
	public String getName(Class<?> serviceInterface) {
19
		String serviceName = null;
20
		
21
		for (Class<?> i : serviceInterface.getInterfaces()) {
22
			if (DriverService.class.isAssignableFrom(i)) {
23
				if (override.get(i) != null)
24
					serviceName = override.get(i);
25
				else
26
					serviceName = i.getSimpleName();
27
			}
28
		}
29

  
30
		return serviceName;
31
	}
32

  
33
	public Map<Class<?>, String> getOverride() {
34
		return override;
35
	}
36

  
37
	public void setOverride(Map<Class<?>, String> override) {
38
		this.override = override;
39
	}
40
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/ServiceLocatorFactory.java
1
package gr.uoa.di.driver.util;
2

  
3
import eu.dnetlib.api.DriverService;
4

  
5
/**
6
 * A factory to create service locators.
7
 * 
8
 * @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
9
 *
10
 */
11
public interface ServiceLocatorFactory {
12

  
13
	/**
14
	 * Creates a dynamic service locator.
15
	 * 
16
	 * @param <S> the service type.
17
	 * @param serviceClass the service class.
18
	 * @return A service locator for services of type S.
19
	 */
20
	public <S extends DriverService> ServiceLocator<S> newServiceLocator(
21
			Class<S> serviceClass);
22
	
23
	/**
24
	 * Creates a service locator. It can be either static (if serviceUrl != null)
25
	 * or dynamic.
26
	 * 
27
	 * @param <S> the service type.
28
	 * @param serviceClass the service class.
29
	 * @param serviceUrl The service URL.
30
	 * @return A service locator for services of type S.
31
	 */
32
	public <S extends DriverService> ServiceLocator<S> newServiceLocator(
33
			Class<S> serviceClass, String serviceUrl);
34
}
modules/uoa-utils/trunk/src/main/java/gr/uoa/di/driver/util/StaticServiceLocator.java
1
package gr.uoa.di.driver.util;
2

  
3
import eu.dnetlib.api.DriverService;
4

  
5
/**
6
 * An implementation of the ServiceLocator that returns a predefined instance
7
 * of a service.
8
 * 
9
 * Can be used for debug purposes, FallBackLocator or when 2 services A and B 
10
 * are deployed in the same application (in this case, service A will get an 
11
 * instance of a StaticServiceLocator<B> in order to avoid calls to the IS and 
12
 * traversing the whole SOAP stack in order to communicate with B). 
13
 * 
14
 * @author <a href="mailto:antleb@di.uoa.gr">Antonis Lempesis</a>
15
 *
16
 * @param <S>
17
 */
18
public class StaticServiceLocator<S extends DriverService>
19
	implements ServiceLocator<S> {
20
	
21
	private S service = null;
22
	
23
	public StaticServiceLocator() {
24
		
25
	}
26

  
27
	public StaticServiceLocator(S service) {
28
		this.service = service;
29
	}
30
	
31
	@Override
32
	public S getService() {
33
		return service;
34
	}
35

  
36
	public void setService(S service) {
37
		this.service = service;
38
	}
39
}
modules/uoa-utils/trunk/src/main/java/eu/dnetlib/utils/cql/Cql.java
1

  
2
package eu.dnetlib.utils.cql;
3

  
4
import java.io.IOException;
5
import java.io.StringReader;
6

  
7
import org.antlr.runtime.ANTLRReaderStream;
8
import org.antlr.runtime.CommonTokenStream;
9
import org.antlr.runtime.RecognitionException;
10

  
11

  
12
/**
13
 * @author stoumpos
14
 * 
15
 */
16
public class Cql {
17

  
18
	/**
19
	 * Parse cql query in <code>text</code> and return the respective cql
20
	 * query object.
21
	 * 
22
	 * @param text
23
	 *            The cql text.
24
	 * @return The cql tree object.
25
	 */
26
	public static CqlQuery parse(String text) throws CqlException {
27

  
28
		try {
29
			StringReader reader = new StringReader(text);
30
			ANTLRReaderStream input = new ANTLRReaderStream(reader);
31
			CqlLexer lexer = new CqlLexer(input);
32
			CommonTokenStream tokens = new CommonTokenStream(lexer);
33
			CqlParser parser = new CqlParser(tokens);
34
			
35
			CqlQuery query = parser.cql().query;
36
			
37
			return query;
38

  
39
		} catch (IOException ioe) {
40
			throw new CqlException("Error building cql parser.", ioe);
41
			
42
		} catch (RecognitionException re) {
43
			throw new CqlException("Error parsing cql query.", re);
44
			
45
		} catch (CqlRuntimeException cre) {
46
			throw new CqlException("Error parsing cql query.", cre.getCause());			
47
		}
48
	}
49

  
50
	/**
51
	 * Writes <code>query</code> as string. The same functionality is possible
52
	 * through {@link CqlQuery#toString()}.
53
	 * 
54
	 * @param query
55
	 * @return
56
	 */
57
	public static String encode(CqlQuery query) {
58
		return query.toString();
59
	}
60
}
modules/uoa-utils/trunk/src/main/java/eu/dnetlib/utils/cql/CqlBoolean.java
1
/**
2
 * 
3
 */
4
package eu.dnetlib.utils.cql;
5

  
6

  
7

  
8
/**
9
 * @author stoumpos
10
 * 
11
 */
12
public class CqlBoolean extends CqlClause {
13

  
14
	String operator = null;
15
	CqlClause left = null;
16
	CqlClause right = null;
17

  
18
	public CqlBoolean() {
19
		this(null, null, null);
20
	}
21

  
22
	public CqlBoolean(CqlClause left, String operator, CqlClause right) {
23
		super(CqlClauseType.BOOLEAN);
24
		this.operator = operator;
25
		this.left = left;
26
		this.right = right;
27
	}
28

  
29
	public CqlClause getLeft() {
30
		return left;
31
	}
32

  
33
	public void setLeft(CqlClause left) {
34
		this.left = left;
35
	}
36

  
37
	public String getOperator() {
38
		return operator;
39
	}
40

  
41
	public void setOperator(String operator) {
42
		this.operator = operator;
43
	}
44

  
45
	public CqlClause getRight() {
46
		return right;
47
	}
48

  
49
	public void setRight(CqlClause right) {
50
		this.right = right;
51
	}
52
	
53
	@Override
54
	public String toCqlString() {
55
		StringBuffer buffer = new StringBuffer();
56
		buffer.append("(").append(left).append(") ").append(operator);
57
		buffer.append(" (").append(right).append(")");
58
		return buffer.toString();
59
	}
60

  
61
	@Override
62
	public String toNodeString(String prefix) {
63
		StringBuffer buffer = new StringBuffer();
64
		buffer.append(prefix).append(operator).append("\n");
65
		buffer.append(left.toNodeString(prefix + "\t")).append("\n");
66
		buffer.append(right.toNodeString(prefix + "\t")).append("\n");
67
		return buffer.toString();
68
	}
69
}
modules/uoa-utils/trunk/src/main/java/eu/dnetlib/utils/cql/CqlLexer.java
1
// $ANTLR 3.0.1 Cql.g3 2013-07-19 13:56:26
2

  
3
	package eu.dnetlib.utils.cql;
4

  
5

  
6
import org.antlr.runtime.*;
7
import java.util.Stack;
8
import java.util.List;
9
import java.util.ArrayList;
10

  
11
public class CqlLexer extends Lexer {
12
    public static final int PROX=7;
13
    public static final int WHITESPACE=15;
14
    public static final int NOT=6;
15
    public static final int AND=4;
16
    public static final int Tokens=25;
17
    public static final int T24=24;
18
    public static final int EOF=-1;
19
    public static final int T23=23;
20
    public static final int T22=22;
21
    public static final int T21=21;
22
    public static final int T20=20;
23
    public static final int QUOTE=14;
24
    public static final int ANY=11;
25
    public static final int IDENTIFIER=12;
26
    public static final int ALL=10;
27
    public static final int OR=5;
28
    public static final int WITHIN=8;
29
    public static final int EXACT=9;
30
    public static final int T16=16;
31
    public static final int T17=17;
32
    public static final int T18=18;
33
    public static final int T19=19;
34
    public static final int STRING=13;
35

  
36
      @Override
37
      public void reportError(RecognitionException e) {
38
        throw new CqlRuntimeException("Lexer Error", e);
39
      }
40

  
41
    public CqlLexer() {;} 
42
    public CqlLexer(CharStream input) {
43
        super(input);
44
    }
45
    public String getGrammarFileName() { return "Cql.g3"; }
46

  
47
    // $ANTLR start T16
48
    public final void mT16() throws RecognitionException {
49
        try {
50
            int _type = T16;
51
            // Cql.g3:16:5: ( '>' )
52
            // Cql.g3:16:7: '>'
53
            {
54
            match('>'); 
55

  
56
            }
57

  
58
            this.type = _type;
59
        }
60
        finally {
61
        }
62
    }
63
    // $ANTLR end T16
64

  
65
    // $ANTLR start T17
66
    public final void mT17() throws RecognitionException {
67
        try {
68
            int _type = T17;
69
            // Cql.g3:17:5: ( '=' )
70
            // Cql.g3:17:7: '='
71
            {
72
            match('='); 
73

  
74
            }
75

  
76
            this.type = _type;
77
        }
78
        finally {
79
        }
80
    }
81
    // $ANTLR end T17
82

  
83
    // $ANTLR start T18
84
    public final void mT18() throws RecognitionException {
85
        try {
86
            int _type = T18;
87
            // Cql.g3:18:5: ( '/' )
88
            // Cql.g3:18:7: '/'
89
            {
90
            match('/'); 
91

  
92
            }
93

  
94
            this.type = _type;
95
        }
96
        finally {
97
        }
98
    }
99
    // $ANTLR end T18
100

  
101
    // $ANTLR start T19
102
    public final void mT19() throws RecognitionException {
103
        try {
104
            int _type = T19;
105
            // Cql.g3:19:5: ( '(' )
106
            // Cql.g3:19:7: '('
107
            {
108
            match('('); 
109

  
110
            }
111

  
112
            this.type = _type;
113
        }
114
        finally {
115
        }
116
    }
117
    // $ANTLR end T19
118

  
119
    // $ANTLR start T20
120
    public final void mT20() throws RecognitionException {
121
        try {
122
            int _type = T20;
123
            // Cql.g3:20:5: ( ')' )
124
            // Cql.g3:20:7: ')'
125
            {
126
            match(')'); 
127

  
128
            }
129

  
130
            this.type = _type;
131
        }
132
        finally {
133
        }
134
    }
135
    // $ANTLR end T20
136

  
137
    // $ANTLR start T21
138
    public final void mT21() throws RecognitionException {
139
        try {
140
            int _type = T21;
141
            // Cql.g3:21:5: ( '<' )
142
            // Cql.g3:21:7: '<'
143
            {
144
            match('<'); 
145

  
146
            }
147

  
148
            this.type = _type;
149
        }
150
        finally {
151
        }
152
    }
153
    // $ANTLR end T21
154

  
155
    // $ANTLR start T22
156
    public final void mT22() throws RecognitionException {
157
        try {
158
            int _type = T22;
159
            // Cql.g3:22:5: ( '>=' )
160
            // Cql.g3:22:7: '>='
161
            {
162
            match(">="); 
163

  
164

  
165
            }
166

  
167
            this.type = _type;
168
        }
169
        finally {
170
        }
171
    }
172
    // $ANTLR end T22
173

  
174
    // $ANTLR start T23
175
    public final void mT23() throws RecognitionException {
176
        try {
177
            int _type = T23;
178
            // Cql.g3:23:5: ( '<=' )
179
            // Cql.g3:23:7: '<='
180
            {
181
            match("<="); 
182

  
183

  
184
            }
185

  
186
            this.type = _type;
187
        }
188
        finally {
189
        }
190
    }
191
    // $ANTLR end T23
192

  
193
    // $ANTLR start T24
194
    public final void mT24() throws RecognitionException {
195
        try {
196
            int _type = T24;
197
            // Cql.g3:24:5: ( '<>' )
198
            // Cql.g3:24:7: '<>'
199
            {
200
            match("<>"); 
201

  
202

  
203
            }
204

  
205
            this.type = _type;
206
        }
207
        finally {
208
        }
209
    }
210
    // $ANTLR end T24
211

  
212
    // $ANTLR start QUOTE
213
    public final void mQUOTE() throws RecognitionException {
214
        try {
215
            int _type = QUOTE;
216
            // Cql.g3:118:7: ( '\"' )
217
            // Cql.g3:118:9: '\"'
218
            {
219
            match('\"'); 
220

  
221
            }
222

  
223
            this.type = _type;
224
        }
225
        finally {
226
        }
227
    }
228
    // $ANTLR end QUOTE
229

  
230
    // $ANTLR start WHITESPACE
231
    public final void mWHITESPACE() throws RecognitionException {
232
        try {
233
            int _type = WHITESPACE;
234
            // Cql.g3:119:12: ( ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' ) )
235
            // Cql.g3:119:14: ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' )
236
            {
237
            if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) {
238
                input.consume();
239

  
240
            }
241
            else {
242
                MismatchedSetException mse =
243
                    new MismatchedSetException(null,input);
244
                recover(mse);    throw mse;
245
            }
246

  
247
            skip();
248

  
249
            }
250

  
251
            this.type = _type;
252
        }
253
        finally {
254
        }
255
    }
256
    // $ANTLR end WHITESPACE
257

  
258
    // $ANTLR start STRING
259
    public final void mSTRING() throws RecognitionException {
260
        try {
261
            int _type = STRING;
262
            // Cql.g3:129:8: ( QUOTE ( '\\\\' QUOTE | ~ ( QUOTE ) )* QUOTE )
263
            // Cql.g3:130:3: QUOTE ( '\\\\' QUOTE | ~ ( QUOTE ) )* QUOTE
264
            {
265
            mQUOTE(); 
266
            // Cql.g3:130:10: ( '\\\\' QUOTE | ~ ( QUOTE ) )*
267
            loop1:
268
            do {
269
                int alt1=3;
270
                int LA1_0 = input.LA(1);
271

  
272
                if ( (LA1_0=='\\') ) {
273
                    int LA1_2 = input.LA(2);
274

  
275
                    if ( (LA1_2=='\"') ) {
276
                        int LA1_4 = input.LA(3);
277

  
278
                        if ( ((LA1_4>='\u0000' && LA1_4<='\uFFFE')) ) {
279
                            alt1=1;
280
                        }
281

  
282
                        else {
283
                            alt1=2;
284
                        }
285

  
286
                    }
287
                    else if ( ((LA1_2>='\u0000' && LA1_2<='!')||(LA1_2>='#' && LA1_2<='\uFFFE')) ) {
288
                        alt1=2;
289
                    }
290

  
291

  
292
                }
293
                else if ( ((LA1_0>='\u0000' && LA1_0<='!')||(LA1_0>='#' && LA1_0<='[')||(LA1_0>=']' && LA1_0<='\uFFFE')) ) {
294
                    alt1=2;
295
                }
296

  
297

  
298
                switch (alt1) {
299
            	case 1 :
300
            	    // Cql.g3:130:12: '\\\\' QUOTE
301
            	    {
302
            	    match('\\'); 
303
            	    mQUOTE(); 
304

  
305
            	    }
306
            	    break;
307
            	case 2 :
308
            	    // Cql.g3:130:26: ~ ( QUOTE )
309
            	    {
310
            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='\uFFFE') ) {
311
            	        input.consume();
312

  
313
            	    }
314
            	    else {
315
            	        MismatchedSetException mse =
316
            	            new MismatchedSetException(null,input);
317
            	        recover(mse);    throw mse;
318
            	    }
319

  
320

  
321
            	    }
322
            	    break;
323

  
324
            	default :
325
            	    break loop1;
326
                }
327
            } while (true);
328

  
329
            mQUOTE(); 
330

  
331
            }
332

  
333
            this.type = _type;
334
        }
335
        finally {
336
        }
337
    }
338
    // $ANTLR end STRING
339

  
340
    // $ANTLR start AND
341
    public final void mAND() throws RecognitionException {
342
        try {
343
            int _type = AND;
344
            // Cql.g3:132:5: ( ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'D' | 'd' ) )
345
            // Cql.g3:132:7: ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'D' | 'd' )
346
            {
347
            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
348
                input.consume();
349

  
350
            }
351
            else {
352
                MismatchedSetException mse =
353
                    new MismatchedSetException(null,input);
354
                recover(mse);    throw mse;
355
            }
356

  
357
            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
358
                input.consume();
359

  
360
            }
361
            else {
362
                MismatchedSetException mse =
363
                    new MismatchedSetException(null,input);
364
                recover(mse);    throw mse;
365
            }
366

  
367
            if ( input.LA(1)=='D'||input.LA(1)=='d' ) {
368
                input.consume();
369

  
370
            }
371
            else {
372
                MismatchedSetException mse =
373
                    new MismatchedSetException(null,input);
374
                recover(mse);    throw mse;
375
            }
376

  
377

  
378
            }
379

  
380
            this.type = _type;
381
        }
382
        finally {
383
        }
384
    }
385
    // $ANTLR end AND
386

  
387
    // $ANTLR start OR
388
    public final void mOR() throws RecognitionException {
389
        try {
390
            int _type = OR;
391
            // Cql.g3:133:4: ( ( 'O' | 'o' ) ( 'R' | 'r' ) )
392
            // Cql.g3:133:6: ( 'O' | 'o' ) ( 'R' | 'r' )
393
            {
394
            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
395
                input.consume();
396

  
397
            }
398
            else {
399
                MismatchedSetException mse =
400
                    new MismatchedSetException(null,input);
401
                recover(mse);    throw mse;
402
            }
403

  
404
            if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
405
                input.consume();
406

  
407
            }
408
            else {
409
                MismatchedSetException mse =
410
                    new MismatchedSetException(null,input);
411
                recover(mse);    throw mse;
412
            }
413

  
414

  
415
            }
416

  
417
            this.type = _type;
418
        }
419
        finally {
420
        }
421
    }
422
    // $ANTLR end OR
423

  
424
    // $ANTLR start NOT
425
    public final void mNOT() throws RecognitionException {
426
        try {
427
            int _type = NOT;
428
            // Cql.g3:134:5: ( ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' ) )
429
            // Cql.g3:134:7: ( 'N' | 'n' ) ( 'O' | 'o' ) ( 'T' | 't' )
430
            {
431
            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
432
                input.consume();
433

  
434
            }
435
            else {
436
                MismatchedSetException mse =
437
                    new MismatchedSetException(null,input);
438
                recover(mse);    throw mse;
439
            }
440

  
441
            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
442
                input.consume();
443

  
444
            }
445
            else {
446
                MismatchedSetException mse =
447
                    new MismatchedSetException(null,input);
448
                recover(mse);    throw mse;
449
            }
450

  
451
            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
452
                input.consume();
453

  
454
            }
455
            else {
456
                MismatchedSetException mse =
457
                    new MismatchedSetException(null,input);
458
                recover(mse);    throw mse;
459
            }
460

  
461

  
462
            }
463

  
464
            this.type = _type;
465
        }
466
        finally {
467
        }
468
    }
469
    // $ANTLR end NOT
470

  
471
    // $ANTLR start PROX
472
    public final void mPROX() throws RecognitionException {
473
        try {
474
            int _type = PROX;
475
            // Cql.g3:135:6: ( ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'X' | 'x' ) )
476
            // Cql.g3:135:8: ( 'P' | 'p' ) ( 'R' | 'r' ) ( 'O' | 'o' ) ( 'X' | 'x' )
477
            {
478
            if ( input.LA(1)=='P'||input.LA(1)=='p' ) {
479
                input.consume();
480

  
481
            }
482
            else {
483
                MismatchedSetException mse =
484
                    new MismatchedSetException(null,input);
485
                recover(mse);    throw mse;
486
            }
487

  
488
            if ( input.LA(1)=='R'||input.LA(1)=='r' ) {
489
                input.consume();
490

  
491
            }
492
            else {
493
                MismatchedSetException mse =
494
                    new MismatchedSetException(null,input);
495
                recover(mse);    throw mse;
496
            }
497

  
498
            if ( input.LA(1)=='O'||input.LA(1)=='o' ) {
499
                input.consume();
500

  
501
            }
502
            else {
503
                MismatchedSetException mse =
504
                    new MismatchedSetException(null,input);
505
                recover(mse);    throw mse;
506
            }
507

  
508
            if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
509
                input.consume();
510

  
511
            }
512
            else {
513
                MismatchedSetException mse =
514
                    new MismatchedSetException(null,input);
515
                recover(mse);    throw mse;
516
            }
517

  
518

  
519
            }
520

  
521
            this.type = _type;
522
        }
523
        finally {
524
        }
525
    }
526
    // $ANTLR end PROX
527

  
528
    // $ANTLR start WITHIN
529
    public final void mWITHIN() throws RecognitionException {
530
        try {
531
            int _type = WITHIN;
532
            // Cql.g3:136:8: ( ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' ) ( 'I' | 'i' ) ( 'N' | 'n' ) )
533
            // Cql.g3:136:10: ( 'W' | 'w' ) ( 'I' | 'i' ) ( 'T' | 't' ) ( 'H' | 'h' ) ( 'I' | 'i' ) ( 'N' | 'n' )
534
            {
535
            if ( input.LA(1)=='W'||input.LA(1)=='w' ) {
536
                input.consume();
537

  
538
            }
539
            else {
540
                MismatchedSetException mse =
541
                    new MismatchedSetException(null,input);
542
                recover(mse);    throw mse;
543
            }
544

  
545
            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
546
                input.consume();
547

  
548
            }
549
            else {
550
                MismatchedSetException mse =
551
                    new MismatchedSetException(null,input);
552
                recover(mse);    throw mse;
553
            }
554

  
555
            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
556
                input.consume();
557

  
558
            }
559
            else {
560
                MismatchedSetException mse =
561
                    new MismatchedSetException(null,input);
562
                recover(mse);    throw mse;
563
            }
564

  
565
            if ( input.LA(1)=='H'||input.LA(1)=='h' ) {
566
                input.consume();
567

  
568
            }
569
            else {
570
                MismatchedSetException mse =
571
                    new MismatchedSetException(null,input);
572
                recover(mse);    throw mse;
573
            }
574

  
575
            if ( input.LA(1)=='I'||input.LA(1)=='i' ) {
576
                input.consume();
577

  
578
            }
579
            else {
580
                MismatchedSetException mse =
581
                    new MismatchedSetException(null,input);
582
                recover(mse);    throw mse;
583
            }
584

  
585
            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
586
                input.consume();
587

  
588
            }
589
            else {
590
                MismatchedSetException mse =
591
                    new MismatchedSetException(null,input);
592
                recover(mse);    throw mse;
593
            }
594

  
595

  
596
            }
597

  
598
            this.type = _type;
599
        }
600
        finally {
601
        }
602
    }
603
    // $ANTLR end WITHIN
604

  
605
    // $ANTLR start EXACT
606
    public final void mEXACT() throws RecognitionException {
607
        try {
608
            int _type = EXACT;
609
            // Cql.g3:138:7: ( ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'A' | 'a' ) ( 'C' | 'c' ) ( 'T' | 't' ) )
610
            // Cql.g3:138:9: ( 'E' | 'e' ) ( 'X' | 'x' ) ( 'A' | 'a' ) ( 'C' | 'c' ) ( 'T' | 't' )
611
            {
612
            if ( input.LA(1)=='E'||input.LA(1)=='e' ) {
613
                input.consume();
614

  
615
            }
616
            else {
617
                MismatchedSetException mse =
618
                    new MismatchedSetException(null,input);
619
                recover(mse);    throw mse;
620
            }
621

  
622
            if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
623
                input.consume();
624

  
625
            }
626
            else {
627
                MismatchedSetException mse =
628
                    new MismatchedSetException(null,input);
629
                recover(mse);    throw mse;
630
            }
631

  
632
            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
633
                input.consume();
634

  
635
            }
636
            else {
637
                MismatchedSetException mse =
638
                    new MismatchedSetException(null,input);
639
                recover(mse);    throw mse;
640
            }
641

  
642
            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
643
                input.consume();
644

  
645
            }
646
            else {
647
                MismatchedSetException mse =
648
                    new MismatchedSetException(null,input);
649
                recover(mse);    throw mse;
650
            }
651

  
652
            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
653
                input.consume();
654

  
655
            }
656
            else {
657
                MismatchedSetException mse =
658
                    new MismatchedSetException(null,input);
659
                recover(mse);    throw mse;
660
            }
661

  
662

  
663
            }
664

  
665
            this.type = _type;
666
        }
667
        finally {
668
        }
669
    }
670
    // $ANTLR end EXACT
671

  
672
    // $ANTLR start ALL
673
    public final void mALL() throws RecognitionException {
674
        try {
675
            int _type = ALL;
676
            // Cql.g3:139:5: ( ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'L' | 'l' ) )
677
            // Cql.g3:139:7: ( 'A' | 'a' ) ( 'L' | 'l' ) ( 'L' | 'l' )
678
            {
679
            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
680
                input.consume();
681

  
682
            }
683
            else {
684
                MismatchedSetException mse =
685
                    new MismatchedSetException(null,input);
686
                recover(mse);    throw mse;
687
            }
688

  
689
            if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
690
                input.consume();
691

  
692
            }
693
            else {
694
                MismatchedSetException mse =
695
                    new MismatchedSetException(null,input);
696
                recover(mse);    throw mse;
697
            }
698

  
699
            if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
700
                input.consume();
701

  
702
            }
703
            else {
704
                MismatchedSetException mse =
705
                    new MismatchedSetException(null,input);
706
                recover(mse);    throw mse;
707
            }
708

  
709

  
710
            }
711

  
712
            this.type = _type;
713
        }
714
        finally {
715
        }
716
    }
717
    // $ANTLR end ALL
718

  
719
    // $ANTLR start ANY
720
    public final void mANY() throws RecognitionException {
721
        try {
722
            int _type = ANY;
723
            // Cql.g3:140:5: ( ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'Y' | 'y' ) )
724
            // Cql.g3:140:8: ( 'A' | 'a' ) ( 'N' | 'n' ) ( 'Y' | 'y' )
725
            {
726
            if ( input.LA(1)=='A'||input.LA(1)=='a' ) {
727
                input.consume();
728

  
729
            }
730
            else {
731
                MismatchedSetException mse =
732
                    new MismatchedSetException(null,input);
733
                recover(mse);    throw mse;
734
            }
735

  
736
            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
737
                input.consume();
738

  
739
            }
740
            else {
741
                MismatchedSetException mse =
742
                    new MismatchedSetException(null,input);
743
                recover(mse);    throw mse;
744
            }
745

  
746
            if ( input.LA(1)=='Y'||input.LA(1)=='y' ) {
747
                input.consume();
748

  
749
            }
750
            else {
751
                MismatchedSetException mse =
752
                    new MismatchedSetException(null,input);
753
                recover(mse);    throw mse;
754
            }
755

  
756

  
757
            }
758

  
759
            this.type = _type;
760
        }
761
        finally {
762
        }
763
    }
764
    // $ANTLR end ANY
765

  
766
    // $ANTLR start IDENTIFIER
767
    public final void mIDENTIFIER() throws RecognitionException {
768
        try {
769
            int _type = IDENTIFIER;
770
            // Cql.g3:153:12: ( (~ ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' | '(' | ')' | '=' | '<' | '>' | '/' | '\"' ) )+ )
771
            // Cql.g3:154:3: (~ ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' | '(' | ')' | '=' | '<' | '>' | '/' | '\"' ) )+
772
            {
773
            // Cql.g3:154:3: (~ ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' | '(' | ')' | '=' | '<' | '>' | '/' | '\"' ) )+
774
            int cnt2=0;
775
            loop2:
776
            do {
777
                int alt2=2;
778
                int LA2_0 = input.LA(1);
779

  
780
                if ( ((LA2_0>='\u0000' && LA2_0<='\b')||LA2_0=='\u000B'||(LA2_0>='\u000E' && LA2_0<='\u001F')||LA2_0=='!'||(LA2_0>='#' && LA2_0<='\'')||(LA2_0>='*' && LA2_0<='.')||(LA2_0>='0' && LA2_0<=';')||(LA2_0>='?' && LA2_0<='\uFFFE')) ) {
781
                    alt2=1;
782
                }
783

  
784

  
785
                switch (alt2) {
786
            	case 1 :
787
            	    // Cql.g3:154:5: ~ ( ' ' | '\\t' | '\\r' | '\\n' | '\\f' | '(' | ')' | '=' | '<' | '>' | '/' | '\"' )
788
            	    {
789
            	    if ( (input.LA(1)>='\u0000' && input.LA(1)<='\b')||input.LA(1)=='\u000B'||(input.LA(1)>='\u000E' && input.LA(1)<='\u001F')||input.LA(1)=='!'||(input.LA(1)>='#' && input.LA(1)<='\'')||(input.LA(1)>='*' && input.LA(1)<='.')||(input.LA(1)>='0' && input.LA(1)<=';')||(input.LA(1)>='?' && input.LA(1)<='\uFFFE') ) {
790
            	        input.consume();
791

  
792
            	    }
793
            	    else {
794
            	        MismatchedSetException mse =
795
            	            new MismatchedSetException(null,input);
796
            	        recover(mse);    throw mse;
797
            	    }
798

  
799

  
800
            	    }
801
            	    break;
802

  
803
            	default :
804
            	    if ( cnt2 >= 1 ) break loop2;
805
                        EarlyExitException eee =
806
                            new EarlyExitException(2, input);
807
                        throw eee;
808
                }
809
                cnt2++;
810
            } while (true);
811

  
812

  
813
            }
814

  
815
            this.type = _type;
816
        }
817
        finally {
818
        }
819
    }
820
    // $ANTLR end IDENTIFIER
821

  
822
    public void mTokens() throws RecognitionException {
823
        // Cql.g3:1:8: ( T16 | T17 | T18 | T19 | T20 | T21 | T22 | T23 | T24 | QUOTE | WHITESPACE | STRING | AND | OR | NOT | PROX | WITHIN | EXACT | ALL | ANY | IDENTIFIER )
824
        int alt3=21;
825
        int LA3_0 = input.LA(1);
826

  
827
        if ( (LA3_0=='>') ) {
828
            int LA3_1 = input.LA(2);
829

  
830
            if ( (LA3_1=='=') ) {
831
                alt3=7;
832
            }
833
            else {
834
                alt3=1;}
835
        }
836
        else if ( (LA3_0=='=') ) {
837
            alt3=2;
838
        }
839
        else if ( (LA3_0=='/') ) {
840
            alt3=3;
841
        }
842
        else if ( (LA3_0=='(') ) {
843
            alt3=4;
844
        }
845
        else if ( (LA3_0==')') ) {
846
            alt3=5;
847
        }
848
        else if ( (LA3_0=='<') ) {
849
            switch ( input.LA(2) ) {
850
            case '=':
851
                {
852
                alt3=8;
853
                }
854
                break;
855
            case '>':
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff